[unix] Use -fvisibility=hidden.
It is now widely recommended that ELF shared libraries hide symbols except those with explicit __attribute__((visibility("default"))). This is supported by all major compilers and should rather be an option in libtool. * builds/unix/configure.raw: Add -fvisibility=hidden to CFLAGS. * builds/unix/ftconfig.in, builds/vms/ftconfig.h, include/freetype/config/ftconfig.h (FT_EXPORT): Use visibility attribute.
This commit is contained in:
parent
036bdc0c9a
commit
f4a3255d45
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
2018-02-04 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
[unix] Use -fvisibility=hidden.
|
||||
|
||||
It is now widely recommended that ELF shared libraries hide symbols
|
||||
except those with explicit __attribute__((visibility("default"))).
|
||||
This is supported by all major compilers and should rather be an
|
||||
option in libtool.
|
||||
|
||||
* builds/unix/configure.raw: Add -fvisibility=hidden to CFLAGS.
|
||||
* builds/unix/ftconfig.in, builds/vms/ftconfig.h,
|
||||
include/freetype/config/ftconfig.h (FT_EXPORT): Use visibility
|
||||
attribute.
|
||||
|
||||
2018-01-27 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[truetype] Better protection against invalid VF data.
|
||||
|
@ -299,6 +299,18 @@ AC_SUBST([XX_CFLAGS])
|
||||
AC_SUBST([XX_ANSIFLAGS])
|
||||
|
||||
|
||||
# It is recommended that shared libraries hide symbols except those with
|
||||
# explicit __attribute__((visibility("default"))).
|
||||
#
|
||||
AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -fvisibility=hidden"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
|
||||
AC_MSG_RESULT(yes),
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
|
||||
# All library tests below try `pkg-config' first. If that fails, a function
|
||||
# from the library is tested in the traditional autoconf way (zlib, bzip2),
|
||||
# or a config script is called (libpng).
|
||||
|
@ -454,9 +454,9 @@ FT_BEGIN_HEADER
|
||||
#endif /* !FT_BASE_DEF */
|
||||
|
||||
|
||||
/* When compiling FreeType as a DLL, some systems/compilers need a */
|
||||
/* special attribute in front OR after the return type of function */
|
||||
/* declarations. */
|
||||
/* When compiling FreeType as a DLL or DSO with hidden visibility */
|
||||
/* some systems/compilers need a special attribute in front OR after */
|
||||
/* the return type of function declarations. */
|
||||
/* */
|
||||
/* Two macros are used within the FreeType source code to define */
|
||||
/* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
|
||||
@ -487,21 +487,28 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
#ifndef FT_EXPORT
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef FT2_BUILD_LIBRARY
|
||||
|
||||
#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) )
|
||||
#define FT_EXPORT( x ) __declspec( dllexport ) x
|
||||
#elif defined( __GNUC__ ) && __GNUC__ >= 4
|
||||
#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x
|
||||
#elif defined( __cplusplus )
|
||||
#define FT_EXPORT( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT( x ) extern x
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined( FT2_BUILD_LIBRARY ) && \
|
||||
( defined( _DLL ) || defined( DLL_EXPORT ) )
|
||||
#undef FT_EXPORT
|
||||
#define FT_EXPORT( x ) __declspec( dllexport ) x
|
||||
#elif defined( FT2_DLLIMPORT )
|
||||
#undef FT_EXPORT
|
||||
#else
|
||||
|
||||
#if defined( FT2_DLLIMPORT )
|
||||
#define FT_EXPORT( x ) __declspec( dllimport ) x
|
||||
#elif defined( __cplusplus )
|
||||
#define FT_EXPORT( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !FT_EXPORT */
|
||||
|
@ -406,9 +406,9 @@ FT_BEGIN_HEADER
|
||||
#endif /* !FT_BASE_DEF */
|
||||
|
||||
|
||||
/* When compiling FreeType as a DLL, some systems/compilers need a */
|
||||
/* special attribute in front OR after the return type of function */
|
||||
/* declarations. */
|
||||
/* When compiling FreeType as a DLL or DSO with hidden visibility */
|
||||
/* some systems/compilers need a special attribute in front OR after */
|
||||
/* the return type of function declarations. */
|
||||
/* */
|
||||
/* Two macros are used within the FreeType source code to define */
|
||||
/* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
|
||||
@ -439,21 +439,28 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
#ifndef FT_EXPORT
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef FT2_BUILD_LIBRARY
|
||||
|
||||
#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) )
|
||||
#define FT_EXPORT( x ) __declspec( dllexport ) x
|
||||
#elif defined( __GNUC__ ) && __GNUC__ >= 4
|
||||
#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x
|
||||
#elif defined( __cplusplus )
|
||||
#define FT_EXPORT( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT( x ) extern x
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined( FT2_BUILD_LIBRARY ) && \
|
||||
( defined( _DLL ) || defined( DLL_EXPORT ) )
|
||||
#undef FT_EXPORT
|
||||
#define FT_EXPORT( x ) __declspec( dllexport ) x
|
||||
#elif defined( FT2_DLLIMPORT )
|
||||
#undef FT_EXPORT
|
||||
#else
|
||||
|
||||
#if defined( FT2_DLLIMPORT )
|
||||
#define FT_EXPORT( x ) __declspec( dllimport ) x
|
||||
#elif defined( __cplusplus )
|
||||
#define FT_EXPORT( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !FT_EXPORT */
|
||||
|
@ -422,9 +422,9 @@ FT_BEGIN_HEADER
|
||||
#endif /* !FT_BASE_DEF */
|
||||
|
||||
|
||||
/* When compiling FreeType as a DLL, some systems/compilers need a */
|
||||
/* special attribute in front OR after the return type of function */
|
||||
/* declarations. */
|
||||
/* When compiling FreeType as a DLL or DSO with hidden visibility */
|
||||
/* some systems/compilers need a special attribute in front OR after */
|
||||
/* the return type of function declarations. */
|
||||
/* */
|
||||
/* Two macros are used within the FreeType source code to define */
|
||||
/* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
|
||||
@ -455,21 +455,28 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
#ifndef FT_EXPORT
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef FT2_BUILD_LIBRARY
|
||||
|
||||
#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) )
|
||||
#define FT_EXPORT( x ) __declspec( dllexport ) x
|
||||
#elif defined( __GNUC__ ) && __GNUC__ >= 4
|
||||
#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x
|
||||
#elif defined( __cplusplus )
|
||||
#define FT_EXPORT( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT( x ) extern x
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined( FT2_BUILD_LIBRARY ) && \
|
||||
( defined( _DLL ) || defined( DLL_EXPORT ) )
|
||||
#undef FT_EXPORT
|
||||
#define FT_EXPORT( x ) __declspec( dllexport ) x
|
||||
#elif defined( FT2_DLLIMPORT )
|
||||
#undef FT_EXPORT
|
||||
#else
|
||||
|
||||
#if defined( FT2_DLLIMPORT )
|
||||
#define FT_EXPORT( x ) __declspec( dllimport ) x
|
||||
#elif defined( __cplusplus )
|
||||
#define FT_EXPORT( x ) extern "C" x
|
||||
#else
|
||||
#define FT_EXPORT( x ) extern x
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !FT_EXPORT */
|
||||
|
Loading…
Reference in New Issue
Block a user