bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/18481] New: wrong addends for R_ARM_TLS_LE32 (tpoff) relocs aga


From: roland at gnu dot org
Subject: [Bug gas/18481] New: wrong addends for R_ARM_TLS_LE32 (tpoff) relocs against local symbol
Date: Wed, 03 Jun 2015 00:18:11 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=18481

            Bug ID: 18481
           Summary: wrong addends for R_ARM_TLS_LE32 (tpoff) relocs
                    against local symbol
           Product: binutils
           Version: 2.25
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: roland at gnu dot org
  Target Milestone: ---

Consider this case:
        $ cat tls.s
                .text
        foo:
                .word tbase(tpoff)-12
                .word tbase(tpoff)-8
                .word tbase(tpoff)-4
                .word tbase(tpoff)+0
                .word tbase(tpoff)+4
                .word tbase(tpoff)+8
                .word tbase(tpoff)+12
                .word tbase(tpoff)
                .section        .tdata,"awT",%progbits
        tbase = . + 12
                .word -12
                .word -8
                .word -4
                .word 0
                .word 4
                .word 8
                .word 12
                .word 0
        $ ./gas/as-new -o tls.o tls.s
        $ ./binutils/readelf -Wsr -x.text tls.o

        Relocation section '.rel.text' at offset 0x128 contains 8 entries:
         Offset     Info    Type                Sym. Value  Symbol's Name
        00000000  0000056c R_ARM_TLS_LE32         0000000c   tbase
        00000004  0000056c R_ARM_TLS_LE32         0000000c   tbase
        00000008  0000056c R_ARM_TLS_LE32         0000000c   tbase
        0000000c  0000056c R_ARM_TLS_LE32         0000000c   tbase
        00000010  0000056c R_ARM_TLS_LE32         0000000c   tbase
        00000014  0000056c R_ARM_TLS_LE32         0000000c   tbase
        00000018  0000056c R_ARM_TLS_LE32         0000000c   tbase
        0000001c  0000056c R_ARM_TLS_LE32         0000000c   tbase

        Symbol table '.symtab' contains 9 entries:
           Num:    Value  Size Type    Bind   Vis      Ndx Name
             0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
             1: 00000000     0 SECTION LOCAL  DEFAULT    1 
             2: 00000000     0 SECTION LOCAL  DEFAULT    3 
             3: 00000000     0 SECTION LOCAL  DEFAULT    4 
             4: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 foo
             5: 0000000c     0 TLS     LOCAL  DEFAULT    5 tbase
             6: 00000000     0 SECTION LOCAL  DEFAULT    5 
             7: 00000000     0 NOTYPE  LOCAL  DEFAULT    1 $d
             8: 00000000     0 SECTION LOCAL  DEFAULT    6 

        Hex dump of section '.text':
         NOTE: This section has relocations against it, but these have NOT been
applied to this dump.
          0x00000000 00000000 04000000 08000000 00000000 ................
          0x00000010 10000000 14000000 18000000 00000000 ................

        $ 

The in-place addends (little-endian) are:
        offset 0:       0
        offset 4:       4
        offset 8:       8
        offset 12:      0
        offset 16:      16
        offset 20:      20
        offset 24:      24
        offset 28:      0
The correct addends would be:
        offset 0:       -12
        offset 4:       -8
        offset 8:       -4
        offset 12:      0
        offset 16:      4
        offset 20:      8
        offset 24:      12
        offset 24:      0

In each case where the expression was "tdata(tpoff) + offset" (with nonzero
offset), the reloc is for "tdata" but the in-place addend has the value
that would be appropriate for a reloc using the section symbol rather than
"tdata" (which starts 12 bytes into the section).  It would be kosher
enough to use these addends if it also made the relocs refer to the .tdata
section symbol rather than the "tdata" symbol.  For the cases with no
offset in the expression syntax or with explicit offset of zero, the addend
is correctly zero.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]