summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-06-01 10:26:59 +0200
committerThomas Haller <thaller@redhat.com>2017-06-01 12:51:31 +0200
commit484d666485f481ea3fce447bfeec0b32a3b4f793 (patch)
tree463dbd9f4f5a8660dddd35f67fc49d83f1a0f723
parentafebdc795d90e9555b5004905955b267b81b9785 (diff)
downloadNetworkManager-484d666485f481ea3fce447bfeec0b32a3b4f793.tar.gz
build: fix nm binutils tool when building with LTO
When building with -flto, we need to use linker plugins. In case of binutils' nm, it means to prefer gcc-nm if available. Like for ranlib and ar, prefer gcc-nm. - replace AC_PATH_TOOL() by AC_CHECK_TOOLS(). That is consistent with what we do for ar,ranlib and suggested on bgo#783311. - instead of using the variable $BINUTILS_NM, replace it by $NM, which is more common according to bgo#783311. - Keep recognizing $BINUTILS_NM environment, which was introduced by commit 8bc88bcc7c. This is purely to keep previous build scripts working. Originally I named it "$BINUTILS_NM" because using $NM in NetworkManager seemed confusing. But well... https://bugs.gentoo.org/show_bug.cgi?id=620052 https://bugzilla.gnome.org/show_bug.cgi?id=782525 https://bugzilla.gnome.org/show_bug.cgi?id=783311
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac3
-rwxr-xr-xtools/create-exports-NetworkManager.sh2
3 files changed, 3 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index 73a6b0a5bd..72bd2418cb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1570,7 +1570,7 @@ $(src_libNetworkManagerTest_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
###############################################################################
src/NetworkManager.ver: src/libNetworkManager.la $(core_plugins)
- $(AM_V_GEN) BINUTILS_NM="$(BINUTILS_NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-make "$(srcdir)"
+ $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-make "$(srcdir)"
CLEANFILES += src/NetworkManager.ver
diff --git a/configure.ac b/configure.ac
index 1b6f3b6060..4080fd4837 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,7 @@ AC_PROG_MKDIR_P
# 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], :)
+AC_CHECK_TOOLS(NM, [$BINUTILS_NM gcc-nm nm])
dnl Initialize libtool
LT_PREREQ([2.2])
@@ -1199,8 +1200,6 @@ else
fi
AC_SUBST(NM_LOG_COMPILER, 'LOG_COMPILER = "$(top_srcdir)/tools/run-nm-test.sh" --called-from-make "$(LIBTOOL)" "$(with_valgrind)" "'"$with_valgrind_suppressions"'" --launch-dbus=auto')
-AC_PATH_TOOL(BINUTILS_NM, nm, nm)
-
AM_PATH_PYTHON([], [], [PYTHON=python])
AC_SUBST(PYTHON, [$PYTHON])
AC_DEFINE_UNQUOTED(TEST_NM_PYTHON, "$PYTHON", [Define python path for test binary])
diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh
index 85c239302e..439aa909f9 100755
--- a/tools/create-exports-NetworkManager.sh
+++ b/tools/create-exports-NetworkManager.sh
@@ -30,7 +30,7 @@ _sort() {
}
call_nm() {
- "${BINUTILS_NM:-${NM:-nm}}" "$1" |
+ "${NM:-nm}" "$1" |
sed -n 's/.* \([^ ]\) \([^ ]*\)$/\1 \2/p'
}