https://sourceware.org/bugzilla/show_bug.cgi?id=27566
--- Comment #12 from lifang_xia at linux dot alibaba.com --- > 2024年10月25日 14:43,i at maskray dot me <sourceware-bugzi...@sourceware.org> 写道: > > https://sourceware.org/bugzilla/show_bug.cgi?id=27566 > > Fangrui Song <i at maskray dot me> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |i at maskray dot me > > --- Comment #11 from Fangrui Song <i at maskray dot me> --- > (In reply to lifang_xia from comment #9) >> Hi we get this error a again..... >> ------------- >> .text >> >> hello: >> .rept 6000 >> lla a0, ARCHOR0 >> .endr >> >> >> .section .rodata >> .set ARCHOR0, . + 4598 >> .fill 100, 4, 0x12345678 >> >> .data >> .align 3 >> world: >> .rept 860 >> .long 0x1000 >> .endr >> ------------- >> build command: >> >> binutils/build/gas/as-new -o 1.o 1.s -march=rv32gc -mabi=ilp32d >> binutils/build/ld/ld-new -o 1 1.o -e hello -m elf32lriscv >> >> we can get the error message: >> >> 1.o: in function `hello': >> (.text+0x0): relocation truncated to fit: R_RISCV_GPREL_I against `ARCHOR0' >> --------------------------------- >> It looks like the max alignment should include page size if the symbol is >> not defined in the same section of GP. >> >> Any idea about this? > > This error still reproduces with GNU ld 2.43. lld can handle it correctly. > > This is might be BFD riscv's linker relaxation with `.set ARCHOR0, . + 4598` Yes. the relaxation like “.set ARCHOR0, . + 4598” being relaxed at 2nd pass or 3rd pass would be fine. > > -- > You are receiving this mail because: > You reported the bug. -- You are receiving this mail because: You are on the CC list for the bug.