On Linux/x86 and Linux/x86-64, I got
[EMAIL PROTECTED] tls-5]$ cat x.c
#include <stdio.h>
__thread int foo __attribute__((tls_model("global-dynamic"))) = 100;
int
main ()
{
printf ("foo: %d\n", foo);
return 0;
}
[EMAIL PROTECTED] tls-5]$ gcc -o x x.c
/usr/local/bin/ld: BFD (Linux/GNU Binutils) 2.18.50.0.1.20070811 assertion fail
/net/gnu-13/export/linux/src/binutils/binutils/bfd/elf64-x86-64.c:2568
[EMAIL PROTECTED] tls-5]$ ./x
foo: 100
The assert comes from
/* GD->LE transition.
.byte 0x66; leaq [EMAIL PROTECTED](%rip), %rdi
.word 0x6666; rex64; call [EMAIL PROTECTED]
Change it into:
movq %fs:0, %rax
leaq [EMAIL PROTECTED](%rax), %rax */
BFD_ASSERT (rel->r_offset >= 4);
for (i = 0; i < 4; i++)
BFD_ASSERT (bfd_get_8 (input_bfd,
contents + rel->r_offset - 4 + i)
== tlsgd[i]);
BFD_ASSERT (rel->r_offset + 12 <= input_section->size);
for (i = 0; i < 4; i++)
BFD_ASSERT (bfd_get_8 (input_bfd,
contents + rel->r_offset + 4 + i)
== tlsgd[i+4]); BFD_ASSERT (rel
+ 1 < relend);
BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
Why is R_X86_64_PLT32 required here?
--
Summary: ___tls_get_addr call requires @PLT even without -fpic
Product: binutils
Version: 2.19 (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
http://sourceware.org/bugzilla/show_bug.cgi?id=4918
------- 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
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-binutils