[all-commits] [llvm/llvm-project] 02eab5: [ELF][AArch64] Fix unneeded thunk for branches to ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Apr 14 11:32:42 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 02eab52866775f1476028129d1b114235fddc127
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-04-14 (Thu, 14 Apr 2022)

  Changed paths:
    M lld/ELF/Arch/AArch64.cpp
    M lld/ELF/InputSection.cpp
    M lld/test/ELF/aarch64-undefined-weak.s

  Log Message:
  [ELF][AArch64] Fix unneeded thunk for branches to hidden undefined weak

Similar to D119787 for PPC64.

A hidden undefined weak may change its binding to local before some
`isUndefinedWeak` code, so some `isUndefinedWeak` code needs to be changed to
`isUndefined`. The undefined non-weak case has been errored, so just using
`isUndefined` is fine.

The Linux kernel recently has a usage that a branch from 0xffff800008491ee0
references a hidden undefined weak symbol `vfio_group_set_kvm`.
It relies on the behavior that a branch to undefined weak resolving to the next
instruction, otherwise it'd see spurious relocation out of range errors.

Fixes https://github.com/ClangBuiltLinux/linux/issues/1624

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

More information about the All-commits mailing list