This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cross gcc linking errors


"Bertin, Philippe" wrote:
> 
> Kai,
> 
> This may be of limited use to the newsgroup (although ...?), but which file
> are you talking about, containing the "libc.so script" ?

 On the contrary, everybody working with Linux targets must learn to know what
the 'libc.so' really is, just as that the 'dynamic linker', 'ld-linux.so.2',
'ld.so.1' or something, is one of the shared libraries and that the 'libc.so.6'
(or the 'libc-2.2.4.so' or something symlinked to this) needs it at link-time,
just as it needs it at run-time...

 Just as it is to learn to toy with the tools like binutils, trying first the
'--help' with them, then all kind of options... The 'objdump -p' is one useful
command for seeing dependencies between the shared libs :

---------------------- clip --------------------------------------------
H:\usr\local\ppc-linux-gnu\lib>..\bin\objdump -p libc.so.6

libc.so.6:     file format elf32-powerpc

Program Header:
    PHDR off    0x00000034 vaddr 0x00000034 paddr 0x00000034 align 2**2
         filesz 0x000000c0 memsz 0x000000c0 flags r-x
  INTERP off    0x000d9a7c vaddr 0x000e9a7c paddr 0x000e9a7c align 2**2
         filesz 0x00000028 memsz 0x00000028 flags rw-
    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**16
         filesz 0x000cb788 memsz 0x000cb788 flags r-x
    LOAD off    0x000cb790 vaddr 0x000db790 paddr 0x000db790 align 2**16
         filesz 0x00011c80 memsz 0x000169f0 flags rwx
 DYNAMIC off    0x000d9b64 vaddr 0x000e9b64 paddr 0x000e9b64 align 2**2
         filesz 0x000000b0 memsz 0x000000b0 flags rw-

Dynamic Section:
  NEEDED      ld.so.1
  SONAME      libc.so.6
  INIT        0x21ec0
  FINI        0xcb73c
  HASH        0xf4
  STRTAB      0x9c80
  SYMTAB      0x2cc0
  STRSZ       0x7b22
  SYMENT      0x10
  PLTGOT      0xedd2c
  PLTRELSZ    0x1638
  PLTREL      0x7
  JMPREL      0x20590
  RELA        0x126dc
  RELASZ      0xf6cc
  RELAENT     0xc
  VERDEF      0x125d4
  VERDEFNUM   0x6
  VERNEED     0x1269c
  VERNEEDNUM  0x1
  VERSYM      0x117da

Version definitions:
1 0x01 0x0865f4e6 libc.so.6
2 0x00 0x0d696910 GLIBC_2.0
3 0x00 0x0d696911 GLIBC_2.1
        GLIBC_2.0
4 0x00 0x09691f71 GLIBC_2.1.1
        GLIBC_2.1
5 0x00 0x09691f72 GLIBC_2.1.2
        GLIBC_2.1.1
6 0x00 0x09691f73 GLIBC_2.1.3
        GLIBC_2.1.2

Version References:
  required from ld.so.1:
    0x09691f71 0x00 09 GLIBC_2.1.1
    0x0d696911 0x00 08 GLIBC_2.1
    0x0d696910 0x00 07 GLIBC_2.0
---------------------- clip --------------------------------------------

 The 'ld.so.1' being linked too, will not be seen using '-v' on the 'gcc'
command line, neither that it is 'libc.so.6' and 'libc_nonshared.a' which
will be scanned instead of the expected 'libc.so' (or because the 'libc.so'
tells this....).

 The 'libc.so' for Linux is not a real shared library (as the '.so' says), but
a ld-script. A native glibc has it in '/usr/lib', while a 'cross' glibc has it
in '$prefix/$target/lib'.

 The difference between the 'static', '.a', libraries and the 'shared', '.so',
libraries and that all current GCCs for the 'system targets' will link against
the shared libraries as default, is one thing to learn too...

 What happens during the linking, will the '-verbose' option for the linker tell.
Putting linker options to the 'gcc' line then happens with the '-Wl,<ld_options>',
like:
        powerpc-linux-gcc -Wl,-V,-verbose -Os -o myprog myprog.c

 Highly recommended trying the '-verbose' at least once...

Cheers, Kai

 "A Finn is one who answers when nobody has asked, asks when nobody can answer,
doesn't answer when asked, one who gets lost on the road, is shouting on a shore,
and on the opposite shore there is another one shouting too..."


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]