Skip to content

Commit 5a899bb

Browse files
jrtc27resistor
authored andcommitted
[BinaryFormat][RISCV] Reserve R_RISCV_CHERI_CAPABILITY_CODE
For non-c18n runtimes this is the same as R_RISCV_CHERI_CAPABILITY, 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 c76f623 commit 5a899bb

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

llvm/include/llvm/BinaryFormat/ELFRelocs/RISCV.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ ELF_RELOC(R_RISCV_VENDOR, 191)
6464
// ELF_RELOC(R_RISCV_CUSTOM192, 192)
6565
// ELF_RELOC(R_RISCV_CUSTOM193, 193)
6666
// ELF_RELOC(R_RISCV_CUSTOM194, 194)
67-
ELF_RELOC(R_RISCV_CUSTOM195, 195)
67+
// ELF_RELOC(R_RISCV_CUSTOM195, 195)
6868
// ELF_RELOC(R_RISCV_CUSTOM196, 196)
6969
// ELF_RELOC(R_RISCV_CUSTOM197, 197)
7070
// ELF_RELOC(R_RISCV_CUSTOM198, 198)
@@ -130,7 +130,7 @@ ELF_RELOC(R_RISCV_CUSTOM255, 255)
130130
ELF_RELOC(R_RISCV_CHERI_CAPTAB_PCREL_HI20, 192)
131131
ELF_RELOC(R_RISCV_CHERI_CAPABILITY, 193)
132132
ELF_RELOC(R_RISCV_FUNC_RELATIVE, 194)
133-
// 195 reserved
133+
ELF_RELOC(R_RISCV_CHERI_CAPABILITY_CODE, 195)
134134
ELF_RELOC(R_RISCV_CHERI_TPREL_CINCOFFSET, 196) // Deprecated
135135
ELF_RELOC(R_RISCV_CHERI_TLS_IE_CAPTAB_PCREL_HI20, 197) // Deprecated
136136
ELF_RELOC(R_RISCV_CHERI_TLS_GD_CAPTAB_PCREL_HI20, 198) // Deprecated

llvm/test/MC/RISCV/rv32-relaxation-xqci.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ start:
4040
# CHECK: qc.e.j {{0x[0-9a-f]+}} <EXT_JUMP_NEGATIVE>
4141
c.j undef
4242
# CHECK: qc.e.j {{0x[0-9a-f]+}} <start+{{0x[0-9a-f]+}}>
43-
# CHECK: R_RISCV_CUSTOM195 undef
43+
# CHECK: R_RISCV_CHERI_CAPABILITY_CODE undef
4444

4545
c.jal NEAR
4646
# CHECK: c.jal {{0x[0-9a-f]+}} <NEAR>
@@ -56,7 +56,7 @@ start:
5656
# CHECK: qc.e.jal {{0x[0-9a-f]+}} <EXT_JUMP_NEGATIVE>
5757
c.jal undef
5858
# CHECK: qc.e.jal {{0x[0-9a-f]+}} <start+{{0x[0-9a-f]+}}>
59-
# CHECK: R_RISCV_CUSTOM195 undef
59+
# CHECK: R_RISCV_CHERI_CAPABILITY_CODE undef
6060

6161
jal zero, NEAR
6262
# CHECK: c.j {{0x[0-9a-f]+}} <NEAR>
@@ -72,7 +72,7 @@ start:
7272
# CHECK: qc.e.j {{0x[0-9a-f]+}} <EXT_JUMP_NEGATIVE>
7373
jal zero, undef
7474
# CHECK: qc.e.j {{0x[0-9a-f]+}} <start+{{0x[0-9a-f]+}}>
75-
# CHECK: R_RISCV_CUSTOM195 undef
75+
# CHECK: R_RISCV_CHERI_CAPABILITY_CODE undef
7676

7777
jal ra, NEAR
7878
# CHECK: c.jal {{0x[0-9a-f]+}} <NEAR>
@@ -88,7 +88,7 @@ start:
8888
# CHECK: qc.e.jal {{0x[0-9a-f]+}} <EXT_JUMP_NEGATIVE>
8989
jal ra, undef
9090
# CHECK: qc.e.jal {{0x[0-9a-f]+}} <start+{{0x[0-9a-f]+}}>
91-
# CHECK: R_RISCV_CUSTOM195 undef
91+
# CHECK: R_RISCV_CHERI_CAPABILITY_CODE undef
9292

9393
qc.e.j NEAR
9494
# CHECK: c.j {{0x[0-9a-f]+}} <NEAR>
@@ -104,7 +104,7 @@ start:
104104
# CHECK: qc.e.j {{0x[0-9a-f]+}} <EXT_JUMP_NEGATIVE>
105105
qc.e.j undef
106106
# CHECK: qc.e.j {{0x[0-9a-f]+}} <start+{{0x[0-9a-f]+}}>
107-
# CHECK: R_RISCV_CUSTOM195 undef
107+
# CHECK: R_RISCV_CHERI_CAPABILITY_CODE undef
108108

