Skip to content

Commit 3749684

Browse files
maddy-kerneldevmpe
authored andcommitted
selftests/powerpc: Re-order *FLAGS to follow lib.mk
In some powerpc/ sub-folder Makefiles, CFLAGS are defined before lib.mk include. Clean it up by re-ordering the flags to follow after the mk include. This is needed to support sub-folders in powerpc/ buildable on its own. Signed-off-by: Madhavan Srinivasan <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 29247de commit 3749684

File tree

13 files changed

+45
-44
lines changed

13 files changed

+45
-44
lines changed

tools/testing/selftests/powerpc/benchmarks/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ TEST_GEN_FILES := exec_target
44

55
TEST_FILES := settings
66

7-
CFLAGS += -O2
8-
97
top_srcdir = ../../../../..
108
include ../../lib.mk
119

10+
CFLAGS += -O2
11+
1212
$(TEST_GEN_PROGS): ../harness.c
1313

1414
$(OUTPUT)/context_switch: ../utils.c

tools/testing/selftests/powerpc/copyloops/Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
# The loops are all 64-bit code
3-
CFLAGS += -m64
4-
CFLAGS += -I$(CURDIR)
5-
CFLAGS += -D SELFTEST
6-
CFLAGS += -maltivec
7-
CFLAGS += -mcpu=power4
8-
9-
# Use our CFLAGS for the implicit .S rule & set the asm machine type
10-
ASFLAGS = $(CFLAGS) -Wa,-mpower4
11-
122
TEST_GEN_PROGS := copyuser_64_t0 copyuser_64_t1 copyuser_64_t2 \
133
copyuser_p7_t0 copyuser_p7_t1 \
144
memcpy_64_t0 memcpy_64_t1 memcpy_64_t2 \
@@ -21,6 +11,16 @@ EXTRA_SOURCES := validate.c ../harness.c stubs.S
2111
top_srcdir = ../../../../..
2212
include ../../lib.mk
2313

14+
# The loops are all 64-bit code
15+
CFLAGS += -m64
16+
CFLAGS += -I$(CURDIR)
17+
CFLAGS += -D SELFTEST
18+
CFLAGS += -maltivec
19+
CFLAGS += -mcpu=power4
20+
21+
# Use our CFLAGS for the implicit .S rule & set the asm machine type
22+
ASFLAGS = $(CFLAGS) -Wa,-mpower4
23+
2424
$(OUTPUT)/copyuser_64_t%: copyuser_64.S $(EXTRA_SOURCES)
2525
$(CC) $(CPPFLAGS) $(CFLAGS) \
2626
-D COPY_LOOP=test___copy_tofrom_user_base \
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
CFLAGS = -O3 -m64 -I./include -I../include
2-
31
TEST_GEN_FILES := gzfht_test gunz_test
42
TEST_PROGS := nx-gzip-test.sh
53

64
include ../../lib.mk
75

6+
CFLAGS = -O3 -m64 -I./include -I../include
7+
88
$(TEST_GEN_FILES): gzip_vas.c ../utils.c

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ include ../../../../../build/Build.include
44
noarg:
55
$(MAKE) -C ../../
66

7-
# The EBB handler is 64-bit code and everything links against it
8-
CFLAGS += -m64
9-
10-
TMPOUT = $(OUTPUT)/TMPDIR/
11-
# Toolchains may build PIE by default which breaks the assembly
12-
no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \
13-
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)
14-
15-
LDFLAGS += $(no-pie-option)
16-
177
TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test \
188
cycles_with_freeze_test pmc56_overflow_test \
199
ebb_vs_cpu_event_test cpu_event_vs_ebb_test \
@@ -29,6 +19,16 @@ TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test \
2919
top_srcdir = ../../../../../..
3020
include ../../../lib.mk
3121

