[PATCH] D74887: [ELF] Shuffle .init_array/.fini_array with --shuffle-sections=

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 13:55:39 PST 2020


MaskRay marked 2 inline comments as done.
MaskRay added inline comments.


================
Comment at: lld/ELF/Writer.cpp:1364
+  // by --symbol-ordering-file or --shuffle-sections=.
+  if (!order.empty())
+    for (BaseCommand *b : sec->sectionCommands)
----------------
respindola wrote:
> This will break code that uses init_priority, no?
> 
> I think we can only shuffle sections of equal priority.
> 
Priorities are respected. Sections with the same priority can be shuffled.

See the test below, `.init_array.1` is the first.

```
# CHECK:      Hex dump of section '.init_array'
# CHECK-NEXT: 0x{{[0-9a-f]+}} ff
# ORDERED-SAME: 000102 03040506 0708090a 0b
# SHUFFLED-NOT: 000102 03040506 0708090a 0b
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74887/new/

https://reviews.llvm.org/D74887





More information about the llvm-commits mailing list