[lld] r232341 - [ELF][ARM] Make gotSymbol a member.

Shankar Easwaran shankare at codeaurora.org
Sun Mar 15 17:54:03 PDT 2015


Author: shankare
Date: Sun Mar 15 19:54:03 2015
New Revision: 232341

URL: http://llvm.org/viewvc/llvm-project?rev=232341&view=rev
Log:
[ELF][ARM] Make gotSymbol a member.

The gotSymbol need not be a global static variable. Apart from this reason, This
variable was creating an issue with self hosting lld, as there seems to be an
issue running global initializers, when initializing the guard for this static
variable.

Program received signal SIGTRAP, Trace/breakpoint trap.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h

Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h?rev=232341&r1=232340&r2=232341&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h Sun Mar 15 19:54:03 2015
@@ -41,18 +41,14 @@ protected:
 private:
   ARMLinkingContext &_context;
   ARMTargetLayout<ELFT> &_armLayout;
-
-  static StringRef gotSymbol;
+  StringRef _gotSymbol;
 };
 
 template <class ELFT>
-StringRef ARMExecutableWriter<ELFT>::gotSymbol = "_GLOBAL_OFFSET_TABLE_";
-
-template <class ELFT>
 ARMExecutableWriter<ELFT>::ARMExecutableWriter(ARMLinkingContext &context,
                                                ARMTargetLayout<ELFT> &layout)
     : ExecutableWriter<ELFT>(context, layout), _context(context),
-      _armLayout(layout) {}
+      _armLayout(layout), _gotSymbol("_GLOBAL_OFFSET_TABLE_") {}
 
 template <class ELFT>
 bool ARMExecutableWriter<ELFT>::createImplicitFiles(
@@ -65,7 +61,7 @@ template <class ELFT>
 void ARMExecutableWriter<ELFT>::finalizeDefaultAtomValues() {
   // Finalize the atom values that are part of the parent.
   ExecutableWriter<ELFT>::finalizeDefaultAtomValues();
-  auto gotAtomIter = _armLayout.findAbsoluteAtom(gotSymbol);
+  auto gotAtomIter = _armLayout.findAbsoluteAtom(_gotSymbol);
   if (gotAtomIter != _armLayout.absoluteAtoms().end()) {
     auto *gotAtom = *gotAtomIter;
     if (auto gotpltSection = _armLayout.findOutputSection(".got.plt"))
@@ -88,8 +84,8 @@ unique_bump_ptr<SymbolTable<ELFT>>
 template <class ELFT>
 void ARMExecutableWriter<ELFT>::processUndefinedSymbol(
     StringRef symName, CRuntimeFile<ELFT> &file) const {
-  if (symName == gotSymbol) {
-    file.addAbsoluteAtom(gotSymbol);
+  if (symName == _gotSymbol) {
+    file.addAbsoluteAtom(_gotSymbol);
   } else if (symName.startswith("__exidx")) {
     file.addAbsoluteAtom("__exidx_start");
     file.addAbsoluteAtom("__exidx_end");





More information about the llvm-commits mailing list