[lld] 5922dd9 - [ELF] Rename hasStaticTlsModel to hasTlsIe
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 24 23:17:21 PST 2021
Author: Fangrui Song
Date: 2021-11-24T21:06:04-08:00
New Revision: 5922dd91f8db24c29d6ae3b1fd57d8b836e521bd
URL: https://github.com/llvm/llvm-project/commit/5922dd91f8db24c29d6ae3b1fd57d8b836e521bd
DIFF: https://github.com/llvm/llvm-project/commit/5922dd91f8db24c29d6ae3b1fd57d8b836e521bd.diff
LOG: [ELF] Rename hasStaticTlsModel to hasTlsIe
and remove unneeded atomic.
Added:
Modified:
lld/ELF/Arch/Hexagon.cpp
lld/ELF/Arch/RISCV.cpp
lld/ELF/Arch/X86.cpp
lld/ELF/Arch/X86_64.cpp
lld/ELF/Config.h
lld/ELF/SyntheticSections.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp
index 300ca675519f..c33bd935f363 100644
--- a/lld/ELF/Arch/Hexagon.cpp
+++ b/lld/ELF/Arch/Hexagon.cpp
@@ -146,7 +146,7 @@ RelExpr Hexagon::getRelExpr(RelType type, const Symbol &s,
case R_HEX_IE_GOT_32_6_X:
case R_HEX_IE_GOT_HI16:
case R_HEX_IE_GOT_LO16:
- config->hasStaticTlsModel = true;
+ config->hasTlsIe = true;
return R_GOTPLT;
case R_HEX_TPREL_11_X:
case R_HEX_TPREL_16:
diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 5ee9e4185f1a..a0ea403e241d 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -261,7 +261,7 @@ RelExpr RISCV::getRelExpr(const RelType type, const Symbol &s,
case R_RISCV_TLS_GD_HI20:
return R_TLSGD_PC;
case R_RISCV_TLS_GOT_HI20:
- config->hasStaticTlsModel = true;
+ config->hasTlsIe = true;
return R_GOT_PC;
case R_RISCV_TPREL_HI20:
case R_RISCV_TPREL_LO12_I:
diff --git a/lld/ELF/Arch/X86.cpp b/lld/ELF/Arch/X86.cpp
index 6b0fae3b6d73..2560dc883257 100644
--- a/lld/ELF/Arch/X86.cpp
+++ b/lld/ELF/Arch/X86.cpp
@@ -79,7 +79,7 @@ int X86::getTlsGdRelaxSkip(RelType type) const {
RelExpr X86::getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const {
if (type == R_386_TLS_IE || type == R_386_TLS_GOTIE)
- config->hasStaticTlsModel = true;
+ config->hasTlsIe = true;
switch (type) {
case R_386_8:
diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index 1c399e5d1b26..614b5ed59218 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -318,7 +318,7 @@ bool X86_64::deleteFallThruJmpInsn(InputSection &is, InputFile *file,
RelExpr X86_64::getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const {
if (type == R_X86_64_GOTTPOFF)
- config->hasStaticTlsModel = true;
+ config->hasTlsIe = true;
switch (type) {
case R_X86_64_8:
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 79c4fe06d7b2..aaeee4755bc3 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -309,19 +309,10 @@ struct Configuration {
// if that's true.)
bool isMips64EL;
- // True if we need to set the DF_STATIC_TLS flag to an output file,
- // which works as a hint to the dynamic loader that the file contains
- // code compiled with the static TLS model. The thread-local variable
- // compiled with the static TLS model is faster but less flexible, and
- // it may not be loaded using dlopen().
- //
- // We set this flag to true when we see a relocation for the static TLS
- // model. Once this becomes true, it will never become false.
- //
- // Since the flag is updated by multi-threaded code, we use std::atomic.
- // (Writing to a variable is not considered thread-safe even if the
- // variable is boolean and we always set the same value from all threads.)
- std::atomic<bool> hasStaticTlsModel{false};
+ // True if we need to set the DF_STATIC_TLS flag to an output file, which
+ // works as a hint to the dynamic loader that the shared object contains code
+ // compiled with the initial-exec TLS model.
+ bool hasTlsIe = false;
// Holds set of ELF header flags for the target.
uint32_t eflags = 0;
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index f1594eb8df86..a47b8d758305 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1382,7 +1382,7 @@ template <class ELFT> void DynamicSection<ELFT>::finalizeContents() {
}
if (!config->zText)
dtFlags |= DF_TEXTREL;
- if (config->hasStaticTlsModel)
+ if (config->hasTlsIe)
dtFlags |= DF_STATIC_TLS;
if (dtFlags)
More information about the llvm-commits
mailing list