From 42ebcbfee4260e1bb76c84cd6c57849354f3dfc0 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Wed, 16 Oct 2019 10:08:15 +0200 Subject: [PATCH 1/2] enable MP_PRIVATE (visibility=hidden) --- tommath_private.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tommath_private.h b/tommath_private.h index 3f4b23a..a6fd3e1 100644 --- a/tommath_private.h +++ b/tommath_private.h @@ -14,11 +14,9 @@ * * On Unix symbols can be marked as hidden if libtommath is compiled * as a shared object. By default, symbols are visible. - * As of now, this feature is opt-in via the MP_PRIVATE_SYMBOLS define. - * * On Win32 a .def file must be used to specify the exported symbols. */ -#if defined (MP_PRIVATE_SYMBOLS) && defined(__GNUC__) && __GNUC__ >= 4 +#if defined(__GNUC__) && __GNUC__ >= 4 # define MP_PRIVATE __attribute__ ((visibility ("hidden"))) #else # define MP_PRIVATE From 3eaa268e2182f4463ee614e2712be4ec5d77ed12 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Fri, 18 Oct 2019 10:00:09 +0200 Subject: [PATCH 2/2] Adapt mingw-build of libtommath.dll to respect internal symbols too --- makefile.mingw | 2 +- tommath_private.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/makefile.mingw b/makefile.mingw index 20b2ffe..0ff00bc 100644 --- a/makefile.mingw +++ b/makefile.mingw @@ -78,7 +78,7 @@ $(LIBMAIN_S): $(OBJECTS) #Create DLL + import library libtommath.dll.a $(LIBMAIN_D) $(LIBMAIN_I): $(OBJECTS) - $(CC) -s -shared -o $(LIBMAIN_D) $^ -Wl,--enable-auto-import,--export-all -Wl,--out-implib=$(LIBMAIN_I) $(LTM_LDFLAGS) + $(CC) -s -shared -o $(LIBMAIN_D) $^ tommath.def -Wl,--out-implib=$(LIBMAIN_I) $(LTM_LDFLAGS) $(STRIP) -S $(LIBMAIN_D) #Build test suite diff --git a/tommath_private.h b/tommath_private.h index a6fd3e1..d87ee9b 100644 --- a/tommath_private.h +++ b/tommath_private.h @@ -16,7 +16,7 @@ * as a shared object. By default, symbols are visible. * On Win32 a .def file must be used to specify the exported symbols. */ -#if defined(__GNUC__) && __GNUC__ >= 4 +#if defined(__GNUC__) && __GNUC__ >= 4 && !defined(_WIN32) # define MP_PRIVATE __attribute__ ((visibility ("hidden"))) #else # define MP_PRIVATE