Skip to content

Depecrated --llvm-lto used in Emscripten upstream backend #13

Description

@pezcode

The Emscripten upstream backend uses the standard -flto option and emits a warning when --llvm-lto is used.

emcc:WARNING: --llvm-lto ignored when using llvm backend

One way to check whether the fastcomp backend is being used is to check for Clang 6.0.1 or older. Fastcomp stopped being supported with Emscripten > 1.40.1 which has that version. Upstream as old as 1.38.33 (oldest version I could get from emsdk) uses Clang 9.

However, the following doesn't work because the toolchain file doesn't have access the compiler version (CMAKE_CXX_COMPILER_VERSION is only detected by CMake afterwards):

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
    set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "-O3 --llvm-lto 1")
else()
    set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "-O3 -flto")
endif()

I fixed it with a

string(REPLACE "--llvm-lto 1" "-flto" CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE})

in my code but the correct flag in the toolchain depending on the backend would be nicer.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions