Fix: Tests: use -no-pie linker option only when available
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 10 Jul 2018 18:36:44 +0000 (14:36 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 16 Jul 2018 18:51:00 +0000 (14:51 -0400)
commitb75d311fbb53cb2f9c857349a6cd1877b411ff60
tree628af174ce468879233e18743ed54eb46c387def
parenta503e1ef71bfe98526469205fc2956cc65954019
Fix: Tests: use -no-pie linker option only when available

Issue
=====
To keep the userspace callstack tests simple, we want to prevent the
testapp to be linked as a Position Independent Execution (PIE) binary as
it is simpler to resolve the addresses of functions. Some distributions
now ship GCC built with the --enable-default-pie option which turns on
PIE by default. To prevent that, we use the -no-pie linker flag when
building the gen-syscall-events-callstack testapp. The issue is that
this flag is not available on older version of GCC thus triggering an
error when building the project.

    gcc: error: unrecognized command line option ‘-no-pie’

Solution
========
Test for the availability of the -no-pie option at the configure time
and enable it only when found. If the option is unavailable we assume
that the -pie option is not enabled by default thus removing the need to
prevent its usage with -no-pie in the first place.

Known drawbacks
===============
None

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
m4/ax_check_link_flag.m4 [new file with mode: 0644]
tests/utils/testapp/gen-syscall-events-callstack/Makefile.am
This page took 0.026614 seconds and 5 git commands to generate.