cmake: pass -DPIC for building libgmp etc.
To really build libgmp, etc. as position independent, passing
-fPIC is not enough, and we need to pass -DPIC as well.
It was ok without this when linking with gold. But it fails to
link with LLD.
Change-Id: Iaa8173f06c39ab377b42988c65014fa4f172c96f
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/186837
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f40aff2..241fad3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,7 @@
string(APPEND EXTCPPFLAGS " --sysroot=${CMAKE_SYSROOT}")
endif()
if(LLVM_ENABLE_PIC)
- string(APPEND EXTCPPFLAGS " -fPIC")
+ string(APPEND EXTCPPFLAGS " -fPIC -DPIC")
endif()
set(EXTLDFLAGS "LDFLAGS=-L${EXTLIBDIR}")
set(EXTCC "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}")