[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gold/25476] New: 3 - [gold] Gold doesn't handle GDesc -> IE transit
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug gold/25476] New: 3 - [gold] Gold doesn't handle GDesc -> IE transition correctly |
Date: |
Tue, 28 Jan 2020 14:15:05 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=25476
Bug ID: 25476
Summary: 3 - [gold] Gold doesn't handle GDesc -> IE transition
correctly
Product: binutils
Version: 2.35 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: hjl.tools at gmail dot com
CC: ian at airs dot com
Target Milestone: ---
Target: i386, x86-64
GDesc -> IE transition is wrong:
[hjl@gnu-cfl-2 tmp]$ cat x.s
.text
.p2align 4
.globl _start
.type _start, @function
_start:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq foo@TLSDESC(%rip), %rax
call *foo@TLSCALL(%rax)
addq %fs:0, %rax
addq foo@gottpoff(%rip), %rax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.size _start, .-_start
.section .tdata,"awT",@progbits
.align 4
.type foo, @object
.size foo, 4
foo:
.long 30
.section .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 tmp]$ gcc -c x.s
[hjl@gnu-cfl-2 tmp]$ ld -shared x.o
[hjl@gnu-cfl-2 tmp]$ objdump -dw --disassemble=_start a.out
a.out: file format elf64-x86-64
Disassembly of section .text:
0000000000001000 <_start>:
1000: 48 83 ec 08 sub $0x8,%rsp
1004: 48 8b 05 ed 2f 00 00 mov 0x2fed(%rip),%rax # 3ff8
<.got>
100b: 66 90 xchg %ax,%ax
100d: 64 48 03 04 25 00 00 00 00 add %fs:0x0,%rax
1016: 48 03 05 db 2f 00 00 add 0x2fdb(%rip),%rax # 3ff8
<.got>
101d: 48 83 c4 08 add $0x8,%rsp
1021: c3 retq
[hjl@gnu-cfl-2 tmp]$ ld.gold -shared x.o
[hjl@gnu-cfl-2 tmp]$ objdump -dw --disassemble=_start a.out
a.out: file format elf64-x86-64
Disassembly of section .plt:
Disassembly of section .text:
0000000000000390 <_start>:
390: 48 83 ec 08 sub $0x8,%rsp
394: 48 8d 05 65 1c 00 00 lea 0x1c65(%rip),%rax # 2000
<_GLOBAL_OFFSET_TABLE_+0x18>
39b: ff 10 callq *(%rax)
39d: 64 48 03 04 25 00 00 00 00 add %fs:0x0,%rax
3a6: 48 03 05 33 1c 00 00 add 0x1c33(%rip),%rax # 1fe0
<foo+0x1fe0>
3ad: 48 83 c4 08 add $0x8,%rsp
3b1: c3 retq
[hjl@gnu-cfl-2 tmp]$
Both i386.cc and x86_64.cc have
// If we are generating a shared library, then we can't do anything
// in the linker.
if (parameters->options().shared())
return tls::TLSOPT_NONE;
which is incorrect.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gold/25476] New: 3 - [gold] Gold doesn't handle GDesc -> IE transition correctly,
hjl.tools at gmail dot com <=