Skip to content

Commit 0695f8b

Browse files
harish-24mpe
authored andcommitted
selftests/powerpc: Handle Makefile for unrecognized option
On older distributions like Sles12SP5 gcc does not recognize -no-pie option making the powerpc selftests build to fail Fixes the following: gcc: error: unrecognized command line option ‘-no-pie’ Signed-off-by: Harish <harish@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20191113094219.14946-1-harish@linux.ibm.com
1 parent 3df1911 commit 0695f8b

File tree

1 file changed

+6
-1
lines changed
  • tools/testing/selftests/powerpc/pmu/ebb

1 file changed

+6
-1
lines changed

tools/testing/selftests/powerpc/pmu/ebb/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# SPDX-License-Identifier: GPL-2.0
2+
include ../../../../../../scripts/Kbuild.include
3+
24
noarg:
35
$(MAKE) -C ../../
46

57
# The EBB handler is 64-bit code and everything links against it
68
CFLAGS += -m64
79

810
# Toolchains may build PIE by default which breaks the assembly
9-
LDFLAGS += -no-pie
11+
no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \
12+
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)
13+
14+
LDFLAGS += $(no-pie-option)
1015

1116
TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test \
1217
cycles_with_freeze_test pmc56_overflow_test \

0 commit comments

Comments
 (0)