109109
qc.e.jal NEAR
110110
# CHECK: c.jal {{0x[0-9a-f]+}} <NEAR>
@@ -120,7 +120,7 @@ start:
120120
# CHECK: qc.e.jal {{0x[0-9a-f]+}} <EXT_JUMP_NEGATIVE>
121121
qc.e.jal undef
122122
# CHECK: qc.e.jal {{0x[0-9a-f]+}} <start+{{0x[0-9a-f]+}}>
123-
# CHECK: R_RISCV_CUSTOM195 undef
123+
# CHECK: R_RISCV_CHERI_CAPABILITY_CODE undef
124124

125125

126126

llvm/test/MC/RISCV/xqcibi-linker-relaxation.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ branch_over_relaxable:
1515
jal x1, foo
1616
# CHECK: qc.e.jal 0x0 <branch_over_relaxable>
1717
# CHECK-NEXT: R_RISCV_VENDOR QUALCOMM
18-
# CHECK-NEXT: R_RISCV_CUSTOM195 foo
18+
# CHECK-NEXT: R_RISCV_CHERI_CAPABILITY_CODE foo
1919
# CHECK-NEXT: R_RISCV_RELAX *ABS*
2020
bne a0, a1, branch_over_relaxable
2121
# CHECK-NEXT: bne a0, a1, 0x6 <branch_over_relaxable+0x6>

llvm/test/MC/RISCV/xqcilb-relocations.s

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ this_section:
2121
# ASM: qc.e.j undef
2222
# OBJ: qc.e.j 0x0 <this_section>
2323
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
24-
# OBJ-NEXT: R_RISCV_CUSTOM195 undef{{$}}
24+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE undef{{$}}
2525
qc.e.j undef
2626

2727
# ASM: qc.e.jal undef
2828
# OBJ-NEXT: qc.e.jal 0x6 <this_section+0x6>
2929
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
30-
# OBJ-NEXT: R_RISCV_CUSTOM195 undef{{$}}
30+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE undef{{$}}
3131
qc.e.jal undef
3232

3333

@@ -42,26 +42,26 @@ qc.e.jal same_section
4242
# ASM: qc.e.j same_section_extern
4343
# OBJ-NEXT: qc.e.j 0x18 <this_section+0x18>
4444
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
45-
# OBJ-NEXT: R_RISCV_CUSTOM195 same_section_extern{{$}}
45+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE same_section_extern{{$}}
4646
qc.e.j same_section_extern
4747

4848
# ASM: qc.e.jal same_section_extern
4949
# OBJ-NEXT: qc.e.jal 0x1e <this_section+0x1e>
5050
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
51-
# OBJ-NEXT: R_RISCV_CUSTOM195 same_section_extern{{$}}
51+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE same_section_extern{{$}}
5252
qc.e.jal same_section_extern
5353

5454

5555
# ASM: qc.e.j other_section
5656
# OBJ-NEXT: qc.e.j 0x24 <this_section+0x24>
5757
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
58-
# OBJ-NEXT: R_RISCV_CUSTOM195 other_section{{$}}
58+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE other_section{{$}}
5959
qc.e.j other_section
6060

6161
# ASM: qc.e.jal other_section
6262
# OBJ-NEXT: qc.e.jal 0x2a <this_section+0x2a>
6363
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
64-
# OBJ-NEXT: R_RISCV_CUSTOM195 other_section{{$}}
64+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE other_section{{$}}
6565
qc.e.jal other_section
6666

6767

@@ -81,14 +81,14 @@ same_section_extern:
8181
# ASM: qc.e.j same_section
8282
# OBJ: qc.e.j 0x38 <same_section_extern+0x4>
8383
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
84-
# OBJ-NEXT: R_RISCV_CUSTOM195 same_section{{$}}
84+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE same_section{{$}}
8585
# OBJ-NEXT: R_RISCV_RELAX
8686
qc.e.j same_section
8787

8888
# ASM: qc.e.jal same_section
8989
# OBJ-NEXT: qc.e.jal 0x3e <same_section_extern+0xa>
9090
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
91-
# OBJ-NEXT: R_RISCV_CUSTOM195 same_section{{$}}
91+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE same_section{{$}}
9292
# OBJ-NEXT: R_RISCV_RELAX
9393
qc.e.jal same_section
9494

@@ -99,14 +99,14 @@ qc.e.j undef
9999
# ASM: j undef
100100
# OBJ: qc.e.j 0x44 <same_section_extern+0x10>
101101
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
102-
# OBJ-NEXT: R_RISCV_CUSTOM195 undef{{$}}
102+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE undef{{$}}
103103
# OBJ-NEXT: R_RISCV_RELAX
104104

105105
qc.e.jal undef
106106
# ASM: jal undef
107107
# OBJ: qc.e.jal 0x4a <same_section_extern+0x16>
108108
# OBJ-NEXT: R_RISCV_VENDOR QUALCOMM{{$}}
109-
# OBJ-NEXT: R_RISCV_CUSTOM195 undef{{$}}
109+
# OBJ-NEXT: R_RISCV_CHERI_CAPABILITY_CODE undef{{$}}
110110
# OBJ-NEXT: R_RISCV_RELAX
111111

112112
.section .text.other, "ax", @progbits

0 commit comments

Comments
 (0)