Reusing Legacy Code in WebAssembly: Key Challenges of Cross-Compilation and Code Semantics Preservation
Sara Baradaran, Liyan Huang, Mukund Raghothaman, Weihang Wang

TL;DR
This paper examines the challenges of cross-compiling legacy C/C++ code to WebAssembly, revealing issues in semantic preservation, identifying bugs, and proposing solutions to improve compiler reliability.
Contribution
It introduces WasmChecker, a differential testing framework for WebAssembly, and uncovers 11 new bugs in the Emscripten compiler, advancing understanding of cross-compilation challenges.
Findings
WebAssembly compilers often do not preserve code semantics accurately.
Identified 11 new bugs in the Emscripten compiler toolchain.
Proposed a differential testing approach to evaluate semantic equivalence.
Abstract
WebAssembly (Wasm) has emerged as a powerful technology for executing high-performance code and reusing legacy code in web browsers. With its increasing adoption, ensuring the reliability of WebAssembly code becomes paramount. In this paper, we investigate how well WebAssembly compilers fulfill code reusability. Specifically, we inquire (1) what challenges arise when cross-compiling a high-level language codebase into WebAssembly and (2) how faithfully WebAssembly compilers preserve code semantics in this new binary. Through a study on 115 open-source codebases, we identify the key challenges in cross-compiling legacy C/C++ code into WebAssembly, highlighting the risks of silent miscompilation and compile-time errors. We categorize these challenges based on their root causes and propose corresponding solutions. We then introduce a differential testing approach, implemented in a…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsScientific Computing and Data Management · Image Processing and 3D Reconstruction · Manufacturing Process and Optimization
