Mercurial > octave
changeset 29238:cd6b616b36a8
Visibility: Compile with visibility attributes for Linux (patch #8919).
* bootstrap.conf: Add module lib-symbol-visibility.
* m4/acinclude.m4: Define macro for exporting symbols in each library for Linux.
* Makefile.am: Add visibility flag to compiler flags.
* oct-conf-post.in.h, build-aux/mk-octave-config-h.sh: Define visibility
attribute for Linux.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 16 Dec 2020 01:05:17 -0500 |
parents | 1af06a145d40 |
children | f6058c6e1b18 |
files | Makefile.am bootstrap.conf build-aux/mk-octave-config-h.sh m4/acinclude.m4 oct-conf-post.in.h |
diffstat | 5 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.am Tue Dec 29 18:31:46 2020 +0100 +++ b/Makefile.am Wed Dec 16 01:05:17 2020 -0500 @@ -46,11 +46,11 @@ # Fortran compiler flags. -AM_FFLAGS = ${FPICFLAG} @FFLAGS@ +AM_FFLAGS = ${FPICFLAG} @FFLAGS@ ${CFLAG_VISIBILITY} # C compiler flags. -AM_CFLAGS = ${CPICFLAG} ${XTRA_CFLAGS} ${WARN_CFLAGS} +AM_CFLAGS = ${CPICFLAG} ${XTRA_CFLAGS} ${WARN_CFLAGS} ${CFLAG_VISIBILITY} # ifeq (${INCLUDE_DEPS},no) # omit_deps = true; @@ -58,7 +58,7 @@ # C++ compiler flags. -AM_CXXFLAGS = ${CXXPICFLAG} ${XTRA_CXXFLAGS} ${WARN_CXXFLAGS} +AM_CXXFLAGS = ${CXXPICFLAG} ${XTRA_CXXFLAGS} ${WARN_CXXFLAGS} ${CFLAG_VISIBILITY} FFTW_XCPPFLAGS = @FFTW_XCPPFLAGS@ FFTW_XLDFLAGS = @FFTW_XLDFLAGS@
--- a/bootstrap.conf Tue Dec 29 18:31:46 2020 +0100 +++ b/bootstrap.conf Wed Dec 16 01:05:17 2020 -0500 @@ -59,6 +59,7 @@ intprops isatty largefile + lib-symbol-visibility link localcharset lstat
--- a/build-aux/mk-octave-config-h.sh Tue Dec 29 18:31:46 2020 +0100 +++ b/build-aux/mk-octave-config-h.sh Wed Dec 16 01:05:17 2020 -0500 @@ -187,7 +187,7 @@ # define OCTAVE_IMPORT __declspec(dllimport) # else /* All other compilers, at least for now. */ -# define OCTAVE_EXPORT +# define OCTAVE_EXPORT __attribute__ ((visibility ("default"))) # define OCTAVE_IMPORT # endif
--- a/m4/acinclude.m4 Tue Dec 29 18:31:46 2020 +0100 +++ b/m4/acinclude.m4 Wed Dec 16 01:05:17 2020 -0500 @@ -2990,6 +2990,11 @@ ;; *-*-linux* | *-*-gnu*) MKOCTFILE_DL_LDFLAGS="-shared -Wl,-Bsymbolic" + EXTERNAL_DLL_DEFS="-DEXTERNAL_DLL" + OCTAVE_DLL_DEFS="-DOCTAVE_DLL" + OCTINTERP_DLL_DEFS="-DOCTINTERP_DLL" + OCTGUI_DLL_DEFS="-DOCTGUI_DLL" + OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL" ;; i[[3456]]86-*-sco3.2v5*) SH_LDFLAGS=-G
--- a/oct-conf-post.in.h Tue Dec 29 18:31:46 2020 +0100 +++ b/oct-conf-post.in.h Wed Dec 16 01:05:17 2020 -0500 @@ -178,7 +178,7 @@ # define OCTAVE_IMPORT __declspec(dllimport) #else /* All other compilers, at least for now. */ -# define OCTAVE_EXPORT +# define OCTAVE_EXPORT __attribute__ ((visibility ("default"))) # define OCTAVE_IMPORT #endif