[lld] r232497 - [ELF][ARM] Place gotSymbol in an anonymous namespace

Shankar Easwaran shankare at codeaurora.org
Tue Mar 17 09:40:15 PDT 2015


Author: shankare
Date: Tue Mar 17 11:40:14 2015
New Revision: 232497

URL: http://llvm.org/viewvc/llvm-project?rev=232497&view=rev
Log:
[ELF][ARM] Place gotSymbol in an anonymous namespace

Address comments from Espindola.

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=232497&r1=232496&r2=232497&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h Tue Mar 17 11:40:14 2015
@@ -14,6 +14,10 @@
 #include "ARMTargetHandler.h"
 #include "ARMSymbolTable.h"
 
+namespace {
+const char *gotSymbol = "_GLOBAL_OFFSET_TABLE_";
+}
+
 namespace lld {
 namespace elf {
 
@@ -41,14 +45,13 @@ protected:
 private:
   ARMLinkingContext &_context;
   ARMTargetLayout<ELFT> &_armLayout;
-  StringRef _gotSymbol;
 };
 
 template <class ELFT>
 ARMExecutableWriter<ELFT>::ARMExecutableWriter(ARMLinkingContext &context,
                                                ARMTargetLayout<ELFT> &layout)
     : ExecutableWriter<ELFT>(context, layout), _context(context),
-      _armLayout(layout), _gotSymbol("_GLOBAL_OFFSET_TABLE_") {}
+      _armLayout(layout) {}
 
 template <class ELFT>
 bool ARMExecutableWriter<ELFT>::createImplicitFiles(
@@ -61,7 +64,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"))
@@ -84,8 +87,8 @@ unique_bump_ptr<SymbolTable<ELFT>>
 template <class ELFT>
 void ARMExecutableWriter<ELFT>::processUndefinedSymbol(
     StringRef symName, RuntimeFile<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