Arm: Fix performance issue with thumb-2 tailcalls
authorTamar Christina <tamar.christina@arm.com>
Tue, 20 Aug 2019 15:34:26 +0000 (16:34 +0100)
committerTamar Christina <tamar.christina@arm.com>
Tue, 20 Aug 2019 15:35:28 +0000 (16:35 +0100)
commitb4e87f2c1eee99dee805e3828514f8afa162f9ba
tree213986cc59e1260fff20c20126bd5e4ffd3d0835
parentd7a11d1383a2d0cdffc8c08e46b0cf5a66b3ce28
Arm: Fix performance issue with thumb-2 tailcalls

We currently use a padding NOP after a Thumb to Arm interworking veneer (BX pc).
The NOP is never executed but may result in a performance penalty on some cores.

For this reason this patch changes the NOPs after Thumb to Arm veneers into B .-2
and adds a note to this in the source code for future reference.

bfd/ChangeLog:

* elf32-arm.c (elf32_thumb2_plt_entry, elf32_arm_plt_thumb_stub,
elf32_arm_stub_long_branch_v4t_thumb_thumb,
elf32_arm_stub_long_branch_v4t_thumb_arm,
elf32_arm_stub_short_branch_v4t_thumb_arm,
elf32_arm_stub_long_branch_v4t_thumb_arm_pic,
elf32_arm_stub_long_branch_v4t_thumb_thumb_pic,
elf32_arm_stub_long_branch_v4t_thumb_tls_pic): Change nop to branch to
previous instruction.

ld/ChangeLog:

* testsuite/ld-arm/cortex-a8-fix-b-plt.d: Update Testcase.
* testsuite/ld-arm/cortex-a8-fix-b-rel-arm.d: Likewise.
* testsuite/ld-arm/cortex-a8-fix-bcc-plt.d: Likewise.
* testsuite/ld-arm/farcall-cond-thumb-arm.d: Likewise.
* testsuite/ld-arm/farcall-mixed-app.d: Likewise.
* testsuite/ld-arm/farcall-mixed-app2.d: Likewise.
* testsuite/ld-arm/farcall-mixed-lib-v4t.d: Likewise.
* testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d: Likewise.
* testsuite/ld-arm/farcall-thumb-arm-short.d: Likewise.
* testsuite/ld-arm/farcall-thumb-arm.d: Likewise.
* testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d: Likewise.
* testsuite/ld-arm/farcall-thumb-thumb.d: Likewise.
* testsuite/ld-arm/fix-arm1176-on.d: Likewise.
* testsuite/ld-arm/ifunc-10.dd: Likewise.
* testsuite/ld-arm/ifunc-2.dd: Likewise.
* testsuite/ld-arm/ifunc-4.dd: Likewise.
* testsuite/ld-arm/ifunc-6.dd: Likewise.
* testsuite/ld-arm/ifunc-8.dd: Likewise.
* testsuite/ld-arm/jump-reloc-veneers-long.d: Likewise.
* testsuite/ld-arm/mixed-app.d: Likewise.
* testsuite/ld-arm/thumb2-b-interwork.d: Likewise.
* testsuite/ld-arm/tls-longplt.d: Likewise.
* testsuite/ld-arm/tls-thumb1.d: Likewise.
26 files changed:
bfd/ChangeLog
bfd/elf32-arm.c
ld/ChangeLog
ld/testsuite/ld-arm/cortex-a8-fix-b-plt.d
ld/testsuite/ld-arm/cortex-a8-fix-b-rel-arm.d
ld/testsuite/ld-arm/cortex-a8-fix-bcc-plt.d
ld/testsuite/ld-arm/farcall-cond-thumb-arm.d
ld/testsuite/ld-arm/farcall-mixed-app.d
ld/testsuite/ld-arm/farcall-mixed-app2.d
ld/testsuite/ld-arm/farcall-mixed-lib-v4t.d
ld/testsuite/ld-arm/farcall-thumb-arm-pic-veneer.d
ld/testsuite/ld-arm/farcall-thumb-arm-short.d
ld/testsuite/ld-arm/farcall-thumb-arm.d
ld/testsuite/ld-arm/farcall-thumb-thumb-pic-veneer.d
ld/testsuite/ld-arm/farcall-thumb-thumb.d
ld/testsuite/ld-arm/fix-arm1176-on.d
ld/testsuite/ld-arm/ifunc-10.dd
ld/testsuite/ld-arm/ifunc-2.dd
ld/testsuite/ld-arm/ifunc-4.dd
ld/testsuite/ld-arm/ifunc-6.dd
ld/testsuite/ld-arm/ifunc-8.dd
ld/testsuite/ld-arm/jump-reloc-veneers-long.d
ld/testsuite/ld-arm/mixed-app.d
ld/testsuite/ld-arm/thumb2-b-interwork.d
ld/testsuite/ld-arm/tls-longplt.d
ld/testsuite/ld-arm/tls-thumb1.d