[all-commits] [llvm/llvm-project] 2f5fe1: [RISCV][MC] Adjust conditions to emit R_RISCV_ADD*...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Tue Mar 14 15:17:51 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2f5fe16e6d29c55ebd9ec098b03d4de47a804a18
https://github.com/llvm/llvm-project/commit/2f5fe16e6d29c55ebd9ec098b03d4de47a804a18
Author: Fangrui Song <i at maskray.me>
Date: 2023-03-14 (Tue, 14 Mar 2023)
Changed paths:
M llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
M llvm/test/MC/RISCV/riscv64-64b-pcrel.s
Log Message:
-----------
[RISCV][MC] Adjust conditions to emit R_RISCV_ADD*/R_RISCV_SUB* pairs
D132262 tried to simplify `IsMetadataOrEHFrameSection` originally introduced in
D127549 but caused a regression as `.quad` directives in
```
.section .note,"a", at note; note:
.quad extern-note # extern is undefined
.section .rodata,"a", at progbits; rodata:
.quad extern-rodata # extern is undefined
.section .nonalloc,"", at progbits; nw:
.quad extern-nw
```
are incorrectly rejected: these differences may be link-time constants and
are allowed in GNU assembler and LLVM MC's non-RISC-V ports.
Relax the conditions to allow these cases. For A-B, A may be defined later, but
this requiresFixups call has to eagerly make a decision. For now, emit ADD/SUB
unless A is `.L*`. This euristic handles many temporary label differences for
.debug_* and .apple_types sections. Ideally we should delay the decision of
PC-relative vs ADD/SUB until A is defined.
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D145474
More information about the All-commits
mailing list