[PATCH] D48792: [ARM] Set execute-only flags in .text.

Ivan Lozano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 2 17:17:04 PDT 2018


ivanlozano updated this revision to Diff 158867.
ivanlozano edited the summary of this revision.
ivanlozano added a comment.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.

The updated patch adds support for the case peter.smith brought up by checking for an empty .text section that's paired with SHF_ARM_PURECODE sections.

There's another case which I'm not sure how to address. When compiling the default .text section, the section will not have SHF_ARM_PURECODE set even if -mexecute-only is provided. This can be illustrated in the simple case:

  .text
    bx lr

Passing this along to the compiler:

  ./clang -target armv6t2-eabi -mexecute-only t.s -c

results in a .text section that does not have the flag set:

  [ 2] .text             PROGBITS        00000000 000034 000004 00  AX  0   0  4

Maybe this is expected behavior, but explicitly setting the flags for a section named .text fails to set the flags as well

  .section .text, "axy" 
    bx lr

I think the section flags for .text are being set in ELFAsmParser::ParseSectionDirectiveText. It's not clear to me what the fix would look like though. (Maybe a change in ARMAsmParser? I'm unfamiliar with how the AsmParser works though).


https://reviews.llvm.org/D48792

Files:
  lib/MC/ELFObjectWriter.cpp
  lib/Target/ARM/ARMTargetObjectFile.cpp
  test/MC/ARM/elf-execute-only-section.ll
  test/MC/ELF/ARM/execute-only-populated-text-section.s
  test/MC/ELF/ARM/execute-only-section.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48792.158867.patch
Type: text/x-patch
Size: 5098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180803/8ef20f76/attachment.bin>


More information about the llvm-commits mailing list