[llvm] MC: Refine ALIGN relocation conditions (PR #150816)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 28 09:54:08 PDT 2025
MaskRay wrote:
@SixWeining reminded me that we have a large problem when mixing -mrelax and -mno-relax object files in relocatable links (-r).
Since we don't generate ALIGN relocations for the -mno-relax relocatable files, their alignment can be lost.
Since we can use a linker script with relocatable links, we should either force ALIGN for all text sections regardless of -mrelax or make linker synthesize ALIGN relocations at input section starts.
```a.sh
cat > x0.s <<e
.globl _start
_start:
call foo
e
cat > x1.s <<e
.option push
.option norelax
.balign 8
l2:
.word 0x12345678
.option pop
.section .text1,"ax"
.globl foo
foo:
e
clang --target=riscv64 -mrelax -c x0.s x1.s
ld.lld -r x0.o x1.o -o x01.o
ld.lld x01.o -o x01
```
https://github.com/llvm/llvm-project/pull/150816
More information about the llvm-commits
mailing list