Cross toolchain problem.
Sjei Ryhstrup
sjei_rhystrup@yahoo.com
Sun Sep 30 01:49:00 GMT 2007
Hi Nick,
here's an interesting observation made after doing
some tests:
arm-linux-gcc -v foo.c
# this is the final part of the output for the above
/home/sjei/cross/libexec/gcc/arm-linux/4.2.1/collect2
--eh-frame-hdr -dynamic-linker /lib/ld-linux.so.2 -X
-m armelf_linux -p
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/../../../../arm-linux/lib/crt1.o
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/../../../../arm-linux/lib/crti.o
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/crtbegin.o
-L/home/sjei/cross/lib/gcc/arm-linux/4.2.1
-L/home/sjei/cross/lib/gcc/arm-linux/4.2.1/../../../../arm-linux/lib
/tmp/ccUmGmSO.o -lgcc --as-needed -lgcc_s
--no-as-needed -lc -lgcc --as-needed -lgcc_s
--no-as-needed
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/crtend.o
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/../../../../arm-linux/lib/crtn.o
Notice the -lgcc --as-needed -lgcc_s --no-as-needed
options are repeated. When I manually ran that line
but omitting the duplicate, the dependency
disappeared.
ie.
arm-linux-gcc -c foo.c # followed by...
/home/sjei/cross/libexec/gcc/arm-linux/4.2.1/collect2
--eh-frame-hdr -dynamic-linker /lib/ld-linux.so.2 -X
-m armelf_linux -p
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/../../../../arm-linux/lib/crt1.o
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/../../../../arm-linux/lib/crti.o
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/crtbegin.o
-L/home/sjei/cross/lib/gcc/arm-linux/4.2.1
-L/home/sjei/cross/lib/gcc/arm-linux/4.2.1/../../../../arm-linux/lib
foo.o -lgcc --as-needed -lgcc_s --no-as-needed -lc
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/crtend.o
/home/sjei/cross/lib/gcc/arm-linux/4.2.1/../../../../arm-linux/lib/crtn.o
Now arm-linux-objdump -p a.out produces:
a.out: file format elf32-littlearm
Program Header:
PHDR off 0x00000034 vaddr 0x00008034 paddr
0x00008034 align 2**2
filesz 0x000000c0 memsz 0x000000c0 flags r-x
INTERP off 0x000000f4 vaddr 0x000080f4 paddr
0x000080f4 align 2**0
filesz 0x00000013 memsz 0x00000013 flags r--
LOAD off 0x00000000 vaddr 0x00008000 paddr
0x00008000 align 2**15
filesz 0x00000564 memsz 0x00000564 flags r-x
LOAD off 0x00000564 vaddr 0x00010564 paddr
0x00010564 align 2**15
filesz 0x00000118 memsz 0x00000134 flags rw-
DYNAMIC off 0x00000578 vaddr 0x00010578 paddr
0x00010578 align 2**2
filesz 0x000000c8 memsz 0x000000c8 flags rw-
NOTE off 0x00000108 vaddr 0x00008108 paddr
0x00008108 align 2**2
filesz 0x00000020 memsz 0x00000020 flags r--
Dynamic Section:
NEEDED libc.so.6
INIT 0x82c4
FINI 0x854c
HASH 0x8128
STRTAB 0x81dc
SYMTAB 0x815c
STRSZ 0x80
SYMENT 0x10
DEBUG 0x0
PLTGOT 0x10640
PLTRELSZ 0x30
PLTREL 0x11
JMPREL 0x8294
REL 0x828c
RELSZ 0x8
RELENT 0x8
VERNEED 0x826c
VERNEEDNUM 0x1
VERSYM 0x825c
Version References:
required from libc.so.6:
0x0d696910 0x00 02 GLIBC_2.0
private flags = 2: [APCS-32] [FPA float format] [has
entry point]
No more libgcc_s.so.1. :)
Rgds.
Sjei
--- Nick Clifton <nickc@redhat.com> wrote:
> Hi Sjei,
>
> > Sorry for the double post, Nick. The first message
> > was rejected by the mailing list.
>
> Strange, it actually showed up in the list's
> archives...
>
> >>>> Check for symbol references in the startup
> files
> >>>> that are being resolved by the libgcc_s.so.1.
> >>> I don't think there are any. Using the results
> of
> >>> $(target)-gcc -v
> >>> I can manually link the app by directly invoking
> >>> $(target)-ld without the -lgcc_s flag and not
> >>> receive any errors about unresolved symbols.
>
> But if you look in the resulting executable you will
> still find references to
> undefined symbols. In particular symbols like
> ____deregister_frame_info.
> Note - these are weak references so the absence of
> their definitions does not
> cause a link time error, but their presence does
> mean that libgcc_s.so.1 will
> be linked in if it is included on the linker command
> line.
>
> Cheers
> Nick
>
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
More information about the Binutils
mailing list