bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/6906] New: TLS relocs prevent changing r19 to r27 when doing sta


From: danglin at gcc dot gnu dot org
Subject: [Bug ld/6906] New: TLS relocs prevent changing r19 to r27 when doing static link with PIC code on PA
Date: 21 Sep 2008 17:18:10 -0000

In trying to debug an eh bug, I tried a static link to minimize issues
wrt lazing binding.  The resulting application segfaults:

Program received signal SIGSEGV, Segmentation fault.
0x00021610 in __tls_get_addr ()
Current language:  auto; currently asm
(gdb) bt
#0  0x00021610 in __tls_get_addr ()
#1  0x000151b4 in __cxa_get_globals ()
    at ../../../../gcc/libstdc++-v3/libsupc++/eh_globals.cc:68
#2  0x00014a50 in __cxa_allocate_exception (thrown_size=76)
    at ../../../../gcc/libstdc++-v3/libsupc++/eh_alloc.cc:137
#3  0x00012060 in doIt ()
    at /home/dave/gcc-4.4/gcc/gcc/testsuite/g++.dg/eh/pr29166.C:79
#4  0x000120b0 in test ()
    at /home/dave/gcc-4.4/gcc/gcc/testsuite/g++.dg/eh/pr29166.C:85
#5  0x00013878 in main (argc=1, argv=0xfdf008b4)
    at /home/dave/gcc-4.4/gcc/gcc/testsuite/g++.dg/eh/pr29166.C:159
(gdb) disass __tls_get_addr
Dump of assembler code for function __tls_get_addr:
0x00021610 <__tls_get_addr+0>:  ldw 4(r26),r20
0x00021614 <__tls_get_addr+4>:  mfctl tr3,ret0
0x00021618 <__tls_get_addr+8>:  ldw 0(ret0),r19
0x0002161c <__tls_get_addr+12>: ldw 8(r19),ret0
0x00021620 <__tls_get_addr+16>: bv r0(rp)
0x00021624 <__tls_get_addr+20>: add,l ret0,r20,ret0
End of assembler dump.
(gdb) p/x $r26
$1 = 0x41aa
(gdb) disass __cxa_get_globals
Dump of assembler code for function __cxa_get_globals:
0x0001519c <__cxa_get_globals+0>:       stw rp,-14(sp)
0x000151a0 <__cxa_get_globals+4>:       addil L%2800,r19,r1
0x000151a4 <__cxa_get_globals+8>:       ldo 5c8(r1),r26
0x000151a8 <__cxa_get_globals+12>:      stw,ma r4,80(sp)
0x000151ac <__cxa_get_globals+16>:      b,l 0x21610 <__tls_get_addr>,rp
0x000151b0 <__cxa_get_globals+20>:      stw r19,-20(sp)
0x000151b4 <__cxa_get_globals+24>:      ldw -94(sp),rp
0x000151b8 <__cxa_get_globals+28>:      addil L%0,ret0,r1
0x000151bc <__cxa_get_globals+32>:      ldo 10(r1),ret0
0x000151c0 <__cxa_get_globals+36>:      bv r0(rp)
0x000151c4 <__cxa_get_globals+40>:      ldw,mb -80(sp),r4
End of assembler dump.

The problem is the addil at __cxa_get_globals+4.  In a static links,
instructions with relocations using the PIC register need to be instructions
using the global register.  Specifically, stuff like the following:

RELOCATION RECORDS FOR [.text.__cxa_get_globals]:
OFFSET   TYPE              VALUE 
00000004 R_PARISC_TLS_LDM21L  _ZZN12_GLOBAL__N_110get_globalEvE6global
00000008 R_PARISC_TLS_LDM14R  _ZZN12_GLOBAL__N_110get_globalEvE6global
0000001c R_PARISC_TLS_LDO21L  _ZZN12_GLOBAL__N_110get_globalEvE6global
00000020 R_PARISC_TLS_LDO14R  _ZZN12_GLOBAL__N_110get_globalEvE6global

-- 
           Summary: TLS relocs prevent changing r19 to r27 when doing static
                    link with PIC code on PA
           Product: binutils
           Version: 2.20 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: danglin at gcc dot gnu dot org
                CC: bug-binutils at gnu dot org
 GCC build triplet: hppa-unknown-linux-gnu
  GCC host triplet: hppa-unknown-linux-gnu
GCC target triplet: hppa-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=6906

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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