arm: Fix encoding of SG stubs in BE8 mode
The Secure Gateway veneers in section .gnu.sgstubs are not part of the
stub group (see dedicated_output_section handling in
elf32_arm_create_or_find_stub_sec).
As a result, elf32_arm_final_link does not perform BE8 encoding when
it processes the regular stub sections.
This patch adds the same handling for cmse_stub_sec, and a new
testcase which checks the raw encoding of the instructions in the
veneer.
For the instructions:
e97f e97f sg
f7ef bffe b.w <__acle_se_exported_entry_veneer3>
e97f e97f sg
f7ef bff8 b.w <__acle_se_exported_entry_veneer2>
We expect
7fe97fe9 eff7febf 7fe97fe9 eff7f8bf
but without the fix, we generate:
e97fe97f f7efbffe e97fe97f f7efbff8
(that is, bytes are swapped compared to the expected output)
Tested on:
arm-linux-gnueabihf
armv8l-linux-gnueabihf
armeb-linux-gnueabihf
arm-linux-gnueabi
arm-none-eabi
armeb-none-eabi
arm-netbsdelf
arm-pe
arm-wince-pe
arm-uclinuxfdpiceabi
arm-vxworks
3 files changed