GnuTLS static library wrongly exports private symbols

Description of problem:

GNU Emacs cannot be linked to GnuTLS statically, because GnuTLS mistakenly exports the private symbols hash_string and hash_lookup, and Emacs wants to use these symbols for its own purposes.

This bug was reported to Emacs as Bug#77476 [PATCH] Rename various hash functions to avoid clashing with GnuTLS and I installed a workaround by renaming Emacs functions, but the original problem really should be fixed in GnuTLS.

Version of gnutls used:

3.8.9

Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)

Fedora 42

How reproducible:

wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.9.tar.xz
xz -d <gnutls-3.8.9.tar.xz | tar xf -
(cd gnutls-3.8.9
 ./configure --prefix=/tmp/prefix 'CC=gcc -std=gnu17'
 make install)
wget https://ftp.gnu.org/pub/gnu/emacs/emacs-30.1.tar.xz
xz -d <emacs-30.1.tar.xz | tar xf -
cd emacs-30.1
./configure LIBGNUTLS_LIBS=/tmp/prefix/lib/libgnutls.a
make

Actual results:

The build fails as follows:

...
  CCLD     temacs                                                                                                                                             
/usr/bin/ld: /tmp/prefix/lib/libgnutls.a(libgnu_la-hash.o): in function `hash_lookup':
/home/eggert/src/gnu/gnutls/gl/hash.c:243: multiple definition of `hash_lookup'; fns.o:/home/eggert/junk/emacs-30.1/src/fns.c:5109: first defined here
/usr/bin/ld: /tmp/prefix/lib/libgnutls.a(libgnu_la-hash.o): in function `hash_string':
/home/eggert/src/gnu/gnutls/gl/hash.c:386: multiple definition of `hash_string'; fns.o:/home/eggert/junk/emacs-30.1/src/fns.c:5348: first defined here
...

Expected results:

The build should work.

I suggest that GnuTLS should use Gnulib's lib-symbol-visibility module to fix the problem.