bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/30844] ld riscv: --emit-relocs does not retain the original relo


From: nelsonc1225 at sourceware dot org
Subject: [Bug ld/30844] ld riscv: --emit-relocs does not retain the original relocation type
Date: Wed, 13 Sep 2023 17:34:43 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30844

--- Comment #4 from Nelson Chu <nelsonc1225 at sourceware dot org> ---
> The --emit-relocs should switch to preserve the original
> relocation type, including R_RISCV_CALL_PLT(etc),
> R_RISCV_RELAX, and R_RISCV_ALIGN.

Looks reasonable, so based on this rule when setting --emit-reloc,

1. R_RISCV_CALL_PLT

auipc, [R_RISCV_CALL_PLT][R_RISCV_RELAX]
jalr
(relax and emit to) ->
jal, [R_RISCV_CALL_PLT][R_RISCV_RELAX]

2. R_RISCV_ALIGN

.align 3, 6 nops under rvc, [R_RISCV_ALIGN] with addend 6
->
less then 6 nops (may be 0), [R_RISCV_ALIGN] with addend 6 or less?

3. R_RISCV_HI20/LO12

Even not all people like gp relaxation, we still need a rule in GNU ld for
--emit-reloc.

lui, [R_RISCV_HI20][R_RISCV_RELAX]
addi, [R_RISCV_LO12][R_RISCV_RELAX]
->
add with gp, [R_RISCV_HI20][R_RISCV_RELAX][R_RISCV_LO12][R_RISCV_RELAX], four
relocs point to same instruction?

4, R_RISCV_PCREL_HI20/PCREL_LO12

Likewise, all the four relocs point to the same pcrel_lo instruction.

5. R_RISCV_GOT_HI20/PCREL_LO12

Likewise.

6. ... future relaxations, TLS, ...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]