[PATCH] D62234: Copy symbol length when we replace a symbol.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 23:36:40 PDT 2019


ruiu created this revision.
ruiu added a reviewer: MaskRay.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Symbol's NameSize is computed lazily. Currently, when we replace a symbol,
a cached length value can be discarded. This patch propagates that value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62234

Files:
  lld/ELF/Symbols.h


Index: lld/ELF/Symbols.h
===================================================================
--- lld/ELF/Symbols.h
+++ lld/ELF/Symbols.h
@@ -482,6 +482,11 @@
   IsPreemptible = Old.IsPreemptible;
   ScriptDefined = Old.ScriptDefined;
 
+  // Symbol length is computed lazily. If we already know a symbol length,
+  // propagate it.
+  if (NameData == New.NameData && NameSize == 0 && New.NameSize != 0)
+    NameSize = New.NameSize;
+
   // Print out a log message if --trace-symbol was specified.
   // This is for debugging.
   if (Traced)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62234.200650.patch
Type: text/x-patch
Size: 542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190522/3ee10bf9/attachment.bin>


More information about the llvm-commits mailing list