mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-15 04:00:56 +00:00
[BOLT][NFC] Better diagnostics for unsupported relocation types
Summary: Print the relocation name instead of just the number. (cherry picked from FBD32704832)
This commit is contained in:
parent
76cd07f9e4
commit
eb9f4eb6ab
@ -11,6 +11,7 @@
|
||||
#include "bolt/Core/Relocation.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/Object/ELF.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace bolt;
|
||||
@ -87,6 +88,7 @@ bool isSupportedAArch64(uint64_t Type) {
|
||||
size_t getSizeForTypeX86(uint64_t Type) {
|
||||
switch (Type) {
|
||||
default:
|
||||
errs() << object::getELFRelocationTypeName(ELF::EM_X86_64, Type) << '\n';
|
||||
llvm_unreachable("unsupported relocation type");
|
||||
case ELF::R_X86_64_8:
|
||||
case ELF::R_X86_64_PC8:
|
||||
@ -112,7 +114,7 @@ size_t getSizeForTypeX86(uint64_t Type) {
|
||||
size_t getSizeForTypeAArch64(uint64_t Type) {
|
||||
switch (Type) {
|
||||
default:
|
||||
dbgs() << "Reloc num: " << Type << "\n";
|
||||
errs() << object::getELFRelocationTypeName(ELF::EM_AARCH64, Type) << '\n';
|
||||
llvm_unreachable("unsupported relocation type");
|
||||
case ELF::R_AARCH64_ABS16:
|
||||
return 2;
|
||||
@ -231,6 +233,7 @@ uint64_t extractValueX86(uint64_t Type, uint64_t Contents, uint64_t PC) {
|
||||
uint64_t extractValueAArch64(uint64_t Type, uint64_t Contents, uint64_t PC) {
|
||||
switch (Type) {
|
||||
default:
|
||||
errs() << object::getELFRelocationTypeName(ELF::EM_AARCH64, Type) << '\n';
|
||||
llvm_unreachable("unsupported relocation type");
|
||||
case ELF::R_AARCH64_ABS16:
|
||||
case ELF::R_AARCH64_ABS32:
|
||||
|
Loading…
Reference in New Issue
Block a user