Skip to content

Commit eb9f4eb

Browse files
aaupovmaksfb
authored andcommitted
[BOLT][NFC] Better diagnostics for unsupported relocation types
Summary: Print the relocation name instead of just the number. (cherry picked from FBD32704832)
1 parent 76cd07f commit eb9f4eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bolt/lib/Core/Relocation.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "bolt/Core/Relocation.h"
1212
#include "llvm/MC/MCContext.h"
1313
#include "llvm/MC/MCStreamer.h"
14+
#include "llvm/Object/ELF.h"
1415

1516
using namespace llvm;
1617
using namespace bolt;
@@ -87,6 +88,7 @@ bool isSupportedAArch64(uint64_t Type) {
8788
size_t getSizeForTypeX86(uint64_t Type) {
8889
switch (Type) {
8990
default:
91+
errs() << object::getELFRelocationTypeName(ELF::EM_X86_64, Type) << '\n';
9092
llvm_unreachable("unsupported relocation type");
9193
case ELF::R_X86_64_8:
9294
case ELF::R_X86_64_PC8:
@@ -112,7 +114,7 @@ size_t getSizeForTypeX86(uint64_t Type) {
112114
size_t getSizeForTypeAArch64(uint64_t Type) {
113115
switch (Type) {
114116
default:
115-
dbgs() << "Reloc num: " << Type << "\n";
117+
errs() << object::getELFRelocationTypeName(ELF::EM_AARCH64, Type) << '\n';
116118
llvm_unreachable("unsupported relocation type");
117119
case ELF::R_AARCH64_ABS16:
118120
return 2;
@@ -231,6 +233,7 @@ uint64_t extractValueX86(uint64_t Type, uint64_t Contents, uint64_t PC) {
231233
uint64_t extractValueAArch64(uint64_t Type, uint64_t Contents, uint64_t PC) {
232234
switch (Type) {
233235
default:
236+
errs() << object::getELFRelocationTypeName(ELF::EM_AARCH64, Type) << '\n';
234237
llvm_unreachable("unsupported relocation type");
235238
case ELF::R_AARCH64_ABS16:
236239
case ELF::R_AARCH64_ABS32:

0 commit comments

Comments
 (0)