[PATCH] D64537: [WebAssembly] Implement thread-local storage for non-PIC cases
Dan Gohman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 16:10:27 PDT 2019
sunfish added a comment.
This looks nice!
> __wasm_init_tls(calloc(__builtin_wasm_tls_size(), 1));
Would it make sense to change the API contract for `__wasm_init_tls` to guarantee that initializes all bytes (with zeros as needed)? `__wasm_init_tls` knows what bytes it's initializing, so we could use plain `malloc` instead of `calloc` and avoid redundant zero initialization of those bytes.
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:1111
+
+ return DAG.getNode(ISD::ADD, DL, VT, TLSBase, TLSOffset);
+}
----------------
It looks like this supports local-exec, but would need to be extended to handle initial-exec or the other TLS models. Assuming this is correct, could you add a check for the TLS model and `report_fatal_error` on unsupported models?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64537/new/
https://reviews.llvm.org/D64537
More information about the cfe-commits
mailing list