merge: branch 'lr/ld-gc'

Make NetworkManager small again!
This commit is contained in:
Lubomir Rintel 2016-05-19 11:30:57 +02:00
commit 71fa3cb810
5 changed files with 41 additions and 25 deletions

View file

@ -35,6 +35,10 @@ AC_PROG_CXX
AC_PROG_LN_S
# Prefer gcc-* variants; the ones libtool would choose don't work with LTO
AC_CHECK_TOOLS(AR, [gcc-ar ar], false)
AC_CHECK_TOOLS(RANLIB, [gcc-ranlib ranlib], :)
dnl Initialize libtool
LT_PREREQ([2.2])
LT_INIT([disable-static])
@ -931,6 +935,16 @@ else
enable_lto='no'
fi
AC_ARG_ENABLE(ld-gc, AS_HELP_STRING([--enable-ld-gc], [Enable garbage collection of unused symbols on linking (default: auto)]))
if (test "${enable_ld_gc}" != "no"); then
NM_COMPILER_FLAG([-fdata-sections -ffunction-sections -Wl,--gc-sections], [enable_ld_gc='yes'], [
if (test "${enable_ld_gc}" = "yes"); then
AC_MSG_ERROR([Unused symbol eviction requested but not supported.])
else
enable_ld_gc='no'
fi
])
fi
dnl -------------------------
dnl Vala bindings
@ -1190,5 +1204,6 @@ echo " more-asserts: $more_asserts"
echo " valgrind: $with_valgrind $with_valgrind_suppressions"
echo " code coverage: $enable_code_coverage"
echo " LTO: $enable_lto"
echo " linker garbage collection: $enable_ld_gc"
echo " JSON validation: $enable_json_validation"
echo

View file

@ -1,17 +1,17 @@
dnl Check whether a particular compiler flag works with code provided,
dnl disable it in CFLAGS if the check fails.
AC_DEFUN([NM_COMPILER_WARNING], [
AC_DEFUN([_NM_COMPILER_FLAG], [
CFLAGS_SAVED="$CFLAGS"
CFLAGS="$CFLAGS -Werror -W$1"
AC_MSG_CHECKING(whether -W$1 works)
CFLAGS="$CFLAGS $GLIB_CFLAGS -Werror $1"
AC_MSG_CHECKING([whether $1 works as expected])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[$2]])], [
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS_SAVED -W$1"
CFLAGS="$CFLAGS_SAVED"
$3
],[
AC_MSG_RESULT(no)
CFLAGS="$CFLAGS_SAVED -Wno-$1"
CFLAGS="$CFLAGS_SAVED"
$4
])
],[
AC_MSG_RESULT(not supported)
@ -19,6 +19,21 @@ AC_DEFUN([NM_COMPILER_WARNING], [
])
])
dnl Check whether a particular compiler flag is supported,
dnl add it to CFLAGS if it is
AC_DEFUN([NM_COMPILER_FLAG], [
_NM_COMPILER_FLAG([$1], [], [
CFLAGS="$CFLAGS $1"
$2
], [$3])
])
dnl Check whether a particular warning is not emitted with code provided,
dnl disable it in CFLAGS if the check fails.
AC_DEFUN([NM_COMPILER_WARNING], [
_NM_COMPILER_FLAG([-W$1], [$2], [CFLAGS="$CFLAGS -W$1"], [CFLAGS="$CFLAGS -Wno-$1"])
])
AC_DEFUN([NM_COMPILER_WARNINGS],
[AC_ARG_ENABLE(more-warnings,
AS_HELP_STRING([--enable-more-warnings], [Possible values: no/yes/error]),
@ -40,7 +55,6 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
dnl attach it to the CFLAGS.
NM_COMPILER_WARNING([unknown-warning-option], [])
CFLAGS_SAVED="$CFLAGS"
CFLAGS_MORE_WARNINGS="-Wall -std=gnu89"
if test "x$set_more_warnings" = xerror; then
@ -57,22 +71,11 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
-Wpointer-arith -Winit-self \
-Wmissing-include-dirs -Wno-pragmas; do
dnl GCC 4.4 does not warn when checking for -Wno-* flags (https://gcc.gnu.org/wiki/FAQ#wnowarning)
CFLAGS="-Werror $CFLAGS_MORE_WARNINGS $(printf '%s' "$option" | sed 's/^-Wno-/-W/') $CFLAGS_SAVED"
AC_MSG_CHECKING([whether compiler understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,
has_option=no,)
if test $has_option != no; then
CFLAGS_MORE_WARNINGS="$CFLAGS_MORE_WARNINGS $option"
fi
AC_MSG_RESULT($has_option)
unset has_option
_NM_COMPILER_FLAG([$(printf '%s' "$option" | sed 's/^-Wno-/-W/')], [],
[CFLAGS_MORE_WARNINGS="$CFLAGS_MORE_WARNINGS $option"], [])
done
unset option
CFLAGS="$CFLAGS_SAVED"
unset CFLAGS_SAVED
dnl Disable warnings triggered by known compiler problems
dnl https://bugzilla.gnome.org/show_bug.cgi?id=745821

View file

@ -1,6 +1,7 @@
{
global:
nm*;
nm_*;
nmp_*;
_nm*;
NM*;
_NM*;

View file

@ -49,8 +49,6 @@
/******************************************************************/
typedef struct _NMPlatform NMPlatform;
/* workaround for older libnl version, that does not define these flags. */
#ifndef IFA_F_MANAGETEMPADDR
#define IFA_F_MANAGETEMPADDR 0x100

View file

@ -94,7 +94,6 @@ typedef enum { /*< skip >*/
NMP_CACHE_ID_TYPE_MAX = __NMP_CACHE_ID_TYPE_MAX - 1,
} NMPCacheIdType;
typedef struct _NMPObject NMPObject;
typedef struct _NMPCacheId NMPCacheId;
struct _NMPCacheId {