[lld] r232497 - [ELF][ARM] Place gotSymbol in an anonymous namespace
Rafael EspĂndola
rafael.espindola at gmail.com
Tue Mar 17 12:57:41 PDT 2015
LLD having its own coding style is a bug. From the last discussion it
looks like the intention is to change LLVM's variable names, but for
the rest, please follow the llvm style.
On 17 March 2015 at 15:13, Rui Ueyama <ruiu at google.com> wrote:
> No, please follow the LLVM coding style when you write code for LLD (except
> the naming convention which was discussed before).
>
> On Tue, Mar 17, 2015 at 12:04 PM, Shankar Easwaran <shankare at codeaurora.org>
> wrote:
>>
>> It looks like lld doesnot follow that pattern and chooses to use anonymous
>> namespace for variables as well.
>>
>> I felt anonymous namespaces are much nicer though.
>>
>> Shankar Easwaran
>>
>>
>> On 3/17/2015 1:58 PM, Rui Ueyama wrote:
>>>
>>> Yup. It's also documented in the coding style (
>>> http://llvm.org/docs/CodingStandards.html#anonymous-namespaces).
>>>
>>> On Tue, Mar 17, 2015 at 9:53 AM, Rafael EspĂndola <
>>> rafael.espindola at gmail.com> wrote:
>>>
>>>> Better.
>>>>
>>>> Just a note of style: we normally use static instead of anonymous
>>>> namespaces when they do the same thing. Probably the best in here
>>>> would be
>>>>
>>>> static const char gotSymbol[] = "_GLOBAL_OFFSET_TABLE_";
>>>>
>>>>
>>>> On 17 March 2015 at 12:40, Shankar Easwaran <shankare at codeaurora.org>
>>>> wrote:
>>>>>
>>>>> 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");
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> llvm-commits mailing list
>>>>> llvm-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>
>>>> _______________________________________________
>>>> 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