-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[RISCV] Support Parsing Nonstandard Relocations #119909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| //===--- RISC-V Nonstandard Relocation List ---------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef ELF_RISCV_NONSTANDARD_RELOC | ||
| #error "ELF_RISCV_NONSTANDARD_RELOC must be defined" | ||
| #endif | ||
|
|
||
| /* | ||
| ELF_RISCV_NONSTANDARD_RELOC(VENDOR, NAME, ID) defines information about | ||
| nonstandard relocation codes. This can be used when parsing relocations, or | ||
| when printing them, to provide better information. | ||
| VENDOR should be the symbol name expected in the associated `R_RISCV_VENDOR` | ||
| relocation. NAME and ID work like `ELF_RELOC` but the mapping is not expected | ||
| to be 1:1. | ||
| The mapping in RISCV.def is 1:1, and should be used when the only information | ||
| available is the relocation enum value. | ||
| */ | ||
|
|
||
| /* Qualcomm Nonstandard Relocations */ | ||
|
||
| ELF_RISCV_NONSTANDARD_RELOC(QUALCOMM, R_RISCV_QC_ABS20_U, 192) | ||
| ELF_RISCV_NONSTANDARD_RELOC(QUALCOMM, R_RISCV_QC_E_BRANCH, 193) | ||
| ELF_RISCV_NONSTANDARD_RELOC(QUALCOMM, R_RISCV_QC_E_32, 194) | ||
| ELF_RISCV_NONSTANDARD_RELOC(QUALCOMM, R_RISCV_QC_E_JUMP_PLT, 195) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,3 +34,20 @@ | |
| nop | ||
| # CHECK-ASM: nop | ||
| # CHECK-OBJ: addi zero, zero, 0x0 | ||
|
|
||
| .reloc ., R_RISCV_VENDOR, QUALCOMM | ||
| .reloc ., R_RISCV_QC_ABS20_U, my_bar + 2 | ||
| addi a1, a1, 0 | ||
| # CHECK-ASM: [[L3:.L[^:]+]]: | ||
|
||
| # CHECK-ASM-NEXT: .reloc [[L3]], R_RISCV_VENDOR, QUALCOMM | ||
| # CHECK-ASM-NEXT: [[L4:.L[^:]+]]: | ||
| # CHECK-ASM-NEXT: .reloc [[L4]], R_RISCV_QC_ABS20_U, my_bar+2 | ||
| # CHECK-ASM-NEXT: mv a1, a1 | ||
|
|
||
| # CHECK-OBJ: addi a1, a1, 0 | ||
| # CHECK-OBJ-NEXT: R_RISCV_VENDOR QUALCOMM | ||
| # CHECK-OBJ-NEXT: R_RISCV_CUSTOM192 my_bar+0x2 | ||
|
|
||
| nop | ||
| # CHECK-ASM: nop | ||
| # CHECK-OBJ: addi zero, zero, 0x0 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer
//There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done