Skip to content

Support for separate compilation with LLVM backend #6830

@sbc100

Description

@sbc100

We now have support for wasm object files in the upstream LLVM backend. This means we can optionally perform separate compilation. However we also want to be able to preserve the existing LTO support in emscripten.

Currently emscripten always outputs bitcode objects and performs some amount of "LTO" by linking with llvm-link and then running opt, in addition there is an --llvm-lto flag which will trigger additional LTO passes over the bitcode.

In order to continue to enable both bitcode objects and native object we have a new different options to choose from:

  1. Enable wasm object files via a specific new -s WASM_OBJECT_FILES option. By default we still produce bitcode objects.
  2. Build wasm object files by default and disable with -flto compiler line flag which requires bitcode objects.
  3. Re-purpose the existing --llvm-lto flag. When this flag is present build bitcode objects, otherwise default to wasm objects.

(1) is probably least disruptive and might be a good option for the initial implementation. We could later change the default and/or have the default driven by -flto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions