[lld] r234271 - ELF: Do not return error from handleUndefinedSymbol.
Rui Ueyama
ruiu at google.com
Mon Apr 6 18:04:15 PDT 2015
Author: ruiu
Date: Mon Apr 6 20:04:15 2015
New Revision: 234271
URL: http://llvm.org/viewvc/llvm-project?rev=234271&view=rev
Log:
ELF: Do not return error from handleUndefinedSymbol.
This function is not supposed to return an error value.
Modified:
lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.h?rev=234271&r1=234270&r2=234271&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.h Mon Apr 6 20:04:15 2015
@@ -262,8 +262,8 @@ protected:
const Elf_Shdr *shdr);
/// Process the Undefined symbol and create an atom for it.
- ErrorOr<ELFUndefinedAtom<ELFT> *>
- handleUndefinedSymbol(StringRef symName, const Elf_Sym *sym) {
+ ELFUndefinedAtom<ELFT> *createUndefinedAtom(StringRef symName,
+ const Elf_Sym *sym) {
return new (_readerStorage) ELFUndefinedAtom<ELFT>(*this, symName, sym);
}
@@ -460,16 +460,16 @@ public:
/// \brief add an undefined atom
virtual Atom *addUndefinedAtom(StringRef symbolName) {
assert(!symbolName.empty() && "UndefinedAtoms must have a name");
- Elf_Sym *symbol = new (this->_readerStorage) Elf_Sym;
- symbol->st_name = 0;
- symbol->st_value = 0;
- symbol->st_shndx = llvm::ELF::SHN_UNDEF;
- symbol->setBindingAndType(llvm::ELF::STB_GLOBAL, llvm::ELF::STT_NOTYPE);
- symbol->setVisibility(llvm::ELF::STV_DEFAULT);
- symbol->st_size = 0;
- auto newAtom = this->handleUndefinedSymbol(symbolName, symbol);
- this->_undefinedAtoms._atoms.push_back(*newAtom);
- return *newAtom;
+ Elf_Sym *sym = new (this->_readerStorage) Elf_Sym;
+ sym->st_name = 0;
+ sym->st_value = 0;
+ sym->st_shndx = llvm::ELF::SHN_UNDEF;
+ sym->setBindingAndType(llvm::ELF::STB_GLOBAL, llvm::ELF::STT_NOTYPE);
+ sym->setVisibility(llvm::ELF::STV_DEFAULT);
+ sym->st_size = 0;
+ ELFUndefinedAtom<ELFT> *atom = this->createUndefinedAtom(symbolName, sym);
+ this->_undefinedAtoms._atoms.push_back(atom);
+ return atom;
}
// cannot add atoms to Runtime file
@@ -646,10 +646,10 @@ std::error_code ELFFile<ELFT>::createSym
std::make_pair(&*SymI, wrapAtom->getValue()));
continue;
}
- ErrorOr<ELFUndefinedAtom<ELFT> *> undefAtom =
- handleUndefinedSymbol(*symbolName, &*SymI);
- _undefinedAtoms._atoms.push_back(*undefAtom);
- _symbolToAtomMapping.insert(std::make_pair(&*SymI, *undefAtom));
+ ELFUndefinedAtom<ELFT> *undefAtom =
+ createUndefinedAtom(*symbolName, &*SymI);
+ _undefinedAtoms._atoms.push_back(undefAtom);
+ _symbolToAtomMapping.insert(std::make_pair(&*SymI, undefAtom));
} else if (isCommonSymbol(&*SymI)) {
ErrorOr<ELFCommonAtom<ELFT> *> commonAtom =
handleCommonSymbol(*symbolName, &*SymI);
More information about the llvm-commits
mailing list