Skip to content

Update emscripten-llvm to version 7 #52323

Closed
@gnzlbg

Description

@gnzlbg
Contributor

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).

Activity

added
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
O-asmjsTarget: asm.js - http://asmjs.org/
on Jul 12, 2018
nikic

nikic commented on Nov 2, 2018

@nikic
Contributor

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

kripken commented on Nov 2, 2018

@kripken

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

nikic commented on Nov 2, 2018

@nikic
Contributor

@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

kripken commented on Nov 2, 2018

@kripken

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

nikic commented on Nov 2, 2018

@nikic
Contributor

@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

kripken commented on Nov 2, 2018

@kripken

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

added
O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!
on Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-enhancementCategory: An issue proposing an enhancement or a PR with one.O-asmjsTarget: asm.js - http://asmjs.org/O-emscriptenTarget: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kennytm@kripken@nikic@gnzlbg@workingjubilee

        Issue actions

          Update emscripten-llvm to version 7 · Issue #52323 · rust-lang/rust