Skip to content

Commit b6560ef

Browse files
jrtc27resistor
authored andcommitted
[RISCV] Use common code for R_RISCV_CHERI_CAPABILITY in getRelocType
Currently it's a one-liner but more code will be added here, so avoid needing to duplicate it.
1 parent 4dc095a commit b6560ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,16 @@ unsigned RISCVELFObjectWriter::getRelocType(const MCFixup &Fixup,
156156
"8-byte capability relocations not supported on RV64");
157157
return ELF::R_RISCV_NONE;
158158
}
159-
return ELF::R_RISCV_CHERI_CAPABILITY;
159+
goto CheriCapability;
160160
case FK_Cap_16:
161161
if (!is64Bit()) {
162162
getContext().reportError(
163163
Fixup.getLoc(),
164164
"16-byte capability relocations not supported on RV32");
165165
return ELF::R_RISCV_NONE;
166166
}
167+
goto CheriCapability;
168+
CheriCapability:
167169
return ELF::R_RISCV_CHERI_CAPABILITY;
168170
case RISCV::fixup_riscv_cheriot_compartment_hi:
169171
return ELF::R_RISCV_CHERIOT_COMPARTMENT_HI;

0 commit comments

Comments
 (0)