Skip to content

Commit 4e91e6e

Browse files
committed
[ELF][RISCV] Stop using CSub for capability subtraction
This code is currently dead since we emit an all-zeroes PLT header on CHERI-RISC-V, but will soon be used. Fixes: 05652b9 ("[CHERI-RISC-V] Remove CSub")
1 parent 2634fad commit 4e91e6e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lld/ELF/Arch/RISCV.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ enum Op {
6868
CIncOffsetImm = 0x105b,
6969
CLC_64 = 0x3003,
7070
CLC_128 = 0x200f,
71-
CSub = 0x2800005b,
7271
};
7372

7473
enum Reg {
@@ -259,7 +258,6 @@ void RISCV::writePltHeader(uint8_t *buf) const {
259258
// (c)jr (c)t3
260259
// (if shift == 0): nop
261260
uint32_t offset = in.gotPlt->getVA() - in.plt->getVA();
262-
uint32_t ptrsub = config->isCheriAbi ? CSub : SUB;
263261
uint32_t ptrload = config->isCheriAbi ? config->is64 ? CLC_128 : CLC_64
264262
: config->is64 ? LD : LW;
265263
uint32_t ptraddi = config->isCheriAbi ? CIncOffsetImm : ADDI;
@@ -268,7 +266,7 @@ void RISCV::writePltHeader(uint8_t *buf) const {
268266
uint32_t ptrsize = config->isCheriAbi ? config->capabilitySize
269267
: config->wordsize;
270268
write32le(buf + 0, utype(AUIPC, X_T2, hi20(offset)));
271-
write32le(buf + 4, rtype(ptrsub, X_T1, X_T1, X_T3));
269+
write32le(buf + 4, rtype(SUB, X_T1, X_T1, X_T3));
272270
write32le(buf + 8, itype(ptrload, X_T3, X_T2, lo12(offset)));
273271
write32le(buf + 12, itype(ADDI, X_T1, X_T1, -target->pltHeaderSize - 12));
274272
write32le(buf + 16, itype(ptraddi, X_T0, X_T2, lo12(offset)));

0 commit comments

Comments
 (0)