s390/s390x code consolidation
RFC 1/1 s390/s390x code consolidation
Hi,
This is my idea of how to start the consolidation of s390 and s390x that Christoph Hellwig proposed (repeatedly).
It's a hack to add a configuration option for 64 bit kernels to arch/s390 and to use files from arch/s390x instead of the ones in arch/s390 if they exist both (same for include/asm). Any duplicate files can simply be deleted from {arch/,include/asm-}s390x.
The necessary steps would be:
- Add support for compiling 64 bit in arch/s390 (this patch)
- While arch/s390x and include/s390x are not empty:
* Merge some s390x files into their s390 counterparts
* Remove merged and duplicate files
- Remove the makefile hacks introduced here
- Profit
Arnd <><
===== arch/s390/kernel/Makefile 1.17 vs edited =====
arch/s390/kernel/Makefile +21 -0
@@ -16,3 +16,24 @@ # Kernel debugging # obj-$(CONFIG_REMOTE_DEBUG) += gdb-stub.o #gdb-low.o + +obj-$(CONFIG_S390_SUPPORT) += linux32.o signal32.o ioctl32.o wrapper32.o \ + exec32.o exec_domain32.o +obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o + +ifdef CONFIG_ARCH_S390X +$(obj)%.o: $(patsubst arch/s390/%,arch/s390x/%,$(src))%.S + $(call if_changed_dep,as_o_S) + +$(obj)%.o: $(patsubst arch/s390/%,arch/s390x/%,$(src))%.c +ifdef CONFIG_MODVERSIONS + $(call if_changed_rule,vcc_o_c) +else + $(call if_changed_dep,cc_o_c) +endif +endif + +# +# This is just to get the dependencies... +# +binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
===== arch/s390/lib/Makefile 1.8 vs edited =====
arch/s390/lib/Makefile +5 -0
@@ -7,3 +7,8 @@ EXTRA_AFLAGS := -traditional obj-y = delay.o memset.o strcmp.o strncpy.o uaccess.o + +ifdef CONFIG_ARCH_S390X +$(obj)%.o: $(patsubst arch/s390/%,arch/s390x/%,$(src))%.S + $(call if_changed_dep,as_o_S) +endif
===== arch/s390/mm/Makefile 1.6 vs edited =====
arch/s390/mm/Makefile +5 -0
@@ -3,3 +3,8 @@ # obj-y := init.o fault.o ioremap.o extable.o + +ifdef CONFIG_ARCH_S390X +$(obj)%.o: $(patsubst arch/s390/%,arch/s390x/%,$(src))%.c + $(call if_changed_dep,cc_o_c) +endif
===== arch/s390/Kconfig 1.8 vs edited =====
arch/s390/Kconfig +54 -14
106 lines not on this page · raw message
===== arch/s390/Makefile 1.24 vs edited =====
arch/s390/Makefile +24 -4
@@ -12,15 +12,35 @@ # # Copyright (C) 1994 by Linus Torvalds # +ifndef CONFIG_ARCH_S390X LDFLAGS := -m elf_s390 -OBJCOPYFLAGS := -O binary -LDFLAGS_vmlinux := -e start LDFLAGS_BLOB := --format binary --oformat elf32-s390 +CFLAGS += -m31 + +else + +LDFLAGS := -m elf64_s390 +MODFLAGS += -fpic -D__PIC__ +LDFLAGS_BLOB := --format binary --oformat elf64-s390 +CFLAGS += -m64 -CFLAGS += -pipe -fno-strength-reduce -finline-limit=10000 -Wno-sign-compare +# this is a hack to use both include/asm directories +# include/asm-s390x should be removed before 2.6 +CC += -Iinclude/asm-s390x +prepare: include/asm-s390x/asm +include/asm-s390x/asm: + @ln -s . $@ + +define src64 $$(patsubst arch/s390/%,arch/s390x/%,$(src)) +endef +export src64 +endif +OBJCOPYFLAGS := -O binary +LDFLAGS_vmlinux := -e start +CFLAGS += -pipe -fno-strength-reduce -finline-limit-10000 -Wno-sign-compare -head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o +head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o core-y += arch/$(ARCH)/mm/ arch/$(ARCH)/kernel/ libs-y += arch/$(ARCH)/lib/
===== arch/s390/vmlinux.lds.S 1.10 vs edited =====
arch/s390/vmlinux.lds.S +9 -0
@@ -3,11 +3,20 @@ */ #include <asm-generic/vmlinux.lds.h> +#include <linux/config.h> +#ifndef CONFIG_ARCH_S390X OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") OUTPUT_ARCH(s390) ENTRY(_start) jiffies = jiffies_64 + 4; +#else +OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390") +OUTPUT_ARCH(s390) +ENTRY(_start) +jiffies = jiffies_64; +#endif + SECTIONS { . = 0x00000000;