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 i386 target.
DF_STATIC_TLS flag indicates that the shared object or executable contains code using a static thread-local storage scheme. Patch checks if IE/LE relocations were used to check if the code uses a static model. If so it sets the DF_STATIC_TLS flag. Differential revision: https://reviews.llvm.org/D57749 llvm-svn: 353293
- Loading branch information
George Rimar
committed
Feb 6, 2019
1 parent
5a6712b
commit da60ad2
Showing
11 changed files
with
140 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.section ".tdata", "awT", @progbits | ||
.globl var | ||
var: | ||
|
||
.section .foo, "aw" | ||
.global _start | ||
_start: | ||
movl $var@tpoff, %edx # R_386_TLS_LE_32 | ||
movl %gs:0, %ecx |
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,9 @@ | ||
.section ".tdata", "awT", @progbits | ||
.globl var | ||
var: | ||
|
||
.section .foo, "aw" | ||
.global _start | ||
_start: | ||
movl %gs:0, %eax | ||
addl var@gotntpoff(%ebx), %eax # R_386_TLS_GOTIE |
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,9 @@ | ||
.section ".tdata", "awT", @progbits | ||
.globl var | ||
var: | ||
|
||
.section .foo, "aw" | ||
.global _start | ||
_start: | ||
movl %gs:0, %eax | ||
addl var@indntpoff, %eax # R_386_TLS_IE |
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,9 @@ | ||
.section ".tdata", "awT", @progbits | ||
.globl var | ||
var: | ||
|
||
.section .foo, "aw" | ||
.global _start | ||
_start: | ||
movl %gs:0, %eax | ||
leal var@ntpoff(%eax), %eax # R_386_TLS_LE |
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,20 @@ | ||
# REQUIRES: x86 | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %S/Inputs/i386-static-tls-model1.s -o %t.o | ||
# RUN: ld.lld %t.o -o %t1 -shared | ||
# RUN: llvm-readobj -dynamic-table %t1 | FileCheck %s | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %S/Inputs/i386-static-tls-model2.s -o %t.o | ||
# RUN: ld.lld %t.o -o %t2 -shared | ||
# RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %S/Inputs/i386-static-tls-model3.s -o %t.o | ||
# RUN: ld.lld %t.o -o %t3 -shared | ||
# RUN: llvm-readobj -dynamic-table %t3 | FileCheck %s | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %S/Inputs/i386-static-tls-model4.s -o %t.o | ||
# RUN: ld.lld %t.o -o %t4 -shared | ||
# RUN: llvm-readobj -dynamic-table %t4 | FileCheck %s | ||
|
||
# CHECK: DynamicSection [ | ||
# CHECK: FLAGS STATIC_TLS |
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