This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] PR bootstrap/25672: Avoid CFLAGS in CFLAGS_FOR_TARGETS if cross-compiling


On 03/09/2015 11:35 PM, Jeff Law wrote:
On 03/09/15 16:22, Aldy Hernandez wrote:
Hello gentlemen.

The problem here is that we pick up the system's CFLAGS and pass it down
to the target libraries.  This causes havoc when, for instance, CFLAGS
is -march=x86-64 and the target is powerpc-linux.

I don't see in what scenario the toplevel shell's CFLAGS would be of any
use in the target libraries, so I've just avoided that code path
altogether.

Tested by doing a cross-build from x86-64 to ppc64-linux-gnu in a
combined tree, and seeing if libgcc starts to build.  Previously we
would fail while configuring GCC.  Now, gcc builds fine, and the target
libraries start to build.

OK for mainline?

Aldy

curr


commit f2d130b93f334c5c680761553624964f87594adf
Author: Aldy Hernandez<aldyh@redhat.com>
Date:   Mon Mar 9 15:12:33 2015 -0700

         PR bootstrap/25672
         * configure.ac: Do not initialize CFLAGS_FOR_TARGET from
CFLAGS if
         cross-compiling.  Similarly for CXX_FOR_TARGET.
         * configure: Regenerate.
I was wondering when someone would come across this oldie-but-goodie...

I'm sure someone, somewhere will complain that

make CFLAGS="whatever" isn't being passed down to the crossses as it has
been for the last two decades.  And they'll be right.

Well, considering this hasn't worked since 4.0.2, with a brief respite in 4.4.0, I wouldn't worry too much. For that matter, setting incompatible CFLAGS won't even survive a toplevel configure on trunk right now. I doubt anyone is dependent on this feature :).

But in the cross compiler case, I think it's reasonable to expect to
have to use CFLAGS_FOR_TARGET so that we have separation between the
host and target flags.  One could easily want to compile the host with
one set of arguments and the target libraries with something completely
different.

And note that the various .mt files already use the _FOR_TARGET macros
to pass down additional flags rather than just CFLAGS or CXXFLAGS.



Are there any docs that need to change?  I don't recall any offhand, but
if you could look prior to committing, it'd be appreciated.

Interestingly, there is nothing but a cursory reference to CFLAGS_FOR_TARGET in our docs:

@code{BOOT_CFLAGS} does not apply to bootstrapped target libraries.
Since these are always compiled with the compiler currently being
bootstrapped, you can use @code{CFLAGS_FOR_TARGET} to modify their
compilation flags, as for non-bootstrapped target libraries.
Again, if the native compiler miscompiles the stage1 compiler, you may
need to work around this by avoiding non-working parts of the stage1
compiler.  Use @code{STAGE1_TFLAGS} to this end.

Considering our entire cross-compilation section is actually quite lacking, I'm going to just commit as is.

Thanks.
Aldy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]