[all-commits] [llvm/llvm-project] ba2de8: [ELF] Allow absolute relocation referencing symbol...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Mar 28 20:44:30 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba2de8f22d0cac86d89c1806fb54ed3463349342
      https://github.com/llvm/llvm-project/commit/ba2de8f22d0cac86d89c1806fb54ed3463349342
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-03-28 (Fri, 28 Mar 2025)

  Changed paths:
    M lld/ELF/Relocations.cpp
    M lld/test/ELF/riscv-relax-hi20-lo12-pie.s
    M lld/test/ELF/weak-undef-rw.s

  Log Message:
  -----------
  [ELF] Allow absolute relocation referencing symbol index 0 in PIC mode

The value of an absolute relocation, like R_RISCV_HI20 or R_PPC64_LO16,
with a symbol index of 0, the resulting value should be treated as
absolute and permitted in both -pie and -shared links.

This change also resolves an absolute relocation referencing an
undefined symbol in statically-linked executables.

PPC64 has unfortunate exceptions:

* R_PPC64_TOCBASE uses symbol index 0 but it should be treated as
  referencing the linker-defined .TOC.
* R_PPC64_PCREL_OPT (https://reviews.llvm.org/D84360) could no longer
  rely on `isAbsoluteValue` return false.



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