gollvm: pass -fPIC to libgmp/mpfr/mpc builds If we are building PIC, pass -fPIC to external library builds. Otherwise linking step may fail with relocation error. Change-Id: I639713819d7706ca5bf028f9172d3a13316a8cb1 Reviewed-on: https://go-review.googlesource.com/127955 Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5674f75..86109ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -29,6 +29,9 @@ if(NOT "${CMAKE_SYSROOT}" STREQUAL "") string(APPEND EXTCPPFLAGS " --sysroot=${CMAKE_SYSROOT}") endif() +if(LLVM_ENABLE_PIC) + string(APPEND EXTCPPFLAGS " -fPIC") +endif() set(EXTLDFLAGS "LDFLAGS=-L${EXTLIBDIR}") set(EXTCC "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}")