[all-commits] [llvm/llvm-project] d606e2: [MC] Support constant offset for symbol PendingFixup
luxufan via All-commits
all-commits at lists.llvm.org
Tue Jan 25 21:51:02 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d606e23305015f14072ed59e8e71d6b27d010b48
https://github.com/llvm/llvm-project/commit/d606e23305015f14072ed59e8e71d6b27d010b48
Author: luxufan <932494295 at qq.com>
Date: 2022-01-26 (Wed, 26 Jan 2022)
Changed paths:
M llvm/lib/MC/MCObjectStreamer.cpp
M llvm/test/MC/RISCV/reloc-directive.s
Log Message:
-----------
[MC] Support constant offset for symbol PendingFixup
This patch add support relocation offset of sym+constant(like `foo+4`) form for pending fixup.
In the past, llvm-mc ignored the constant in sym+constant form, for `foo+4`, `4` would be ignored. And test case
```
.text
ret
nop
nop
.reloc foo+4, R_RISCV_32, 6
.data
.globl foo
foo:
.word 0
.word 0
.word 0
```
when run `llvm-mc -filetype=obj -triple=riscv64 %s | llvm-readobj -r`
The output is
```
Relocations [
Section (3) .rela.text {
0x0 R_RISCV_32 - 0x6
}
]
```
After applying this patch, the output is
```
Relocations [
Section (3) .rela.text {
0x4 R_RISCV_32 - 0x6
}
]
```
Differential Revision: https://reviews.llvm.org/D117316
More information about the All-commits
mailing list