aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2018-05-08 19:53:00 +0930
committerStewart Smith <stewart@linux.ibm.com>2018-05-09 10:17:42 -0500
commita565a2837a60c5546e55999e32a88f844f46e860 (patch)
treeb36ab5eadd690ef786cd77f0d05918ffad5cdd42 /test
parentef280be1657a32f9e0b69a216d64a2e0954a19a8 (diff)
downloadskiboot-a565a2837a60c5546e55999e32a88f844f46e860.zip
skiboot-a565a2837a60c5546e55999e32a88f844f46e860.tar.gz
skiboot-a565a2837a60c5546e55999e32a88f844f46e860.tar.bz2
test: Simplify build process for hello and sreset tests
Link with ld instead of gcc so we can build with clang as cc. Remove the linker script and unnecessary flags. The application links just fine without them. Add cflags required by clang in order to build for the correct target. Remove the dependency file generation. The assembly files don't include any headers, so they weren't doing anything. Simplify clean rule, as the $(RM) alias does -f for us, and we no longer have .d files. Build tested on ppc64le and amd64. Booted in Qemu on both using: qemu-system-ppc64 -M powernv -nodefaults -nographic -serial stdio \ -kernel test/hello_world/hello_kernel/hello_kernel Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'test')
-rw-r--r--test/hello_world/Makefile.check21
-rw-r--r--test/hello_world/hello_kernel/hello_kernel.ld29
-rw-r--r--test/sreset_world/Makefile.check21
-rw-r--r--test/sreset_world/sreset_kernel/sreset_kernel.ld29
4 files changed, 24 insertions, 76 deletions
diff --git a/test/hello_world/Makefile.check b/test/hello_world/Makefile.check
index e791ea7..0390cf6 100644
--- a/test/hello_world/Makefile.check
+++ b/test/hello_world/Makefile.check
@@ -16,6 +16,13 @@ hello_world-tests: $(HELLO_WORLD_STB_TEST:%=%-check-stb-p9-mambo)
boot-tests: hello_world-tests
check: hello_world-tests
+cc-name := $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
+
+ifeq ($(cc-name),clang)
+hello_kernel_CFLAGS = --target=powerpc64-linux-gnu
+endif
+hello_kernel_CFLAGS += -mbig-endian -m64
+
$(HELLO_WORLD_TEST:%=%-check-smt-mambo): %-check-smt-mambo: % skiboot.lid
$(call Q , BOOT TEST , THREADS=2 ./test/hello_world/run_mambo_hello_world.sh , $@)
@@ -46,15 +53,11 @@ $(HELLO_WORLD_STB_TEST:%=%-check-stb-p9-mambo): %-check-stb-p9-mambo: % skiboot.
$(HELLO_WORLD_TEST:%=%-check-qemu): %-check-qemu: % skiboot.lid
$(call Q , BOOT TEST , ./test/hello_world/run_qemu_hello_world.sh, $@)
-test/hello_world/hello_kernel/hello_kernel.o: test/hello_world/hello_kernel/hello_kernel.S test/hello_world/hello_kernel/hello_kernel.ld
- $(call Q,CC, $(CC) -m64 -c -MMD -o $@ $< ,$@)
-
-hello_kernel_LDFLAGS=-m64 -Wl,--build-id=none -T test/hello_world/hello_kernel/hello_kernel.ld -ffreestanding -nostdlib -Ttext=0x0 -N
-
--include $(wildcard test/hello_world/hello_kernel/*.d)
+test/hello_world/hello_kernel/hello_kernel.o: test/hello_world/hello_kernel/hello_kernel.S
+ $(call Q,CC, $(CC) $(hello_kernel_CFLAGS) -c -o $@ $< ,$@)
test/hello_world/hello_kernel/hello_kernel: test/hello_world/hello_kernel/hello_kernel.o
- $(call Q,LD, $(CC) $(hello_kernel_LDFLAGS) -o $@ $^ , $@)
+ $(call Q,LD, $(LD) -EB -m elf64ppc -N -o $@ $^ , $@)
test/hello_world/hello_kernel/hello_kernel.stb: test/hello_world/hello_kernel/hello_kernel libstb/create-container
$(call Q,STB-DEVELOPMENT-SIGNED-CONTAINER,$(SRC)/libstb/sign-with-local-keys.sh $< $@ $(SRC)/libstb/keys/,$@)
@@ -62,5 +65,5 @@ test/hello_world/hello_kernel/hello_kernel.stb: test/hello_world/hello_kernel/he
clean: hello_world-test-clean
hello_world-test-clean:
- $(RM) -f test/hello_world/hello_kernel/hello_kernel
- $(RM) -f test/hello_world/hello_kernel/hello_kernel.[od]
+ $(RM) test/hello_world/hello_kernel/hello_kernel
+ $(RM) test/hello_world/hello_kernel/hello_kernel.o
diff --git a/test/hello_world/hello_kernel/hello_kernel.ld b/test/hello_world/hello_kernel/hello_kernel.ld
deleted file mode 100644
index d9bbc92..0000000
--- a/test/hello_world/hello_kernel/hello_kernel.ld
+++ /dev/null
@@ -1,29 +0,0 @@
-ENTRY(_start)
-SECTIONS
-{
- .text :
- {
- _start = .;
- *(.text)
- }
-
- . = ALIGN(4096);
- .data :
- {
- *(.rodata*)
- *(.data*)
- *(.sdata*)
- *(.got2)
- }
-
- . = ALIGN(4096);
- .bss :
- {
- _edata = .;
- __bss_start = .;
- *(.sbss)
- *(.bss)
- *(COMMON)
- _end = . ;
- }
-}
diff --git a/test/sreset_world/Makefile.check b/test/sreset_world/Makefile.check
index 1bd7b40..ec9fd27 100644
--- a/test/sreset_world/Makefile.check
+++ b/test/sreset_world/Makefile.check
@@ -12,6 +12,13 @@ sreset_world-tests: $(SRESET_WORLD_STB_TEST:%=%-check-stb-smt-p9-mambo)
boot-tests: sreset_world-tests
check: sreset_world-tests
+cc-name := $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
+
+ifeq ($(cc-name),clang)
+sreset_kernel_CFLAGS = --target=powerpc64-linux-gnu
+endif
+sreset_kernel_CFLAGS += -mbig-endian -m64
+
$(SRESET_WORLD_TEST:%=%-check-smt-mambo): %-check-smt-mambo: % skiboot.lid
$(call Q , BOOT TEST , THREADS=2 ./test/sreset_world/run_mambo_sreset.sh , $@)
@@ -24,15 +31,11 @@ $(SRESET_WORLD_STB_TEST:%=%-check-stb-smt-mambo): %-check-stb-smt-mambo: % skibo
$(SRESET_WORLD_STB_TEST:%=%-check-stb-smt-p9-mambo): %-check-stb-smt-p9-mambo: % skiboot.lid.stb
$(call Q , BOOT TEST , SKIBOOT_ENABLE_MAMBO_STB=1 THREADS=2 ./test/sreset_world/run_mambo_p9_sreset.sh , $@)
-test/sreset_world/sreset_kernel/sreset_kernel.o: test/sreset_world/sreset_kernel/sreset_kernel.S test/sreset_world/sreset_kernel/sreset_kernel.ld
- $(call Q,CC, $(CC) -mbig-endian -m64 -c -MMD -o $@ $< ,$@)
-
-sreset_kernel_LDFLAGS=-m64 -Wl,--build-id=none -T test/sreset_world/sreset_kernel/sreset_kernel.ld -ffreestanding -nostdlib -Ttext=0x0 -mbig-endian -N
-
--include $(wildcard test/sreset_world/sreset_kernel/*.d)
+test/sreset_world/sreset_kernel/sreset_kernel.o: test/sreset_world/sreset_kernel/sreset_kernel.S
+ $(call Q,CC, $(CC) $(sreset_kernel_CFLAGS) -c -o $@ $< ,$@)
test/sreset_world/sreset_kernel/sreset_kernel: test/sreset_world/sreset_kernel/sreset_kernel.o
- $(call Q,LD, $(CC) $(sreset_kernel_LDFLAGS) -o $@ $^ , $@)
+ $(call Q,LD, $(LD) -EB -m elf64ppc -N -o $@ $^ , $@)
test/sreset_world/sreset_kernel/sreset_kernel.stb: test/sreset_world/sreset_kernel/sreset_kernel libstb/create-container
$(call Q,STB-DEVELOPMENT-SIGNED-CONTAINER,$(SRC)/libstb/sign-with-local-keys.sh $< $@ $(SRC)/libstb/keys/,$@)
@@ -41,5 +44,5 @@ test/sreset_world/sreset_kernel/sreset_kernel.stb: test/sreset_world/sreset_kern
clean: sreset_world-test-clean
sreset_world-test-clean:
- $(RM) -f test/sreset_world/sreset_kernel/sreset_kernel
- $(RM) -f test/sreset_world/sreset_kernel/sreset_kernel.[od]
+ $(RM) test/sreset_world/sreset_kernel/sreset_kernel
+ $(RM) test/sreset_world/sreset_kernel/sreset_kernel.o
diff --git a/test/sreset_world/sreset_kernel/sreset_kernel.ld b/test/sreset_world/sreset_kernel/sreset_kernel.ld
deleted file mode 100644
index d9bbc92..0000000
--- a/test/sreset_world/sreset_kernel/sreset_kernel.ld
+++ /dev/null
@@ -1,29 +0,0 @@
-ENTRY(_start)
-SECTIONS
-{
- .text :
- {
- _start = .;
- *(.text)
- }
-
- . = ALIGN(4096);
- .data :
- {
- *(.rodata*)
- *(.data*)
- *(.sdata*)
- *(.got2)
- }
-
- . = ALIGN(4096);
- .bss :
- {
- _edata = .;
- __bss_start = .;
- *(.sbss)
- *(.bss)
- *(COMMON)
- _end = . ;
- }
-}