Greg Schafer wrote:
> But the worst part IMHO has already been pinpointed by Bruce in that it
> will encourage novice users to play with `--with-arch=my-uber-cool-cpu'.
> This isn't bad in itself but it can lead to problems. For example, it has
> been well known for years that you cannot compile Glibc with a GCC that
> was configured as `--with-arch=i686' (unless you patch Glibc). It bombs
> out due to conflicts in GCC preprocessor macros with Glibc assembler code.
> This is arguably a bug in Glibc, but the fact that Glibc devs refuse to
> fix it indicates rather strongly that CFLAGS is the correct way to build
> Glibc. It also proves that CC="gcc -march=i?86" is wrong for Glibc. To
> clarify, if you give CFLAGS to Glibc configure, it will build .c files
> with those flags but it won't use them for .S files.

After doing some tests and a great deal of Googling I've come to agree 
with Greg's estimation, the above paragraph being part of the clincher. 
Setting '--with-arch=i486' for GCC results in it using '-march=i486' for 
*everything*, unless another -march option is specified. As the above 
example shows, that concept seems contrary to the intention of Glibc 
developers.

I did indeed test building GCC using --with=arch=i686, which would be 
the same as using CC="gcc -march=i686" for Glibc, and as Greg stated, it 
causes Glibc to bomb with assembler errors. Conversely, I tested 
building GCC without using --with-arch and then used 'CFLAGS=-march=i686 
-mtune=native -O2 -pipe' ../glibc-2.6.1/configure ...' and built 
successfully. It seems to prove that it's better to let the Glibc devs 
decide where to use -march.

--with-march=i486 works, but seems prone to breakage. I think if we want 
to introduce optimization into LFS, then we could do better, and more 
correctly, than just using --with-arch on GCC. Using CFLAGS with Glibc 
would allow for other cpu-types for the -march statement and the 
possiblie introduction of -mtune=native as Greg also suggested.

So, to summarize, I propose not using --with-arch, but use the following 
for Glibc:

CFLAGS="-march=i486 -O2 -pipe" ../glibc-2.6.1/configure ...etc.

Glibc requires some sort of optimization and -O2 seems safe. -pipe 
should also be safe on gnu systems and should speed up compile times by 
using pipes instead of temporary files.

Anyone have any comments or suggestions? If not, and unless Matt decides 
to do it first, I'll be applying the patches he created plus the above 
change to trunk by the end of the weekend.

--
JH
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to