Skip to content

Conversation

@cjacek
Copy link
Contributor

@cjacek cjacek commented May 16, 2025

Both LLVM and mingw-w64 now have sufficient ARM64EC support to build a functional toolchain. This PR adds the necessary llvm-mingw tweaks. With these changes, it's possible to build the toolchain using:

ARCHS="i686 x86_64 armv7 aarch64 arm64ec" LLVM_VERSION=main ./build-all.sh

cmake --build . ${CORES:+-j${CORES}}

# Skip install on arm64ec, we merge archives instead.
if [ $arch = arm64ec ]; then
Copy link
Owner

@mstorsjo mstorsjo May 16, 2025

Choose a reason for hiding this comment

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

For comparisons like these, my shell scripting style is to enclose both the variable and the value with quotes, i.e. if [ "$arch" = "arm64ec" ]; then. In case the variable would happen to expand to an empty string, it makes sure the test command doesn't misparse the arguments. Same below on line 157.

(Obviously it should be impossible for $arch to expand to an empty string here, as it's the result of a for arch in .., but I'd prefer that style for consistency.)

Clang expects the aarch64 compiler-rt name on ARM64EC. While this could be adjusted
in Clang, the current approach mirrors MSVC, where the core CRT is provided as
archives containing both EC and native support. Ideally, the LLVM build system would
handle this automatically, but for now we can merge it here.
@mstorsjo
Copy link
Owner

I think you'd want to have d358dd8 (from my arm64ec branch) included as well; without it, the FLAGS variable in build-mingw-w64.sh won't get reset as expected when looping over the architectures. And if you'd build with ARCHS=arm64ec so you hadn't run a previous iteration with aarch64 right before it, it probably doesn't work as expected.

@cjacek
Copy link
Contributor Author

cjacek commented May 17, 2025

Thanks! I cherry-picked your patch and fixed if statements.

Copy link
Owner

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

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

LGTM; this works as an initial step for enabling arm64ec.

@mstorsjo mstorsjo merged commit 1b781e8 into mstorsjo:master May 18, 2025
21 checks passed
@cjacek cjacek deleted the arm64ec branch May 21, 2025 14:28
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.

2 participants