[PATCH] D98679: [ELF] Change --shuffle-sections=<seed> to --shuffle-sections=<section-glob>=<seed>

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 20:53:49 PDT 2021


MaskRay created this revision.
MaskRay added reviewers: grimar, jhenderson, peter.smith.
Herald added subscribers: dang, arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

`--shuffle-sections=<seed>` applies on all sections.  The new
`--shuffle-sections=<section-glob>=<seed>` makes shuffling selective.  To the
best of my knowledge, the option is only used as debugging, so just drop the
original form.

`--shuffle-sections .init_array*=-1` `--shuffle-sections .fini_array*=-1`.
reverses static constructors/destructors of the same priority.
Useful to detect some static initialization order fiasco.

`--shuffle-sections .data*=-1`
reverses `.data*` sections. Useful to detect unfunded pointer comparison results
of two unrelated objects.

If certain sections have an intrinsic order, the old form cannot be used.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98679

Files:
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/Options.td
  lld/ELF/Writer.cpp
  lld/docs/ReleaseNotes.rst
  lld/docs/ld.lld.1
  lld/test/ELF/shuffle-sections-init-fini.s
  lld/test/ELF/shuffle-sections.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98679.330874.patch
Type: text/x-patch
Size: 10723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210316/f7f6d0df/attachment.bin>


More information about the llvm-commits mailing list