Skip to content

Fix building ARM assembly for Windows for mingw targets#26

Open
mstorsjo wants to merge 1 commit into
madebr:master-with-github-cifrom
mstorsjo:windows-arm-asm
Open

Fix building ARM assembly for Windows for mingw targets#26
mstorsjo wants to merge 1 commit into
madebr:master-with-github-cifrom
mstorsjo:windows-arm-asm

Conversation

@mstorsjo

Copy link
Copy Markdown

This code was attempted to be fixed to support building for Windows on ARM with MSVC before - by adding ifdefs for _M_ARM.

The MSVC compilers predefine _M_ARM when targeting ARM - but mingw compilers don't define this (they predefine arm instead).

However, within ARM specific files, we don't specifically need to check for an _M_ARM at all - we can just check for _WIN32 which is predefined by all compilers targeting Windows.

Secondly, add "#ifdef ELF" around ".fpu neon" instead of "#ifndef APPLE"; the .fpu directive can only be assembled on ELF targets.

Thirdly, use a separate codepath for Windows in the synth*_neon_accurate.S files. Windows on ARM is Thumb only, and in Thumb mode, not all instructions are allowed. In this case, we can't align the stack pointer with one single instruction, but need to use a scratch register inbetween.

This fixes building for Windows on ARM in mingw environments, such as with llvm-mingw toolchains.

This code was attempted to be fixed to support building for
Windows on ARM with MSVC before - by adding ifdefs for _M_ARM.

The MSVC compilers predefine _M_ARM when targeting ARM - but
mingw compilers don't define this (they predefine __arm__
instead).

However, within ARM specific files, we don't specifically need
to check for an _M_ARM at all - we can just check for _WIN32
which is predefined by all compilers targeting Windows.

Secondly, add "#ifdef __ELF__" around ".fpu neon" instead of
"#ifndef __APPLE__"; the .fpu directive can only be assembled on
ELF targets.

Thirdly, use a separate codepath for Windows in the
synth*_neon_accurate.S files. Windows on ARM is Thumb only, and in
Thumb mode, not all instructions are allowed. In this case, we can't
align the stack pointer with one single instruction, but need to
use a scratch register inbetween.

This fixes building for Windows on ARM in mingw environments,
such as with llvm-mingw toolchains.
@github-actions

Copy link
Copy Markdown

The mpg123-devel mailing list has been notified of the existence of this pr.

@sobukus

sobukus commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Merged upstream, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants