On Fri, Dec 09, 2016 at 11:39:58AM +1100, Tony Cook wrote: > On Fri, Dec 09, 2016 at 01:01:01AM +0100, gregor herrmann wrote: > > On Fri, 09 Dec 2016 01:14:23 +0200, Niko Tyni wrote: > > > > > TL;dr: this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78176
> > > Unfortunately gcc doesn't seem to have a targeted option to disable this > > > optimization. Building with -O0 on mips and mipsel is probably the best > > > workaround we have (-O1 isn't enough.) > > +# #847397 > > +DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH) > > +NOOPT = mips mipsel amd64 > > +ifneq (,$(filter $(DEB_HOST_ARCH), $(NOOPT))) > > +export DEB_CFLAGS_MAINT_STRIP:=-O2 > > +export DEB_CFLAGS_MAINT_APPEND:=-O0 > > +endif > That certainly looks like a sensible workaround. Looks good to me too. > Is there some mechanism that will remove it if the gcc (or perhaps > kernel) bug is fixed? The only way I can think of is building and running a test case during every build and setting the gcc flags based on that. But I suppose this would give a false negative when building on 'real' 32-bit systems that don't exhibit the problem, yielding binaries that fail on 64-bit systems. And it feels overkill to me anyway. We could leave a bug open about the disabled optimization and hope that somebody will review the bugs at some point... -- Niko