[PATCH] D30886: [ELF] Pad x86 executable sections with 0xcc int3 instructions

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 02:52:18 PDT 2017


jhenderson updated this revision to Diff 93608.
jhenderson edited the summary of this revision.
jhenderson added a comment.

I have rewritten the patch to now only write padding immediately before writing InputSection and BYTE()-style commands. This has required recording where to start writing padding when assigning offsets, which accounts for the majority of the changes.

I noticed in the process of this a couple of differences with the ld.bfd behaviour around FILL()/=fillexp commands. The first is that prior to this change, padding was being written before any data was written, which meant that padding sometimes with a value mid-way through the FILL value. This change fixes that (see, for example, the changes to test/ELF/linkerscript/section-padding.s). It may be possible to keep the old behaviour, if that is preferred, but it would make the patch slightly more complex. The second is that only one FILL() command in an output section is used (see the ELF/linkerscript/fill.s test), whereas ld.bfd uses the most recent seen fill for each separate block of padding in a section. I have not tried to fix this in this patch and will separately file a bug for this.

@ruiu, I expect that this will fix the performance issues you were seeing, but since I couldn't see them before, I have no way of checking. Would you mind re-running the testing you did before?


https://reviews.llvm.org/D30886

Files:
  ELF/InputSection.cpp
  ELF/InputSection.h
  ELF/LinkerScript.cpp
  ELF/LinkerScript.h
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/SyntheticSections.cpp
  ELF/Target.cpp
  ELF/Target.h
  test/ELF/default-fill.s
  test/ELF/linkerscript/excludefile.s
  test/ELF/linkerscript/fill-exec-sections.s
  test/ELF/linkerscript/sections-padding.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30886.93608.patch
Type: text/x-patch
Size: 19190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170331/ba7413c6/attachment.bin>


More information about the llvm-commits mailing list