Skip to content

Commit e9bf108

Browse files
committed
[llvm-objdump][llvm-readobj] Decode IRELATIVE-style caprelocs permissions
1 parent 5420041 commit e9bf108

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
@@ -2151,6 +2151,7 @@ printELFCapRelocations(const ELFObjectFile<ELFT> *Obj) {
21512151
entry + 4*sizeof(TargetUint));
21522152
const uint64_t Function = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 1);
21532153
const uint64_t Constant = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 2);
2154+
const uint64_t Indirect = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 3);
21542155
StringRef PermStr;
21552156
switch (Perms) {
21562157
case 0:
@@ -2162,6 +2163,9 @@ printELFCapRelocations(const ELFObjectFile<ELFT> *Obj) {
21622163
case Function:
21632164
PermStr = " (Function)";
21642165
break;
2166+
case Function | Indirect:
2167+
PermStr = " (GNU Indirect Function)";
2168+
break;
21652169
default:
21662170
PermStr = " (Unknown)";
21672171
break;

llvm/tools/llvm-readobj/ELFDumper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3441,6 +3441,7 @@ template <class ELFT> void ELFDumper<ELFT>::printCheriCapRelocs() {
34413441
entry + 4*sizeof(TargetUint));
34423442
const uint64_t Function = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 1);
34433443
const uint64_t Constant = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 2);
3444+
const uint64_t Indirect = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 3);
34443445
StringRef PermStr;
34453446
switch (Perms) {
34463447
case 0:
@@ -3452,6 +3453,9 @@ template <class ELFT> void ELFDumper<ELFT>::printCheriCapRelocs() {
34523453
case Function:
34533454
PermStr = "Function";
34543455
break;
3456+
case Function | Indirect:
3457+
PermStr = "GNU Indirect Function";
3458+
break;
34553459
default:
34563460
PermStr = "Unknown";
34573461
break;

0 commit comments

Comments
 (0)