Skip to content

Commit ae309b6

Browse files
jrtc27resistor
authored andcommitted
[llvm-objdump][llvm-readobj] Decode code caprelocs permissions
For non-c18n runtimes this is the same as a plain function capreloc, but for c18n runtimes this marks capabilities that must not be wrapped in a trampoline as they must point directly to the code in question.
1 parent 5d4bc78 commit ae309b6

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
@@ -2715,6 +2715,7 @@ printELFCapRelocations(const ELFObjectFile<ELFT> *Obj) {
27152715
const uint64_t Function = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 1);
27162716
const uint64_t Constant = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 2);
27172717
const uint64_t Indirect = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 3);
2718+
const uint64_t Code = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 4);
27182719
StringRef PermStr;
27192720
switch (Perms) {
27202721
case 0:
@@ -2729,6 +2730,9 @@ printELFCapRelocations(const ELFObjectFile<ELFT> *Obj) {
27292730
case Function | Indirect:
27302731
PermStr = " (GNU Indirect Function)";
27312732
break;
2733+
case Function | Code:
2734+
PermStr = " (Code)";
2735+
break;
27322736
default:
27332737
PermStr = " (Unknown)";
27342738
break;

llvm/tools/llvm-readobj/ELFDumper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,6 +3529,7 @@ template <class ELFT> void ELFDumper<ELFT>::printCheriCapRelocs() {
35293529
const uint64_t Function = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 1);
35303530
const uint64_t Constant = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 2);
35313531
const uint64_t Indirect = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 3);
3532+
const uint64_t Code = UINT64_C(1) << ((sizeof(TargetUint) * 8) - 4);
35323533
StringRef PermStr;
35333534
switch (Perms) {
35343535
case 0:
@@ -3543,6 +3544,9 @@ template <class ELFT> void ELFDumper<ELFT>::printCheriCapRelocs() {
35433544
case Function | Indirect:
35443545
PermStr = "GNU Indirect Function";
35453546
break;
3547+
case Function | Code:
3548+
PermStr = "Code";
3549+
break;
35463550
default:
35473551
PermStr = "Unknown";
35483552
break;

0 commit comments

Comments
 (0)