[PATCH] D62725: [ELF] Replace a dead test in getSymVA() with assert()

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 02:37:40 PDT 2019

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

Symbols relative to discarded comdat sections are Undefined instead of
Defined now (after D59649 <https://reviews.llvm.org/D59649> and D61583 <https://reviews.llvm.org/D61583>). The == &InputSection::Discarded
test is now dead. I cannot find a test related to this behavior.

  rLLD LLVM Linker



Index: ELF/Symbols.cpp
--- ELF/Symbols.cpp
+++ ELF/Symbols.cpp
@@ -47,17 +47,11 @@
     auto &D = cast<Defined>(Sym);
     SectionBase *IS = D.Section;
-    // According to the ELF spec reference to a local symbol from outside
-    // the group are not allowed. Unfortunately .eh_frame breaks that rule
-    // and must be treated specially. For now we just replace the symbol with
-    // 0.
-    if (IS == &InputSection::Discarded)
-      return 0;
     // This is an absolute symbol.
     if (!IS)
       return D.Value;
+    assert(IS != &InputSection::Discarded);
     IS = IS->Repl;
     uint64_t Offset = D.Value;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62725.202401.patch
Type: text/x-patch
Size: 697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190531/bd2fdaa6/attachment.bin>

More information about the llvm-commits mailing list