[PATCH] D71795: [ELF] Delete an unused special rule from isStaticLinkTimeConstant. NFC

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 22:08:06 PST 2019


MaskRay created this revision.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay updated this revision to Diff 235002.
MaskRay added reviewers: grimar, peter.smith, ruiu.
MaskRay added a comment.

.


Weak undefined symbols are preemptible after D71794 <https://reviews.llvm.org/D71794>.

  if (sym.isPreemptible)
    return false;
  if (!config->isPic)
    return true;
  // isPic means includeInDynsym is true after D71794.
  
  ...
  
  // We can delete this if because it can never be true.
  if (sym.isUndefWeak)
    return true;


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71795

Files:
  lld/ELF/Relocations.cpp


Index: lld/ELF/Relocations.cpp
===================================================================
--- lld/ELF/Relocations.cpp
+++ lld/ELF/Relocations.cpp
@@ -404,17 +404,7 @@
   if (!absVal && !relE)
     return target->usesOnlyLowPageBits(type);
 
-  // Relative relocation to an absolute value. This is normally unrepresentable,
-  // but if the relocation refers to a weak undefined symbol, we allow it to
-  // resolve to the image base. This is a little strange, but it allows us to
-  // link function calls to such symbols. Normally such a call will be guarded
-  // with a comparison, which will load a zero from the GOT.
-  // Another special case is MIPS _gp_disp symbol which represents offset
-  // between start of a function and '_gp' value and defined as absolute just
-  // to simplify the code.
   assert(absVal && relE);
-  if (sym.isUndefWeak())
-    return true;
 
   // We set the final symbols values for linker script defined symbols later.
   // They always can be computed as a link time constant.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71795.235002.patch
Type: text/x-patch
Size: 1024 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191221/e71eac3c/attachment.bin>


More information about the llvm-commits mailing list