<div dir="ltr">Yup. It's also documented in the coding style (<a href="http://llvm.org/docs/CodingStandards.html#anonymous-namespaces">http://llvm.org/docs/CodingStandards.html#anonymous-namespaces</a>).<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 17, 2015 at 9:53 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Better.<br>
<br>
Just a note of style: we normally use static instead of anonymous<br>
namespaces when they do the same thing. Probably the best in here<br>
would be<br>
<br>
static const char gotSymbol[] = "_GLOBAL_OFFSET_TABLE_";<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 17 March 2015 at 12:40, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org">shankare@codeaurora.org</a>> wrote:<br>
> Author: shankare<br>
> Date: Tue Mar 17 11:40:14 2015<br>
> New Revision: 232497<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=232497&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=232497&view=rev</a><br>
> Log:<br>
> [ELF][ARM] Place gotSymbol in an anonymous namespace<br>
><br>
> Address comments from Espindola.<br>
><br>
> Modified:<br>
> lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h<br>
><br>
> Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h?rev=232497&r1=232496&r2=232497&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h?rev=232497&r1=232496&r2=232497&view=diff</a><br>
> ==============================================================================<br>
> --- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h (original)<br>
> +++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMExecutableWriter.h Tue Mar 17 11:40:14 2015<br>
> @@ -14,6 +14,10 @@<br>
> #include "ARMTargetHandler.h"<br>
> #include "ARMSymbolTable.h"<br>
><br>
> +namespace {<br>
> +const char *gotSymbol = "_GLOBAL_OFFSET_TABLE_";<br>
> +}<br>
> +<br>
> namespace lld {<br>
> namespace elf {<br>
><br>
> @@ -41,14 +45,13 @@ protected:<br>
> private:<br>
> ARMLinkingContext &_context;<br>
> ARMTargetLayout<ELFT> &_armLayout;<br>
> - StringRef _gotSymbol;<br>
> };<br>
><br>
> template <class ELFT><br>
> ARMExecutableWriter<ELFT>::ARMExecutableWriter(ARMLinkingContext &context,<br>
> ARMTargetLayout<ELFT> &layout)<br>
> : ExecutableWriter<ELFT>(context, layout), _context(context),<br>
> - _armLayout(layout), _gotSymbol("_GLOBAL_OFFSET_TABLE_") {}<br>
> + _armLayout(layout) {}<br>
><br>
> template <class ELFT><br>
> bool ARMExecutableWriter<ELFT>::createImplicitFiles(<br>
> @@ -61,7 +64,7 @@ template <class ELFT><br>
> void ARMExecutableWriter<ELFT>::finalizeDefaultAtomValues() {<br>
> // Finalize the atom values that are part of the parent.<br>
> ExecutableWriter<ELFT>::finalizeDefaultAtomValues();<br>
> - auto gotAtomIter = _armLayout.findAbsoluteAtom(_gotSymbol);<br>
> + auto gotAtomIter = _armLayout.findAbsoluteAtom(gotSymbol);<br>
> if (gotAtomIter != _armLayout.absoluteAtoms().end()) {<br>
> auto *gotAtom = *gotAtomIter;<br>
> if (auto gotpltSection = _armLayout.findOutputSection(".got.plt"))<br>
> @@ -84,8 +87,8 @@ unique_bump_ptr<SymbolTable<ELFT>><br>
> template <class ELFT><br>
> void ARMExecutableWriter<ELFT>::processUndefinedSymbol(<br>
> StringRef symName, RuntimeFile<ELFT> &file) const {<br>
> - if (symName == _gotSymbol) {<br>
> - file.addAbsoluteAtom(_gotSymbol);<br>
> + if (symName == gotSymbol) {<br>
> + file.addAbsoluteAtom(gotSymbol);<br>
> } else if (symName.startswith("__exidx")) {<br>
> file.addAbsoluteAtom("__exidx_start");<br>
> file.addAbsoluteAtom("__exidx_end");<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>