Skip to content

Commit dbf6aec

Browse files
committed
fix: disable PIE for post_process with LLVMFlang to fix R_X86_64_32 relocation error
flang-23/LLD defaults to building PIE executables. SILO and LAPACK static libraries on Frontier are compiled without -fPIC, so their 32-bit absolute relocations (R_X86_64_32) are rejected by LLD when linking a PIE binary. Add -no-pie to post_process link options for LLVMFlang to allow non-PIC system libraries. simulation is unaffected (no SILO/LAPACK dependency).
1 parent 473f9ce commit dbf6aec

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,12 @@ if (MFC_POST_PROCESS)
791791

792792
# -O0 is in response to https://github.com/MFlowCode/MFC-develop/issues/95
793793
target_compile_options(post_process PRIVATE -O0)
794+
795+
# flang-23/LLD defaults to PIE; SILO and LAPACK static libs on Frontier are
796+
# non-PIC, producing R_X86_64_32 relocations that LLD rejects in PIE mode.
797+
if (CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
798+
target_link_options(post_process PRIVATE -no-pie)
799+
endif()
794800
endif()
795801

796802
if (MFC_SYSCHECK)

0 commit comments

Comments
 (0)