[PATCH] D63833: [wasm-ld] Add __global_base symbol to mark the value of --global-base

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 11:48:49 PDT 2019


sbc100 added a comment.

As I said in  D63742 <https://reviews.llvm.org/D63742>, I don't really like that fact that `__global_base` and `__data_end` are use for the start and end of the static data but use completely different naming conventions, but since we already expose the --global-base command line arg I guess its hard to make the align without changing the command line arg and/or change the name of `__data_end`.   So I think I'm ok with this for now, but I'd like to find a way to make these consistent in the future.



================
Comment at: lld/test/wasm/global-base.ll:3
+
+target triple = "wasm32-unknown-unknown"
+
----------------
You could avoid creating a .ll file here maybe and simply make this a `.test` file (pure text) that compiles that simple `wasm/Inputs/start.ll` file.. then you could also drop the `--no-entry`


================
Comment at: lld/test/wasm/global-base.ll:5
+
+; RUN: wasm-ld -no-gc-sections --export=__global_base --export=__data_end --allow-undefined --no-entry -o %t.wasm %t.o
+; RUN: obj2yaml %t.wasm | FileCheck %s  -check-prefix=CHECK-1024
----------------
Do you need `--no-gc-sections` here?


================
Comment at: lld/wasm/Writer.cpp:223
   } else {
     MemoryPtr = Config->GlobalBase;
     log("mem: global base = " + Twine(Config->GlobalBase));
----------------
Looks like we need to figure what to do with GlobalBase in the case of --stack-first.  But that is somewhat independent of this change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63833





More information about the llvm-commits mailing list