cib icon indicating copy to clipboard operation
cib copied to clipboard

Integrate into WebAssembly.Studio

Open mbebenita opened this issue 7 years ago • 4 comments

First of all, thanks for your efforts in bringing LLVM to the browser, great work.

The Clang format library from this project is being used in http://WebAssembly.studio. For now, compilation is done server side (in order to reduce code size) but we'd like to eventually do everything on the client.

Would you be interested in integrating these two projects more tightly?

mbebenita avatar Feb 08 '18 23:02 mbebenita

It's worth exploring. How are you handling security issues server side? Executing user-defined gulp files seems dangerous.

tbfleming avatar Feb 08 '18 23:02 tbfleming

Gulp (really a simple/basic re-implementation of the Gulp API in the browser) files are running client side. The server just invokes clang with sanitized input.

mbebenita avatar Feb 09 '18 02:02 mbebenita

Nice.

tbfleming avatar Feb 09 '18 03:02 tbfleming

the cib project doesn't work anymore with some recent browser update.

I'm trying to update it with llvm 10. So far I've got clang built into wasm. I was able to compile an empty main function.

But as soon as I include <iostream>, I will see lots of issues. The reason seems to be that llvm expects a file buffer being null terminated, but that's not true. Internally, llvm uses mmap to read in the files.

According to https://stackoverflow.com/questions/27096816/how-to-work-around-lack-of-nul-terminator-in-strings-returned-from-mmap

on x86, mmap is usually null terminated. But I suspect this is not true for the wasm case.

I wonder if you have seen something similar too? and have a solution already. Thanks.

shi-yan avatar Dec 09 '19 07:12 shi-yan