Revert [ELF] Error on relocations to STT_SECTION symbols if the sections were discarded

This reverts r361792 (git commit cfca5095df), the
revision causes link errors internally, will share more details with the
author.

llvm-svn: 361806
This commit is contained in:
Haojian Wu
2019-05-28 11:21:59 +00:00
parent 48c8bdad2a
commit 241dcb386e
8 changed files with 11 additions and 33 deletions

View File

@@ -681,17 +681,9 @@ static std::string maybeReportDiscarded(Undefined &Sym, InputSectionBase &Sec,
return "";
ArrayRef<Elf_Shdr_Impl<ELFT>> ObjSections =
CHECK(File->getObj().sections(), File);
std::string Msg;
if (Sym.Type == ELF::STT_SECTION) {
Msg = "relocation refers to a discarded section: ";
Msg += CHECK(
File->getObj().getSectionName(&ObjSections[Sym.DiscardedSecIdx]), File);
} else {
Msg = "relocation refers to a symbol in a discarded section: " +
toString(Sym);
}
Msg += "\n>>> defined in " + toString(File);
std::string Msg =
"relocation refers to a symbol in a discarded section: " + toString(Sym) +
"\n>>> defined in " + toString(File);
Elf_Shdr_Impl<ELFT> ELFSec = ObjSections[Sym.DiscardedSecIdx - 1];
if (ELFSec.sh_type != SHT_GROUP)