From 7c77044a38114847a0e104a93a37bc47ee928a46 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 6 Feb 2019 18:53:17 +0000 Subject: [PATCH] Add comment. llvm-svn: 353323 --- lld/ELF/Config.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index bc33fa87c653..74400261d714 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -81,7 +81,6 @@ struct VersionDefinition { // and such fields have the same name as the corresponding options. // Most fields are initialized by the driver. struct Configuration { - std::atomic HasStaticTlsModel{false}; uint8_t OSABI = 0; llvm::CachePruningPolicy ThinLTOCachePolicy; llvm::StringMap SectionStartMap; @@ -255,6 +254,20 @@ 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 + // varaible is boolean and we always set the same value from all threads.) + std::atomic HasStaticTlsModel{false}; + // Holds set of ELF header flags for the target. uint32_t EFlags = 0;