public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* RFH: libgcc_s.so being unnecessarily linked for mipsel-linux cross compiler...
@ 2005-07-28 19:48 David Daney
  2005-07-28 20:37 ` H. J. Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: David Daney @ 2005-07-28 19:48 UTC (permalink / raw)
  To: gcc; +Cc: binutils

I am not sure if this is a GCC problem or a binutils problem.

I have a a mipsel-linux cross compiler (gcc-3.4.3/binutils-2.16.1) and 
whenever I compile even the simplest hello-world.c libgcc_s.so is linked.

When I do the same thing natively on my i686/FC3, libgcc_s.so is not linked.

If if explicitly pass -static-libgcc to the cross compiler I do not need 
libgcc_s.so (as would be expected).

As you can see from the transcript below libgcc_s is being linked with 
--as-needed.

Also you can see that neither hello-world.o nor my libc-2.3.3.so have 
any undefined symbols that would be satisfied by libgcc_s.so.

Any ideas about what is going on here?


[daney@dl2 junk]$ cat hello-world.c
#include <stdio.h>

int main(int argc, char *argv[])
{
         puts("Hello World!");
         return 0;
}
[daney@dl2 junk]$ mipsel-linux-gcc -v -o hello-world hello-world.c
Reading specs from 
/usr/local/mipsel-linux-3.4.3/lib/gcc/mipsel-linux/3.4.3/specs
Configured with: ../gcc-3.4.3/configure --target=mipsel-linux 
--with-sysroot=/usr/local/mipsel-linux-3.4.3 --with-arch=mips32 
--with-float=soft --enable-languages=c,c++,java 
--prefix=/usr/local/mipsel-linux-3.4.3 --with-system-zlib 
--disable-java-awt --without-x --disable-jvmpi
Thread model: posix
gcc version 3.4.3
  /usr/local/mipsel-linux-3.4.3/libexec/gcc/mipsel-linux/3.4.3/cc1 
-quiet -v hello-world.c -quiet -dumpbase hello-world.c -march=mips32 
-msoft-float -auxbase hello-world -version -o /tmp/cclyJCDa.s
ignoring nonexistent directory 
"/usr/local/mipsel-linux-3.4.3/usr/local/include"ignoring nonexistent 
directory 
"/usr/local/mipsel-linux-3.4.3/lib/gcc/mipsel-linux/3.4.3/../../../../mipsel-linux/include"
#include "..." search starts here:
#include <...> search starts here:
  /usr/local/mipsel-linux-3.4.3/lib/gcc/mipsel-linux/3.4.3/include
  /usr/local/mipsel-linux-3.4.3/usr/include
End of search list.
GNU C version 3.4.3 (mipsel-linux)
         compiled by GNU C version 3.4.3 20050227 (Red Hat 3.4.3-22.fc3).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64141
 
/usr/local/mipsel-linux-3.4.3/lib/gcc/mipsel-linux/3.4.3/../../../../mipsel-linux/bin/as 
-EL -no-mdebug -32 -march=mips32 -v -KPIC -o /tmp/ccylpyDd.o /tmp/cclyJCDa.s
GNU assembler version 2.16.1 (mipsel-linux) using BFD version 2.16.1
  /usr/local/mipsel-linux-3.4.3/libexec/gcc/mipsel-linux/3.4.3/collect2 
--eh-frame-hdr -EL -dynamic-linker /lib/ld.so.1 -o hello-world 
/usr/local/mipsel-linux-3.4.3/usr/lib/crt1.o 
/usr/local/mipsel-linux-3.4.3/usr/lib/crti.o 
/usr/local/mipsel-linux-3.4.3/lib/gcc/mipsel-linux/3.4.3/crtbegin.o 
-L/usr/local/mipsel-linux-3.4.3/lib/gcc/mipsel-linux/3.4.3 
-L/usr/local/mipsel-linux-3.4.3/lib/gcc/mipsel-linux/3.4.3/../../../../mipsel-linux/lib 
-L/usr/local/mipsel-linux-3.4.3/lib 
-L/usr/local/mipsel-linux-3.4.3/usr/lib /tmp/ccylpyDd.o -lgcc 
--as-needed -lgcc_s --no-as-needed -rpath-link 
/usr/local/mipsel-linux-3.4.3/lib:/usr/local/mipsel-linux-3.4.3/usr/lib 
-lc -lgcc --as-needed -lgcc_s --no-as-needed 
/usr/local/mipsel-linux-3.4.3/lib/gcc/mipsel-linux/3.4.3/crtend.o 
/usr/local/mipsel-linux-3.4.3/usr/lib/crtn.o

[daney@dl2 junk]$ readelf -d hello-world

Dynamic section at offset 0x15c contains 26 entries:
   Tag        Type                         Name/Value
  0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
  0x00000001 (NEEDED)                     Shared library: [libc.so.6]


[daney@dl2 junk]$ mipsel-linux-gcc -c hello-world.c
[daney@dl2 junk]$ mipsel-linux-nm hello-world.o
          U _gp_disp
00000000 T main
          U puts

[daney@dl2 junk]$ mipsel-linux-nm 
/usr/local/mipsel-linux-3.4.3/lib/libc-2.3.3.so | grep 'U '
          U _dl_argv@@GLIBC_PRIVATE
          U _dl_catch_error@@GLIBC_PRIVATE
          U _dl_check_map_versions@@GLIBC_PRIVATE
          U _dl_debug_printf@@GLIBC_PRIVATE
          U _dl_debug_state@@GLIBC_PRIVATE
          U _dl_dst_count@@GLIBC_PRIVATE
          U _dl_dst_substitute@@GLIBC_PRIVATE
          U _dl_get_origin@@GLIBC_PRIVATE
          U _dl_init@@GLIBC_PRIVATE
          U _dl_lookup_symbol@@GLIBC_PRIVATE
          U _dl_lookup_symbol_skip@@GLIBC_PRIVATE
          U _dl_lookup_versioned_symbol@@GLIBC_PRIVATE
          U _dl_lookup_versioned_symbol_skip@@GLIBC_PRIVATE
          U _dl_map_object_deps@@GLIBC_PRIVATE
          U _dl_map_object@@GLIBC_PRIVATE
          U _dl_mcount@@GLIBC_2.2
          U _dl_out_of_memory@@GLIBC_PRIVATE
          U _dl_relocate_object@@GLIBC_PRIVATE
          U _dl_signal_error@@GLIBC_PRIVATE
          U _dl_start_profile@@GLIBC_PRIVATE
          U _dl_unload_cache@@GLIBC_PRIVATE
          U __libc_enable_secure@@GLIBC_PRIVATE
          U __libc_stack_end@@GLIBC_2.2
          U _r_debug@@GLIBC_2.0
          U _rtld_global@@GLIBC_PRIVATE

Thanks,
David Daney


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-07-29  5:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-28 19:48 RFH: libgcc_s.so being unnecessarily linked for mipsel-linux cross compiler David Daney
2005-07-28 20:37 ` H. J. Lu
2005-07-28 20:54   ` David Daney
2005-07-29  0:31     ` H. J. Lu
2005-07-29  0:44       ` David Daney
2005-07-28 21:26 ` James E Wilson
2005-07-28 21:47   ` Richard Henderson
2005-07-28 23:58   ` Greg Schafer
2005-07-29  0:22     ` James E Wilson
2005-07-29  0:35       ` Mike Frysinger
2005-07-29  5:11 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).