bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] gc-random: Replace implementation with call to getrandom.


From: Bruno Haible
Subject: Re: [PATCH] gc-random: Replace implementation with call to getrandom.
Date: Wed, 20 Jan 2021 21:48:11 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

Hi Simon,

> Hi.  I re-read the discussion around getrandom vs gc-random and didn't
> see any point in keeping the duplicated code.  I believe the
> getrandom-approach is better than what was in gc-gnulib.c today, so this
> patch make it use that function.  I have pushed the patch below.

The change produces a link error when building for native Windows with MSVC:

libgnu.a(getrandom.obj) : error LNK2019: unresolved external symbol 
BCryptGenRandom referenced in function getrandom
test-gc.exe : fatal error LNK1120: 1 unresolved externals

This patch fixes it.


2021-01-20  Bruno Haible  <bruno@clisp.org>

        gc-random: Fix link error in tests.
        * modules/crypto/gc-random (Link): New section.
        * modules/crypto/gc-tests (Makefile.am): Link test-gc with
        $(LIB_GETRANDOM).

diff --git a/modules/crypto/gc-random b/modules/crypto/gc-random
index 8a5ae46..0e1bd76 100644
--- a/modules/crypto/gc-random
+++ b/modules/crypto/gc-random
@@ -15,6 +15,9 @@ Makefile.am:
 Include:
 "gc.h"
 
+Link:
+$(LIB_GETRANDOM)
+
 License:
 LGPLv2+
 
diff --git a/modules/crypto/gc-tests b/modules/crypto/gc-tests
index 7b153d1..5a16ba3 100644
--- a/modules/crypto/gc-tests
+++ b/modules/crypto/gc-tests
@@ -8,4 +8,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-gc
 check_PROGRAMS += test-gc
-test_gc_LDADD = $(LDADD) @LIB_CRYPTO@
+test_gc_LDADD = $(LDADD) @LIB_CRYPTO@ $(LIB_GETRANDOM)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]