[PATCH] D74791: Add a --shuffle-sections option to lld
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 14:53:13 PST 2020
MaskRay added a comment.
I think It'd be useful to add --shuffle-sections=seed, so that the result can be reproducible.
- `=0`: random seed
- `=seed`: specified seed
Making `--shuffle-sections=` work with `--symbol-ordering-file=` won't be too difficult. We can assign natural numbers to sections without a negative priority.
We actually already have some approaches to disturb the layout a bit:
- `-z noseparate-code` vs `-z separate-code` vs `-z separate-loadable-segments`: change addresses
- `INPUT [BEFORE|AFTER]`: change output section orders.
A way that disturbing the layout of input sections will also be useful.
================
Comment at: lld/ELF/Writer.cpp:1216
+ if (config->shuffleSections) {
+ std::vector<int> priorities(inputSections.size());
+ int cur_prio = -1;
----------------
Indent by 2.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74791/new/
https://reviews.llvm.org/D74791
More information about the llvm-commits
mailing list