[PATCH] D66426: [lld] Enable a watermark of loadable sections to be generated and placed in a note section

Chris Jackson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 09:56:25 PDT 2019


chrisjackson created this revision.
Herald added subscribers: llvm-commits, MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Add a '--watermark' flag to lld that enables an xxhash of loadable sections to be placed in a note section, 'note.llvm.watermark'. This enables the loader to determine if any loadable sections have been modified since the ELF was linked and also to determine if lld was used to link the ELF.

We have selected xxhash to minimise the overhead of calculating the watermark. The functionality already provided for the GNU build Id has been reused where possible.

By ensuring loadable sections have not changed since link-time, we can have confidence that they are compliant with the system ABI. This helps to ensure that changes to system software will not unexpectedly cause the ELF to execute incorrectly. If additional tooling is being used to modify the ELF this would indicate functionality that is lacking in our toolchain and is desired by users.


https://reviews.llvm.org/D66426

Files:
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/InputFiles.cpp
  lld/ELF/Options.td
  lld/ELF/SyntheticSections.cpp
  lld/ELF/SyntheticSections.h
  lld/ELF/Writer.cpp
  lld/test/ELF/watermark.s
  llvm/include/llvm/BinaryFormat/ELF.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66426.215924.patch
Type: text/x-patch
Size: 12031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190819/3c656cfc/attachment.bin>


More information about the llvm-commits mailing list