From 9fdb81d09b82f2bd4ec5075d9d636ef952b3a99b Mon Sep 17 00:00:00 2001 From: Shankar Easwaran Date: Mon, 16 Mar 2015 00:54:03 +0000 Subject: [PATCH] [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. llvm-svn: 232341 --- lld/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lld/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h b/lld/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h index 4ef1603..7f1d37e 100644 --- a/lld/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h +++ b/lld/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h @@ -41,18 +41,14 @@ protected: private: ARMLinkingContext &_context; ARMTargetLayout &_armLayout; - - static StringRef gotSymbol; + StringRef _gotSymbol; }; template -StringRef ARMExecutableWriter::gotSymbol = "_GLOBAL_OFFSET_TABLE_"; - -template ARMExecutableWriter::ARMExecutableWriter(ARMLinkingContext &context, ARMTargetLayout &layout) : ExecutableWriter(context, layout), _context(context), - _armLayout(layout) {} + _armLayout(layout), _gotSymbol("_GLOBAL_OFFSET_TABLE_") {} template bool ARMExecutableWriter::createImplicitFiles( @@ -65,7 +61,7 @@ template void ARMExecutableWriter::finalizeDefaultAtomValues() { // Finalize the atom values that are part of the parent. ExecutableWriter::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> template void ARMExecutableWriter::processUndefinedSymbol( StringRef symName, CRuntimeFile &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"); -- 2.7.4