Re: Patch from George to fix libnettle build on mips64el (was Fwd: "undefined reference to `__builtin_bswap64'" on mips64el/loongson)

2019-12-04 Thread manphiz
On 12/3/19 10:28 PM, Antoine Jacoutot wrote:
> On Tue, Dec 03, 2019 at 05:58:52PM -0800, manp...@gmail.com wrote:
>> On 12/3/19 6:42 AM, Stuart Henderson wrote:
>>> On 2019/12/03 00:03, manp...@gmail.com wrote:
 Hi Ports maintainers,

 Just to forward George's patch to fix libnettle build on mips64el in
 case it's buried in a misleading title.
>>>
>>> It's best to include the relevant maintainer if you're going to ask about
>>> a port. Sometimes it makes sense to CC ports@ as well but definitely include
>>> the maintainer.
>>>
>>> See "make show=MAINTAINER" or "pkg_info ".
>>>
>>
>> Thanks for the tip Stuart!  I'm adding the maintainer Antoine and CCing
>> George.  The patch is reattached here.
> 
> Looks fine, ok.
> 

Thanks Antoine!  Can you also help commit it (I don't have permission)?

>> Index: Makefile
>> ===
>> RCS file: /cvs/ports/security/libnettle/Makefile,v
>> retrieving revision 1.24
>> diff -u -p -r1.24 Makefile
>> --- Makefile 29 Jun 2019 22:26:25 -  1.24
>> +++ Makefile 30 Nov 2019 20:38:46 -
>> @@ -4,6 +4,7 @@ COMMENT= cryptographic library
>>  
>>  DISTNAME=   nettle-3.5.1
>>  PKGNAME=lib${DISTNAME}
>> +REVISION=   0
>>  
>>  SHARED_LIBS +=  hogweed   3.0 # 6.5
>>  SHARED_LIBS +=  nettle5.0 # 4.5
>> Index: patches/patch-configure
>> ===
>> RCS file: /cvs/ports/security/libnettle/patches/patch-configure,v
>> retrieving revision 1.8
>> diff -u -p -r1.8 patch-configure
>> --- patches/patch-configure  29 Jun 2019 22:26:25 -  1.8
>> +++ patches/patch-configure  30 Nov 2019 20:38:46 -
>> @@ -1,5 +1,8 @@
>>  $OpenBSD: patch-configure,v 1.8 2019/06/29 22:26:25 ajacoutot Exp $
>>  
>> +The test for __builtin_bswap64 must fail if the linker can't find the
>> +symbol.  We need this for base-gcc on little endian, like mips64el.
>> +
>>  Fix relocation errors on (at least) sparc64.
>>  
>>  We don't want extra debug flags in regular builds.
>> @@ -7,6 +10,15 @@ We don't want extra debug flags in regul
>>  Index: configure
>>  --- configure.orig
>>  +++ configure
>> +@@ -6062,7 +6062,7 @@ uint64_t y = __builtin_bswap64(x);
>> +   return 0;
>> + }
>> + _ACEOF
>> +-if ac_fn_c_try_compile "$LINENO"; then :
>> ++if ac_fn_c_try_link "$LINENO"; then :
>> +   nettle_cv_c_builtin_bswap64=yes
>> + else
>> +   nettle_cv_c_builtin_bswap64=no
>>  @@ -6720,6 +6720,7 @@ else
>>  bsdi4.*)CCPIC="-fPIC" ;;
>>  bsdi*)  CCPIC="" ;;
> 
> 
> 
> 
> 



signature.asc
Description: OpenPGP digital signature


Re: Patch from George to fix libnettle build on mips64el (was Fwd: "undefined reference to `__builtin_bswap64'" on mips64el/loongson)

2019-12-03 Thread Antoine Jacoutot
On Tue, Dec 03, 2019 at 05:58:52PM -0800, manp...@gmail.com wrote:
> On 12/3/19 6:42 AM, Stuart Henderson wrote:
> > On 2019/12/03 00:03, manp...@gmail.com wrote:
> >> Hi Ports maintainers,
> >>
> >> Just to forward George's patch to fix libnettle build on mips64el in
> >> case it's buried in a misleading title.
> > 
> > It's best to include the relevant maintainer if you're going to ask about
> > a port. Sometimes it makes sense to CC ports@ as well but definitely include
> > the maintainer.
> > 
> > See "make show=MAINTAINER" or "pkg_info ".
> > 
> 
> Thanks for the tip Stuart!  I'm adding the maintainer Antoine and CCing
> George.  The patch is reattached here.

Looks fine, ok.

