diff --git a/cmake/GPU.cmake b/cmake/GPU.cmake index eb261d1521..a9388bb340 100644 --- a/cmake/GPU.cmake +++ b/cmake/GPU.cmake @@ -115,6 +115,20 @@ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Flang") if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelDebug") add_compile_options($<$:-O1> $<$:-g>) endif() +elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang") + # AMD/LLVM flang (amdflang). These are CPU-build flags only; the OpenMP-offload GPU + # build sets its own flags (MFCTargets.cmake) and links via the offload wrapper, so + # it is left untouched here. + if (NOT (MFC_OpenMP OR MFC_OpenACC)) + if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelDebug") + # Ordinary (non-LTO) objects plus static deps built without -fPIC + # (e.g. libfftw3) hit ld.lld's default-PIE "relocation R_X86_64_32 + # against local symbol". Link a non-PIE executable to accept them. + # Release links fine via LTO's link-time PIC codegen, so it is left alone. + add_link_options(-no-pie) + add_compile_options($<$:-O1> $<$:-g>) + endif() + endif() elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") add_compile_options($<$:-free>)