Skip to content

Commit b813360

Browse files
jrtc27resistor
authored andcommitted
[llvm-objdump][llvm-readobj] Decode IRELATIVE-style caprelocs permissions
1 parent f5fa4be commit b813360

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

llvm/tools/llvm-objdump/llvm-objdump.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,6 +2714,7 @@ printELFCapRelocations(const ELFObjectFile<ELFT> *Obj) {
27142714
entry + 4*sizeof(TargetUint));
27152715
const uint64_t Function = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 1);
27162716
const uint64_t Constant = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 2);
2717+
const uint64_t Indirect = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 3);
27172718
StringRef PermStr;
27182719
switch (Perms) {
27192720
case 0:
@@ -2725,6 +2726,9 @@ printELFCapRelocations(const ELFObjectFile<ELFT> *Obj) {
27252726
case Function:
27262727
PermStr = " (Function)";
27272728
break;
2729+
case Function | Indirect:
2730+
PermStr = " (GNU Indirect Function)";
2731+
break;
27282732
default:
27292733
PermStr = " (Unknown)";
27302734
break;

llvm/tools/llvm-readobj/ELFDumper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3528,6 +3528,7 @@ template <class ELFT> void ELFDumper<ELFT>::printCheriCapRelocs() {
35283528
entry + 4*sizeof(TargetUint));
35293529
const uint64_t Function = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 1);
35303530
const uint64_t Constant = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 2);
3531+
const uint64_t Indirect = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 3);
35313532
StringRef PermStr;
35323533
switch (Perms) {
35333534
case 0:
@@ -3539,6 +3540,9 @@ template <class ELFT> void ELFDumper<ELFT>::printCheriCapRelocs() {
35393540
case Function:
35403541
PermStr = "Function";
35413542
break;
3543+
case Function | Indirect:
3544+
PermStr = "GNU Indirect Function";
3545+
break;
35423546
default:
35433547
PermStr = "Unknown";
35443548
break;

0 commit comments

Comments
 (0)