[Bug bootstrap/28515] CFLAGS not propagated, resulting in object mismatch
skunk at iskunk dot org
Mon Aug 7 04:32:00 GMT 2006
------- Comment #18 from skunk at iskunk dot org 2006-08-07 04:32 -------
(In reply to comment #16)
> > (**None** of what you're saying is currently in the docs, so far as I can
> > see.)
> Take a look at http://gcc.gnu.org/install/specific.html#sparc64-x-solaris2
Okay, so the sparc64 and CC="cc -xarch=v9" bits are there. What about the
non-system-specific caveats w.r.t. CFLAGS and ABI compatibility?
> > If users ignoring docs is a problem, then do as the MPlayer folks do and
> > have the configure script print a big fat warning if it detects anything
> > unwholesome.
> This would be a lot of work for GCC!
"Detects anything unwholesome" can be as simple as checking whether CFLAGS is
set at all (which is all MPlayer's build does). Over time, it could be expanded
into a case statement keying off a triplet, so you could have e.g. a
present/absent check for -xarch=v9 in CFLAGS for sparc*-sun-solaris*.
> > So you're saying that CC and the target triplet have to agree, ABI-wise?
> If you want to do a bootstrap, yes. Otherwise this is a cross-compilation and
> a bootstrap will miserably fail like in your case.
The reason why it failed in my case is because it linked code built with "$CC"
(genmodes) against code built with "$CC $CFLAGS" (libiberty). It was a flat-out
violation of flag-variable convention to build stage 1 genmodes without CFLAGS.
Now, if the failure was in linking code built with xgcc against the original
[cc-built] libiberty, then that's a more meaningful issue---because CFLAGS
doesn't apply there. It is the target (right?) triplet that controls what kind
of code xgcc generates, and this must be compatible with the output of "$CC
$CFLAGS". (I obtained this result by attempting to build with CC="cc
-xarch=v9", but without the sparc64 triplet.)
> CC+CFLAGS and the --host parameter of configure must always be in keeping.
> For a native compilation (hence a bootstrap), --target must additionally be.
> So the safe procedure is to modify CC and not CFLAGS.
Wait a second---you said that CFLAGS was being ignored because you didn't trust
the user to tweak it appropriately. So the "safe procedure" is what it is
because of that, not because of any technical requirement of the bootstrap
More information about the Gcc-bugs