tests: put -no-pie in LDFLAGS instead of CFLAGS
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 13 Feb 2020 15:36:04 +0000 (10:36 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 25 Mar 2020 19:19:12 +0000 (15:19 -0400)
When building with clang, we get:

    make[4]: Entering directory
    '/home/smarchi/build/lttng-tools-clang/tests/utils/testapp/gen-syscall-events-callstack'
      CC       gen-syscall-events-callstack.o
    clang: error: argument unused during compilation: '-no-pie'
    [-Werror,-Wunused-command-line-argument]

Indeed, -no-pie should be in LDFLAGS, not CFLAGS.

To make sure that Makefiles can use `AM_LDFLAGS += ...`, I have added
an AC_SUBST for AM_LDFLAGS in configure.ac.  This makes it so that if
we ever set AM_LDFLAGS for real in configure.ac, the Makefiles won't
inadvertently overwrite that value.

Change-Id: I7bad985bb135e50750917db6a928f2705a85b445
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
tests/utils/testapp/gen-syscall-events-callstack/Makefile.am

index 0614b270efcfa42e3c64856603a9143dd9998cc6..7b284593474f4d7109dbb57a2659c9e5a7ca1adf 100644 (file)
@@ -1059,6 +1059,10 @@ AM_CONDITIONAL([BUILD_LIB_UST_CONSUMER], [test x$build_lib_ust_consumer = xyes])
 AM_CFLAGS="${WARN_CFLAGS} -fno-strict-aliasing $PTHREAD_CFLAGS"
 AC_SUBST(AM_CFLAGS)
 
+# This is set even though it is empty, so Makefiles can do "AM_LDFLAGS += ...".
+AM_LDFLAGS=""
+AC_SUBST(AM_LDFLAGS)
+
 # The order in which the include folders are searched is important.
 # The top_builddir should always be searched first in the event that a build
 # time generated file is included. An example of this is the "version.i" file.
index 81800a50a01b3539afa4747d99f068d8b7a3654e..3b10c274d2fc6493b580aea940d0659cc207b34c 100644 (file)
@@ -10,7 +10,7 @@ AM_CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 #  available, we assume that the PIE is not enabled by default so we do not
 #  need to disable it.
 if LINKER_HAVE_NO_PIE_OPTION
-AM_CFLAGS += -no-pie
+AM_LDFLAGS += -no-pie
 endif
 
 noinst_PROGRAMS = gen-syscall-events-callstack
This page took 0.026697 seconds and 4 git commands to generate.