@@ -50,14 +50,14 @@ Expected<StringRef> getDynamicStrTab(const ELFFile<ELFT> *Elf) {
5050}
5151
5252template <class ELFT >
53- static std::error_code getRelocationValueString (const ELFObjectFile<ELFT> *Obj,
54- const RelocationRef &RelRef,
55- SmallVectorImpl<char > &Result) {
53+ static Error getRelocationValueString (const ELFObjectFile<ELFT> *Obj,
54+ const RelocationRef &RelRef,
55+ SmallVectorImpl<char > &Result) {
5656 const ELFFile<ELFT> &EF = *Obj->getELFFile ();
5757 DataRefImpl Rel = RelRef.getRawDataRefImpl ();
5858 auto SecOrErr = EF.getSection (Rel.d .a );
5959 if (!SecOrErr)
60- return errorToErrorCode ( SecOrErr.takeError () );
60+ return SecOrErr.takeError ();
6161
6262 int64_t Addend = 0 ;
6363 // If there is no Symbol associated with the relocation, we set the undef
@@ -72,7 +72,7 @@ static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
7272 Addend = ERela->r_addend ;
7373 Undef = ERela->getSymbol (false ) == 0 ;
7474 } else if ((*SecOrErr)->sh_type != ELF::SHT_REL) {
75- return object_error::parse_failed ;
75+ return make_error<BinaryError>() ;
7676 }
7777
7878 // Default scheme is to print Target, as well as "+ <addend>" for nonzero
@@ -86,17 +86,17 @@ static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
8686 if (Sym->getType () == ELF::STT_SECTION) {
8787 Expected<section_iterator> SymSI = SI->getSection ();
8888 if (!SymSI)
89- return errorToErrorCode ( SymSI.takeError () );
89+ return SymSI.takeError ();
9090 const typename ELFT::Shdr *SymSec =
9191 Obj->getSection ((*SymSI)->getRawDataRefImpl ());
9292 auto SecName = EF.getSectionName (SymSec);
9393 if (!SecName)
94- return errorToErrorCode ( SecName.takeError () );
94+ return SecName.takeError ();
9595 Fmt << *SecName;
9696 } else {
9797 Expected<StringRef> SymName = SI->getName ();
9898 if (!SymName)
99- return errorToErrorCode ( SymName.takeError () );
99+ return SymName.takeError ();
100100 if (Demangle)
101101 Fmt << demangle (*SymName);
102102 else
@@ -110,13 +110,12 @@ static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
110110 Fmt << (Addend < 0 ? " " : " +" ) << Addend;
111111 Fmt.flush ();
112112 Result.append (FmtBuf.begin (), FmtBuf.end ());
113- return std::error_code ();
113+ return Error::success ();
114114}
115115
116- std::error_code
117- llvm::getELFRelocationValueString (const ELFObjectFileBase *Obj,
118- const RelocationRef &Rel,
119- SmallVectorImpl<char > &Result) {
116+ Error llvm::getELFRelocationValueString (const ELFObjectFileBase *Obj,
117+ const RelocationRef &Rel,
118+ SmallVectorImpl<char > &Result) {
120119 if (auto *ELF32LE = dyn_cast<ELF32LEObjectFile>(Obj))
121120 return getRelocationValueString (ELF32LE, Rel, Result);
122121 if (auto *ELF64LE = dyn_cast<ELF64LEObjectFile>(Obj))
0 commit comments