On Wed, Dec 08, 2004 at 09:17:39PM +0100, Arno Wagner wrote: > E ~/exp/c/misc>gcc -profile hello.c > E ~/exp/c/misc>a.out > Inconsistency detected by ld.so: dl-version.c: 230: _dl_check_map_versions: > Assertion `needed != ((void *)0)' failed! > E ~/exp/c/misc>
This has got to be either a GCC or binutils bug. The link line is: /usr/lib/gcc-lib/i486-linux/3.3.5/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc-lib/i486-linux/3.3.5/../../../gcrt1.o /usr/lib/gcc-lib/i486-linux/3.3.5/../../../crti.o /usr/lib/gcc-lib/i486-linux/3.3.5/crtbegin.o -L/usr/lib/gcc-lib/i486-linux/3.3.5 -L/usr/lib/gcc-lib/i486-linux/3.3.5/../../.. /tmp/ccNEb3Zl.o -lgcc --as-needed -lgcc_s --no-as-needed -lc_p -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc-lib/i486-linux/3.3.5/crtend.o /usr/lib/gcc-lib/i486-linux/3.3.5/../../../crtn.o But somehow a.out has a DT_NEEDED entry for libc.so.6. I see two problems: 1. It looks like --as-needed -lgcc_s --no-as-needed has somehow dragged in libc.so.6, even though libgcc_s.so is not needed (and not referenced by the output). 2. Should GCC add -static automatically to -profile, since libc_p.a is a static library? You can't link libc statically to a dynamic executable. -- Daniel Jacobowitz