bash-3.1$ cat t.c
__thread int x;

int
_start ()
{
  return x;
}
bash-3.1$ make
cc -fPIC -ftls-model=local-dynamic   -c -o t.o t.c
./ld -o foo t.o
nm -u foo
                 U _GLOBAL_OFFSET_TABLE_
                 U __tls_get_addr
bash-3.1$ 

The problem is there is

              /* LD->LE transition:
                 Ensure it is:
                 leaq [EMAIL PROTECTED](%rip), %rdi; call [EMAIL PROTECTED]
                 We change it into:
                 .word 0x6666; .byte 0x66; movl %fs:0, %rax.  */

in elf64-x86-64.c. When the reference to __tls_get_addr is removed, it leaves
undefined symbol in symtab. It is confusing.

-- 
           Summary: Undefined symbols in static executable
           Product: binutils
           Version: 2.18 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: hjl at lucon dot org
                CC: bug-binutils at gnu dot org
GCC target triplet: x86_64-unknown-linux-gnu


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

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


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to