pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/ghc7 Suppress linker warnings about compatibility...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f61d1b89b414
branches:  trunk
changeset: 646695:f61d1b89b414
user:      pho <pho%pkgsrc.org@localhost>
date:      Fri Feb 13 19:28:40 2015 +0000

description:
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:

 lang/ghc7/Makefile                                                 |   4 +-
 lang/ghc7/buildlink3.mk                                            |   4 +-
 lang/ghc7/distinfo                                                 |   4 +-
 lang/ghc7/patches/patch-libraries_time_Data_Time_Clock_CTimeval.hs |  33 ++++++++
 lang/ghc7/patches/patch-libraries_unix_System_Posix_Signals.hsc    |  39 ++++++++++
 5 files changed, 79 insertions(+), 5 deletions(-)

diffs (133 lines):

diff -r ff065f3aa588 -r f61d1b89b414 lang/ghc7/Makefile
--- a/lang/ghc7/Makefile        Fri Feb 13 19:26:49 2015 +0000
+++ b/lang/ghc7/Makefile        Fri Feb 13 19:28:40 2015 +0000
@@ -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 -r ff065f3aa588 -r f61d1b89b414 lang/ghc7/buildlink3.mk
--- a/lang/ghc7/buildlink3.mk   Fri Feb 13 19:26:49 2015 +0000
+++ b/lang/ghc7/buildlink3.mk   Fri Feb 13 19:28:40 2015 +0000
@@ -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 @@
 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 -r ff065f3aa588 -r f61d1b89b414 lang/ghc7/distinfo
--- a/lang/ghc7/distinfo        Fri Feb 13 19:26:49 2015 +0000
+++ b/lang/ghc7/distinfo        Fri Feb 13 19:28:40 2015 +0000
@@ -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_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 -r ff065f3aa588 -r f61d1b89b414 lang/ghc7/patches/patch-libraries_time_Data_Time_Clock_CTimeval.hs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/ghc7/patches/patch-libraries_time_Data_Time_Clock_CTimeval.hs        Fri Feb 13 19:28:40 2015 +0000
@@ -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 -r ff065f3aa588 -r f61d1b89b414 lang/ghc7/patches/patch-libraries_unix_System_Posix_Signals.hsc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/ghc7/patches/patch-libraries_unix_System_Posix_Signals.hsc   Fri Feb 13 19:28:40 2015 +0000
@@ -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
+ 



Home | Main Index | Thread Index | Old Index