[all-commits] [llvm/llvm-project] 854447: [lld][RISCV] Implement GP relaxation for R_RISCV_H...

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Apr 13 10:52:49 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 85444794cdde8211b916767cc51a37547dbd17e9
      https://github.com/llvm/llvm-project/commit/85444794cdde8211b916767cc51a37547dbd17e9
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-04-13 (Thu, 13 Apr 2023)

  Changed paths:
    M lld/ELF/Arch/RISCV.cpp
    M lld/ELF/Config.h
    M lld/ELF/Driver.cpp
    M lld/ELF/Options.td
    M lld/ELF/Symbols.cpp
    M lld/ELF/Symbols.h
    M lld/ELF/Writer.cpp
    M lld/docs/ld.lld.1
    A lld/test/ELF/riscv-relax-hi20-lo12-pie.s
    A lld/test/ELF/riscv-relax-hi20-lo12.s

  Log Message:
  -----------
  [lld][RISCV] Implement GP relaxation for R_RISCV_HI20/R_RISCV_LO12_I/R_RISCV_LO12_S.

This implements support for relaxing these relocations to use the GP
register to compute addresses of globals in the .sdata and .sbss
sections.

This feature is off by default and must be enabled by passing
--relax-gp to the linker.

The GP register might not always be the "global pointer". It can
be used for other purposes. See discussion here
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/371

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D143673




More information about the All-commits mailing list