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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 01:23:56 PST 2020


grimar added inline comments.


================
Comment at: lld/test/ELF/shuffle-sections-init-fini.s:1
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
----------------
This test passes for me without any code changes.


================
Comment at: lld/test/ELF/shuffle-sections-init-fini.s:11
+# CHECK:      Hex dump of section '.fini_array'
+# CHECK-NEXT: {{....}}ff
+
----------------
I think this tests nothing. If you have the same result with different seeds, it probably means that
`--shuffle-sections=` does not work as expected.

What I think can be done to test it:
Run LLD without `--shuffle-sections` and then check that with this option, the result is just different.
e.g.:

```
# COMMON:       Hex dump of section '.init_array'
# WITHOUT-NEXT: ff0100
# WITH-NOT:     ff0100
...
```



================
Comment at: lld/test/ELF/shuffle-sections-init-fini.s:17
+.byte 1
+.section .init_array.1,"aw", at init_array,unique,2
+.byte 255
----------------
You do not need "unique" here it seems.


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