> Index: Makefile
> ===
> RCS file: /cvs/ports/security/libnettle/Makefile,v
> retrieving revision 1.24
> diff -u -p -r1.24 Makefile
> --- Makefile  29 Jun 2019 22:26:25 -  1.24
> +++ Makefile  30 Nov 2019 20:38:46 -
> @@ -4,6 +4,7 @@ COMMENT=  cryptographic library
>  
>  DISTNAME=nettle-3.5.1
>  PKGNAME= lib${DISTNAME}
> +REVISION=0
>  
>  SHARED_LIBS +=  hogweed   3.0 # 6.5
>  SHARED_LIBS +=  nettle5.0 # 4.5
> Index: patches/patch-configure
> ===
> RCS file: /cvs/ports/security/libnettle/patches/patch-configure,v
> retrieving revision 1.8
> diff -u -p -r1.8 patch-configure
> --- patches/patch-configure   29 Jun 2019 22:26:25 -  1.8
> +++ patches/patch-configure   30 Nov 2019 20:38:46 -
> @@ -1,5 +1,8 @@
>  $OpenBSD: patch-configure,v 1.8 2019/06/29 22:26:25 ajacoutot Exp $
>  
> +The test for __builtin_bswap64 must fail if the linker can't find the
> +symbol.  We need this for base-gcc on little endian, like mips64el.
> +
>  Fix relocation errors on (at least) sparc64.
>  
>  We don't want extra debug flags in regular builds.
> @@ -7,6 +10,15 @@ We don't want extra debug flags in regul
>  Index: configure
>  --- configure.orig
>  +++ configure
> +@@ -6062,7 +6062,7 @@ uint64_t y = __builtin_bswap64(x);
> +   return 0;
> + }
> + _ACEOF
> +-if ac_fn_c_try_compile "$LINENO"; then :
> ++if ac_fn_c_try_link "$LINENO"; then :
> +   nettle_cv_c_builtin_bswap64=yes
> + else
> +   nettle_cv_c_builtin_bswap64=no
>  @@ -6720,6 +6720,7 @@ else
>   bsdi4.*)CCPIC="-fPIC" ;;
>   bsdi*)  CCPIC="" ;;





-- 
Antoine



Re: Patch from George to fix libnettle build on mips64el (was Fwd: "undefined reference to `__builtin_bswap64'" on mips64el/loongson)

2019-12-03 Thread manphiz
On 12/3/19 6:42 AM, Stuart Henderson wrote:
> On 2019/12/03 00:03, manp...@gmail.com wrote:
>> Hi Ports maintainers,
>>
>> Just to forward George's patch to fix libnettle build on mips64el in
>> case it's buried in a misleading title.
> 
> It's best to include the relevant maintainer if you're going to ask about
> a port. Sometimes it makes sense to CC ports@ as well but definitely include
> the maintainer.
> 
> See "make show=MAINTAINER" or "pkg_info ".
> 

Thanks for the tip Stuart!  I'm adding the maintainer Antoine and CCing
George.  The patch is reattached here.
Index: Makefile
===
RCS file: /cvs/ports/security/libnettle/Makefile,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile
--- Makefile29 Jun 2019 22:26:25 -  1.24
+++ Makefile30 Nov 2019 20:38:46 -
@@ -4,6 +4,7 @@ COMMENT=cryptographic library
 
 DISTNAME=  nettle-3.5.1
 PKGNAME=   lib${DISTNAME}
+REVISION=  0
 
 SHARED_LIBS +=  hogweed   3.0 # 6.5
 SHARED_LIBS +=  nettle5.0 # 4.5
Index: patches/patch-configure
===
RCS file: /cvs/ports/security/libnettle/patches/patch-configure,v
retrieving revision 1.8
diff -u -p -r1.8 patch-configure
--- patches/patch-configure 29 Jun 2019 22:26:25 -  1.8
+++ patches/patch-configure 30 Nov 2019 20:38:46 -
@@ -1,5 +1,8 @@
 $OpenBSD: patch-configure,v 1.8 2019/06/29 22:26:25 ajacoutot Exp $
 
+The test for __builtin_bswap64 must fail if the linker can't find the
+symbol.  We need this for base-gcc on little endian, like mips64el.
+
 Fix relocation errors on (at least) sparc64.
 
 We don't want extra debug flags in regular builds.
@@ -7,6 +10,15 @@ We don't want extra debug flags in regul
 Index: configure
 --- configure.orig
 +++ configure
+@@ -6062,7 +6062,7 @@ uint64_t y = __builtin_bswap64(x);
+   return 0;
+ }
+ _ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
++if ac_fn_c_try_link "$LINENO"; then :
+   nettle_cv_c_builtin_bswap64=yes
+ else
+   nettle_cv_c_builtin_bswap64=no
 @@ -6720,6 +6720,7 @@ else
