From: Andreas Henriksson <andreas@fatal.se>
Date: Thu, 5 Jan 2023 17:19:44 +0100
Subject: [PATCH] Make byteReverse hidden

When building on big-endian systems, the byteReverse symbol becomes an
exported symbol of the library. This seems like it's not intended,
specially since there are no symbol on little-endian systems
(where byteReverse is just an empty define).

src/fcmd5.h already includes src/fcint.h which has a FcPrivate define to
hide symbols (when possible) that is already widely used, so use that.
(fontconfig/fcprivate.h defines FC_ATTRIBUTE_VISIBILITY_HIDDEN but it
seems basically unused.)

On debian package builds (on big-endian archs) this extra unexpected
symbol gets caught:

> [...]
> dh_makeshlibs -plibfontconfig1 -V"libfontconfig1 (>= 2.13)" --add-udeb="fontconfig-udeb" -- -c4
> dpkg-gensymbols: error: some new symbols appeared in the symbols file: see diff output below
> dpkg-gensymbols: warning: debian/libfontconfig1/DEBIAN/symbols doesn't match completely debian/libfontconfig1.symbols
> --- a/debian/libfontconfig1.symbols (libfontconfig1_2.14.1-2_sparc64)
> +++ b/debian/libfontconfig1.symbols	2023-01-05 14:08:46.386909057 +0000
> @@ -237,5 +237,6 @@
>   FcWeightFromOpenTypeDouble@Base 2.13.0
>   FcWeightToOpenType@Base 2.12.6
>   FcWeightToOpenTypeDouble@Base 2.13.0
> + byteReverse@Base 2.14.1-2
>   default_langs@Base 2.12.6
>   other_types@Base 2.12.6
> dh_makeshlibs: error: failing due to earlier errors
> make[1]: *** [debian/rules:16: override_dh_makeshlibs] Error 25
> make[1]: Leaving directory '/<<PKGBUILDDIR>>'
> make: *** [debian/rules:10: binary-arch] Error 2
> dpkg-buildpackage: error: fakeroot debian/rules binary-arch subprocess returned exit status 2

Forwarded: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/253
---
 src/fcmd5.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/fcmd5.h b/src/fcmd5.h
index 7e8a6e1..4e2047b 100644
--- a/src/fcmd5.h
+++ b/src/fcmd5.h
@@ -33,7 +33,7 @@ static void MD5Transform(FcChar32 buf[4], FcChar32 in[16]);
 /*
  * Note: this code is harmless on little-endian machines.
  */
-void
+FcPrivate void
 byteReverse (unsigned char *buf, unsigned longs)
 {
     FcChar32 t;
