summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-05-20 15:32:53 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2021-05-21 13:15:01 +0100
commitfec927dc8061d30cf48e8bbb61e500930e9137a1 (patch)
tree2da64a7442327bf01a4e4983a16ca701f5d045b3
parent939a56e780b7cc55cf49b52c4222e0e8061e99b1 (diff)
downloadhaskell-wip/libffi-carnage.tar.gz
libffi: Attempt to fix the absolute carnagewip/libffi-carnage
Pray for make build
-rw-r--r--configure.ac20
-rw-r--r--hadrian/src/Settings/Packages.hs4
-rw-r--r--libraries/ghci/ghci.cabal.in2
-rw-r--r--mk/config.mk.in4
4 files changed, 23 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index e3763055ec..13893be1e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1077,6 +1077,21 @@ dnl ################################################################
# system libffi
+# Whether to use libffi for adjustors (foreign import "wrapper") or
+# not. If we have built-in support (rts/Adjustor.c) then we use that,
+# otherwise we fall back on libffi, which is slightly slower.
+AC_MSG_CHECKING(whether target needs libffi for adjustors)
+case "$TargetArch" in
+ i386|x86_64)
+ UseLibFFIForAdjustors=YES
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ UseLibFFIForAdjustors=YES
+ AC_MSG_RESULT([yes])
+ ;;
+esac
+
AC_ARG_WITH([system-libffi],
[AS_HELP_STRING([--with-system-libffi],
[Use system provided libffi for RTS [default=no]])
@@ -1141,6 +1156,11 @@ AS_IF([test "$UseSystemLibFFI" = "YES"], [
LDFLAGS="$LDFLAGS2"
])
+AS_IF([test "$UseLibFFIForAdjustors" = "YES"],
+ [AC_SUBST([CabalHaveLibffi], [True])])
+
+
+
dnl ** check whether we need -ldl to get dlopen()
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([dl], [dlopen], [AC_SUBST([CabalHaveLibdl], [True])], [AC_SUBST([CabalHaveLibdl], [False])])
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index a08cc3ee98..b89ccca238 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -274,8 +274,6 @@ rtsPackageArgs = package rts ? do
let cArgs = mconcat
[ rtsWarnings
- , flag UseSystemFfi ? arg ("-I" ++ ffiIncludeDir)
- , flag WithLibdw ? arg ("-I" ++ libdwIncludeDir)
, arg "-fomit-frame-pointer"
-- RTS *must* be compiled with optimisations. The INLINE_HEADER macro
-- requires that functions are inlined to work as expected. Inlining
@@ -373,6 +371,8 @@ rtsPackageArgs = package rts ? do
, if not (null libdwIncludeDir) then arg ("--extra-include-dirs="++libdwIncludeDir) else mempty
, if not (null libnumaLibraryDir) then arg ("--extra-lib-dirs="++libnumaLibraryDir) else mempty
, if not (null libnumaIncludeDir) then arg ("--extra-include-dirs="++libnumaIncludeDir) else mempty
+ , notM (flag UseSystemFfi) ? arg ("--extra-include-dirs=" ++ path)
+ , if not (null ffiIncludeDir) then arg ("--extra-lib-dirs="++ffiIncludeDir) else mempty
]
, builder (Cc FindCDependencies) ? cArgs
, builder (Ghc CompileCWithGhc) ? map ("-optc" ++) <$> cArgs
diff --git a/libraries/ghci/ghci.cabal.in b/libraries/ghci/ghci.cabal.in
index e9922ab24a..cc56fcbc77 100644
--- a/libraries/ghci/ghci.cabal.in
+++ b/libraries/ghci/ghci.cabal.in
@@ -58,7 +58,7 @@ library
GHCi.StaticPtrTable
GHCi.TH
- include-dirs: @FFIIncludeDir@
+ extra-libraries: ffi
exposed-modules:
GHCi.BreakArray
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 086a9147f2..b2c056bc07 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -181,10 +181,6 @@ else
GhcWithInterpreter=$(if $(findstring YES,$(DYNAMIC_GHC_PROGRAMS)),YES,NO)
endif
-# Whether to use libffi for adjustors (foreign import "wrapper") or
-# not. If we have built-in support (rts/Adjustor.c) then we use that,
-# otherwise we fall back on libffi, which is slightly slower.
-ArchHasAdjustorSupport = $(if $(findstring $(TargetArch_CPP),i386 x86_64),YES,NO)
ifeq "$(ArchHasAdjustorSupport)" "YES"
UseLibFFIForAdjustors=NO
else