Skip to content

Added architecture linker specific flags to toolchains#18498

Merged
memsharded merged 4 commits into
conan-io:develop2from
perseoGI:pgi/fix/asmjs-link-flags
Jun 20, 2025
Merged

Added architecture linker specific flags to toolchains#18498
memsharded merged 4 commits into
conan-io:develop2from
perseoGI:pgi/fix/asmjs-link-flags

Conversation

@perseoGI

@perseoGI perseoGI commented Jun 19, 2025

Copy link
Copy Markdown
Contributor

Changelog: Feature: New linker flags autodetected by conan based on profile architecture.
Docs: omit

In #18432 native asmjs architecture support was introduced.
To enable asmjs code generation the -sWASM=0 flag needs to be passed to the emscripten linker.

That flag was added in architecture_flag without noticing that those flags were being passed to both compiler and linker across all toolchains.
This was causing the compiler to throw warnings as this flag is only understood by the linker:

em++: warning: linker setting ignored during compilation: 'WASM' [-Wunused-command-line-argument]

Having a compilation warning is not desirable as a compilation with warning as errors will result in a build failure:

em++: error: linker setting ignored during compilation: 'WASM' [-Wunused-command-line-argument] [-Werror]

This PR aims to address this issue by creating a new architecture_link_flags which will return the required flags only for the linker based on the profile architecture.

This function will be called by several toolchains which will bypass the result to the final linker by setting LD_FLAGS.

Tests

The current test_emcc test suite already tests this new functionality added.

@perseoGI
perseoGI force-pushed the pgi/fix/asmjs-link-flags branch from 92b6069 to 757ccaf Compare June 19, 2025 14:33
Comment thread conan/tools/cmake/toolchain/blocks.py Outdated
Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>

@memsharded memsharded left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor issue in the CMake integration.

It will be necessary to add some tests (can be integration, no need to be functional)

Comment thread conan/tools/cmake/toolchain/blocks.py Outdated
@memsharded memsharded self-assigned this Jun 20, 2025
@memsharded memsharded added this to the 2.18.0 milestone Jun 20, 2025
@memsharded
memsharded merged commit beb1754 into conan-io:develop2 Jun 20, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants