[all-commits] [llvm/llvm-project] 631769: [LLD][RISCV] Add relaxation for absolute int12 Hi2...

Philip Reames via All-commits all-commits at lists.llvm.org
Thu Mar 20 18:57:18 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 631769f2a05a082eafa03b7f99502381da704d7d
      https://github.com/llvm/llvm-project/commit/631769f2a05a082eafa03b7f99502381da704d7d
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2025-03-20 (Thu, 20 Mar 2025)

  Changed paths:
    M lld/ELF/Arch/RISCV.cpp
    M lld/test/ELF/riscv-relax-hi20-lo12.s

  Log Message:
  -----------
  [LLD][RISCV] Add relaxation for absolute int12 Hi20Lo12 (#86124)

If we have an absolute address whose high bits are known to be a sign
extend of the low 12 bits, we can avoid emitting the LUI entirely. This
is implemented in an analogous manner to the gp relative relocations -
defining an internal usage relocation type.

Since 12 bits (really 11 since the high bit must be zero in user code)
is less than one page, all of these offsets fit in the null page. As
such, the only application of these is likely to be undefined weak
symbols except for embedded use cases. I'm mostly posting this for
completeness sake.



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