ARM: Fix BE8 encoding for Secure Gateway stubs
Corrects ARM BE8 encoding for CMSE stubs to match expected output.
This commit fixes an issue with ARM’s Big-Endian 8-bit (BE8) encoding for Secure Gateway (SG) stubs. The Secure Gateway veneers were not being correctly processed for BE8 encoding during the final link phase, leading to incorrect byte ordering in the generated code. The fix ensures these stubs are handled properly and includes a new testcase to verify the correct encoding.
In Details
The ARM BFD backend's elf32_arm_final_link function incorrectly handled Secure Gateway stub sections (.gnu.sgstubs) in BE8 mode. These sections were not included in the regular stub group processing, preventing BE8 encoding. This patch adds specific handling for cmse_stub_sec to ensure correct BE8 encoding, verified by a new test case checking the raw instruction bytes.
- BE8
- Big-Endian 8-bit mode, a specific endianness configuration for ARM processors where data is accessed in 8-bit chunks, with the most significant byte first.
- Secure Gateway (SG) stubs
- Code stubs used in ARM's TrustZone technology for secure function calls between secure and non-secure worlds.
- veneers
- Small pieces of code that act as intermediaries, often used for function calls, jumps, or to bridge different code segments or security states.