PellesC: Add support for ASM_POASM language assembler

The Pelles C compiler does not support ASM, and the `poasm` assembler
uses a distinct syntax.  Add a dedicated language as we do for similar
cases from other vendors.  Leave documentation commented out for now
because the PellesC toolchain support in general is not yet documented.

Fixes: #27758
Issue: #21536
Co-authored-by: Serguei E. Leontiev <leo@sai.msu.ru>
This commit is contained in:
Brad King
2026-04-21 18:13:07 -04:00
parent efc3e90d0d
commit a95fae2d36
13 changed files with 99 additions and 1 deletions

View File

@@ -51,4 +51,9 @@ The supported languages are:
``ASM_MASM``
Microsoft Assembler (x86, x64)
.. FIXME(#21536): ``ASM_POASM``
.. versionadded:: 4.4
Pelles C toolchain assembler.
``ASM-ATT``

View File

@@ -7,9 +7,15 @@ Preferred executable for compiling a specific dialect of assembly language
files. ``ASM<DIALECT>`` can be one of:
* ``ASM``
* ``ASM_NASM`` (Netwide Assembler)
* ``ASM_MASM`` (Microsoft Assembler)
* ``ASM_MARMASM`` (Microsoft ARM Assembler)
.. FIXME(#21536): * ``ASM_POASM`` (Pelles Macro Assembler)
* ``ASM-ATT`` (Assembler AT&T)
Will only be used by CMake on the first configuration to determine

View File

@@ -7,9 +7,15 @@ Add default compilation flags to be used when compiling a specific dialect
of an assembly language. ``ASM<DIALECT>FLAGS`` can be one of:
* ``ASMFLAGS``
* ``ASM_NASMFLAGS``
* ``ASM_MASMFLAGS``
* ``ASM_MARMASMFLAGS``
.. FIXME(#21536): * ``ASM_POASMFLAGS``
* ``ASM-ATTFLAGS``
.. |CMAKE_LANG_FLAGS| replace:: :variable:`CMAKE_ASM<DIALECT>_FLAGS <CMAKE_<LANG>_FLAGS>`

View File

@@ -0,0 +1,7 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
set(ASM_DIALECT "_POASM")
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
include(CMakeASMInformation)
set(ASM_DIALECT)

View File

@@ -165,6 +165,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Renesas "-v")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Renesas "(RX Family C/C\\+\\+ Compiler)|(RL78 Family Compiler)|(RH850 Family Compiler)")
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS PellesC)
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_PellesC )
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_PellesC "Pelles Macro Assembler")
include(CMakeDetermineCompilerId)
set(userflags)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}")
@@ -263,7 +267,7 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX)
endif ()
set(_CMAKE_PROCESSING_LANGUAGE "ASM")
set(_CMAKE_PROCESSING_LANGUAGE "ASM${ASM_DIALECT}")
include(CMakeFindBinUtils)
include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-FindBinUtils OPTIONAL)
unset(_CMAKE_PROCESSING_LANGUAGE)

View File

@@ -0,0 +1,7 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
set(ASM_DIALECT "_POASM")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT poasm)
include(CMakeDetermineASMCompiler)
unset(ASM_DIALECT)

View File

@@ -0,0 +1,12 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
# This file is used by EnableLanguage in cmGlobalGenerator to
# determine that the selected ASM_POASM "compiler" (should be poasm)
# works. For assembler this can only check whether the compiler has been found,
# because otherwise there would have to be a separate assembler source file
# for each assembler on every architecture.
set(ASM_DIALECT "_POASM")
include(CMakeTestASMCompiler)
set(ASM_DIALECT)

View File

@@ -0,0 +1,9 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
# Support for the PellesC assembler, poasm
# Load the generic ASMInformation file:
set(ASM_DIALECT "_POASM")
include(Internal/CMakeASMLinkerInformation)
set(ASM_DIALECT)

View File

@@ -0,0 +1,7 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
# Load the generic ASM test file:
set(ASM_DIALECT "_POASM")
include(Internal/CMakeInspectASMLinker)
set(ASM_DIALECT)

View File

@@ -0,0 +1,8 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file LICENSE.rst or https://cmake.org/licensing for details.
include (Platform/Windows-PellesC)
__windows_compiler_pellesc(ASM_POASM)
set(CMAKE_ASM_POASM_COMPILE_OBJECT
"<CMAKE_ASM_POASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -Fo<OBJECT> <SOURCE>")

View File

@@ -2142,6 +2142,11 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(VSMASM VSMASM)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "PellesC")
ADD_TEST_MACRO(PellesASM PellesASM)
set_property(TEST PellesASM APPEND PROPERTY LABELS "PellesC")
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio")
if(NOT MSVC60)
ADD_TEST_MACRO(SBCS SBCS)

View File

@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 4.3)
project(PellesASM LANGUAGES ASM_POASM)
add_executable(PellesASM main-AMD64.asm)

View File

@@ -0,0 +1,19 @@
extern $printf:proc
.rdata
fmt db "hello assembler world, %d arguments given", 0ah, 0
.code
main proc
sub rsp, 40
mov edx, ecx
lea rcx, [rip + fmt]
call $printf
mov eax, 0
add rsp, 40
ret
main endp
.drectve SEGMENT
db ' -defaultlib:crt64'
db ' -defaultlib:kernel32'
end