Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update emscripten-llvm to version 7 #52323

Closed
gnzlbg opened this issue Jul 12, 2018 · 6 comments
Closed

Update emscripten-llvm to version 7 #52323

gnzlbg opened this issue Jul 12, 2018 · 6 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. O-asmjs Target: asm.js - http://asmjs.org/

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 12, 2018

See emscripten-core/emscripten-fastcomp#193 (comment)

emscripten already supports the wasm backend in LLVM7, so we should move the current emscripten-llvm from version 4.0 to that, so that we can remove all the workarounds lying around for LLVM < 5.0 (LLVM 5 is the new minimum supported version).

@kennytm kennytm added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. O-asmjs Target: asm.js - http://asmjs.org/ labels Jul 12, 2018
@nikic
Copy link
Contributor

nikic commented Nov 2, 2018

I've tried updating to emscripten 1.38.15 locally. There were some test failures related to exported symbols. E.g.

#![feature(linkage)]
#[linkage = "external"]
pub static TEST2: bool = true;
fn main() {}

results in

ERROR:root:undefined exported function: "__ZN3foo5TEST217he2beacac66605ee4E"

emcc is called with "EXPORTED_FUNCTIONS=[\"__ZN3foo5TEST217he2beacac66605ee4E\",\"_main\",\"_rust_eh_personality\"]".

Possibly EXPORTED_FUNCTIONS previously also worked with non-function symbols but now no longer does?

My current state: master...nikic:update-emscripten

@kripken
Copy link

kripken commented Nov 2, 2018

Emscripten recently changed to error on undefined symbols, instead of just warn, that might be the cause of that error. You can disable that with -s ERROR_ON_UNDEFINED_SYMBOLS=0 (but, maybe this is something worth fixing).

@nikic
Copy link
Contributor

nikic commented Nov 2, 2018

@kripken Rust explicitly passes ERROR_ON_UNDEFINED_SYMBOLS=1 to emcc, so it was already operating in this mode beforehand. I ended up dropping statics from the exported symbols if emscripten is used (https://github.com/rust-lang/rust/pull/55626/files#diff-f6e6083c951157a35938312877e731b6R391). Does that sound reasonable? From what I understand, it doesn't really make sense to export anything other than functions when emscripten is used.

@kripken
Copy link

kripken commented Nov 2, 2018

Oh, sorry, then my previous comment is irrelevant then.

Does "statics" mean global variables? It's possible to export both functions and global variables in emscripten, but i think it's extremely rare that globals are needed to be exported (when a global variable is exported, its address is exported).

@nikic
Copy link
Contributor

nikic commented Nov 2, 2018

@kripken Yeah, by statics I mean global variables. How does one specify globals that should be exported? Should they be part of EXPORTED_FUNCTIONS or something else?

@kripken
Copy link

kripken commented Nov 2, 2018

@nikic we export them in shared modules (MAIN_MODULE etc. flags), but there isn't a way to export specific ones, I believe.

bors added a commit that referenced this issue Nov 9, 2018
Update emscripten

This updates emscripten to 1.38.15, which is based on LLVM 6.0.1 and would allow us to drop code for handling LLVM 4.

The main issue I ran into is that exporting statics through `EXPORTED_FUNCTIONS` no longer works. As far as I understand exporting non-functions doesn't really make sense under emscripten anyway, so I've modified the symbol export code to not even try.

Closes #52323.
bors added a commit that referenced this issue Nov 10, 2018
Update emscripten

This updates emscripten to 1.38.15, which is based on LLVM 6.0.1 and would allow us to drop code for handling LLVM 4.

The main issue I ran into is that exporting statics through `EXPORTED_FUNCTIONS` no longer works. As far as I understand exporting non-functions doesn't really make sense under emscripten anyway, so I've modified the symbol export code to not even try.

Closes #52323.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. O-asmjs Target: asm.js - http://asmjs.org/
Projects
None yet
Development

No branches or pull requests

4 participants