From f42b821489761159a7421a176b8dd8e6d51672c9 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 21 May 2015 08:05:57 +0200 Subject: [PATCH] build: only uses -pie when linking programs We can't rely on libtool to remove the flag on libraries. --- configure.ac | 7 +++++-- src/client/Makefile.am | 1 + src/daemon/Makefile.am | 1 + tests/Makefile.am | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 196829df..616a6d2b 100644 --- a/configure.ac +++ b/configure.ac @@ -67,6 +67,7 @@ DX_PS_FEATURE(OFF) DX_INIT_DOXYGEN([lldpd], [doxygen.cfg], [doxygen]) # Check some compiler flags +AX_CFLAGS_GCC_OPTION([-Wunknown-warning-option], [LLDP_CFLAGS]) AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option], [LLDP_CFLAGS]) AX_CFLAGS_GCC_OPTION([-fdiagnostics-color=auto], [LLDP_CFLAGS]) AX_CFLAGS_GCC_OPTION([-pipe], [LLDP_CFLAGS]) @@ -98,7 +99,8 @@ if test x"$hardening" != x"no"; then AX_CFLAGS_GCC_OPTION([-fstack-protector-strong], [LLDP_CFLAGS]) AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2], [LLDP_CPPFLAGS]) AX_CFLAGS_GCC_OPTION([-fPIE], [LLDP_CFLAGS]) - AX_LDFLAGS_OPTION([-fPIE -pie], [LLDP_LDFLAGS]) + AX_LDFLAGS_OPTION([-fPIE -pie], [LLDP_BIN_LDFLAGS], + [AX_LDFLAGS_OPTION([-fPIE -Wl,-pie], [LLDP_BIN_LDFLAGS])]) fi # OS @@ -299,6 +301,7 @@ lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [ AC_SUBST([LLDP_CFLAGS]) AC_SUBST([LLDP_CPPFLAGS]) AC_SUBST([LLDP_LDFLAGS]) +AC_SUBST([LLDP_BIN_LDFLAGS]) AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"]) AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"]) AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"]) @@ -321,7 +324,7 @@ cat <