[lld] r263272 - Revert r263252: "[ELF] - Change all messages to lowercase to be consistent."
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 11 10:46:51 PST 2016
Author: ruiu
Date: Fri Mar 11 12:46:51 2016
New Revision: 263272
URL: http://llvm.org/viewvc/llvm-project?rev=263272&view=rev
Log:
Revert r263252: "[ELF] - Change all messages to lowercase to be consistent."
This reverts commit r263252 because the change contained unrelated changes.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/InputFiles.h
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.cpp
lld/trunk/ELF/Target.cpp
lld/trunk/test/ELF/basic.s
lld/trunk/test/ELF/driver.test
lld/trunk/test/ELF/invalid-cie-reference.s
lld/trunk/test/ELF/invalid-elf.test
lld/trunk/test/ELF/invalid-relocations.test
lld/trunk/test/ELF/libsearch.s
lld/trunk/test/ELF/linkerscript-sections-padding.s
lld/trunk/test/ELF/merge-string-error.s
lld/trunk/test/ELF/merge-string-no-null.s
lld/trunk/test/ELF/mips-gnu-hash.s
lld/trunk/test/ELF/ppc64-addr16-error.s
lld/trunk/test/ELF/relocation-in-merge.s
lld/trunk/test/ELF/relocation-past-merge-end.s
lld/trunk/test/ELF/splitstacks.s
lld/trunk/test/ELF/sysroot.s
lld/trunk/test/ELF/writable-merge.s
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Fri Mar 11 12:46:51 2016
@@ -61,9 +61,9 @@ static std::pair<ELFKind, uint16_t> pars
if (S == "aarch64linux")
return {ELF64LEKind, EM_AARCH64};
if (S == "i386pe" || S == "i386pep" || S == "thumb2pe")
- error("windows targets are not supported on the ELF frontend: " + S);
+ error("Windows targets are not supported on the ELF frontend: " + S);
else
- error("unknown emulation: " + S);
+ error("Unknown emulation: " + S);
return {ELFNoneKind, 0};
}
@@ -112,7 +112,7 @@ void LinkerDriver::addFile(StringRef Pat
return;
case file_magic::elf_shared_object:
if (Config->Relocatable) {
- error("attempted static link of dynamic object " + Path);
+ error("Attempted static link of dynamic object " + Path);
return;
}
Files.push_back(createSharedFile(MBRef));
@@ -126,7 +126,7 @@ void LinkerDriver::addFile(StringRef Pat
void LinkerDriver::addLibrary(StringRef Name) {
std::string Path = searchLibrary(Name);
if (Path.empty())
- error("unable to find library -l" + Name);
+ error("Unable to find library -l" + Name);
else
addFile(Path);
}
@@ -137,7 +137,7 @@ static void checkOptions(opt::InputArgLi
// The MIPS ABI as of 2016 does not support the GNU-style symbol lookup
// table which is a relatively new feature.
if (Config->EMachine == EM_MIPS && Config->GnuHash)
- error("the .gnu.hash section is not compatible with the MIPS target.");
+ error("The .gnu.hash section is not compatible with the MIPS target.");
if (Config->EMachine == EM_AMDGPU && !Config->Entry.empty())
error("-e option is not valid for AMDGPU.");
@@ -262,7 +262,7 @@ void LinkerDriver::readConfigs(opt::Inpu
if (auto *Arg = Args.getLastArg(OPT_O)) {
StringRef Val = Arg->getValue();
if (Val.getAsInteger(10, Config->Optimize))
- error("invalid optimization level");
+ error("Invalid optimization level");
}
if (auto *Arg = Args.getLastArg(OPT_hash_style)) {
@@ -273,7 +273,7 @@ void LinkerDriver::readConfigs(opt::Inpu
} else if (S == "both") {
Config->GnuHash = true;
} else if (S != "sysv")
- error("unknown hash style: " + S);
+ error("Unknown hash style: " + S);
}
for (auto *Arg : Args.filtered(OPT_undefined))
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Fri Mar 11 12:46:51 2016
@@ -53,7 +53,7 @@ ELFFileBase<ELFT>::getElfSymbols(bool On
uint32_t NumSymbols = std::distance(Syms.begin(), Syms.end());
uint32_t FirstNonLocal = Symtab->sh_info;
if (FirstNonLocal > NumSymbols)
- fatal("invalid sh_info in symbol table");
+ fatal("Invalid sh_info in symbol table");
if (OnlyGlobals)
return make_range(Syms.begin() + FirstNonLocal, Syms.end());
@@ -137,7 +137,7 @@ elf::ObjectFile<ELFT>::getShtGroupEntrie
ArrayRef<uint32_X> Entries =
check(Obj.template getSectionContentsAsArray<uint32_X>(&Sec));
if (Entries.empty() || Entries[0] != GRP_COMDAT)
- fatal("unsupported SHT_GROUP format");
+ fatal("Unsupported SHT_GROUP format");
return Entries.slice(1);
}
@@ -148,7 +148,7 @@ static bool shouldMerge(const typename E
if (!(Flags & SHF_MERGE))
return false;
if (Flags & SHF_WRITE)
- fatal("writable SHF_MERGE sections are not supported");
+ fatal("Writable SHF_MERGE sections are not supported");
uintX_t EntSize = Sec.sh_entsize;
if (!EntSize || Sec.sh_size % EntSize)
fatal("SHF_MERGE section size must be a multiple of sh_entsize");
@@ -187,7 +187,7 @@ void elf::ObjectFile<ELFT>::initializeSe
continue;
for (uint32_t SecIndex : getShtGroupEntries(Sec)) {
if (SecIndex >= Size)
- fatal("invalid section index in group");
+ fatal("Invalid section index in group");
Sections[SecIndex] = InputSection<ELFT>::Discarded;
}
break;
@@ -204,7 +204,7 @@ void elf::ObjectFile<ELFT>::initializeSe
case SHT_REL: {
uint32_t RelocatedSectionIndex = Sec.sh_info;
if (RelocatedSectionIndex >= Size)
- fatal("invalid relocated section index");
+ fatal("Invalid relocated section index");
InputSectionBase<ELFT> *RelocatedSection =
Sections[RelocatedSectionIndex];
// Strictly speaking, a relocation section must be included in the
@@ -213,7 +213,7 @@ void elf::ObjectFile<ELFT>::initializeSe
if (RelocatedSection == InputSection<ELFT>::Discarded)
continue;
if (!RelocatedSection)
- fatal("unsupported relocation reference");
+ fatal("Unsupported relocation reference");
if (Config->Relocatable) {
// For -r, relocation sections are handled as regular input sections.
Sections[I] = new (Alloc) InputSection<ELFT>(this, &Sec);
@@ -221,10 +221,10 @@ void elf::ObjectFile<ELFT>::initializeSe
S->RelocSections.push_back(&Sec);
} else if (auto *S = dyn_cast<EHInputSection<ELFT>>(RelocatedSection)) {
if (S->RelocSection)
- fatal("multiple relocation sections to .eh_frame are not supported");
+ fatal("Multiple relocation sections to .eh_frame are not supported");
S->RelocSection = &Sec;
} else {
- fatal("relocations pointing to SHF_MERGE are not supported");
+ fatal("Relocations pointing to SHF_MERGE are not supported");
}
break;
}
@@ -247,7 +247,7 @@ elf::ObjectFile<ELFT>::createInputSectio
return InputSection<ELFT>::Discarded;
if (Name == ".note.GNU-split-stack")
- error("objects using splitstacks are not supported");
+ error("Objects using splitstacks are not supported");
// A MIPS object file has a special section that contains register
// usage info, which needs to be handled by the linker specially.
@@ -281,7 +281,7 @@ elf::ObjectFile<ELFT>::getSection(const
if (Index == 0)
return nullptr;
if (Index >= Sections.size() || !Sections[Index])
- fatal("invalid section index");
+ fatal("Invalid section index");
InputSectionBase<ELFT> *S = Sections[Index];
if (S == InputSectionBase<ELFT>::Discarded)
return S;
@@ -397,7 +397,7 @@ template <class ELFT> void SharedFile<EL
if (Dyn.d_tag == DT_SONAME) {
uintX_t Val = Dyn.getVal();
if (Val >= this->StringTable.size())
- fatal("invalid DT_SONAME entry");
+ fatal("Invalid DT_SONAME entry");
SoName = StringRef(this->StringTable.data() + Val);
return;
}
@@ -433,7 +433,51 @@ static uint8_t getGvVisibility(const Glo
case GlobalValue::ProtectedVisibility:
return STV_PROTECTED;
}
- llvm_unreachable("unknown visibility");
+ llvm_unreachable("Unknown visibility");
+}
+
+SymbolBody *
+BitcodeFile::createSymbolBody(const DenseSet<const Comdat *> &KeptComdats,
+ const IRObjectFile &Obj,
+ const BasicSymbolRef &Sym) {
+ const GlobalValue *GV = Obj.getSymbolGV(Sym.getRawDataRefImpl());
+ assert(GV);
+ if (const Comdat *C = GV->getComdat())
+ if (!KeptComdats.count(C))
+ return nullptr;
+
+ uint8_t Visibility = getGvVisibility(GV);
+
+ SmallString<64> Name;
+ raw_svector_ostream OS(Name);
+ Sym.printName(OS);
+ StringRef NameRef = Saver.save(StringRef(Name));
+
+ const Module &M = Obj.getModule();
+ SymbolBody *Body;
+ uint32_t Flags = Sym.getFlags();
+ bool IsWeak = Flags & BasicSymbolRef::SF_Weak;
+ if (Flags & BasicSymbolRef::SF_Undefined) {
+ Body = new (Alloc) Undefined(NameRef, IsWeak, Visibility, false);
+ } else if (Flags & BasicSymbolRef::SF_Common) {
+ const DataLayout &DL = M.getDataLayout();
+ uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
+ Body = new (Alloc)
+ DefinedCommon(NameRef, Size, GV->getAlignment(), IsWeak, Visibility);
+ } else {
+ Body = new (Alloc) DefinedBitcode(NameRef, IsWeak, Visibility);
+ }
+ Body->IsTls = GV->isThreadLocal();
+ return Body;
+}
+
+bool BitcodeFile::shouldSkip(const BasicSymbolRef &Sym) {
+ uint32_t Flags = Sym.getFlags();
+ if (!(Flags & BasicSymbolRef::SF_Global))
+ return true;
+ if (Flags & BasicSymbolRef::SF_FormatSpecific)
+ return true;
+ return false;
}
void BitcodeFile::parse(DenseSet<StringRef> &ComdatGroups) {
@@ -448,43 +492,9 @@ void BitcodeFile::parse(DenseSet<StringR
KeptComdats.insert(&P.second);
}
- for (const BasicSymbolRef &Sym : Obj->symbols()) {
- const GlobalValue *GV = Obj->getSymbolGV(Sym.getRawDataRefImpl());
- assert(GV);
- uint32_t Flags = Sym.getFlags();
- if (const Comdat *C = GV->getComdat())
- if (!KeptComdats.count(C))
- continue;
- if (!(Flags & BasicSymbolRef::SF_Global))
- continue;
- if (GV->hasAppendingLinkage()) {
- ExtraKeeps.push_back(GV->getName().copy(Alloc));
- continue;
- }
- if (Flags & BasicSymbolRef::SF_FormatSpecific)
- continue;
- uint8_t Visibility = getGvVisibility(GV);
-
- SmallString<64> Name;
- raw_svector_ostream OS(Name);
- Sym.printName(OS);
- StringRef NameRef = Saver.save(StringRef(Name));
-
- SymbolBody *Body;
- bool IsWeak = Flags & BasicSymbolRef::SF_Weak;
- if (Flags & BasicSymbolRef::SF_Undefined) {
- Body = new (Alloc) Undefined(NameRef, IsWeak, Visibility, false);
- } else if (Flags & BasicSymbolRef::SF_Common) {
- const DataLayout &DL = M.getDataLayout();
- uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
- Body = new (Alloc)
- DefinedCommon(NameRef, Size, GV->getAlignment(), IsWeak, Visibility);
- } else {
- Body = new (Alloc) DefinedBitcode(NameRef, IsWeak, Visibility);
- }
- Body->IsTls = GV->isThreadLocal();
- SymbolBodies.push_back(Body);
- }
+ for (const BasicSymbolRef &Sym : Obj->symbols())
+ if (!shouldSkip(Sym))
+ SymbolBodies.push_back(createSymbolBody(KeptComdats, *Obj, Sym));
}
template <typename T>
@@ -506,7 +516,7 @@ template <template <class> class T>
static std::unique_ptr<InputFile> createELFFile(MemoryBufferRef MB) {
std::pair<unsigned char, unsigned char> Type = getElfArchType(MB.getBuffer());
if (Type.second != ELF::ELFDATA2LSB && Type.second != ELF::ELFDATA2MSB)
- fatal("invalid data encoding: " + MB.getBufferIdentifier());
+ fatal("Invalid data encoding: " + MB.getBufferIdentifier());
if (Type.first == ELF::ELFCLASS32) {
if (Type.second == ELF::ELFDATA2LSB)
@@ -518,7 +528,7 @@ static std::unique_ptr<InputFile> create
return createELFFileAux<T<ELF64LE>>(MB);
return createELFFileAux<T<ELF64BE>>(MB);
}
- fatal("invalid file class: " + MB.getBufferIdentifier());
+ fatal("Invalid file class: " + MB.getBufferIdentifier());
}
std::unique_ptr<InputFile> elf::createObjectFile(MemoryBufferRef MB,
Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Fri Mar 11 12:46:51 2016
@@ -18,8 +18,10 @@
#include "lld/Core/LLVM.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/IR/Comdat.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ELF.h"
+#include "llvm/Object/IRObjectFile.h"
#include "llvm/Support/StringSaver.h"
namespace lld {
@@ -180,19 +182,16 @@ public:
static bool classof(const InputFile *F);
void parse(llvm::DenseSet<StringRef> &ComdatGroups);
ArrayRef<SymbolBody *> getSymbols() { return SymbolBodies; }
- ArrayRef<StringRef> getExtraKeeps() { return ExtraKeeps; }
+ static bool shouldSkip(const llvm::object::BasicSymbolRef &Sym);
private:
std::vector<SymbolBody *> SymbolBodies;
- // Some symbols like llvm.global_ctors are internal to the IR and so
- // don't show up in SymbolBodies, but must be kept when creating the
- // combined LTO module. We track them here.
- // We currently use a different Module for creating SymbolBody's vs when
- // we are creating the combined LTO module, and so we can't store IR
- // pointers directly and must rely on the IR names.
- std::vector<StringRef> ExtraKeeps;
llvm::BumpPtrAllocator Alloc;
llvm::StringSaver Saver{Alloc};
+ SymbolBody *
+ createSymbolBody(const llvm::DenseSet<const llvm::Comdat *> &KeptComdats,
+ const llvm::object::IRObjectFile &Obj,
+ const llvm::object::BasicSymbolRef &Sym);
};
// .so file.
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Mar 11 12:46:51 2016
@@ -25,7 +25,7 @@ using namespace lld;
using namespace lld::elf;
template <class ELFT>
-InputSectionBase<ELFT>::InputSectionBase(ObjectFile<ELFT> *File,
+InputSectionBase<ELFT>::InputSectionBase(elf::ObjectFile<ELFT> *File,
const Elf_Shdr *Header,
Kind SectionKind)
: Header(Header), File(File), SectionKind(SectionKind), Repl(this) {
@@ -62,7 +62,7 @@ InputSectionBase<ELFT>::getOffset(uintX_
// so it should never be copied to output.
llvm_unreachable("MIPS .reginfo reached writeTo().");
}
- llvm_unreachable("invalid section kind");
+ llvm_unreachable("Invalid section kind");
}
template <class ELFT>
@@ -93,7 +93,8 @@ InputSectionBase<ELFT>::getRelocTarget(c
}
template <class ELFT>
-InputSection<ELFT>::InputSection(ObjectFile<ELFT> *F, const Elf_Shdr *Header)
+InputSection<ELFT>::InputSection(elf::ObjectFile<ELFT> *F,
+ const Elf_Shdr *Header)
: InputSectionBase<ELFT>(F, Header, Base::Regular) {}
template <class ELFT>
@@ -331,12 +332,12 @@ void InputSection<ELFT>::replace(InputSe
template <class ELFT>
SplitInputSection<ELFT>::SplitInputSection(
- ObjectFile<ELFT> *File, const Elf_Shdr *Header,
+ elf::ObjectFile<ELFT> *File, const Elf_Shdr *Header,
typename InputSectionBase<ELFT>::Kind SectionKind)
: InputSectionBase<ELFT>(File, Header, SectionKind) {}
template <class ELFT>
-EHInputSection<ELFT>::EHInputSection(ObjectFile<ELFT> *F,
+EHInputSection<ELFT>::EHInputSection(elf::ObjectFile<ELFT> *F,
const Elf_Shdr *Header)
: SplitInputSection<ELFT>(F, Header, InputSectionBase<ELFT>::EHFrame) {
// Mark .eh_frame sections as live by default because there are
@@ -386,7 +387,7 @@ SplitInputSection<ELFT>::getRangeAndSize
StringRef Data((const char *)D.data(), D.size());
uintX_t Size = Data.size();
if (Offset >= Size)
- fatal("entry is past the end of the section");
+ fatal("Entry is past the end of the section");
// Find the element this offset points to.
auto I = std::upper_bound(
@@ -424,13 +425,13 @@ MergeInputSection<ELFT>::getOffset(uintX
}
template <class ELFT>
-MipsReginfoInputSection<ELFT>::MipsReginfoInputSection(ObjectFile<ELFT> *F,
+MipsReginfoInputSection<ELFT>::MipsReginfoInputSection(elf::ObjectFile<ELFT> *F,
const Elf_Shdr *Hdr)
: InputSectionBase<ELFT>(F, Hdr, InputSectionBase<ELFT>::MipsReginfo) {
// Initialize this->Reginfo.
ArrayRef<uint8_t> D = this->getSectionData();
if (D.size() != sizeof(Elf_Mips_RegInfo<ELFT>))
- fatal("invalid size of .reginfo section");
+ fatal("Invalid size of .reginfo section");
Reginfo = reinterpret_cast<const Elf_Mips_RegInfo<ELFT> *>(D.data());
}
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Fri Mar 11 12:46:51 2016
@@ -296,7 +296,7 @@ void ScriptParser::addFile(StringRef S)
} else {
std::string Path = findFromSearchPaths(S);
if (Path.empty())
- setError("unable to find " + S);
+ setError("Unable to find " + S);
else
Driver->addFile(Saver.save(Path));
}
@@ -419,7 +419,7 @@ std::vector<uint8_t> ScriptParser::parse
S = S.substr(2);
uint8_t H;
if (B.getAsInteger(16, H)) {
- setError("not a HEX value: " + B);
+ setError("Not a HEX value: " + B);
return {};
}
Hex.push_back(H);
@@ -442,13 +442,13 @@ void ScriptParser::readOutputSectionDesc
readSectionPatterns(OutSec, true);
expect(")");
} else {
- setError("unknown command " + Tok);
+ setError("Unknown command " + Tok);
}
}
StringRef Tok = peek();
if (Tok.startswith("=")) {
if (!Tok.startswith("=0x")) {
- setError("filler should be a HEX value");
+ setError("Filler should be a HEX value");
return;
}
Tok = Tok.substr(3);
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Fri Mar 11 12:46:51 2016
@@ -256,7 +256,7 @@ typename ELFFile<ELFT>::uintX_t DynamicR
case Off_GotPlt:
return Sym->getGotPltVA<ELFT>();
}
- llvm_unreachable("invalid offset kind");
+ llvm_unreachable("Invalid offset kind");
}
template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
@@ -1150,7 +1150,7 @@ void EHOutputSection<ELFT>::addSectionAu
uint32_t CieOffset = Offset + 4 - ID;
auto I = OffsetToIndex.find(CieOffset);
if (I == OffsetToIndex.end())
- fatal("invalid CIE reference");
+ fatal("Invalid CIE reference");
Cies[I->second].Fdes.push_back(EHRegion<ELFT>(S, Index));
Out<ELFT>::EhFrameHdr->reserveFde();
this->Header.sh_size += alignTo(Length, sizeof(uintX_t));
@@ -1266,7 +1266,7 @@ void MergeOutputSection<ELFT>::addSectio
while (!Data.empty()) {
size_t End = findNull(Data, EntSize);
if (End == StringRef::npos)
- fatal("string is not null terminated");
+ fatal("String is not null terminated");
StringRef Entry = Data.substr(0, End + EntSize);
uintX_t OutputOffset = Builder.add(Entry);
if (shouldTailMerge())
@@ -1512,7 +1512,7 @@ SymbolTableSection<ELFT>::getOutputSecti
case SymbolBody::LazyKind:
break;
case SymbolBody::DefinedBitcodeKind:
- llvm_unreachable("should have been replaced");
+ llvm_unreachable("Should have been replaced");
}
return nullptr;
}
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Fri Mar 11 12:46:51 2016
@@ -84,7 +84,8 @@ void SymbolTable<ELFT>::addFile(std::uni
BitcodeFiles.emplace_back(cast<BitcodeFile>(File.release()));
F->parse(ComdatGroups);
for (SymbolBody *B : F->getSymbols())
- resolve(B);
+ if (B)
+ resolve(B);
return;
}
@@ -118,7 +119,7 @@ std::unique_ptr<InputFile> SymbolTable<E
std::string ErrMsg;
const Target *TheTarget = TargetRegistry::lookupTarget(TripleStr, ErrMsg);
if (!TheTarget)
- fatal("target not found: " + ErrMsg);
+ fatal("Target not found: " + ErrMsg);
TargetOptions Options;
Reloc::Model R = Config->Shared ? Reloc::PIC_ : Reloc::Static;
@@ -129,7 +130,7 @@ std::unique_ptr<InputFile> SymbolTable<E
legacy::PassManager CodeGenPasses;
if (TM->addPassesToEmitFile(CodeGenPasses, OS,
TargetMachine::CGFT_ObjectFile))
- fatal("failed to setup codegen");
+ fatal("Failed to setup codegen");
CodeGenPasses.run(M);
LtoBuffer = MemoryBuffer::getMemBuffer(OwningLTOData, "", false);
if (Config->SaveTemps)
@@ -139,28 +140,33 @@ std::unique_ptr<InputFile> SymbolTable<E
static void addBitcodeFile(IRMover &Mover, BitcodeFile &F,
LLVMContext &Context) {
- std::unique_ptr<MemoryBuffer> Buffer =
- MemoryBuffer::getMemBuffer(F.MB, false);
- std::unique_ptr<Module> M =
- check(getLazyBitcodeModule(std::move(Buffer), Context,
- /*ShouldLazyLoadMetadata*/ false));
+
+ std::unique_ptr<IRObjectFile> Obj =
+ check(IRObjectFile::create(F.MB, Context));
std::vector<GlobalValue *> Keep;
- for (SymbolBody *B : F.getSymbols()) {
- if (&B->repl() != B)
+ unsigned BodyIndex = 0;
+ ArrayRef<SymbolBody *> Bodies = F.getSymbols();
+
+ for (const BasicSymbolRef &Sym : Obj->symbols()) {
+ GlobalValue *GV = Obj->getSymbolGV(Sym.getRawDataRefImpl());
+ assert(GV);
+ if (GV->hasAppendingLinkage()) {
+ Keep.push_back(GV);
+ continue;
+ }
+ if (BitcodeFile::shouldSkip(Sym))
+ continue;
+ SymbolBody *B = Bodies[BodyIndex++];
+ if (!B || &B->repl() != B)
continue;
auto *DB = dyn_cast<DefinedBitcode>(B);
if (!DB)
continue;
- GlobalValue *GV = M->getNamedValue(B->getName());
- assert(GV);
Keep.push_back(GV);
}
- for (StringRef S : F.getExtraKeeps()) {
- GlobalValue *GV = M->getNamedValue(S);
- assert(GV);
- Keep.push_back(GV);
- }
- Mover.move(std::move(M), Keep, [](GlobalValue &, IRMover::ValueAdder) {});
+
+ Mover.move(Obj->takeModule(), Keep,
+ [](GlobalValue &, IRMover::ValueAdder) {});
}
// This is for use when debugging LTO.
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Fri Mar 11 12:46:51 2016
@@ -73,12 +73,12 @@ getSymVA(const SymbolBody &Body, typenam
case SymbolBody::UndefinedKind:
return 0;
case SymbolBody::LazyKind:
- assert(Body.isUsedInRegularObj() && "lazy symbol reached writer");
+ assert(Body.isUsedInRegularObj() && "Lazy symbol reached writer");
return 0;
case SymbolBody::DefinedBitcodeKind:
- llvm_unreachable("should have been replaced");
+ llvm_unreachable("Should have been replaced");
}
- llvm_unreachable("invalid symbol kind");
+ llvm_unreachable("Invalid symbol kind");
}
template <class ELFT>
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Fri Mar 11 12:46:51 2016
@@ -46,28 +46,28 @@ template <unsigned N> static void checkI
if (isInt<N>(V))
return;
StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
- error("relocation " + S + " out of range");
+ error("Relocation " + S + " out of range");
}
template <unsigned N> static void checkUInt(uint64_t V, uint32_t Type) {
if (isUInt<N>(V))
return;
StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
- error("relocation " + S + " out of range");
+ error("Relocation " + S + " out of range");
}
template <unsigned N> static void checkIntUInt(uint64_t V, uint32_t Type) {
if (isInt<N>(V) || isUInt<N>(V))
return;
StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
- error("relocation " + S + " out of range");
+ error("Relocation " + S + " out of range");
}
template <unsigned N> static void checkAlignment(uint64_t V, uint32_t Type) {
if ((V & (N - 1)) == 0)
return;
StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
- error("improper alignment for relocation " + S);
+ error("Improper alignment for relocation " + S);
}
template <class ELFT> bool isGnuIFunc(const SymbolBody &S) {
@@ -246,7 +246,7 @@ TargetInfo *createTarget() {
case ELF32BEKind:
return new MipsTargetInfo<ELF32BE>();
default:
- fatal("unsupported MIPS target");
+ fatal("Unsupported MIPS target");
}
case EM_PPC:
return new PPCTargetInfo();
@@ -255,7 +255,7 @@ TargetInfo *createTarget() {
case EM_X86_64:
return new X86_64TargetInfo();
}
- fatal("unknown target machine");
+ fatal("Unknown target machine");
}
TargetInfo::~TargetInfo() {}
@@ -566,7 +566,7 @@ size_t X86TargetInfo::relaxTls(uint8_t *
relocateOne(Loc, BufEnd, R_386_TLS_LE, P, SA);
return 0;
}
- llvm_unreachable("unknown TLS optimization");
+ llvm_unreachable("Unknown TLS optimization");
}
// "Ulrich Drepper, ELF Handling For Thread-Local Storage" (5.1
@@ -914,7 +914,7 @@ size_t X86_64TargetInfo::relaxTls(uint8_
// The next relocation should be against __tls_get_addr, so skip it
return 1;
}
- llvm_unreachable("unknown TLS optimization");
+ llvm_unreachable("Unknown TLS optimization");
}
void X86_64TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,
@@ -1470,7 +1470,7 @@ size_t AArch64TargetInfo::relaxTls(uint8
case R_AARCH64_TLSDESC_ADD_LO12_NC:
case R_AARCH64_TLSDESC_CALL: {
if (canBePreempted(S))
- fatal("unsupported TLS optimization");
+ fatal("Unsupported TLS optimization");
uint64_t X = S.getVA<ELF64LE>();
relocateTlsGdToLe(Type, Loc, BufEnd, P, X);
return 0;
@@ -1480,7 +1480,7 @@ size_t AArch64TargetInfo::relaxTls(uint8
relocateTlsIeToLe(Type, Loc, BufEnd, P, S.getVA<ELF64LE>());
return 0;
}
- llvm_unreachable("unknown TLS optimization");
+ llvm_unreachable("Unknown TLS optimization");
}
// Global-Dynamic relocations can be relaxed to Local-Exec if both binary is
@@ -1519,7 +1519,7 @@ void AArch64TargetInfo::relocateTlsGdToL
NewInst = 0xf2800000 | ((X & 0xffff) << 5);
break;
default:
- llvm_unreachable("unsupported Relocation for TLS GD to LE relax");
+ llvm_unreachable("Unsupported Relocation for TLS GD to LE relax");
}
write32le(Loc, NewInst);
}
@@ -1544,7 +1544,7 @@ void AArch64TargetInfo::relocateTlsIeToL
unsigned RegNo = (Inst & 0x1f);
NewInst = (0xf2800000 | RegNo) | ((X & 0xffff) << 5);
} else {
- llvm_unreachable("invalid Relocation for TLS IE to LE Relax");
+ llvm_unreachable("Invalid Relocation for TLS IE to LE Relax");
}
write32le(Loc, NewInst);
}
Modified: lld/trunk/test/ELF/basic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/basic.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/basic.s (original)
+++ lld/trunk/test/ELF/basic.s Fri Mar 11 12:46:51 2016
@@ -213,4 +213,4 @@ _start:
# DUP: duplicate symbol: _start in {{.*}} and {{.*}}
# RUN: not ld.lld %t -o %t -m wrong_emul 2>&1 | FileCheck --check-prefix=UNKNOWN_EMUL %s
-# UNKNOWN_EMUL: unknown emulation: wrong_emul
+# UNKNOWN_EMUL: Unknown emulation: wrong_emul
Modified: lld/trunk/test/ELF/driver.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/driver.test?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/driver.test (original)
+++ lld/trunk/test/ELF/driver.test Fri Mar 11 12:46:51 2016
@@ -6,9 +6,9 @@
# UNKNOWN: warning: unknown argument: --unknown1
# UNKNOWN: warning: unknown argument: --unknown2
# UNKNOWN: unknown argument(s) found
-# UNKNOWN: unknown emulation: foo
+# UNKNOWN: Unknown emulation: foo
# UNKNOWN: cannot open /no/such/file
-# UNKNOWN: unable to find library -lnosuchlib
+# UNKNOWN: Unable to find library -lnosuchlib
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: not ld.lld %t -o /no/such/file 2>&1 | FileCheck -check-prefix=MISSING %s
@@ -23,7 +23,7 @@
## Attempt to link DSO with -r
# RUN: ld.lld -shared %t -o %t.so
# RUN: not ld.lld -r %t.so %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR %s
-# ERR: attempted static link of dynamic object
+# ERR: Attempted static link of dynamic object
## Attempt to use -r and -shared together
# RUN: not ld.lld -r -shared %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR2 %s
Modified: lld/trunk/test/ELF/invalid-cie-reference.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid-cie-reference.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid-cie-reference.s (original)
+++ lld/trunk/test/ELF/invalid-cie-reference.s Fri Mar 11 12:46:51 2016
@@ -29,4 +29,4 @@
.long 0x0
.long 0x0
-// CHECK: invalid CIE reference
+// CHECK: Invalid CIE reference
Modified: lld/trunk/test/ELF/invalid-elf.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid-elf.test?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid-elf.test (original)
+++ lld/trunk/test/ELF/invalid-elf.test Fri Mar 11 12:46:51 2016
@@ -2,27 +2,26 @@
# RUN: not ld.lld %t %p/Inputs/invalid-data-encoding.a -o %t2 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-DATA-ENC %s
-# INVALID-DATA-ENC: invalid data encoding: test.o
+# INVALID-DATA-ENC: Invalid data encoding: test.o
# RUN: not ld.lld %t %p/Inputs/invalid-file-class.a -o %t2 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-FILE-CLASS %s
-# INVALID-FILE-CLASS: invalid file class: test.o
+# INVALID-FILE-CLASS: Invalid file class: test.o
# RUN: not ld.lld %p/Inputs/invalid-symtab-sh_info.elf -o %t2 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-SYMTAB-SHINFO %s
-# INVALID-SYMTAB-SHINFO: invalid sh_info in symbol table
+# INVALID-SYMTAB-SHINFO: Invalid sh_info in symbol table
# RUN: not ld.lld %p/Inputs/invalid-binding.elf -o %t2 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-BINDING %s
# INVALID-BINDING: unexpected binding
# RUN: not ld.lld %p/Inputs/invalid-section-index.elf -o %t2 2>&1 | \
-# RUN: FileCheck --check-prefix=INVALID-SECTION-INDEX-LLD %s
-# INVALID-SECTION-INDEX-LLD: invalid section index
+# RUN: FileCheck --check-prefix=INVALID-SECTION-INDEX %s
+# INVALID-SECTION-INDEX: Invalid section index
# RUN: not ld.lld %p/Inputs/invalid-shstrndx.so -o %t2 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-SECTION-INDEX %s
-# INVALID-SECTION-INDEX: Invalid section index
# RUN: not ld.lld %p/Inputs/invalid-shentsize-zero.elf -o %t2 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-SHENTSIZE-ZERO %s
@@ -30,6 +29,6 @@
# RUN: not ld.lld %p/Inputs/invalid-multiple-eh-relocs.elf -o %t2 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-EH-RELOCS %s
-# INVALID-EH-RELOCS: multiple relocation sections to .eh_frame are not supported
+# INVALID-EH-RELOCS: Multiple relocation sections to .eh_frame are not supported
.long foo
Modified: lld/trunk/test/ELF/invalid-relocations.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid-relocations.test?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid-relocations.test (original)
+++ lld/trunk/test/ELF/invalid-relocations.test Fri Mar 11 12:46:51 2016
@@ -19,4 +19,4 @@ Symbols:
Global:
- Name: lulz
-# CHECK: invalid relocated section index
+# CHECK: Invalid relocated section index
Modified: lld/trunk/test/ELF/libsearch.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/libsearch.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/libsearch.s (original)
+++ lld/trunk/test/ELF/libsearch.s Fri Mar 11 12:46:51 2016
@@ -23,7 +23,7 @@
// Should fail if cannot find specified library (without -L switch)
// RUN: not ld.lld -o %t3 %t.o -lls 2>&1 \
// RUN: | FileCheck --check-prefix=NOLIB %s
-// NOLIB: unable to find library -lls
+// NOLIB: Unable to find library -lls
// Should use explicitly specified static library
// Also ensure that we accept -L <arg>
@@ -55,7 +55,7 @@
// RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s
// RUN: not ld.lld -o %t3 %t.o -L%t.dir -Bstatic -lls2 2>&1 \
// RUN: | FileCheck --check-prefix=NOLIB2 %s
-// NOLIB2: unable to find library -lls2
+// NOLIB2: Unable to find library -lls2
// -Bdynamic should restore default behaviour
// RUN: ld.lld -o %t3 %t.o -L%t.dir -Bstatic -Bdynamic -lls
Modified: lld/trunk/test/ELF/linkerscript-sections-padding.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript-sections-padding.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript-sections-padding.s (original)
+++ lld/trunk/test/ELF/linkerscript-sections-padding.s Fri Mar 11 12:46:51 2016
@@ -23,13 +23,13 @@
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =99 }" > %t.script
# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 \
# RUN: | FileCheck --check-prefix=ERR %s
-# ERR: filler should be a HEX value
+# ERR: Filler should be a HEX value
## Filler should be a hex value (2):
# RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99XX }" > %t.script
# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 \
# RUN: | FileCheck --check-prefix=ERR2 %s
-# ERR2: not a HEX value: XX
+# ERR2: Not a HEX value: XX
.section .mysec.1,"a"
.align 16
Modified: lld/trunk/test/ELF/merge-string-error.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-string-error.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/merge-string-error.s (original)
+++ lld/trunk/test/ELF/merge-string-error.s Fri Mar 11 12:46:51 2016
@@ -8,4 +8,4 @@
.text
.long .rodata.str1.1 + 4
-// CHECK: entry is past the end of the section
+// CHECK: Entry is past the end of the section
Modified: lld/trunk/test/ELF/merge-string-no-null.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/merge-string-no-null.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/merge-string-no-null.s (original)
+++ lld/trunk/test/ELF/merge-string-no-null.s Fri Mar 11 12:46:51 2016
@@ -5,4 +5,4 @@
.section .rodata.str1.1,"aMS", at progbits,1
.ascii "abc"
-// CHECK: string is not null terminated
+// CHECK: String is not null terminated
Modified: lld/trunk/test/ELF/mips-gnu-hash.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-gnu-hash.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-gnu-hash.s (original)
+++ lld/trunk/test/ELF/mips-gnu-hash.s Fri Mar 11 12:46:51 2016
@@ -6,7 +6,7 @@
# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %t-el.o
# RUN: not ld.lld -shared -hash-style=gnu %t-el.o -o %t-el.so 2>&1 | FileCheck %s
-# CHECK: the .gnu.hash section is not compatible with the MIPS target.
+# CHECK: The .gnu.hash section is not compatible with the MIPS target.
# REQUIRES: mips
Modified: lld/trunk/test/ELF/ppc64-addr16-error.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-addr16-error.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-addr16-error.s (original)
+++ lld/trunk/test/ELF/ppc64-addr16-error.s Fri Mar 11 12:46:51 2016
@@ -5,4 +5,4 @@
.short sym+65539
-// CHECK: relocation R_PPC64_ADDR16 out of range
+// CHECK: Relocation R_PPC64_ADDR16 out of range
Modified: lld/trunk/test/ELF/relocation-in-merge.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-in-merge.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocation-in-merge.s (original)
+++ lld/trunk/test/ELF/relocation-in-merge.s Fri Mar 11 12:46:51 2016
@@ -1,7 +1,7 @@
// REQUIRES: x86
// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
// RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
-// CHECK: relocations pointing to SHF_MERGE are not supported
+// CHECK: Relocations pointing to SHF_MERGE are not supported
.section .foo,"aM", at progbits,4
.long bar
Modified: lld/trunk/test/ELF/relocation-past-merge-end.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-past-merge-end.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocation-past-merge-end.s (original)
+++ lld/trunk/test/ELF/relocation-past-merge-end.s Fri Mar 11 12:46:51 2016
@@ -1,7 +1,7 @@
// REQUIRES: x86
// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
// RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s
-// CHECK: entry is past the end of the section
+// CHECK: Entry is past the end of the section
.long .foo + 1
.section .foo,"aM", at progbits,4
Modified: lld/trunk/test/ELF/splitstacks.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/splitstacks.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/splitstacks.s (original)
+++ lld/trunk/test/ELF/splitstacks.s Fri Mar 11 12:46:51 2016
@@ -2,7 +2,7 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
# RUN: not ld.lld %t1.o -o %t 2>&1 | FileCheck %s
-# CHECK: objects using splitstacks are not supported
+# CHECK: Objects using splitstacks are not supported
.globl _start
_start:
Modified: lld/trunk/test/ELF/sysroot.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/sysroot.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/sysroot.s (original)
+++ lld/trunk/test/ELF/sysroot.s Fri Mar 11 12:46:51 2016
@@ -14,7 +14,7 @@
// We need to be sure that there is no suitable library in the /lib directory
// RUN: not ld.lld -o %t/r %t/m.o -L/lib -l:libls.a 2>&1 \
// RUN: | FileCheck --check-prefix=NOLIB %s
-// NOLIB: unable to find library -l:libls.a
+// NOLIB: Unable to find library -l:libls.a
// Should just remove the '=' symbol if --sysroot is not specified.
// Case 1: relative path
Modified: lld/trunk/test/ELF/writable-merge.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/writable-merge.s?rev=263272&r1=263271&r2=263272&view=diff
==============================================================================
--- lld/trunk/test/ELF/writable-merge.s (original)
+++ lld/trunk/test/ELF/writable-merge.s Fri Mar 11 12:46:51 2016
@@ -1,6 +1,6 @@
// REQUIRES: x86
// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
// RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
-// CHECK: writable SHF_MERGE sections are not supported
+// CHECK: Writable SHF_MERGE sections are not supported
.section .foo,"awM", at progbits,4
More information about the llvm-commits
mailing list