[all-commits] [llvm/llvm-project] a9962e: Statically linked AArch64 binaries crash at loadin...

Paschalis Mpeis via All-commits all-commits at lists.llvm.org
Mon Aug 19 06:49:28 PDT 2024


  Branch: refs/heads/users/paschalis-mpeis/bolt-static-binary-patchelf-fix
  Home:   https://github.com/llvm/llvm-project
  Commit: a9962ed5890f1ae0b374b4e8113cb0c6092cb9ec
      https://github.com/llvm/llvm-project/commit/a9962ed5890f1ae0b374b4e8113cb0c6092cb9ec
  Author: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    A bolt/test/AArch64/patch-elfstatic-libc.test
    A bolt/test/Inputs/main.c

  Log Message:
  -----------
  Statically linked AArch64 binaries crash at loading time.

Executing such a binary would result in:
> Unexpected reloc type in static binary.
> [1]    1234 abort (core dumped)


  Commit: fe4d176f261536c948bc8164be967944fc9f25fd
      https://github.com/llvm/llvm-project/commit/fe4d176f261536c948bc8164be967944fc9f25fd
  Author: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M bolt/lib/Rewrite/RewriteInstance.cpp
    M bolt/test/AArch64/patch-elfstatic-libc.test

  Log Message:
  -----------
  [WORKAROUND][BOLT][AArch64] Static binary patching for ELF.

When patching statically linked binaries, avoid patching GOT entries
that did not belong to the original text section and had an alias.

One such special case is the '_init' function that belongs to the '.init'
section. It has '.init' as an alias, which points to the same address of
'_init' in the original binary.

This was observed with GNU linker. BOLT normally rejects these cases.
See issue:
https://github.com/llvm/llvm-project/issues/100096


Compare: https://github.com/llvm/llvm-project/compare/ec7f76862b9f...fe4d176f2615

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