[lld] r232341 - [ELF][ARM] Make gotSymbol a member.
Shankar Easwaran
shankare at codeaurora.org
Tue Mar 17 09:43:11 PDT 2015
Fixed in r232497.
On 3/17/2015 11:08 AM, Shankar Easwaran wrote:
> Thinking about this, it could very well be a variable in anonymous
> namespace for that file, than a member variable.
>
> On 3/17/2015 10:54 AM, Shankar Easwaran wrote:
>> Why would you do that, ARMExecutableWriter is the only thing that
>> refers to it though. Making it a global symbol didnt make sense.
>>
>> Apart from this error, there was a problem with this static variable
>> for self hosting.
>>
>> Shankar Easwaran
>>
>> On 3/17/2015 10:49 AM, Rafael EspĂndola wrote:
>>> On 15 March 2015 at 20:54, Shankar Easwaran
>>> <shankare at codeaurora.org> wrote:
>>>> 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.
>>> But static is desirable.
>>>
>>>> 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.
>>>>
>>> Could you just use
>>>
>>>
>>> static const char *gotSymbol;
>>>
>>>
>>> To avoid the static constructor?
>>>
>>>> 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");
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation
More information about the llvm-commits
mailing list