[ELF] Rename hasStaticTlsModel to hasTlsIe

and remove unneeded atomic.
This commit is contained in:
Fangrui Song 2021-11-24 21:06:04 -08:00
parent 371290dfd4
commit 5922dd91f8
6 changed files with 9 additions and 18 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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;

View File

@ -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)