bsdi4.*)CCPIC="-fPIC" ;;
bsdi*)  CCPIC="" ;;


signature.asc
Description: OpenPGP digital signature


Re: Patch from George to fix libnettle build on mips64el (was Fwd: "undefined reference to `__builtin_bswap64'" on mips64el/loongson)

2019-12-03 Thread Stuart Henderson
On 2019/12/03 00:03, manp...@gmail.com wrote:
> Hi Ports maintainers,
> 
> Just to forward George's patch to fix libnettle build on mips64el in
> case it's buried in a misleading title.

It's best to include the relevant maintainer if you're going to ask about
a port. Sometimes it makes sense to CC ports@ as well but definitely include
the maintainer.

See "make show=MAINTAINER" or "pkg_info ".



Patch from George to fix libnettle build on mips64el (was Fwd: "undefined reference to `__builtin_bswap64'" on mips64el/loongson)

2019-12-03 Thread manphiz
Hi Ports maintainers,

Just to forward George's patch to fix libnettle build on mips64el in
case it's buried in a misleading title.

Thanks!


 Forwarded Message 
Subject: Re: "undefined reference to `__builtin_bswap64'" on
mips64el/loongson
Date: Sat, 30 Nov 2019 16:26:40 -0500
From: George Koehler 
To: manp...@gmail.com
CC: ports@openbsd.org

On Sat, 30 Nov 2019 01:10:56 -0800
manp...@gmail.com wrote:

> Hi OpenBSD ports maintainers,
> 
> I'm having trouble building security/libnettle on mips64el/loongson
> which is caused by missing symbol of "__builtin_bswap64" when linking.
> It looks like this symbol is introduced since GCC 4.3[1], while mips64el
> ships with GCC 4.2.1.  It's interesting because I can compile with the
> symbol but cannot link.  Would like to hear from the ports maintainers'
> opinion on how to solve this issue?

Bad luck!  libnettle uses __builtin_bswap64 only on little-endian
platforms.  My big-endian powerpc/macppc also uses base-gcc 4.2.1 but
can use the powerpc snapshot package of libnettle.

The configure test for __builtin_bswap64 is wrong.  It is a compile
test, but you got a link error, not a compile error.  Here is a diff
to do a link test.  On my powerpc with base-gcc, the compile test
passed but the link test fails.  The regression tests look good:
"make test" reports "All 98 tests passed", "All 3 tests passed".

For big endian, the test for __builtin_bswap64 should have no effect.
For little endian, the failing test should disable a special case for
block_size == 16 in WRKSRC/ctr.c ctr_crypt().

Does this diff fix the problem on mips64el/longsoon?

Index: Makefile
===
RCS file: /cvs/ports/security/libnettle/Makefile,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile
--- Makefile29 Jun 2019 22:26:25 -  1.24
+++ Makefile30 Nov 2019 20:38:46 -
@@ -4,6 +4,7 @@ COMMENT=cryptographic library
  DISTNAME= nettle-3.5.1
 PKGNAME=   lib${DISTNAME}
+REVISION=  0
  SHARED_LIBS +=  hogweed   3.0 # 6.5
 SHARED_LIBS +=  nettle5.0 # 4.5
Index: patches/patch-configure
===
RCS file: /cvs/ports/security/libnettle/patches/patch-configure,v
retrieving revision 1.8
diff -u -p -r1.8 patch-configure
--- patches/patch-configure 29 Jun 2019 22:26:25 -  1.8
+++ patches/patch-configure 30 Nov 2019 20:38:46 -
@@ -1,5 +1,8 @@
 $OpenBSD: patch-configure,v 1.8 2019/06/29 22:26:25 ajacoutot Exp $
 +The test for __builtin_bswap64 must fail if the linker can't find the
+symbol.  We need this for base-gcc on little endian, like mips64el.
+
 Fix relocation errors on (at least) sparc64.
  We don't want extra debug flags in regular builds.
@@ -7,6 +10,15 @@ We don't want extra debug flags in regul
 Index: configure
 --- configure.orig
 +++ configure
+@@ -6062,7 +6062,7 @@ uint64_t y = __builtin_bswap64(x);
+   return 0;
+ }
+ _ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
++if ac_fn_c_try_link "$LINENO"; then :
+   nettle_cv_c_builtin_bswap64=yes
+ else
+   nettle_cv_c_builtin_bswap64=no
 @@ -6720,6 +6720,7 @@ else
bsdi4.*)CCPIC="-fPIC" ;;
bsdi*)  CCPIC="" ;;



signature.asc
Description: OpenPGP digital signature