[lld] r361364 - Copy symbol length when we replace a symbol.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 02:19:30 PDT 2019
Author: ruiu
Date: Wed May 22 02:19:30 2019
New Revision: 361364
URL: http://llvm.org/viewvc/llvm-project?rev=361364&view=rev
Log:
Copy symbol length when we replace a symbol.
Symbol's NameSize is computed lazily. Currently, when we replace a symbol,
a cached length value can be discarded. This patch propagates that value.
Differential Revision: https://reviews.llvm.org/D62234
Modified:
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=361364&r1=361363&r2=361364&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Wed May 22 02:19:30 2019
@@ -486,6 +486,11 @@ void Symbol::replace(const Symbol &New)
IsPreemptible = Old.IsPreemptible;
ScriptDefined = Old.ScriptDefined;
+ // Symbol length is computed lazily. If we already know a symbol length,
+ // propagate it.
+ if (NameData == Old.NameData && NameSize == 0 && Old.NameSize != 0)
+ NameSize = Old.NameSize;
+
// Print out a log message if --trace-symbol was specified.
// This is for debugging.
if (Traced)
More information about the llvm-commits
mailing list