22+
# The EBB handler is 64-bit code and everything links against it
23+
CFLAGS += -m64
24+
25+
TMPOUT = $(OUTPUT)/TMPDIR/
26+
# Toolchains may build PIE by default which breaks the assembly
27+
no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \
28+
$(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)
29+
30+
LDFLAGS += $(no-pie-option)
31+
3232
$(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c \
3333
ebb.c ebb_handler.S trace.c busy_loop.S
3434

tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
CFLAGS += -m64
3-
42
TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_test group_constraint_pmc_count_test \
53
group_constraint_repeat_test group_constraint_radix_scope_qual_test reserved_bits_mmcra_sample_elig_mode_test \
64
group_constraint_mmcra_sample_test invalid_event_code_test reserved_bits_mmcra_thresh_ctl_test \
@@ -12,4 +10,6 @@ TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_te
1210
top_srcdir = ../../../../../..
1311
include ../../../lib.mk
1412

13+
CFLAGS += -m64
14+
1515
$(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c ../sampling_tests/misc.h ../sampling_tests/misc.c

tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
CFLAGS += -m64
3-
42
TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test \
53
mmcr0_pmcjce_test mmcr0_fc56_pmc1ce_test mmcr0_fc56_pmc56_test \
64
mmcr1_comb_test mmcr2_l2l3_test mmcr2_fcs_fch_test \
@@ -12,4 +10,6 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test
1210
top_srcdir = ../../../../../..
1311
include ../../../lib.mk
1412

13+
CFLAGS += -m64
14+
1515
$(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c misc.c misc.h ../loop.S ../branch_loops.S
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
CFLAGS += -I$(CURDIR)
3-
42
TEST_GEN_PROGS := load_unaligned_zeropad
53

64
top_srcdir = ../../../../..
75
include ../../lib.mk
86

7+
CFLAGS += -I$(CURDIR)
8+
99
$(TEST_GEN_PROGS): ../harness.c

tools/testing/selftests/powerpc/security/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ TEST_PROGS := mitigation-patching.sh
55

66
top_srcdir = ../../../../..
77

8-
CFLAGS += $(KHDR_INCLUDES)
9-
108
include ../../lib.mk
119

10+
CFLAGS += $(KHDR_INCLUDES)
11+
1212
$(TEST_GEN_PROGS): ../harness.c ../utils.c
1313

1414
$(OUTPUT)/spectre_v2: CFLAGS += -m64

tools/testing/selftests/powerpc/signal/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ TEST_GEN_PROGS := signal signal_tm sigfuz sigreturn_vdso sig_sc_double_restart
33
TEST_GEN_PROGS += sigreturn_kernel
44
TEST_GEN_PROGS += sigreturn_unaligned
55

6-
CFLAGS += -maltivec
76
$(OUTPUT)/signal_tm: CFLAGS += -mhtm
87
$(OUTPUT)/sigfuz: CFLAGS += -pthread -m64
98

@@ -12,4 +11,6 @@ TEST_FILES := settings
1211
top_srcdir = ../../../../..
1312
include ../../lib.mk
1413

14+
CFLAGS += -maltivec
15+
1516
$(TEST_GEN_PROGS): ../harness.c ../utils.c signal.S

tools/testing/selftests/powerpc/stringloops/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
# The loops are all 64-bit code
3-
CFLAGS += -I$(CURDIR)
4-
52
EXTRA_SOURCES := ../harness.c
63

74
build_32bit = $(shell if ($(CC) $(CFLAGS) -m32 -o /dev/null memcmp.c >/dev/null 2>&1) then echo "1"; fi)
@@ -27,9 +24,12 @@ $(OUTPUT)/strlen_32: CFLAGS += -m32
2724
TEST_GEN_PROGS += strlen_32
2825
endif
2926

30-
ASFLAGS = $(CFLAGS)
31-
3227
top_srcdir = ../../../../..
3328
include ../../lib.mk
3429

30+
# The loops are all 64-bit code
31+
CFLAGS += -I$(CURDIR)
32+
33+
ASFLAGS = $(CFLAGS)
34+
3535
$(TEST_GEN_PROGS): $(EXTRA_SOURCES)

tools/testing/selftests/powerpc/switch_endian/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# SPDX-License-Identifier: GPL-2.0
22
TEST_GEN_PROGS := switch_endian_test
33

4-
ASFLAGS += -O2 -Wall -g -nostdlib -m64
5-
64
EXTRA_CLEAN = $(OUTPUT)/*.o $(OUTPUT)/check-reversed.S
75

86
top_srcdir = ../../../../..
97
include ../../lib.mk
108

9+
ASFLAGS += -O2 -Wall -g -nostdlib -m64
10+
1111
$(OUTPUT)/switch_endian_test: ASFLAGS += -I $(OUTPUT)
1212
$(OUTPUT)/switch_endian_test: $(OUTPUT)/check-reversed.S
1313

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
TEST_GEN_PROGS := ipc_unmuxed rtas_filter
33

4-
CFLAGS += $(KHDR_INCLUDES)
5-
64
top_srcdir = ../../../../..
75
include ../../lib.mk
86

7+
CFLAGS += $(KHDR_INCLUDES)
8+
99
$(TEST_GEN_PROGS): ../harness.c ../utils.c
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
TEST_GEN_PROGS := test-vphn
33

4-
CFLAGS += -m64 -I$(CURDIR)
5-
64
top_srcdir = ../../../../..
75
include ../../lib.mk
86

7+
CFLAGS += -m64 -I$(CURDIR)
8+
99
$(TEST_GEN_PROGS): ../harness.c
1010

0 commit comments

Comments
 (0)