@@ -50,14 +50,14 @@ Expected<StringRef> getDynamicStrTab(const ELFFile<ELFT> *Elf) {
50
50
}
51
51
52
52
template <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) {
56
56
const ELFFile<ELFT> &EF = *Obj->getELFFile ();
57
57
DataRefImpl Rel = RelRef.getRawDataRefImpl ();
58
58
auto SecOrErr = EF.getSection (Rel.d .a );
59
59
if (!SecOrErr)
60
- return errorToErrorCode ( SecOrErr.takeError () );
60
+ return SecOrErr.takeError ();
61
61
62
62
int64_t Addend = 0 ;
63
63
// 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,
72
72
Addend = ERela->r_addend ;
73
73
Undef = ERela->getSymbol (false ) == 0 ;
74
74
} else if ((*SecOrErr)->sh_type != ELF::SHT_REL) {
75
- return object_error::parse_failed ;
75
+ return make_error<BinaryError>() ;
76
76
}
77
77
78
78
// 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,
86
86
if (Sym->getType () == ELF::STT_SECTION) {
87
87
Expected<section_iterator> SymSI = SI->getSection ();
88
88
if (!SymSI)
89
- return errorToErrorCode ( SymSI.takeError () );
89
+ return SymSI.takeError ();
90
90
const typename ELFT::Shdr *SymSec =
91
91
Obj->getSection ((*SymSI)->getRawDataRefImpl ());
92
92
auto SecName = EF.getSectionName (SymSec);
93
93
if (!SecName)
94
- return errorToErrorCode ( SecName.takeError () );
94
+ return SecName.takeError ();
95
95
Fmt << *SecName;
96
96
} else {
97
97
Expected<StringRef> SymName = SI->getName ();
98
98
if (!SymName)
99
- return errorToErrorCode ( SymName.takeError () );
99
+ return SymName.takeError ();
100
100
if (Demangle)
101
101
Fmt << demangle (*SymName);
102
102
else
@@ -110,13 +110,12 @@ static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
110
110
Fmt << (Addend < 0 ? " " : " +" ) << Addend;
111
111
Fmt.flush ();
112
112
Result.append (FmtBuf.begin (), FmtBuf.end ());
113
- return std::error_code ();
113
+ return Error::success ();
114
114
}
115
115
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) {
120
119
if (auto *ELF32LE = dyn_cast<ELF32LEObjectFile>(Obj))
121
120
return getRelocationValueString (ELF32LE, Rel, Result);
122
121
if (auto *ELF64LE = dyn_cast<ELF64LEObjectFile>(Obj))
0 commit comments