[Openmp-commits] [PATCH] D150532: [OpenMP] Compile assembly files as ASM, not C

Martin Storsjö via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun May 14 14:22:22 PDT 2023


mstorsjo created this revision.
mstorsjo added reviewers: tianshilei1992, Mordante.
Herald added subscribers: sunshaoce, guansong, kristof.beyls, yaxunl.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: jplehr, sstefan1.
Herald added a project: OpenMP.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150532

Files:
  openmp/CMakeLists.txt
  openmp/runtime/src/CMakeLists.txt


Index: openmp/runtime/src/CMakeLists.txt
===================================================================
--- openmp/runtime/src/CMakeLists.txt
+++ openmp/runtime/src/CMakeLists.txt
@@ -133,8 +133,6 @@
 # Set the compiler flags for each type of source
 set_source_files_properties(${LIBOMP_CXXFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CXXFLAGS}")
 set_source_files_properties(${LIBOMP_ASMFILES} ${LIBOMP_GNUASMFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_ASMFLAGS}")
-# Let the compiler handle the GNU assembly files
-set_source_files_properties(${LIBOMP_GNUASMFILES} PROPERTIES LANGUAGE C)
 
 # Remove any cmake-automatic linking of the standard C++ library.
 # We neither need (nor want) the standard C++ library dependency even though we compile c++ files.
Index: openmp/CMakeLists.txt
===================================================================
--- openmp/CMakeLists.txt
+++ openmp/CMakeLists.txt
@@ -11,7 +11,7 @@
 # llvm/runtimes/ will set OPENMP_STANDALONE_BUILD.
 if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
   set(OPENMP_STANDALONE_BUILD TRUE)
-  project(openmp C CXX)
+  project(openmp C CXX ASM)
 endif()
 
 # Must go below project(..)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150532.522023.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230514/5abb18e3/attachment.bin>


More information about the Openmp-commits mailing list