[2/2 PATCH][ARM] Purecode compatible long branch veneer for M-profile targets with movw

Andre Vieira (lists) Andre.SimoesDiasVieira@arm.com
Thu Jun 30 14:28:00 GMT 2016


Hello,

This patch introduces a long branch veneer for M-profile targets with
the movw instruction that is compatible with the processor-specific ELF
section attribute SHF_ARM_PURECODE. This attribute restricts sections to
only contain code, and no data. For this reason a new type of veneer
must be used that does not rely on literal pools and instead, we use the
R_ARM_THM_MOVT_ABS and R_ARM_THM_MOVW_ABS_NC relocations to load the
address into a register. These relocation types are documented in the
ELF for the ARM Architecture found on http://infocenter.arm.com.

As mentioned earlier, we only support M-Profile targets with the mowv
instruction. For any other targets the linker will issue a warning for
every veneer that is to be created inside a section with the
SHF_ARM_PURECODE. We could add an option to turn this warning into an
error if that proves to be useful. Other perhaps useful functionality
that could be added later is to not use purecode veneers in sections
with the SHF_ARM_PURECODE if these sections were deliberately put into
segments with other impure sections, thus stripping such a section of
its SHF_ARM_PURECODE attribute.

Is this OK?

Best Regards,
Andre

bfd/ChangeLog
2016-06-30  Andre Vieria  <andre.simoesdiasvieira@arm.com>

        * elf32-arm.c (THUMB32_MOVT): New veneer macro.
          (THUMB32_MOVW): Likewise.
          (elf32_arm_stub_long_branch_thumb2_only_pure): New.
          (DEF_STUBS): Define long_branch_thumb2_only_pure.
          (arm_stub_is_thumb): Add new veneer stub.
          (arm_type_of_stub): Use new veneer.
          (arm_stub_required_alignment): Add new veneer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: purecode-2.patch
Type: text/x-patch
Size: 8056 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20160630/ecfb5655/attachment.bin>


More information about the Binutils mailing list