Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions llvm/include/llvm/BinaryFormat/ELFRelocs/RISCV.def
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,68 @@ ELF_RELOC(R_RISCV_TLSDESC_HI20, 62)
ELF_RELOC(R_RISCV_TLSDESC_LOAD_LO12, 63)
ELF_RELOC(R_RISCV_TLSDESC_ADD_LO12, 64)
ELF_RELOC(R_RISCV_TLSDESC_CALL, 65)
ELF_RELOC(R_RISCV_VENDOR, 191)
ELF_RELOC(R_RISCV_CUSTOM192, 192)
ELF_RELOC(R_RISCV_CUSTOM193, 193)
ELF_RELOC(R_RISCV_CUSTOM194, 194)
ELF_RELOC(R_RISCV_CUSTOM195, 195)
ELF_RELOC(R_RISCV_CUSTOM196, 196)
ELF_RELOC(R_RISCV_CUSTOM197, 197)
ELF_RELOC(R_RISCV_CUSTOM198, 198)
ELF_RELOC(R_RISCV_CUSTOM199, 199)
ELF_RELOC(R_RISCV_CUSTOM200, 200)
ELF_RELOC(R_RISCV_CUSTOM201, 201)
ELF_RELOC(R_RISCV_CUSTOM202, 202)
ELF_RELOC(R_RISCV_CUSTOM203, 203)
ELF_RELOC(R_RISCV_CUSTOM204, 204)
ELF_RELOC(R_RISCV_CUSTOM205, 205)
ELF_RELOC(R_RISCV_CUSTOM206, 206)
ELF_RELOC(R_RISCV_CUSTOM207, 207)
ELF_RELOC(R_RISCV_CUSTOM208, 208)
ELF_RELOC(R_RISCV_CUSTOM209, 209)
ELF_RELOC(R_RISCV_CUSTOM210, 210)
ELF_RELOC(R_RISCV_CUSTOM211, 211)
ELF_RELOC(R_RISCV_CUSTOM212, 212)
ELF_RELOC(R_RISCV_CUSTOM213, 213)
ELF_RELOC(R_RISCV_CUSTOM214, 214)
ELF_RELOC(R_RISCV_CUSTOM215, 215)
ELF_RELOC(R_RISCV_CUSTOM216, 216)
ELF_RELOC(R_RISCV_CUSTOM217, 217)
ELF_RELOC(R_RISCV_CUSTOM218, 218)
ELF_RELOC(R_RISCV_CUSTOM219, 219)
ELF_RELOC(R_RISCV_CUSTOM220, 220)
ELF_RELOC(R_RISCV_CUSTOM221, 221)
ELF_RELOC(R_RISCV_CUSTOM222, 222)
ELF_RELOC(R_RISCV_CUSTOM223, 223)
ELF_RELOC(R_RISCV_CUSTOM224, 224)
ELF_RELOC(R_RISCV_CUSTOM225, 225)
ELF_RELOC(R_RISCV_CUSTOM226, 226)
ELF_RELOC(R_RISCV_CUSTOM227, 227)
ELF_RELOC(R_RISCV_CUSTOM228, 228)
ELF_RELOC(R_RISCV_CUSTOM229, 229)
ELF_RELOC(R_RISCV_CUSTOM230, 230)
ELF_RELOC(R_RISCV_CUSTOM231, 231)
ELF_RELOC(R_RISCV_CUSTOM232, 232)
ELF_RELOC(R_RISCV_CUSTOM233, 233)
ELF_RELOC(R_RISCV_CUSTOM234, 234)
ELF_RELOC(R_RISCV_CUSTOM235, 235)
ELF_RELOC(R_RISCV_CUSTOM236, 236)
ELF_RELOC(R_RISCV_CUSTOM237, 237)
ELF_RELOC(R_RISCV_CUSTOM238, 238)
ELF_RELOC(R_RISCV_CUSTOM239, 239)
ELF_RELOC(R_RISCV_CUSTOM240, 240)
ELF_RELOC(R_RISCV_CUSTOM241, 241)
ELF_RELOC(R_RISCV_CUSTOM242, 242)
ELF_RELOC(R_RISCV_CUSTOM243, 243)
ELF_RELOC(R_RISCV_CUSTOM244, 244)
ELF_RELOC(R_RISCV_CUSTOM245, 245)
ELF_RELOC(R_RISCV_CUSTOM246, 246)
ELF_RELOC(R_RISCV_CUSTOM247, 247)
ELF_RELOC(R_RISCV_CUSTOM248, 248)
ELF_RELOC(R_RISCV_CUSTOM249, 249)
ELF_RELOC(R_RISCV_CUSTOM250, 250)
ELF_RELOC(R_RISCV_CUSTOM251, 251)
ELF_RELOC(R_RISCV_CUSTOM252, 252)
ELF_RELOC(R_RISCV_CUSTOM253, 253)
ELF_RELOC(R_RISCV_CUSTOM254, 254)
ELF_RELOC(R_RISCV_CUSTOM255, 255)
35 changes: 35 additions & 0 deletions llvm/test/MC/RISCV/custom_reloc.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# RUN: llvm-mc -triple riscv32 %s \
# RUN: | FileCheck -check-prefix=CHECK-ASM %s
# RUN: llvm-mc -triple riscv64 %s \
# RUN: | FileCheck -check-prefix=CHECK-ASM %s

# RUN: llvm-mc -filetype=obj -triple riscv32 %s \
# RUN: | llvm-objdump -dr -M no-aliases - \
# RUN: | FileCheck -check-prefix=CHECK-OBJ %s
# RUN: llvm-mc -filetype=obj -triple riscv64 %s \
# RUN: | llvm-objdump -dr -M no-aliases - \
# RUN: | FileCheck -check-prefix=CHECK-OBJ %s

# CHECK-ASM: .text
# CHECK-OBJ: <.text>:

nop
# CHECK-ASM: nop
# CHECK-OBJ: addi zero, zero, 0x0

.reloc ., R_RISCV_VENDOR, VENDOR_NAME
.reloc ., R_RISCV_CUSTOM192, my_foo + 1
addi a0, a0, 0
# CHECK-ASM: [[L1:.L[^:]+]]:
# CHECK-ASM-NEXT: .reloc [[L1]], R_RISCV_VENDOR, VENDOR_NAME
# CHECK-ASM-NEXT: [[L2:.L[^:]+]]:
# CHECK-ASM-NEXT: .reloc [[L2]], R_RISCV_CUSTOM192, my_foo+1
# CHECK-ASM-NEXT: mv a0, a0

# CHECK-OBJ: addi a0, a0, 0
# CHECK-OBJ-NEXT: R_RISCV_VENDOR VENDOR_NAME
# CHECK-OBJ-NEXT: R_RISCV_CUSTOM192 my_foo+0x1

nop
# CHECK-ASM: nop
# CHECK-OBJ: addi zero, zero, 0x0
Loading