Skip to content

Commit 4072c8a

Browse files
committed
[OpenMP] Compile assembly files as ASM, not C
Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent) when compiling a file which has been set as having the language C. This behaviour change only takes place if "cmake_minimum_required" is set to 3.20 or newer, or if the policy CMP0119 is set to new. Attempting to compile assembly files with "-x c" fails, however this is workarounded in many cases, as OpenMP overrides this with "-x assembler-with-cpp", however this is only added for non-Windows targets. Thus, after increasing cmake_minimum_required to 3.20, this breaks compiling the GNU assembly for Windows targets; the GNU assembly is used for ARM and AArch64 Windows targets when building with Clang. This patch unbreaks that. Differential Revision: https://reviews.llvm.org/D150532
1 parent be556c8 commit 4072c8a

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

openmp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ list(INSERT CMAKE_MODULE_PATH 0
1111
# llvm/runtimes/ will set OPENMP_STANDALONE_BUILD.
1212
if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
1313
set(OPENMP_STANDALONE_BUILD TRUE)
14-
project(openmp C CXX)
14+
project(openmp C CXX ASM)
1515
endif()
1616

1717
# Must go below project(..)

openmp/runtime/src/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ libomp_get_asmflags(LIBOMP_CONFIGURED_ASMFLAGS)
133133
# Set the compiler flags for each type of source
134134
set_source_files_properties(${LIBOMP_CXXFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CXXFLAGS}")
135135
set_source_files_properties(${LIBOMP_ASMFILES} ${LIBOMP_GNUASMFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_ASMFLAGS}")
136-
# Let the compiler handle the GNU assembly files
137-
set_source_files_properties(${LIBOMP_GNUASMFILES} PROPERTIES LANGUAGE C)
138136

139137
# Remove any cmake-automatic linking of the standard C++ library.
140138
# We neither need (nor want) the standard C++ library dependency even though we compile c++ files.

0 commit comments

Comments
 (0)