ld built without --hash-style, Ch5, Fedora Core 6 -> glibc config failure

Luca liliana.perossa at fastwebnet.it
Tue Nov 28 10:36:07 PST 2006


Amadeus wrote: 
> Hi, sorry for the idiot question, but how to pass --hash-style=both? I
> tried editing /usr/lib/gcc/i386-redhat-linux/4.1.1/specs but gcc
> -dumpspecs still show's hash-style=gnu.
>
> I'll post back to the list when all is well.
>
> Thanks
>
> Amadeus
>
Sorry if I repost the mail, but now I'm sending it from my lfs system.

On Fedora Core 6:

Let's take the dummy.c from the Adjusting the Toolchain phase:

echo 'main(){}' > dummy.c

cc dummy.c

[root at localhost ~]# readelf -l a.out

Elf file type is EXEC (Executable file)
Entry point 0x8048280
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Allign
  PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x08048114 0x08048114 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x00414 0x00414 R E 0x1000
  LOAD           0x000414 0x08049414 0x08049414 0x000fc 0x00100 RW  0x1000
  DYNAMIC        0x000428 0x08049428 0x08049428 0x000c8 0x000c8 RW  0x4
  NOTE           0x000128 0x08048128 0x08048128 0x00020 0x00020 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00    
   01     .interp
   02     .interp .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version
.gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06    
[root at localhost ~]#

cc -Xlinker --hash-style=sysv dummy.c

[root at localhost ~]# readelf -l a.out

Elf file type is EXEC (Executable file)
Entry point 0x8048280
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x08048114 0x08048114 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x00414 0x00414 R E 0x1000
  LOAD           0x000414 0x08049414 0x08049414 0x000fc 0x00100 RW  0x1000
  DYNAMIC        0x000428 0x08049428 0x08049428 0x000c8 0x000c8 RW  0x4
  NOTE           0x000128 0x08048128 0x08048128 0x00020 0x00020 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00    
   01     .interp
   02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version
.gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06    
[root at localhost ~]#

cc -Wl,--hash-style=both dummy.c

[root at localhost ~]# readelf -l a.out

Elf file type is EXEC (Executable file)
Entry point 0x80482a0
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x08048114 0x08048114 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x00434 0x00434 R E 0x1000
  LOAD           0x000434 0x08049434 0x08049434 0x00104 0x00108 RW  0x1000
  DYNAMIC        0x000448 0x08049448 0x08049448 0x000d0 0x000d0 RW  0x4
  NOTE           0x000128 0x08048128 0x08048128 0x00020 0x00020 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00    
   01     .interp
   02     .interp .note.ABI-tag .hash .gnu.hash .dynsym .dynstr
.gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini
.rodata .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06    
[root at localhost ~]#

It's possible to pass "-Wa,<arg>" options to assembler, "-Wp,<arg>"
options to the prepocessor, "-Wl,<arg>" options to the linker;
"-Xassembler <arg>" option to the assembler, "-Xpreprocessor <arg>"
option to the preprocessor and "-Xlinker <arg>" option to the linker;
same for gcc and g++.
So a "cc="cc -Xlinker --hash-style=sysv"", "gcc="gcc -Xlinker
--hash-style=sysv"" and "g++="g++ -Xlinker --hash-style=sysv"" should do
the trick without problems (or at least, I compiled the toolchain in
this way to test and it compiled flawlessly).

Have a good evening to all.
Luca

P.S. Sorry for being pedantic with the examples, but I think that an
example could be better than words.



More information about the lfs-support mailing list