[all-commits] [llvm/llvm-project] db1a76: [LLD][RISCV] Error on PCREL_LO referencing other S...

Sam Elliott via All-commits all-commits at lists.llvm.org
Tue Oct 8 04:45:23 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: db1a76206902e6926464e30cc47249e217405dab
      https://github.com/llvm/llvm-project/commit/db1a76206902e6926464e30cc47249e217405dab
  Author: Sam Elliott <quic_aelliott at quicinc.com>
  Date:   2024-10-08 (Tue, 08 Oct 2024)

  Changed paths:
    M lld/ELF/InputSection.cpp
    A lld/test/ELF/riscv-pcrel-hilo-error-sections.s
    M lld/test/ELF/riscv-pcrel-hilo-error.s

  Log Message:
  -----------
  [LLD][RISCV] Error on PCREL_LO referencing other Section (#107558)

The RISC-V psABI states that "The `R_RISCV_PCREL_LO12_I` or
`R_RISCV_PCREL_LO12_S` relocations contain a label pointing to an
instruction in the same section with an `R_RISCV_PCREL_HI20` relocation
entry that points to the target symbol."

Without this patch, GNU ld errors, but LLD does not -- I think because LLD is
doing the right thing, certainly in the testcase provided.

Nonetheless, I think an error is good here to bring LLD in line with
what GNU ld is doing in showing that the object the user provided is not
following the psABI as written.

Fixes #107304



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list