Skip to content

Commit 92a09a0

Browse files
committed
build: ensure that Windows is built without PIC
PIC on windows does not make sense. All code is position independent. Currently clang and LLVM do the wrong thing and generate ELF style PIC code on Windows when `-fPIC` is used. Add `-fno-pic` to disable that when cross-compiling to Windows.
1 parent 4662674 commit 92a09a0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ function(_add_variant_c_compile_flags)
230230
list(APPEND result "-D_MDd")
231231
list(APPEND result -Xclang;--dependent-lib=msvcrtd)
232232
endif()
233+
list(APPEND result -fno-pic)
233234
endif()
234235

235236
if(CFLAGS_ENABLE_ASSERTIONS)

0 commit comments

Comments
 (0)