[PATCH] ARM: Add support for SHF_ARM_NOREAD section flag

mickael guene mickael.guene@st.com
Wed Dec 16 15:50:00 GMT 2015


Hi all,

   This is a proposal for a patch that implements the new arm section
flag SHF_ARM_NOREAD. Below is an excerpt of the section extracted
from 'Elf for the ARM architecture' draft version:

> 4.3.3 Section Attribute Flags
>  The defined processor-specific section attribute flags are listed in
> Table 4-5, Processor specific section attribute flags. All other
> processor-specific values are reserved to future revisions of this
> specification.
>
> Table 4-5, Processor specific section attribute flags
>
> Name            | Value            | Comment
> ------------------------------------------------------------------------
> SHF_ARM_NOREAD  | 0x20000000       | The content of this section should
>                 |                  | not be read by program executor
> ------------------------------------------------------------------------
>
>  If all the sections contained by a segment have the SHF_ARM_NOREAD
> section attribute set, the PF_R attribute should be unset in the program
> header for the segment.

This patch implements this feature in bfd.

  Unit tests have be written to check correct implementation.
  No regressions have been observed for arm-linux-gnueabi,
arm-linux-gnueabihf, arm-none-eabi, arm-none-nacl,
armeb-linux-gnueabihf, arm-netbsdelf and arm-vxworks targets
on 64-bit Linux host.

Changelogs:

include/ChangeLog:

2015-12-03 Mickael Guene <mickael.guene@st.com>

      * elf/arm.h: Add arm SHF_ARM_NOREAD section flag.

bfd/ChangeLog:

2015-12-03 Mickael Guene <mickael.guene@st.com>

      * bfd-in2.h: Regenerate.
      * section.c: Add SEC_ELF_NOREAD.
      * elf32-arm.c (elf32_arm_post_process_headers): Only set
      PF_X attribute if a segment only contains section with
      SHF_ARM_NOREAD flag.
      (elf32_arm_fake_sections): Add SEC_ELF_NOREAD conversion.
      (elf32_arm_section_flags): New function to convert SHF_ARM_NOREAD
      to bfd flag.
      (elf32_arm_lookup_section_flags): New function to allow
      INPUT_SECTION_FLAGS directive with SHF_ARM_NOREAD flag.
      (elf32_arm_special_sections): Add special sections array
      to catch section prefix by '.text.noread' pattern.

ld/testsuite/ChangeLog:

2015-12-03 Mickael Guene <mickael.guene@st.com>

      * ld-arm/arm-elf.exp: New tests.
      * ld-arm/thumb1-input-section-flag-match.d: New
      * ld-arm/thumb1-input-section-flag-match.s: New
      * ld-arm/thumb1-noread-not-present-mixing-two-section.d: New
      * ld-arm/thumb1-noread-not-present-mixing-two-section.s: New
      * ld-arm/thumb1-noread-present-one-section.d: New
      * ld-arm/thumb1-noread-present-one-section.s: New
      * ld-arm/thumb1-noread-present-two-section.d: New
      * ld-arm/thumb1-noread-present-two-section.s: New
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-support-for-SHF_ARM_NOREAD-section-flag.patch
Type: text/x-patch
Size: 12298 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20151216/728d2c7e/attachment.bin>


More information about the Binutils mailing list