On Mon, Sep 25, 2006 at 02:40:49PM -0700, Kevin B. McCarty wrote: > > One thing I noticed is that there are a lot of "problems" (in your > terminology) caused by unneeded dependencies on libgcc1 > (/lib/libgcc_s.so.1). From my quick investigation, it appears that the > C++ and Fortran compilers (g++, g77, gfortran) introduce this dependency > automatically to programs linked with them. However, if gcc is instead > used in the linking step, no such dependency is created (at least on > amd64 where I'm testing). > > That is, programs compiled like this have libgcc_s.so.1 NEEDED: > > g++ foo.cc > g77 foo.F > gfortran foo.F > > but if they are compiled to object code and then linked with plain > vanilla gcc, like this, they don't: > > g++ -c foo.cc -o foo.o && gcc foo.o -lstdc++ > g77 -c foo.F -o foo.o && gcc foo.o -lg2c -lfrtbegin > gfortran -c foo.F -o foo.o && gcc foo.o -lgfortran -lgfortranbegin > > [CC'ed to debian-gcc to see if someone there can explain why this happens.]
Atleast for g++, it ends up being linked to both -lm and -lgcc_s Using g++ I get: [pid 22315] execve("/usr/bin/ld", ["/usr/bin/ld", "--eh-frame-hdr", "-m", "elf_x86_64", "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-o", "foo", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crt1.o", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crti.o", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtbegin.o", "-L/usr/lib/gcc/x86_64-linux-gnu/4.1.2", "-L/usr/lib/gcc/x86_64-linux-gnu/4.1.2", "-L/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64", "-L/lib/../lib64", "-L/usr/lib/../lib64", "foo.o", "-lstdc++", "-lm", "-lgcc_s", "-lgcc", "-lc", "-lgcc_s", "-lgcc", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtend.o", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crtn.o"], [/* 18 vars */]) = 0 Using gcc I get: [pid 22347] execve("/usr/bin/ld", ["/usr/bin/ld", "--eh-frame-hdr", "-m", "elf_x86_64", "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-o", "foo", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crt1.o", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crti.o", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtbegin.o", "-L/usr/lib/gcc/x86_64-linux-gnu/4.1.2", "-L/usr/lib/gcc/x86_64-linux-gnu/4.1.2", "-L/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64", "-L/lib/../lib64", "-L/usr/lib/../lib64", "foo.o", "-lstdc++", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "-lc", "-lgcc", "--as-needed", "-lgcc_s", "--no-as-needed", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/crtend.o", "/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crtn.o"], [/* 18 vars */]) = 0 Notice the --as-needed and --no-as-needed around the -lgcc_s's. >From the specs: *libgcc: %{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared-libgcc:-lgcc --as-needed -lgcc_s --no-as-needed}%{shared-libgcc:-lgcc_s%{!shared: -lgcc}}}} g++ seem to be using some other specs, but I have no idea how I should dump them. Kurt -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]