diff mbox

[kvm-unit-tests,05/14] powerpc/pp64: ppc-ify makefiles and linker script

Message ID 1438612891-3718-6-git-send-email-drjones@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Jones Aug. 3, 2015, 2:41 p.m. UTC
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 powerpc/Makefile.common | 44 +++++++++++++-------------------------------
 powerpc/Makefile.ppc64  | 16 ++++++++--------
 powerpc/flat.lds        | 14 ++++++++++----
 3 files changed, 31 insertions(+), 43 deletions(-)
diff mbox

Patch

diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
index f50d9f9d4e0f6..5cd3ea8085038 100644
--- a/powerpc/Makefile.common
+++ b/powerpc/Makefile.common
@@ -1,17 +1,15 @@ 
 #
-# arm common makefile
+# powerpc common makefile
 #
 # Authors: Andrew Jones <drjones@redhat.com>
 #
 
 ifeq ($(LOADADDR),)
-	# qemu mach-virt default load address
-	LOADADDR = 0x40000000
+	LOADADDR = 0x0
 endif
 
 tests-common = \
-	$(TEST_DIR)/selftest.flat \
-	$(TEST_DIR)/spinlock-test.flat
+	$(TEST_DIR)/selftest.elf
 
 ifneq ($(TEST),)
 	tests = $(TEST_DIR)/$(TEST).flat
@@ -35,39 +33,24 @@  include scripts/asm-offsets.mak
 cflatobjs += lib/util.o
 cflatobjs += lib/alloc.o
 cflatobjs += lib/devicetree.o
-cflatobjs += lib/virtio.o
-cflatobjs += lib/virtio-mmio.o
-cflatobjs += lib/chr-testdev.o
-cflatobjs += lib/prng.o
-cflatobjs += lib/arm/io.o
-cflatobjs += lib/arm/setup.o
-cflatobjs += lib/arm/mmu.o
-cflatobjs += lib/arm/bitops.o
-cflatobjs += lib/arm/psci.o
-cflatobjs += lib/arm/smp.o
-
-libeabi = lib/arm/libeabi.a
-eabiobjs = lib/arm/eabi_compat.o
+cflatobjs += lib/powerpc/io.o
+cflatobjs += lib/powerpc/setup.o
+cflatobjs += lib/powerpc/mmu.o
+cflatobjs += lib/powerpc/smp.o
 
 libgcc := $(shell $(CC) $(machine) --print-libgcc-file-name)
 start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
 
-FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
+FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc)
 %.elf: LDFLAGS = $(CFLAGS) -nostdlib
-%.elf: %.o $(FLATLIBS) arm/flat.lds
+%.elf: %.o $(FLATLIBS) powerpc/flat.lds
 	$(CC) $(LDFLAGS) -o $@ \
-		-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
+		-Wl,-T,powerpc/flat.lds,--build-id=none,-Ttext=$(start_addr) \
 		$(filter %.o, $^) $(FLATLIBS)
 
-%.flat: %.elf
-	$(OBJCOPY) -O binary $^ $@
-
-$(libeabi): $(eabiobjs)
-	$(AR) rcs $@ $^
-
-arm_clean: libfdt_clean asm_offsets_clean
-	$(RM) $(TEST_DIR)/*.{o,flat,elf} $(libeabi) $(eabiobjs) \
-	      $(TEST_DIR)/.*.d lib/arm/.*.d
+powerpc_clean: libfdt_clean asm_offsets_clean
+	$(RM) $(TEST_DIR)/*.{o,elf} \
+	      $(TEST_DIR)/.*.d lib/powerpc/.*.d
 
 ##################################################################
 
@@ -77,4 +60,3 @@  test_cases: $(generated_files) $(tests-common) $(tests)
 
 $(TEST_DIR)/$(TEST).elf: $(cstart.o) $(TEST_DIR)/$(TEST).o
 $(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
-$(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
diff --git a/powerpc/Makefile.ppc64 b/powerpc/Makefile.ppc64
index 0b0761c729c7c..7c61933dfa8ba 100644
--- a/powerpc/Makefile.ppc64
+++ b/powerpc/Makefile.ppc64
@@ -1,20 +1,20 @@ 
 #
-# arm64 makefile
+# ppc64 makefile
 #
 # Authors: Andrew Jones <drjones@redhat.com>
 #
 bits = 64
-ldarch = elf64-littleaarch64
-kernel_offset = 0x80000
+ldarch = elf64-powerpc #elf64-powerpcle (eventually)
+kernel_offset = 0x0
 
 cstart.o = $(TEST_DIR)/cstart64.o
-cflatobjs += lib/arm64/processor.o
-cflatobjs += lib/arm64/spinlock.o
+cflatobjs += lib/ppc64/processor.o
+cflatobjs += lib/ppc64/spinlock.o
 
-# arm64 specific tests
+# ppc64 specific tests
 tests =
 
 include $(TEST_DIR)/Makefile.common
 
-arch_clean: arm_clean
-	$(RM) lib/arm64/.*.d
+arch_clean: powerpc_clean
+	$(RM) lib/ppc64/.*.d
diff --git a/powerpc/flat.lds b/powerpc/flat.lds
index efdf5d7109ffb..bd075efb2c51b 100644
--- a/powerpc/flat.lds
+++ b/powerpc/flat.lds
@@ -4,6 +4,8 @@  SECTIONS
     .text : { *(.init) *(.text) *(.text.*) }
     . = ALIGN(64K);
     etext = .;
+    .opd : { *(.opd) }
+    . = ALIGN(16);
     .data : {
         *(.data)
     }
@@ -11,16 +13,20 @@  SECTIONS
     .rodata : { *(.rodata) }
     . = ALIGN(16);
     .bss : { *(.bss) }
+    . = ALIGN(16);
+    /*
+     * tocptr is tocbase + 32K, allowing toc offsets to be +-32K
+     */
+    tocptr = . + 32K;
+    .got : { *(.toc) *(.got) }
     . = ALIGN(64K);
     edata = .;
     . += 64K;
     . = ALIGN(64K);
     /*
-     * stack depth is 16K for arm and PAGE_SIZE for arm64, see THREAD_SIZE
-     * sp must be 16 byte aligned for arm64, and 8 byte aligned for arm
-     * sp must always be strictly less than the true stacktop
+     * stackptr set with initial stack frame (64 bytes) preallocated
      */
-    stackptr = . - 16;
+    stackptr = . - 64;
     stacktop = .;
 }