summaryrefslogtreecommitdiff
path: root/flang/tools
diff options
context:
space:
mode:
authorPeter Steinfeld <psteinfeld@nvidia.com>2022-10-12 12:41:51 -0700
committerPeter Steinfeld <psteinfeld@nvidia.com>2022-10-14 12:27:48 -0700
commit1cfae76ed91a91aac9444e5a07d31965aae9a628 (patch)
tree3e7656a9b844e6bfdd0f3541b8f789e538d858d9 /flang/tools
parentd877e3fe71676b0ff10410d80456b35cdd5bf796 (diff)
downloadllvm-1cfae76ed91a91aac9444e5a07d31965aae9a628.tar.gz
[Flang] Adjust preprocessing to build modules correctly
Several module files in .../llvm-project/flang/module check for the existence of the macro "__x86_64__" to conditionally compile Fortran code. Unfortunately, this macro was not being defined anywhere. This patch fixes that for compilations targeting 64 bit x86 machines. I made the following changes -- -- Removed the test for 32 bit X86 targets. The rest of the compiler and runtime do not support X86 32 bits. -- Added predefined macros to define "__x86_64__" and "__x86__64" to be 1 when the target architecture is 64 bit x86 and the "-cpp" option is on the command line. -- Changed the cmake file for creating the Fortran module files to use the "-cpp" option so that the macro "__x86_64__" will be defined when building the module files. -- Added a test. Differential Revision: https://reviews.llvm.org/D135810
Diffstat (limited to 'flang/tools')
-rw-r--r--flang/tools/f18/CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index e7a826e0dda5..b046850557d0 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -39,7 +39,7 @@ if (NOT CMAKE_CROSSCOMPILING)
endif()
add_custom_command(OUTPUT ${base}.mod
COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR}
- COMMAND flang-new -fc1 -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
+ COMMAND flang-new -fc1 -cpp -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
${FLANG_SOURCE_DIR}/module/${filename}.f90
DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends}
)