On 8/23/06, Alan Mckinnon <[EMAIL PROTECTED]> wrote:
Can you be absolutely certain I'm wrong? Can you absolutely guarantee
that a recompile with a different config MUST be treated differently to
an upgrade?

We are still talking about CFLAGS here, right?  Then ok, no, it is not
_necessary_ to treat this differently than an upgrade in gcc versions.
One can happily run "emerge -e system; emerge -e world" and get to
the same result.  But that doesn't change the fact that the emerge -e
system step is redundant _in this case_.

Why am I sure?  Because many ebuilds in the tree already replace -O3
or -Os with -O2, or add/remove -fsome-flag based on useflags and what
is known to break (or fix) something.  So on any Gentoo system, you
are practically guaranteed to have some binaries that are built with
different flags than the libraries they link against, and they all
play nicely together.  It is part of the standard C/C++ ABI that gcc
defines, and compiler flags must not have any effect on that.

As I see it the only difference I can count on is that the first just
happens to not involve a change in version number.

No change in version number means no change in ABI.

The only way you could guarantee that is if the gcc sources ignore
CFLAGS and other settings when compiling gcc in an effort to build a

Gcc is (almost) always built with -O2 on Gentoo, but it does not
matter anyway.  The CFLAGS that gcc is built with does not effect the
binaries it generates...only the code and the flags passed to gcc
during the compilation effect this.  If your model were correct, you
would need a gcc built with -Os for using -Os, a gcc built with "-Os
-fweb" for building with "-Os -fweb", "-O3" for building with -O3,
"-O3 -mmx" for ... and so on.

Think about this for a second.  What you are claiming here is that the
output of this bash script can depend upon what CFLAGS bash was built
with:

#!/bin/bash
echo -e "\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x21"

Admittedly a compiler is many orders of magnitude more complex than
this, but functionally the same.  Only the code and the options passed
to the compiler can effect its output.  Or to put another way, one
could write a C compiler in java, C#, python, or even shell script
that would support the exact same flags as gcc and generate the exact
same code.  They would almost certainly be much, much slower, but the
output would be the same.  It is identical in concept to changing the
flags that _gcc_ is built with...the gcc program itself changes
(hopefully gets faster), but the output remains the same.

-Richard
--
[email protected] mailing list

Reply via email to