3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 04:32:37 +01:00

build: only enable backtrace(3) in maintainer mode

Using backtrace() is of no use when building with PIE (which most
distro compilers do by default) and prevents catching the coredump
for later retracing, which is needed since distros usually don't
install debug symbols by default either.

This patch thus only enables backtrace() when --enable-maintainer-mode
is passed and also tries to explicitly disable PIE.
This commit is contained in:
Andreas Henriksson 2018-11-24 03:27:04 +01:00 committed by Denis Kenzior
parent c4803d3b12
commit b6910e1210
4 changed files with 13 additions and 5 deletions

View File

@ -80,8 +80,16 @@ AC_DEFINE_UNQUOTED(WIRED_STORAGEDIR, "${wired_storagedir}",
AC_CHECK_HEADERS(linux/types.h linux/if_alg.h)
AC_CHECK_HEADERS_ONCE(execinfo.h)
AC_CHECK_LIB(execinfo, backtrace)
# In maintainer mode: try to build with application backtrace and disable PIE.
if (test "${USE_MAINTAINER_MODE}" = yes); then
AC_SEARCH_LIBS([backtrace], [execinfo],
[
AC_DEFINE([HAVE_BACKTRACE], [1],
[Define to 1 if you have backtrace(3).])
CFLAGS="$CFLAGS -fno-PIE"
LDFLAGS="$LDFLAGS -no-pie"
])
fi
AC_ARG_ENABLE([daemon], AC_HELP_STRING([--disable-daemon],
[don't install iwd system daemon]),

View File

@ -27,7 +27,7 @@
#define _GNU_SOURCE
#include <features.h>
#ifdef HAVE_EXECINFO_H
#ifdef HAVE_BACKTRACE
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_EXECINFO_H
#ifdef HAVE_BACKTRACE
void __iwd_backtrace_init();
void __iwd_backtrace_print(unsigned int offset);
#endif

View File

@ -445,7 +445,7 @@ int main(int argc, char *argv[])
if (debugopt)
l_debug_enable(debugopt);
#ifdef HAVE_EXECINFO_H
#ifdef HAVE_BACKTRACE
__iwd_backtrace_init();
#endif