[PATCH] D40526: [WebAssembly] Change size_t to `unsigned long`

Dan Gohman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 15:09:05 PST 2017


sunfish created this revision.
Herald added subscribers: aheejin, sbc100, jfb.

Currently wasm's size_t is `unsigned int` for compatibility with asm.js and Emscripten's library code; see the patch <https://reviews.llvm.org/D24134> for details.

Changing it to `unsigned long` (which is also 32-bit on wasm32) would make it the same type as wasm64 (where unsigned long is 64-bit), which would eliminate the most common cause for mangled names being different between wasm32 and wasm64. For example, export lists containing symbol names could often be the same between wasm32 and wasm64.

Even though the ABI won't be officially stable for a while, increasing numbers of tools are looking to interoperate with LLVM's output, and core details like the size_t type may become inconvenient to change in the future.

This patch aims to remain compatible with current Emscripten integration by making the change only in the wasm32-unknown-unknown-wasm triple, so it won't affect the s2wasm path, which uses the wasm32-unknown-unknown-elf triple. It would be something that would need to be handled if Emscripten wants to start using the wasm32-unknown-unknown-wasm triple through.


Repository:
  rL LLVM

https://reviews.llvm.org/D40526

Files:
  lib/Basic/Targets/WebAssembly.h
  test/Preprocessor/init.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40526.124474.patch
Type: text/x-patch
Size: 7196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171127/61ce9e22/attachment.bin>


More information about the llvm-commits mailing list