gcc-3.4.0 + glibc-2.2.5 generate static apps that segfault at startup?

Jim Wilson wilson@specifixinc.com
Tue Jun 1 07:44:00 GMT 2004


Dan Kegel wrote:
> I built a gcc-3.4.0-glibc-2.2.5 toolchain for i686,
> then built "int main(){return 0;}" with -static.
> Running it on my Red Hat 9 box results in a crash.

I would guess some kind of problem with .init and .init_array sections. 
    Maybe gcc-3.4 is using init_array sections when it should use .init 
sections, because glibc-2.2.5 does not support .init_array?  Or 
similarly with related sections like .preinit_array.

I see that gcc/aclocal.m4 does an AC_TRY_RUN test to see if init_array 
works, but that assumes the compiler being used to build gcc will be 
using the same glibc as the compiler we are building, which may not be 
true in your case.  Not unless you configure this compiler with itself, 
which won't work unless if was configured correctly in the first place. 
  Well, I see that there is a configure option for this, so maybe 
--disable-initfini-array will solve the problem.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list