[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getrandom not replaced
From: |
Po Lu |
Subject: |
Re: getrandom not replaced |
Date: |
Mon, 26 Dec 2022 11:36:42 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Paul Eggert <eggert@cs.ucla.edu> writes:
> I meant to use the compiler that is actually used to compile
> lib/getrandom.c. You can deduce this with something like this:
>
> rm lib/getrandom.o; cd lib; make V=1 getrandom.o
>
> and replace '-c -o getrandom.o' with '-E' in the resulting command.
>
>
>> #if 1
>> /* Fill a buffer with random bytes. */
>> # if 0
>> # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
>> # undef getrandom
>> # define getrandom rpl_getrandom
>> # endif
>> _GL_FUNCDECL_RPL (getrandom, ssize_t,
>> (void *buffer, size_t length, unsigned int flags)
>> _GL_ARG_NONNULL ((1)));
>> _GL_CXXALIAS_RPL (getrandom, ssize_t,
>> (void *buffer, size_t length, unsigned int flags));
>> # else
>> # if !0
>> _GL_FUNCDECL_SYS (getrandom, ssize_t,
>> (void *buffer, size_t length, unsigned int flags)
>> _GL_ARG_NONNULL ((1)));
>
> That last decl should have been reached and should have declared
> 'getrandom', but evidently it didn't. This is where the -E output
> would be helpful.
Thanks. I found the problem later on: $(top_srcdir)/lib/sys/random.h
was being included by the #include_next statement at the beginning,
leading to gnulib configuration on the host leaking through to the
out-of-tree cross-compile.
Sorry for the noise.