diff options
author | pho <pho@pkgsrc.org> | 2015-02-13 19:28:40 +0000 |
---|---|---|
committer | pho <pho@pkgsrc.org> | 2015-02-13 19:28:40 +0000 |
commit | 6d9b752e27e3cf62698dc3882721f3be20fa53cc (patch) | |
tree | 848d1b37d1800cee77ee5533ec17c82086518c5d /lang/ghc7 | |
parent | a5bde6769fbab26f00ca4326bfdd98e5fdd7a226 (diff) | |
download | pkgsrc-6d9b752e27e3cf62698dc3882721f3be20fa53cc.tar.gz |
Suppress linker warnings about compatibility syscall wrappers by using "capi" instead of "ccall"
In Haskell FFI, "ccall" is actually an interface to C ABI rather than
C API. That is, GHC generates direct references to the symbol even if
it's actually defined as a cpp macro or something like that, because
GHC knows nothing about those macros in foreign headers.
I will later send these patches to the upstream.
Diffstat (limited to 'lang/ghc7')
-rw-r--r-- | lang/ghc7/Makefile | 4 | ||||
-rw-r--r-- | lang/ghc7/buildlink3.mk | 4 | ||||
-rw-r--r-- | lang/ghc7/distinfo | 4 | ||||
-rw-r--r-- | lang/ghc7/patches/patch-libraries_time_Data_Time_Clock_CTimeval.hs | 33 | ||||
-rw-r--r-- | lang/ghc7/patches/patch-libraries_unix_System_Posix_Signals.hsc | 39 |
5 files changed, 79 insertions, 5 deletions
diff --git a/lang/ghc7/Makefile b/lang/ghc7/Makefile index 916be45bb0f..1dcc2365f86 100644 --- a/lang/ghc7/Makefile +++ b/lang/ghc7/Makefile @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.16 2015/02/11 13:38:42 pho Exp $ +# $NetBSD: Makefile,v 1.17 2015/02/13 19:28:40 pho Exp $ # ----------------------------------------------------------------------------- # Package metadata # DISTNAME= ghc-7.6.3-src PKGNAME= ${DISTNAME:S/-src$//} -PKGREVISION= 4 +PKGREVISION= 5 CATEGORIES= lang MASTER_SITES= http://www.haskell.org/ghc/dist/${PKGVERSION_NOREV}/ EXTRACT_SUFX= .tar.bz2 diff --git a/lang/ghc7/buildlink3.mk b/lang/ghc7/buildlink3.mk index a051c54a43c..41a3c9ef5eb 100644 --- a/lang/ghc7/buildlink3.mk +++ b/lang/ghc7/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.5 2015/02/13 19:26:49 pho Exp $ +# $NetBSD: buildlink3.mk,v 1.6 2015/02/13 19:28:40 pho Exp $ BUILDLINK_TREE+= ghc @@ -6,7 +6,7 @@ BUILDLINK_TREE+= ghc GHC_BUILDLINK3_MK:= BUILDLINK_API_DEPENDS.ghc+= ghc>=7.6.3 -BUILDLINK_ABI_DEPENDS.ghc+= ghc>=7.6.3nb4 +BUILDLINK_ABI_DEPENDS.ghc+= ghc>=7.6.3nb5 BUILDLINK_PKGSRCDIR.ghc?= ../../lang/ghc7 # On FreeBSD we need pkgsrc libiconv. See bootstrap.mk for details. diff --git a/lang/ghc7/distinfo b/lang/ghc7/distinfo index b1ffdceec8f..456f1d8f646 100644 --- a/lang/ghc7/distinfo +++ b/lang/ghc7/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.9 2015/02/11 09:38:08 pho Exp $ +$NetBSD: distinfo,v 1.10 2015/02/13 19:28:40 pho Exp $ SHA1 (ghc-7.6.3-boot-i386-unknown-freebsd.tar.xz) = aea6224f30aa52d9998f2c77f473902179f03b8c RMD160 (ghc-7.6.3-boot-i386-unknown-freebsd.tar.xz) = 39a588cac4a0411db45ef269fbe6a63c6cb428ee @@ -18,7 +18,9 @@ SHA1 (patch-libraries_base_configure.ac) = 4f160844cf0e0fe6c5825b9a0ad8287d6eaae SHA1 (patch-libraries_integer-gmp_configure.ac) = bc5ce3a6c39d681c413eb08b66e7287e39406fe0 SHA1 (patch-libraries_integer-simple_GHC_Integer.hs) = f079285bc489c194959b9bee2aa5c977ec77ae1e SHA1 (patch-libraries_integer-simple_GHC_Integer_Type.hs) = b3140e169726f78f6d3b4edcd4cc119b6f767bfa +SHA1 (patch-libraries_time_Data_Time_Clock_CTimeval.hs) = acc2a2255f53fbe55d91004f9d843ae249dad206 SHA1 (patch-libraries_unix_System_Posix_Files.hsc) = f2e0892f9ebb9d82ddaf71b014d9af33967848dc +SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 3fbb8cff53b342dd69efa186ad8b86718a101a79 SHA1 (patch-mk_config.mk.in) = 90a156f6c455d4b2c5d10fdf65b3a170dcfc4892 SHA1 (patch-rts_Linker.c) = 39d1ca7a856a3ec25e493e97832ef255562c0719 SHA1 (patch-rts_StgCRun.c) = 5d4010dc250af25db0b5b2717c510752f4813e73 diff --git a/lang/ghc7/patches/patch-libraries_time_Data_Time_Clock_CTimeval.hs b/lang/ghc7/patches/patch-libraries_time_Data_Time_Clock_CTimeval.hs new file mode 100644 index 00000000000..0ecd223b50f --- /dev/null +++ b/lang/ghc7/patches/patch-libraries_time_Data_Time_Clock_CTimeval.hs @@ -0,0 +1,33 @@ +$NetBSD: patch-libraries_time_Data_Time_Clock_CTimeval.hs,v 1.1 2015/02/13 19:28:40 pho Exp $ + +Suppress linker warnings about compatibility syscall wrappers by using +"capi" instead of "ccall". In Haskell FFI, "ccall" is actually an +interface to C ABI rather than C API. That is, GHC generates direct +references to the symbol even if it's actually defined as a cpp macro +or something like that, because GHC knows nothing about those macros +in foreign headers. Hence the following warnings: + + .../libHStime-1.4.0.1.a(CTimeval.o): In function `s1Kp_info': + (.text+0x2f): warning: warning: reference to compatibility + gettimeofday(); include <sys/time.h> to generate correct reference + +In other words, you can safely use "ccall" only when you are sure the +symbol you want to import is actually a symbol in the ABI sense, which +is not always the case for the POSIX API. + +--- libraries/time/Data/Time/Clock/CTimeval.hs.orig 2015-02-13 15:42:45.000000000 +0000 ++++ libraries/time/Data/Time/Clock/CTimeval.hs +@@ -1,3 +1,4 @@ ++{-# LANGUAGE CApiFFI #-} + -- #hide + module Data.Time.Clock.CTimeval where + +@@ -20,7 +21,7 @@ instance Storable CTimeval where + pokeElemOff (castPtr p) 0 s + pokeElemOff (castPtr p) 1 mus + +-foreign import ccall unsafe "time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt ++foreign import capi unsafe "sys/time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt + + -- | Get the current POSIX time from the system clock. + getCTimeval :: IO CTimeval diff --git a/lang/ghc7/patches/patch-libraries_unix_System_Posix_Signals.hsc b/lang/ghc7/patches/patch-libraries_unix_System_Posix_Signals.hsc new file mode 100644 index 00000000000..e53de007692 --- /dev/null +++ b/lang/ghc7/patches/patch-libraries_unix_System_Posix_Signals.hsc @@ -0,0 +1,39 @@ +$NetBSD: patch-libraries_unix_System_Posix_Signals.hsc,v 1.1 2015/02/13 19:28:40 pho Exp $ + +Suppress linker warnings about compatibility syscall wrappers by using +"capi" instead of "ccall". In Haskell FFI, "ccall" is actually an +interface to C ABI rather than C API. That is, GHC generates direct +references to the symbol even if it's actually defined as a cpp macro +or something like that, because GHC knows nothing about those macros +in foreign headers. Hence the following warnings: + + .../libHSunix-2.6.0.1.a(Signals.o): In function `s4SG_info': + (.text+0x3a3e): warning: warning: reference to compatibility + sigsuspend(); include <signal.h> for correct reference + .../libHSunix-2.6.0.1.a(Signals.o): In function `s5uV_info': + (.text+0x6adb): warning: warning: reference to compatibility + sigpending(); include <signal.h> for correct reference + +In other words, you can safely use "ccall" only when you are sure the +symbol you want to import is actually a symbol in the ABI sense, which +is not always the case for the POSIX API. + +--- libraries/unix/System/Posix/Signals.hsc.orig 2015-02-13 15:40:27.000000000 +0000 ++++ libraries/unix/System/Posix/Signals.hsc +@@ -598,7 +598,7 @@ awaitSignal maybe_sigset = do + -- XXX My manpage says it can also return EFAULT. And why is ignoring + -- EINTR the right thing to do? + +-foreign import ccall unsafe "sigsuspend" ++foreign import capi unsafe "signal.h sigsuspend" + c_sigsuspend :: Ptr CSigset -> IO CInt + #endif + +@@ -622,6 +622,6 @@ foreign import capi unsafe "signal.h sig + c_sigismember :: Ptr CSigset -> CInt -> IO CInt + #endif /* __HUGS__ */ + +-foreign import ccall unsafe "sigpending" ++foreign import capi unsafe "signal.h sigpending" + c_sigpending :: Ptr CSigset -> IO CInt + |