[PATCH] D10522: Implement target independent TLS compatible with glibc's emutls.c.

David davidxl at google.com
Tue Jul 14 14:43:42 PDT 2015


davidxl added a subscriber: davidxl.
davidxl added a comment.

The compile_rt runtime support is still missing. Is it in a different patch?

David


================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:381
@@ -363,2 +380,3 @@
   MCSymbol *GVSym = getSymbol(GV);
-  EmitVisibility(GVSym, GV->getVisibility(), !GV->isDeclaration());
+  MCSymbol *EmittedSym = IsEmuTLSVar ?
+      createEmuTLSControlSym(GVSym, OutContext) : GVSym;
----------------
Should GVSym be just overwritten for emulated tls?

================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:388
@@ +387,3 @@
+
+  // A declaration has no initializer and no control variable in the current
+  // module for the emulated TLS model.
----------------
This comment seems redundent

================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:412
@@ +411,3 @@
+  bool AllZeroInitValue = false;
+  if (GV->hasInitializer()) {
+    const Constant *InitValue = GV->getInitializer();
----------------
Note that this check is not necessary -- see previous early return.

================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:422
@@ +421,3 @@
+  }
+  if (IsEmuTLSVar) {
+    // If there is init value, use .data.rel.local section;
----------------
Should this be moved into a helper routine to improve readability?

================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:440
@@ +439,3 @@
+      OutStreamer->EmitSymbolValue(
+          createEmuTLSInitSym(GVSym, OutContext), WordSize);
+    } else
----------------
createEmuTLSInitSym is called later again which seems wrong.

================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:505
@@ +504,3 @@
+
+  MCSymbol *EmittedInitSym = IsEmuTLSVar ?
+      createEmuTLSInitSym(GVSym, OutContext) : GVSym;
----------------
Just overwrite GVSym?

================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:506
@@ +505,3 @@
+  MCSymbol *EmittedInitSym = IsEmuTLSVar ?
+      createEmuTLSInitSym(GVSym, OutContext) : GVSym;
+  // createEmuTLSInitSym only creates the symbol with name and default attributes.
----------------
This was called before.


Repository:
  rL LLVM

http://reviews.llvm.org/D10522







More information about the llvm-commits mailing list