This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, ARM] Support NOREAD section attribute across Bintuils for ARM target

Hi there,

In order to protect proprietary code from reverse-engineering, some ARM
baremetal boards have a special flash area where code is executable but not
readable. Normally this area is very small and can only accommodate certain
code sections (sections with NOREAD attribute in this case). The attached
patch implements a new letter 'y' to represent this new SHF_NOREAD section
attribute and enables user to define/allocate such code sections to
executable-only flash area in linker script. We talked to community with an
intention to make it to be a common and standard ELF section attribute, but
got rejected. So now it is implemented as a process-specific attribute for
ARM target.

This new attribute is a supplementary attribute to normal code section. It
won't break current way to handle code section. It will be safely ignored
for targets that don't have executable-only feature i.e. code section with
this new attribute will be treated as a normal code section.

Tested with all regression tests in Binutils, no new regressions. Is it OK
to trunk?


2014-04-18  Terry Guo  <>

     * elf/arm.h (SHF_NOREAD): New flag to represent NOREAD attribute.

2014-04-18  Terry Guo  <>

     * elf32-arm.c (elf32_arm_elf_lookup_section_flags): New function to
help linker
     recognize flag SHF_NOREAD.
     (elf_backend_lookup_section_flags_hook): Implement this hook for ARM

2014-04-18  Terry Guo  <>

     * config/obj-elf.c (obj_elf_change_section): Accept ARM executable-only
text section.
     * config/tc-arm.h (md_elf_section_letter): Implement this hook for ARM
     (arm_elf_section_letter): Declare it.
     * config/tc-arm.c (arm_elf_section_letter): Handle ARM section
attribute letter 'y'.
     * doc/c-arm.texi (ARM section attribute 'y'): Document it.

2014-04-18  Terry Guo  <>

     * gas/arm/section-execute-only.s: New test case.
     * gas/arm/section-execute-only.d: Expected output.

2014-04-18  Terry Guo  <>

     * readelf.c (get_elf_section_flags): Display ARM specific NOREAD
section attribute.

2014-04-18  Terry Guo  <>

     * ld-arm/section-execute-only.s: New test.
     * ld-arm/execute-only-section.ld: Linker script with executable-only
     * ld-arm/section-execute-only.d: Expected output for target with
executable-only memory.
     * ld-arm/no-execute-only-section.ld: Linker script without
executable-only memory.
     * ld-arm/no-section-execute-only.d: Expected output for target without
executable-only memory.
     * ld-arm/arm-elf.exp: Add tests for executable-only attribute.

Attachment: binutils-exo-v4.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]