Merge pull request #540 from smcv/default-symver
build: Add a symbol version to all exported symbols
This commit is contained in:
commit
73ccec0601
@ -107,6 +107,9 @@ if (HAS_NO_FORMAT_TRUNCATION)
|
|||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format-truncation")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format-truncation")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include (CheckSymbolExists)
|
||||||
|
check_symbol_exists("__GLIBC__" "stdlib.h" LIBC_IS_GLIBC)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# Turn off Microsofts "security" warnings.
|
# Turn off Microsofts "security" warnings.
|
||||||
add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" )
|
add_definitions( "/W3 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo" )
|
||||||
@ -366,6 +369,10 @@ if(JANSSON_BUILD_SHARED_LIBS)
|
|||||||
${JANSSON_HDR_PUBLIC}
|
${JANSSON_HDR_PUBLIC}
|
||||||
src/jansson.def)
|
src/jansson.def)
|
||||||
|
|
||||||
|
if (LIBC_IS_GLIBC)
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--default-symver")
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(jansson PROPERTIES
|
set_target_properties(jansson PROPERTIES
|
||||||
VERSION ${JANSSON_VERSION}
|
VERSION ${JANSSON_VERSION}
|
||||||
SOVERSION ${JANSSON_SOVERSION})
|
SOVERSION ${JANSSON_SOVERSION})
|
||||||
|
@ -137,6 +137,10 @@ fi
|
|||||||
AS_IF([test "x$with_Bsymbolic" = "xyes"], [JSON_BSYMBOLIC_LDFLAGS=-Wl[,]-Bsymbolic-functions])
|
AS_IF([test "x$with_Bsymbolic" = "xyes"], [JSON_BSYMBOLIC_LDFLAGS=-Wl[,]-Bsymbolic-functions])
|
||||||
AC_SUBST(JSON_BSYMBOLIC_LDFLAGS)
|
AC_SUBST(JSON_BSYMBOLIC_LDFLAGS)
|
||||||
|
|
||||||
|
# Enable symbol versioning on GNU libc
|
||||||
|
JSON_SYMVER_LDFLAGS=
|
||||||
|
AC_CHECK_DECL([__GLIBC__], [JSON_SYMVER_LDFLAGS=-Wl,--default-symver])
|
||||||
|
AC_SUBST([JSON_SYMVER_LDFLAGS])
|
||||||
|
|
||||||
AC_ARG_ENABLE([ossfuzzers],
|
AC_ARG_ENABLE([ossfuzzers],
|
||||||
[AS_HELP_STRING([--enable-ossfuzzers],
|
[AS_HELP_STRING([--enable-ossfuzzers],
|
||||||
|
@ -26,4 +26,5 @@ libjansson_la_LDFLAGS = \
|
|||||||
-no-undefined \
|
-no-undefined \
|
||||||
-export-symbols-regex '^json_|^jansson_' \
|
-export-symbols-regex '^json_|^jansson_' \
|
||||||
-version-info 17:0:13 \
|
-version-info 17:0:13 \
|
||||||
|
@JSON_SYMVER_LDFLAGS@ \
|
||||||
@JSON_BSYMBOLIC_LDFLAGS@
|
@JSON_BSYMBOLIC_LDFLAGS@
|
||||||
|
Loading…
Reference in New Issue
Block a user