[llvm-branch-commits] [ELF] Support placing .lbss/.lrodata/.ldata after .bss (PR #81224)

Arthur Eubanks via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Feb 15 15:18:55 PST 2024


================
@@ -1436,6 +1436,8 @@ static void readConfigs(opt::InputArgList &args) {
   config->zInterpose = hasZOption(args, "interpose");
   config->zKeepTextSectionPrefix = getZFlag(
       args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
+  config->zLrodataAfterBss =
+      getZFlag(args, "lrodata-after-bss", "nolrodata-after-bss", false);
----------------
aeubanks wrote:

> With -z separate-code and a large max-page-size, one extra PT_LOAD can have a significant waste.

This makes sense for the more common `-pie` case.

But *everybody* who's linking with `-no-pie` on x86-64 and has large sections is going to need `.lrodata` at the end of the binary so it doesn't affect small data relocations. This basically forces the user to pass `-z lrodata-after-bss` if they're passing `-no-pie`, which seems like a pointless burden on the user. I don't think people are generally concerned about exactly where `.lrodata` is in the binary, the whole point is that it's *somewhere* far away, doesn't really matter where.

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


More information about the llvm-branch-commits mailing list