From 4738edeab5c361b3bd8aec2f6d9367df96e426eb Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 27 Oct 2018 11:06:16 +0200 Subject: [PATCH] symbol visibility=hidden only in release mode for shared library and codemodels --- configure.ac | 29 +++++++++++++++++++++-------- src/xspice/icm/GNUmakefile.in | 4 ++-- src/xspice/icm/makedefs.in | 1 + 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index de4432c54..156ad2b98 100644 --- a/configure.ac +++ b/configure.ac @@ -319,19 +319,24 @@ if test "x$with_ngshared" != x && test "x$with_ngshared" != xno ; then has_shcyg=true AC_CHECK_LIB([pthread], [pthread_create]) ;; + *) + AC_CHECK_LIB([pthread], [pthread_create]) + ;; + esac + if test "x$enable_debug" = xno; then + case $host_os in *solaris* ) if test "x$GCC" = xyes; then CFLAGS="$CFLAGS -fvisibility=hidden" else CFLAGS="$CFLAGS -xldscope=hidden" fi - AC_CHECK_LIB([pthread], [pthread_create]) ;; *) CFLAGS="$CFLAGS -fvisibility=hidden" - AC_CHECK_LIB([pthread], [pthread_create]) ;; - esac + esac + fi with_x=no with_windows=no @@ -931,6 +936,7 @@ AC_PROG_LEX # Add new code models to the build by pointing to them here. if test "x$enable_xspice" = xyes; then + VIS_CFLAGS="" AC_MSG_RESULT([X-Spice features included]) AC_DEFINE([XSPICE], [1], [The xspice enhancements]) case $host_os in @@ -953,23 +959,30 @@ if test "x$enable_xspice" = xyes; then *solaris* ) AC_DEFINE([IPC_UNIX_SOCKETS], [1], [Client-Server via socket.]) XSPICEDLLIBS="" - if test -z "$has_shared_module"; then - if test "x$GCC" = xyes; then - CFLAGS="$CFLAGS -fvisibility=hidden" + if test "x$with_ngshared" != xyes ; then + if test "x$enable_debug" = xno; then + if test "x$GCC" = xyes; then + VIS_CFLAGS="-fvisibility=hidden" + else + VIS_CFLAGS="-xldscope=hidden" + fi fi fi ;; * ) AC_DEFINE([IPC_UNIX_SOCKETS], [1], [Client-Server via socket.]) XSPICEDLLIBS="-ldl" - if test -z "$has_shared_module"; then - CFLAGS="$CFLAGS -fvisibility=hidden" + if test "x$with_ngshared" != xyes ; then + if test "x$enable_debug" = xno; then + VIS_CFLAGS="-fvisibility=hidden" + fi fi ;; esac XSPICEINIT="" AC_CHECK_FUNCS([modf]) AC_CHECK_HEADERS([libintl.h malloc.h]) + AC_SUBST([VIS_CFLAGS]) else XSPICEINIT="*" fi diff --git a/src/xspice/icm/GNUmakefile.in b/src/xspice/icm/GNUmakefile.in index 06dbab4bf..342d51807 100644 --- a/src/xspice/icm/GNUmakefile.in +++ b/src/xspice/icm/GNUmakefile.in @@ -92,7 +92,7 @@ cm-distclean : #----- $(cm)/$(cm).cm : $(cm-objs) - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(VIS_CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@ # "order-only" prerequisites # (info "(make) Prerequisite Types") @@ -134,7 +134,7 @@ define do-deps rm $$x.pp endef -COMPILE = $(CC) $(INCLUDES) -I$(cm) -I$(srcdir)/$(cm) $(CFLAGS) $(EXTRA_CFLAGS) +COMPILE = $(CC) $(INCLUDES) -I$(cm) -I$(srcdir)/$(cm) $(CFLAGS) $(EXTRA_CFLAGS) $(VIS_CFLAGS) $(cm)/dlmain.o : $(srcdir)/dlmain.c $(cm-descr) $(COMPILE) $(gen_pp) -o $@ -c $< diff --git a/src/xspice/icm/makedefs.in b/src/xspice/icm/makedefs.in index deab32e2c..e344507ba 100644 --- a/src/xspice/icm/makedefs.in +++ b/src/xspice/icm/makedefs.in @@ -15,6 +15,7 @@ uname = $(shell uname) # C compiler to use CC = @CC@ CFLAGS = @CFLAGS@ +VIS_CFLAGS = @VIS_CFLAGS@ EXEEXT = @EXEEXT@ BUILD_EXEEXT = @BUILD_EXEEXT@