bfd: aarch64: Fix stubs that may break BTI PR30076
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 18 Jan 2023 12:56:46 +0000 (12:56 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 23 Mar 2023 12:49:32 +0000 (12:49 +0000)
commit15b4f66b0a9a3be6caf1898d22a13c39e662006f
tree8b5660b277c55c9af5d9f91f2e7ae7389f344d37
parent557a2f28224738382d55c7c1a8aa00587d424b13
bfd: aarch64: Fix stubs that may break BTI PR30076

Insert two stubs in a BTI enabled binary when fixing long calls: The
first is near the call site and uses an indirect jump like before,
but it targets the second stub that is near the call target site and
uses a direct jump.

This is needed when a single stub breaks BTI compatibility.

The stub layout is kept fixed between sizing and building the stubs,
so the location of the second stub is known at build time, this may
introduce padding between stubs when those are relaxed.  Stub layout
with BTI disabled is unchanged.
bfd/elfnn-aarch64.c
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/bti-far-1.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/bti-far-2.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/bti-far.ld [new file with mode: 0644]
ld/testsuite/ld-aarch64/bti-far.s [new file with mode: 0644]