pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Replace random(), pg_erand48(), etc with a better PRNG API and a
Date: Sun, 28 Nov 2021 22:47:48 -0500
Message-ID: <1135295.1638157668@sss.pgh.pa.us> (raw)
In-Reply-To: <E1mrWUD-000235-Hq@gemulon.postgresql.org>
References: <E1mrWUD-000235-Hq@gemulon.postgresql.org>

Tom Lane <tgl@sss.pgh.pa.us> writes:
> Replace random(), pg_erand48(), etc with a better PRNG API and algorithm.

Hmm, fairywren doesn't like this [1]:

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 win32ver.o pg_test_fsync.o -L../../../src/port -L../../../src/common  -Wl,--allow-multiple-definition -Wl,--disable-auto-import  -L/c/prog/3p64/lib -L/c/prog/3p64/openssl/lib -Wl,--as-needed   -lpgcommon -lpgport -lssl -lcrypto -lz -lws2_32 -lm  -lws2_32 -o pg_test_fsync.exe
C:/tools/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: pg_test_fsync.o: in function `main':
C:/tools/msys64/home/pgrunner/bf/root/HEAD/pgsql.build/../pgsql/src/bin/pg_test_fsync/pg_test_fsync.c:121: undefined reference to `__imp_pg_global_prng_state'
collect2.exe: error: ld returned 1 exit status

I think what is going on here is that the compilation of pg_test_fsync.c
sees

extern PGDLLIMPORT pg_prng_state pg_global_prng_state;

and does something that's inappropriate when the variable is actually
coming from elsewhere in the same program.  If so, we could perhaps
fix it by doing

#ifdef FRONTEND
extern pg_prng_state pg_global_prng_state;
#else
extern PGDLLIMPORT pg_prng_state pg_global_prng_state;
#endif

Thoughts?

			regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=fairywren&dt=2021-11-29%2003%3A04%3A24





view thread (3+ messages)  latest in thread

Message-ID: <1135295.1638157668@sss.pgh.pa.us>
Permalink:  ../1135295.1638157668@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1135295.1638157668@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andrew@dunslane.net
  Subject: Re: pgsql: Replace random(), pg_erand48(), etc with a better PRNG API and a
  In-Reply-To: <1135295.1638157668@sss.pgh.pa.us>
  References: <E1mrWUD-000235-Hq@gemulon.postgresql.org> <1135295.1638157668@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox