This is the mail archive of the 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]

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

I built a gcc-3.4.0-glibc-2.2.5 toolchain for i686,
then built "int main(){return 0;}" with -static.
$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.3, statically linked, not stripped

Running it on my Red Hat 9 box results in a crash.
This doesn't happen for toolchains built with earlier versions of gcc,
or when I build glibc-2.3.2 with gcc-3.4.0.

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x08048850 in ptmalloc_init () at malloc.c:1756
#2  0x08048b72 in malloc_hook_ini (sz=0, caller=0x804c7e8) at malloc.c:1856
#3  0x0804912e in __libc_malloc (bytes=12) at malloc.c:2797
#4  0x0804c7e8 in _dl_init_paths (llp=0x0) at dl-load.c:586
#5  0x080513aa in non_dynamic_init () at dl-support.c:152
#6  0x080517f2 in __libc_init (argc=1, argv=0xbffff3b4, envp=0xbffff3bc) at set-init.c:22
#7  0x08051788 in init (argc=1, argv=0xbffff3b4, envp=0xbffff3bc) at ../sysdeps/unix/sysv/linux/init-first.c:95
#8  0x080517b2 in __libc_init_first (argc=0, argv=0x0, envp=0x0) at ../sysdeps/unix/sysv/linux/init-first.c:124
#9  0x080482d0 in __libc_start_main (main=0x8048204 <main>, argc=1, ubp_av=0xbffff3b4, init=0x80480d4 <_init>, fini=0x80908df <_fini>, rtld_fini=0, stack_end=0x0)
    at ../sysdeps/generic/libc-start.c:109
(gdb) frame 1
#1  0x08048850 in ptmalloc_init () at malloc.c:1756
1756      mutex_init(&main_arena.mutex);
(gdb) list
1751      /* Initialize the pthreads interface. */
1752      if (__pthread_initialize != NULL)
1753        __pthread_initialize();
1754    #endif
1755    #endif /* !defined NO_THREADS */
1756      mutex_init(&main_arena.mutex);
1757      mutex_init(&list_lock);
1758      tsd_key_create(&arena_key, NULL);
1759      tsd_setspecific(arena_key, (Void_t *)&main_arena);
1760      thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_init_all);

(Looks kinda similar to
but then I suppose a lot of bugs look similar.)

It seems like it's probably a glibc bug of some sort,
but it's awful funny it only shows up for me with
gcc-3.4.0.  Anyone seen this before, or have tips for how to proceed?
[ And yes, I could just build static apps with gcc-2.3.2, but I'd
like to figure this bug out anyway... ]
- Dan

My technical stuff:
My politics: see for examples of why I'm for regime change

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