[lld] r353323 - Add comment.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 6 10:53:18 PST 2019


Author: ruiu
Date: Wed Feb  6 10:53:17 2019
New Revision: 353323

URL: http://llvm.org/viewvc/llvm-project?rev=353323&view=rev
Log:
Add comment.

Modified:
    lld/trunk/ELF/Config.h

Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=353323&r1=353322&r2=353323&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Wed Feb  6 10:53:17 2019
@@ -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<bool> HasStaticTlsModel{false};
   uint8_t OSABI = 0;
   llvm::CachePruningPolicy ThinLTOCachePolicy;
   llvm::StringMap<uint64_t> 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<bool> HasStaticTlsModel{false};
+
   // Holds set of ELF header flags for the target.
   uint32_t EFlags = 0;
 




More information about the llvm-commits mailing list