[lld] ELF: Introduce --randomize-section-padding option. (PR #117653)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 18:30:36 PST 2024
================
@@ -0,0 +1,125 @@
+# REQUIRES: x86
+# RUN: split-file %s %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o
+
+## --randomize-section-padding= inserts segment offset padding and pre-section
+## padding, and does not affect flags. Segment offset padding is only inserted
+## when PT_LOAD changes, as shown by .bss size (.data and .bss share a PT_LOAD).
+
+# RUN: ld.lld --randomize-section-padding=6 %t/a.o -o %t/a.out
+# RUN: llvm-readelf -sS -x .rodata -x .text -x .data %t/a.out | FileCheck --check-prefix=PAD6 %s
+
+# PAD6: .rodata PROGBITS 0000000000200158 000158 000b8d 00 A 0 0 1
+# PAD6: .text PROGBITS 0000000000201ce8 000ce8 000270 00 AX 0 0 4
----------------
pcc wrote:
Done
https://github.com/llvm/llvm-project/pull/117653
More information about the llvm-commits
mailing list