[all-commits] [llvm/llvm-project] 501c77: [LLD][ELF][ARM] Fix resolution of R_ARM_THM_JUMP8 ...

Victor Campos via All-commits all-commits at lists.llvm.org
Mon Feb 17 02:10:57 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 501c77da6024959438c92f33bd997fe6f39e6b6c
      https://github.com/llvm/llvm-project/commit/501c77da6024959438c92f33bd997fe6f39e6b6c
  Author: Victor Campos <victor.campos at arm.com>
  Date:   2025-02-17 (Mon, 17 Feb 2025)

  Changed paths:
    M lld/ELF/Arch/ARM.cpp
    A lld/test/ELF/arm-thumb-jump8-11.s

  Log Message:
  -----------
  [LLD][ELF][ARM] Fix resolution of R_ARM_THM_JUMP8 and R_ARM_THM_JUMP11 for big endian (#126933)

These relocations apply to 16-bit Thumb instructions, so reading 16 bits
rather than 32 bits ensures the correct bits are masked and written
back. This fixes the incorrect masking and aligns the relocation logic
with the instruction encoding.

Before this patch, 32 bits were read from the ELF object. This did not
align with the instruction size of 16 bits, but the masking incidentally
made it all work nonetheless. However, this was the case only in little
endian.

In big endian mode, the read 32-bit word had to have its bytes reversed.
With this byte reordering, the masking would be applied to the wrong
bits, hence causing the incorrect encoding to be produced as a result of
the relocation resolution.

The added test checks the result for both little and big endian modes.



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