Pass different flags on different platforms when building PIC.
authorNick Lewycky <nicholas@mxc.ca>
Sat, 21 Feb 2009 08:41:09 +0000 (08:41 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Sat, 21 Feb 2009 08:41:09 +0000 (08:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65229 91177308-0d34-0410-b5e6-96231b3b80d8

Makefile.rules

index af2b459bc054278cd81b839401221eb704edfab0..52a61109d6ed75205fc0ae58940d5b07e952503f 100644 (file)
@@ -278,8 +278,19 @@ ifdef ENABLE_EXPENSIVE_CHECKS
 endif
 
 ifeq ($(ENABLE_PIC),1)
-  CXX.Flags += -fPIC
-  C.Flags   += -fPIC
+  ifeq ($(LLVM_ON_WIN32),1)
+    # Nothing. Win32 defaults to PIC and warns when given -fPIC
+  else
+    ifeq ($(OS),Darwin)
+      # common is forbidden in dylib files
+      CXX.Flags += -fno-common
+      C.Flags   += -fno-common
+    else
+      # Linux and others; pass -fPIC
+      CXX.Flags += -fPIC
+      C.Flags   += -fPIC
+    endif
+  endif
 endif
 
 CXX.Flags     += $(CXXFLAGS) -Woverloaded-virtual