http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48264
Summary: Simple dummy program fails with Segmentation Fault upon -shared linking Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: leo.i...@gmail.com Here's my output of gcc -v: Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) I make a simple C program, compiled it an ran it. If I link it with -shared, it segfaults, as in: [Leo@chessman ~]$ cat test.c int main(void) { return 0; } [Leo@chessman ~]$ gcc -c -o test.o test.c [Leo@chessman ~]$ gcc -o test test.o [Leo@chessman ~]$ ./test [Leo@chessman ~]$ gcc -shared -o test test.o [Leo@chessman ~]$ ./test Segmentation fault (core dumped) [Leo@chessman ~]$ I assume that this is a bug in collect2 and not cc1 given that linking differently fixed it, but I would like to link with -shared so this is sort of annoying.