This series fixes issues I encountered building and running the selftests on a Ubuntu Cosmic ppc64le system.
Joel Stanley (6): selftests: powerpc/ptrace: Make tests build selftests: powerpc/ptrace: Remove clean rule selftests: powerpc/ptrace: Fix linking against pthread selftests: powerpc/signal: Make tests build selftests: powerpc/signal: Fix signal_tm CFLAGS selftests: powerpc/pmu: Link ebb tests with -no-pie
tools/testing/selftests/powerpc/pmu/ebb/Makefile | 3 +++ tools/testing/selftests/powerpc/ptrace/Makefile | 11 ++++------- tools/testing/selftests/powerpc/signal/Makefile | 9 +++------ 3 files changed, 10 insertions(+), 13 deletions(-)
According to lib.mk, TEST_PROGS is for shell scripts. It appears we need to define the programs as TEST_GEN_PROGS to ensure they are built.
Signed-off-by: Joel Stanley joel@jms.id.au --- tools/testing/selftests/powerpc/ptrace/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile index 6ac71b629276..e9a3850aae86 100644 --- a/tools/testing/selftests/powerpc/ptrace/Makefile +++ b/tools/testing/selftests/powerpc/ptrace/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -TEST_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \ +TEST_GEN_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \ ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \ ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak ptrace-pkey core-pkey \ perf-hwbreak ptrace-syscall @@ -12,7 +12,7 @@ CFLAGS += -m64 -I../../../../../usr/include -I../tm -mhtm -fno-pie ptrace-pkey core-pkey: child.h ptrace-pkey core-pkey: LDLIBS += -pthread
-$(TEST_PROGS): ../harness.c ../utils.c ../lib/reg.S ptrace.h +$(TEST_GEN_PROGS): ../harness.c ../utils.c ../lib/reg.S ptrace.h
clean: - rm -f $(TEST_PROGS) *.o + rm -f $(TEST_GEN_PROGS) *.o
When running 'make ptrace':
make[1]: Entering directory 'tools/testing/selftests/powerpc/ptrace' Makefile:18: warning: overriding recipe for target 'clean' ../../lib.mk:137: warning: ignoring old recipe for target 'clean'
The rule is unnecessary as TEST_GEN_FILES are cleaned up by the rule in lib.mk.
Signed-off-by: Joel Stanley joel@jms.id.au --- tools/testing/selftests/powerpc/ptrace/Makefile | 3 --- 1 file changed, 3 deletions(-)
diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile index e9a3850aae86..58de6d4a0cf4 100644 --- a/tools/testing/selftests/powerpc/ptrace/Makefile +++ b/tools/testing/selftests/powerpc/ptrace/Makefile @@ -13,6 +13,3 @@ ptrace-pkey core-pkey: child.h ptrace-pkey core-pkey: LDLIBS += -pthread
$(TEST_GEN_PROGS): ../harness.c ../utils.c ../lib/reg.S ptrace.h - -clean: - rm -f $(TEST_GEN_PROGS) *.o
Some of the ptrace tests require -ptrace when linking:
/usr/bin/ld: /tmp/ccH32S9w.o: in function `init_child_sync': core-pkey.c:(.text+0x1d64): undefined reference to `sem_init'
The targets for these tests are modfied in lib.mk to add the $(OUTPUT) prefix. The makefile needs to specify that modifying those rules, or else they do not match and we miss out on the extra flags.
Signed-off-by: Joel Stanley joel@jms.id.au --- tools/testing/selftests/powerpc/ptrace/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile index 58de6d4a0cf4..8d3f006c98cc 100644 --- a/tools/testing/selftests/powerpc/ptrace/Makefile +++ b/tools/testing/selftests/powerpc/ptrace/Makefile @@ -9,7 +9,7 @@ include ../../lib.mk
CFLAGS += -m64 -I../../../../../usr/include -I../tm -mhtm -fno-pie
-ptrace-pkey core-pkey: child.h -ptrace-pkey core-pkey: LDLIBS += -pthread +$(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: child.h +$(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread
$(TEST_GEN_PROGS): ../harness.c ../utils.c ../lib/reg.S ptrace.h
According to lib.mk, TEST_PROGS is for shell scripts. It appears we need to define the programs as TEST_GEN_PROGS to ensure they are built.
The definition must also happen below the inclusion of lib.mk.
Signed-off-by: Joel Stanley joel@jms.id.au --- tools/testing/selftests/powerpc/signal/Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/powerpc/signal/Makefile b/tools/testing/selftests/powerpc/signal/Makefile index d34a7c7710db..25d0973df5b3 100644 --- a/tools/testing/selftests/powerpc/signal/Makefile +++ b/tools/testing/selftests/powerpc/signal/Makefile @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -TEST_PROGS := signal signal_tm - -$(TEST_PROGS): ../harness.c ../utils.c signal.S +TEST_GEN_PROGS := signal signal_tm
CFLAGS += -maltivec signal_tm: CFLAGS += -mhtm @@ -9,5 +7,4 @@ signal_tm: CFLAGS += -mhtm top_srcdir = ../../../../.. include ../../lib.mk
-clean: - rm -f $(TEST_PROGS) *.o +$(TEST_GEN_PROGS): ../harness.c ../utils.c signal.S
signal_tm tries to build with -mhtm but it currently does not.
The targets is modified in lib.mk to add the $(OUTPUT) prefix. The makefile needs to specify that modifying the rules, or else it does not match and we miss out on the extra flag.
Signed-off-by: Joel Stanley joel@jms.id.au --- tools/testing/selftests/powerpc/signal/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/powerpc/signal/Makefile b/tools/testing/selftests/powerpc/signal/Makefile index 25d0973df5b3..209a958dca12 100644 --- a/tools/testing/selftests/powerpc/signal/Makefile +++ b/tools/testing/selftests/powerpc/signal/Makefile @@ -2,7 +2,7 @@ TEST_GEN_PROGS := signal signal_tm
CFLAGS += -maltivec -signal_tm: CFLAGS += -mhtm +$(OUTPUT)/signal_tm: CFLAGS += -mhtm
top_srcdir = ../../../../.. include ../../lib.mk
When running the ebb tests after building on a ppc64le Ubuntu machine:
$ pmu/ebb/reg_access_test: error while loading shared libraries: R_PPC64_ADDR16_HI reloc at 0x000000013a965130 for symbol `' out of range
This is because the Ubuntu toolchain builds has PIE enabled by default. Change it to be always off instead.
Signed-off-by: Joel Stanley joel@jms.id.au --- tools/testing/selftests/powerpc/pmu/ebb/Makefile | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/Makefile b/tools/testing/selftests/powerpc/pmu/ebb/Makefile index bd5dfa509272..23f4caf48ffc 100644 --- a/tools/testing/selftests/powerpc/pmu/ebb/Makefile +++ b/tools/testing/selftests/powerpc/pmu/ebb/Makefile @@ -5,6 +5,9 @@ noarg: # The EBB handler is 64-bit code and everything links against it CFLAGS += -m64
+# Toolchains may build PIE by default which breaks the assembly +LDFLAGS += -no-pie + TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test \ cycles_with_freeze_test pmc56_overflow_test \ ebb_vs_cpu_event_test cpu_event_vs_ebb_test \
linux-kselftest-mirror@lists.linaro.org