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


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: ld relocation problem on ARM (PIC related)


jeroen dobbelaere wrote:
jeroen dobbelaere wrote:

Daniel Jacobowitz wrote:

[..]

You didn't show the dynamic relocations in this binary.  The content of
the GOT in the binary can be NULL if there is an appropriate relocation
against var to fill it in.


[..]

It seems that the correct relocations are being added to section '.rel.got',
but this section does not make it in the output (a.out)...

Just to be more complete :


SECTIONS
{
  /* Read-only sections, merged into text segment: */
  . = 0x00008000 + SIZEOF_HEADERS;
  .interp         : { *(.interp) }
  .hash           : { *(.hash) }
  .dynsym         : { *(.dynsym) }
  .dynstr         : { *(.dynstr) }
  .gnu.version    : { *(.gnu.version) }
  .gnu.version_d  : { *(.gnu.version_d) }
  .gnu.version_r  : { *(.gnu.version_r) }
  .rel.dyn        :
    {
      *(.rel.init)
      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
      *(.rel.fini)
      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
      *(.rel.ctors)
      *(.rel.dtors)
      *(.rel.got)
      *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
      *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
      *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
      *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
    }
[...]


the linker script collapses .rel.got into a .rel.dyn section,
which is also not present in the a.out file :

readelf -S a.out
There are 29 section headers, starting at offset 0x2828:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        000080f4 0000f4 000013 00   A  0   0  1
  [ 2] .note.ABI-tag     NOTE            00008110 000110 000020 00   A  0   0 16
  [ 3] .hash             HASH            00008130 000130 000030 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          00008160 000160 000070 10   A  5   1  4
  [ 5] .dynstr           STRTAB          000081d0 0001d0 000056 00   A  0   0  1
  [ 6] .gnu.version      VERSYM          00008226 000226 00000e 02   A  4   0  2
  [ 7] .gnu.version_r    VERNEED         00008234 000234 000020 00   A  5   1  4
  [ 8] .rel.plt          REL             00008264 000264 000018 08   A  4   a  4
  [ 9] .init             PROGBITS        0000827c 00027c 000014 00  AX  0   0  4
  [10] .plt              PROGBITS        00008290 000290 000040 04  AX  0   0  4
  [11] .text             PROGBITS        000082d0 0002d0 000174 00  AX  0   0  4
  [12] .fini             PROGBITS        00008444 000444 00000c 00  AX  0   0  4
  [13] .rodata           PROGBITS        00008450 000450 00000c 00   A  0   0  8
  [14] .data             PROGBITS        0001045c 00045c 00000c 00  WA  0   0  4
  [15] .eh_frame         PROGBITS        00010468 000468 000004 00  WA  0   0  4
  [16] .dynamic          DYNAMIC         0001046c 00046c 0000c8 08  WA  5   0  4
  [17] .ctors            PROGBITS        00010534 000534 000008 00  WA  0   0  4
  [18] .dtors            PROGBITS        0001053c 00053c 000008 00  WA  0   0  4
  [19] .jcr              PROGBITS        00010544 000544 000004 00  WA  0   0  4
  [20] .got              PROGBITS        00010548 000548 000024 04  WA  0   0  4
  [21] .sbss             PROGBITS        0001056c 00056c 000000 00   W  0   0  1
  [22] .bss              NOBITS          0001056c 00056c 000004 00  WA  0   0  1
  [23] .stab             PROGBITS        00000000 00056c 0007b0 0c     24   0  4
  [24] .stabstr          STRTAB          00000000 000d1c 001941 00      0   0  1
  [25] .comment          PROGBITS        00000000 00265d 0000f0 00      0   0  1
  [26] .shstrtab         STRTAB          00000000 00274d 0000da 00      0   0  1
  [27] .symtab           SYMTAB          00000000 002cb0 0005f0 10     28  49  4
  [28] .strtab           STRTAB          00000000 0032a0 000316 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Greetings,
--
Jeroen Dobbelaere
Embedded Software Engineer

ACUNIA Embedded Solutions
http://www.acunia.com/aes



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