summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-01-24 23:31:21 +0000
committerIan Lynagh <igloo@earth.li>2011-01-24 23:31:21 +0000
commit001b9a4d8b5e3f120c419c6f6fa3dd67b1d6cd9e (patch)
tree303f900a56d5f00b6e4eaba44a75a49796905813
parent77b29b5685db2f8745d191af1599ed753bef91e7 (diff)
downloadhaskell-001b9a4d8b5e3f120c419c6f6fa3dd67b1d6cd9e.tar.gz
Keep separate linker flags, for when we want to link with gcc or ld
-rw-r--r--aclocal.m418
-rw-r--r--compiler/ghc.mk6
-rw-r--r--compiler/main/DynFlags.hs3
-rw-r--r--configure.ac17
-rw-r--r--distrib/configure.ac.in21
-rw-r--r--libffi/ghc.mk2
-rw-r--r--mk/config.mk.in9
-rw-r--r--rules/build-package-data.mk2
-rw-r--r--rules/distdir-way-opts.mk2
9 files changed, 50 insertions, 30 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 84fb2b1a47..09ef225166 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -8,12 +8,13 @@
# ----------------------------------
# Set the C, LD and CPP flags for a given platform
# $1 is the platform
-# $2 is the name of the C flags variable
-# $3 is the name of the LD flags variable
-# $4 is the name of the CPP flags variable
+# $2 is the name of the CC flags variable
+# $3 is the name of the linker flags variable when linking with gcc
+# $4 is the name of the linker flags variable when linking with ld
+# $5 is the name of the CPP flags variable
AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
[
- AC_MSG_CHECKING([Setting up $2, $3 and $4])
+ AC_MSG_CHECKING([Setting up $2, $3, $4 and $5])
case $$1 in
i386-apple-darwin)
# By default, gcc on OS X will generate SSE
@@ -22,12 +23,14 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
# back to generic i686 compatibility. Trac #2983.
$2="$$2 -march=i686 -m32"
$3="$$3 -march=i686 -m32"
- $4="$$4 -march=i686 -m32"
+ $4="$$4 -arch i386"
+ $5="$$5 -march=i686 -m32"
;;
x86_64-apple-darwin)
$2="$$2 -m64"
$3="$$3 -m64"
- $4="$$4 -m64"
+ $4="$$4 -arch x86_64"
+ $5="$$5 -m64"
;;
esac
@@ -36,7 +39,8 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
# We support back to OS X 10.5
$2="$$2 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5"
$3="$$3 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5"
- $4="$$4 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5"
+ $4="$$4 -macosx_version_min 10.5"
+ $5="$$5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5"
;;
esac
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index c601f29942..77f673bc8b 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -110,8 +110,10 @@ compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/.
@echo 'cStage = show (STAGE :: Int)' >> $@
@echo 'cCcOpts :: [String]' >> $@
@echo 'cCcOpts = words "$(CONF_CC_OPTS_STAGE$*)"' >> $@
- @echo 'cLdOpts :: [String]' >> $@
- @echo 'cLdOpts = words "$(CONF_LD_OPTS_STAGE$*)"' >> $@
+ @echo 'cGccLinkerOpts :: [String]' >> $@
+ @echo 'cGccLinkerOpts = words "$(CONF_GCC_LINKER_OPTS_STAGE$*)"' >> $@
+ @echo 'cLdLinkerOpts :: [String]' >> $@
+ @echo 'cLdLinkerOpts = words "$(CONF_LD_LINKER_OPTS_STAGE$*)"' >> $@
@echo 'cIntegerLibrary :: String' >> $@
@echo 'cIntegerLibrary = "$(INTEGER_LIBRARY)"' >> $@
@echo 'cSplitObjs :: String' >> $@
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 854b83af4d..17b8fdb8b7 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -2296,6 +2296,7 @@ compilerInfo = [("Project name", String cProjectName),
("LibDir", FromDynFlags topDir),
("Global Package DB", FromDynFlags systemPackageConfig),
("C compiler flags", String (show cCcOpts)),
- ("Linker flags", String (show cLdOpts))
+ ("Gcc Linker flags", String (show cGccLinkerOpts)),
+ ("Ld Linker flags", String (show cLdLinkerOpts))
]
diff --git a/configure.ac b/configure.ac
index d116ff18b7..ea06662c94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -546,11 +546,11 @@ dnl If gcc, make sure it's at least 2.1
dnl
FP_HAVE_GCC
-FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[CPPFLAGS])
-FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_LD_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
-FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_LD_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
+FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
+FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
+FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
# Stage 3 won't be supported by cross-compilation
-FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_LD_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
+FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
FP_GCC_EXTRA_FLAGS
@@ -560,9 +560,12 @@ AC_PROG_CPP
AC_SUBST(CONF_CC_OPTS_STAGE0)
AC_SUBST(CONF_CC_OPTS_STAGE1)
AC_SUBST(CONF_CC_OPTS_STAGE2)
-AC_SUBST(CONF_LD_OPTS_STAGE0)
-AC_SUBST(CONF_LD_OPTS_STAGE1)
-AC_SUBST(CONF_LD_OPTS_STAGE2)
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
AC_SUBST(CONF_CPP_OPTS_STAGE0)
AC_SUBST(CONF_CPP_OPTS_STAGE1)
AC_SUBST(CONF_CPP_OPTS_STAGE2)
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index 677a249dc4..e17bcf52b4 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -60,17 +60,24 @@ dnl ** Check gcc version and flags we need to pass it **
#
FP_GCC_EXTRA_FLAGS
-FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS])
-FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_LD_OPTS_STAGE0])
-FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_LD_OPTS_STAGE1])
-FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_LD_OPTS_STAGE2])
+FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
+FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
+FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAGE1],[CONF_LD_LINKER_OPTS_STAGE1],[CONF_CPP_OPTS_STAGE1])
+# Stage 3 won't be supported by cross-compilation
+FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
AC_SUBST(CONF_CC_OPTS_STAGE0)
AC_SUBST(CONF_CC_OPTS_STAGE1)
AC_SUBST(CONF_CC_OPTS_STAGE2)
-AC_SUBST(CONF_LD_OPTS_STAGE0)
-AC_SUBST(CONF_LD_OPTS_STAGE1)
-AC_SUBST(CONF_LD_OPTS_STAGE2)
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE0)
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE1)
+AC_SUBST(CONF_GCC_LINKER_OPTS_STAGE2)
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE0)
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE1)
+AC_SUBST(CONF_LD_LINKER_OPTS_STAGE2)
+AC_SUBST(CONF_CPP_OPTS_STAGE0)
+AC_SUBST(CONF_CPP_OPTS_STAGE1)
+AC_SUBST(CONF_CPP_OPTS_STAGE2)
#
dnl ** how to invoke `ar' and `ranlib'
diff --git a/libffi/ghc.mk b/libffi/ghc.mk
index 3ff7d88b1c..6dfef8ff3b 100644
--- a/libffi/ghc.mk
+++ b/libffi/ghc.mk
@@ -119,7 +119,7 @@ $(libffi_STAMP_CONFIGURE):
AR=$(AR) \
NM=$(NM) \
CFLAGS="$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE1) -w" \
- LDFLAGS="$(SRC_LD_OPTS) $(CONF_LD_OPTS_STAGE1) -w" \
+ LDFLAGS="$(SRC_LD_OPTS) $(CONF_GCC_LINKER_OPTS_STAGE1) -w" \
"$(SHELL)" configure \
--enable-static=yes \
--enable-shared=$(libffi_EnableShared) \
diff --git a/mk/config.mk.in b/mk/config.mk.in
index e271cb1984..d0e683feb9 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -545,9 +545,12 @@ endif
CONF_CC_OPTS_STAGE0 = @CONF_CC_OPTS_STAGE0@
CONF_CC_OPTS_STAGE1 = @CONF_CC_OPTS_STAGE1@
CONF_CC_OPTS_STAGE2 = @CONF_CC_OPTS_STAGE2@
-CONF_LD_OPTS_STAGE0 = @CONF_LD_OPTS_STAGE0@
-CONF_LD_OPTS_STAGE1 = @CONF_LD_OPTS_STAGE1@
-CONF_LD_OPTS_STAGE2 = @CONF_LD_OPTS_STAGE2@
+CONF_GCC_LINKER_OPTS_STAGE0 = @CONF_GCC_LINKER_OPTS_STAGE0@
+CONF_GCC_LINKER_OPTS_STAGE1 = @CONF_GCC_LINKER_OPTS_STAGE1@
+CONF_GCC_LINKER_OPTS_STAGE2 = @CONF_GCC_LINKER_OPTS_STAGE2@
+CONF_LD_LINKER_OPTS_STAGE0 = @CONF_LD_LINKER_OPTS_STAGE0@
+CONF_LD_LINKER_OPTS_STAGE1 = @CONF_LD_LINKER_OPTS_STAGE1@
+CONF_LD_LINKER_OPTS_STAGE2 = @CONF_LD_LINKER_OPTS_STAGE2@
CONF_CPP_OPTS_STAGE0 = @CONF_CPP_OPTS_STAGE0@
CONF_CPP_OPTS_STAGE1 = @CONF_CPP_OPTS_STAGE1@
CONF_CPP_OPTS_STAGE2 = @CONF_CPP_OPTS_STAGE2@
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 3392d904d0..dcffee6110 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -40,7 +40,7 @@ endif
# for a feature it may not generate warning-free C code, and thus may
# think that the feature doesn't exist if -Werror is on.
$1_$2_CONFIGURE_OPTS += --configure-option=CFLAGS="$$(filter-out -Werror,$$(SRC_CC_OPTS)) $$(CONF_CC_OPTS_STAGE$3) $$($1_CC_OPTS) $$($1_$2_CC_OPTS)"
-$1_$2_CONFIGURE_OPTS += --configure-option=LDFLAGS="$$(SRC_LD_OPTS) $$(CONF_LD_OPTS_STAGE$3) $$($1_LD_OPTS) $$($1_$2_LD_OPTS)"
+$1_$2_CONFIGURE_OPTS += --configure-option=LDFLAGS="$$(SRC_LD_OPTS) $$(CONF_GCC_LINKER_OPTS_STAGE$3) $$($1_LD_OPTS) $$($1_$2_LD_OPTS)"
$1_$2_CONFIGURE_OPTS += --configure-option=CPPFLAGS="$$(SRC_CPP_OPTS) $$(CONF_CPP_OPTS_STAGE$3) $$($1_CPP_OPTS) $$($1_$2_CPP_OPTS)"
ifneq "$$(ICONV_INCLUDE_DIRS)" ""
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index 7a83f50c2e..bd09ad1528 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -109,7 +109,7 @@ $1_$2_DIST_LD_LIB_DIRS:=$$(shell for i in $$($1_$2_DEP_LIB_DIRS); do echo \"-L$$
endif
$1_$2_DIST_LD_OPTS = \
- $$(CONF_LD_OPTS_STAGE$4) \
+ $$(CONF_GCC_LINKER_OPTS_STAGE$4) \
$$(SRC_LD_OPTS) \
$$($1_LD_OPTS) \
$$($1_$2_LD_OPTS) \