From 29e56d06f239c11e0ba64682273905109cb2d675 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 7 Apr 2015 01:08:16 +0000 Subject: [PATCH] ELF: Do not return error from handleAbsoluteSymbol. This function never fails. llvm-svn: 234272 --- lld/lib/ReaderWriter/ELF/ELFFile.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lld/lib/ReaderWriter/ELF/ELFFile.h b/lld/lib/ReaderWriter/ELF/ELFFile.h index 38e8226..6e7f9ce 100644 --- a/lld/lib/ReaderWriter/ELF/ELFFile.h +++ b/lld/lib/ReaderWriter/ELF/ELFFile.h @@ -273,8 +273,8 @@ protected: } /// Process the Absolute symbol and create an atom for it. - ErrorOr *> - handleAbsoluteSymbol(StringRef symName, const Elf_Sym *sym, int64_t value) { + ELFAbsoluteAtom *createAbsoluteAtom(StringRef symName, + const Elf_Sym *sym, int64_t value) { return new (_readerStorage) ELFAbsoluteAtom(*this, symName, sym, value); } @@ -445,16 +445,16 @@ public: /// \brief add a global absolute atom virtual Atom *addAbsoluteAtom(StringRef symbolName) { assert(!symbolName.empty() && "AbsoluteAtoms 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_ABS; - symbol->setBindingAndType(llvm::ELF::STB_GLOBAL, llvm::ELF::STT_OBJECT); - symbol->setVisibility(llvm::ELF::STV_DEFAULT); - symbol->st_size = 0; - auto newAtom = this->handleAbsoluteSymbol(symbolName, symbol, -1); - this->_absoluteAtoms._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_ABS; + sym->setBindingAndType(llvm::ELF::STB_GLOBAL, llvm::ELF::STT_OBJECT); + sym->setVisibility(llvm::ELF::STV_DEFAULT); + sym->st_size = 0; + ELFAbsoluteAtom *atom = this->createAbsoluteAtom(symbolName, sym, -1); + this->_absoluteAtoms._atoms.push_back(atom); + return atom; } /// \brief add an undefined atom @@ -634,10 +634,10 @@ std::error_code ELFFile::createSymbolsFromAtomizableSections() { return ec; if (isAbsoluteSymbol(&*SymI)) { - ErrorOr *> absAtom = - handleAbsoluteSymbol(*symbolName, &*SymI, (int64_t)getSymbolValue(&*SymI)); - _absoluteAtoms._atoms.push_back(*absAtom); - _symbolToAtomMapping.insert(std::make_pair(&*SymI, *absAtom)); + ELFAbsoluteAtom *absAtom = createAbsoluteAtom( + *symbolName, &*SymI, (int64_t)getSymbolValue(&*SymI)); + _absoluteAtoms._atoms.push_back(absAtom); + _symbolToAtomMapping.insert(std::make_pair(&*SymI, absAtom)); } else if (isUndefinedSymbol(&*SymI)) { if (_useWrap && (_wrapSymbolMap.find(*symbolName) != _wrapSymbolMap.end())) { -- 2.7.4