Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LLD][ELF] - Set DF_STATIC_TLS flag for X64 target
This is the same as D57749, but for x64 target. "ELF Handling For Thread-Local Storage" p41 says (https://www.akkadia.org/drepper/tls.pdf): R_X86_64_GOTTPOFF relocation is used for IE TLS models. Hence if linker sees this relocation we should add DF_STATIC_TLS flag. Differential revision: https://reviews.llvm.org/D57821 llvm-svn: 353378
- Loading branch information
George Rimar
committed
Feb 7, 2019
1 parent
c418352
commit 55f7c72
Showing
5 changed files
with
54 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# REQUIRES: x86 | ||
|
||
## In this test R_X86_64_GOTTPOFF is a IE relocation (static TLS model), | ||
## test check we add STATIC_TLS flag. | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o | ||
# RUN: ld.lld %t.o -o %t1 -shared | ||
# RUN: llvm-readobj -dynamic-table %t1 | FileCheck %s | ||
|
||
# CHECK: DynamicSection [ | ||
# CHECK: FLAGS STATIC_TLS | ||
|
||
.section ".tdata", "awT", @progbits | ||
.globl var | ||
var: | ||
|
||
movq var@GOTTPOFF(%rip), %rax # R_X86_64_GOTTPOFF | ||
movl %fs:0(%rax), %eax |