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

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 05:23:29 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" ||
----------------
smithp35 wrote:

`-fdata-sections` will result in section names having .rodata.* .data.* and .bss.* which would limit the effectiveness of shuffle padding when that option is enabled.

IIUC the reason to limit to .data and .bss et al here is to reduce the chance that someone has used a linker defined start/stop on .data.<mysection>. At this stage in the link it should be possible to check to see if the symbols exist for each section if that were a concern.

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


More information about the llvm-commits mailing list