[PATCH] D136117: [lld][WebAssembly] Don't allow `--global-base` to be specified in -share/-pie or --relocatable modes

Dan Gohman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 09:34:22 PDT 2022


sunfish added inline comments.


================
Comment at: lld/wasm/Writer.cpp:269
+    if (!config->globalBase && !config->relocatable && !config->isPic) {
+      config->globalBase = 1024;
+    }
----------------
Could you add a comment here explaining why this is 1024? I think it's to avoid putting any global at address 0 which C/C++ would consider to be a null pointer, and 1024 is a nice round (in binary) number. Is there any other consideration here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136117/new/

https://reviews.llvm.org/D136117



More information about the llvm-commits mailing list