[PATCH] D61583: [ELF] Create Undefined for local STT_SECTION symbol if the section is discarded

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 5 22:50:47 PDT 2019


MaskRay created this revision.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay added a parent revision: D61563: [ELF] Error on relocations to local undefined symbols.

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D61583

Files:
  ELF/InputFiles.cpp


Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -802,7 +802,7 @@
       fatal(toString(this) + ": invalid symbol name offset");
 
     StringRefZ Name = this->StringTable.data() + Sym->st_name;
-    if (Sym->st_shndx == SHN_UNDEF)
+    if (Sym->st_shndx == SHN_UNDEF || Sec == &InputSection::Discarded)
       return make<Undefined>(this, Name, Binding, StOther, Type);
 
     return make<Defined>(this, Name, Binding, StOther, Type, Value, Size, Sec);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61583.198222.patch
Type: text/x-patch
Size: 548 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190506/b304ecf6/attachment.bin>


More information about the llvm-commits mailing list