[lld] ELF: Introduce --shuffle-padding option. (PR #117653)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 29 22:31:09 PST 2024


================
@@ -1444,6 +1444,38 @@ static void finalizeSynthetic(Ctx &ctx, SyntheticSection *sec) {
   }
 }
 
+static bool canInsertPadding(OutputSection *sec) {
+  StringRef s = sec->name;
+  return s == ".bss" || s == ".data" || s == ".data.rel.ro" || s == ".rodata" ||
----------------
MaskRay wrote:

Hard coding these names is a bit too magical and we'd prefer options avoiding the magic.

Perhaps encode the output section patterns in the option argument like 
`--shuffle-sections='1;.bss;.data;.rodata;.text*'`

https://github.com/llvm/llvm-project/pull/117653


More information about the llvm-commits mailing list