x86: do not use $(ARCH) when not needed
authorSam Ravnborg <sam@ravnborg.org>
Mon, 12 Nov 2007 19:14:19 +0000 (20:14 +0100)
committerSam Ravnborg <sam@ravnborg.org>
Mon, 12 Nov 2007 20:02:20 +0000 (21:02 +0100)
For x86 ARCH may say i386 or x86_64 and soon x86.
Rely on CONFIG_X64_32 to select between 32/64 or just
hardcode the value as appropriate.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Makefile
arch/x86/Makefile
arch/x86/Makefile_32
arch/x86/Makefile_64
arch/x86/boot/Makefile
arch/x86/kernel/Makefile_32
arch/x86/kernel/Makefile_64
arch/x86/vdso/Makefile

index e28dde8887d7a50d242f7fc94d165f8de9358dc7..b32963adfb9548d38ce5f36048ca9edfb9c78349 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -197,8 +197,13 @@ CROSS_COMPILE      ?=
 UTS_MACHINE    := $(ARCH)
 SRCARCH        := $(ARCH)
 
-# for i386 and x86_64 we use SRCARCH equal to x86
-SRCARCH := $(if $(filter x86_64 i386,$(SRCARCH)),x86,$(SRCARCH))
+# Additional ARCH settings for x86
+ifeq ($(ARCH),i386)
+        SRCARCH := x86
+endif
+ifeq ($(ARCH),x86_64)
+        SRCARCH := x86
+endif
 
 KCONFIG_CONFIG ?= .config
 
index 309597386a77c7811ea3bc594084d5deec6a5d9c..116b03a4563608b00077707ae303106852374d8b 100644 (file)
@@ -1,12 +1,16 @@
 # Unified Makefile for i386 and x86_64
 
 # select defconfig based on actual architecture
-KBUILD_DEFCONFIG := $(ARCH)_defconfig
+ifeq ($(ARCH),x86)
+        KBUILD_DEFCONFIG := i386_defconfig
+else
+        KBUILD_DEFCONFIG := $(ARCH)_defconfig
+endif
 
-# No need to remake these files
+# No need to remake these files
 $(srctree)/arch/x86/Makefile%: ;
 
-ifeq ($(ARCH),i386)
+ifeq ($(CONFIG_X86_32),y)
         include $(srctree)/arch/x86/Makefile_32
 else
         include $(srctree)/arch/x86/Makefile_64
index 346ac07668758f2beb24450d942c039451b01056..50394da2f6c122da4bac4234a4c6ad41d7dc83e3 100644 (file)
@@ -160,7 +160,7 @@ archclean:
        $(Q)$(MAKE) $(clean)=arch/x86/boot
 
 define archhelp
-  echo  '* bzImage     - Compressed kernel image (arch/$(ARCH)/boot/bzImage)'
+  echo  '* bzImage     - Compressed kernel image (arch/x86/boot/bzImage)'
   echo  '  install     - Install kernel using'
   echo  '                 (your) ~/bin/installkernel or'
   echo  '                 (distribution) /sbin/installkernel or'
@@ -170,6 +170,6 @@ define archhelp
   echo  '  isoimage     - Create a boot CD-ROM image'
 endef
 
-CLEAN_FILES += arch/$(ARCH)/boot/fdimage \
-              arch/$(ARCH)/boot/image.iso \
-              arch/$(ARCH)/boot/mtools.conf
+CLEAN_FILES += arch/x86/boot/fdimage \
+              arch/x86/boot/image.iso \
+              arch/x86/boot/mtools.conf
index 57e714a47af7aff0e78512860c9a004db49c1d5f..a804860022e65a7ec6c5f71a81b7011d0cee6852 100644 (file)
@@ -127,7 +127,7 @@ archclean:
        $(Q)$(MAKE) $(clean)=$(boot)
 
 define archhelp
-  echo  '* bzImage     - Compressed kernel image (arch/$(ARCH)/boot/bzImage)'
+  echo  '* bzImage     - Compressed kernel image (arch/x86/boot/bzImage)'
   echo  '  install     - Install kernel using'
   echo  '                 (your) ~/bin/installkernel or'
   echo  '                 (distribution) /sbin/installkernel or'
@@ -137,8 +137,8 @@ define archhelp
   echo  '  isoimage     - Create a boot CD-ROM image'
 endef
 
-CLEAN_FILES += arch/$(ARCH)/boot/fdimage \
-              arch/$(ARCH)/boot/image.iso \
-              arch/$(ARCH)/boot/mtools.conf
+CLEAN_FILES += arch/x86/boot/fdimage \
+              arch/x86/boot/image.iso \
+              arch/x86/boot/mtools.conf
 
 
index 89dbf970e058c845e676f8b2be9efc65dcbdfe84..7a3116ccf3878d6e3212f8d4e346a3ceef912e8b 100644 (file)
@@ -49,10 +49,10 @@ HOSTCFLAGS_build.o := $(LINUXINCLUDE)
 
 # How to compile the 16-bit code.  Note we always compile for -march=i386,
 # that way we can complain to the user if the CPU is insufficient.
-cflags-i386   := 
-cflags-x86_64 := -m32
+cflags-$(CONFIG_X86_32) :=
+cflags-$(CONFIG_X86_64) := -m32
 KBUILD_CFLAGS  := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
-                  $(cflags-$(ARCH)) \
+                  $(cflags-y) \
                   -Wall -Wstrict-prototypes \
                   -march=i386 -mregparm=3 \
                   -include $(srctree)/$(src)/code16gcc.h \
index b9d679820306d10d69078d14d7cb18cfbec33c26..a7bc93c27662f058711fe5349acb44cd08876bf1 100644 (file)
@@ -3,6 +3,7 @@
 #
 
 extra-y := head_32.o init_task.o vmlinux.lds
+CPPFLAGS_vmlinux.lds += -Ui386
 
 obj-y  := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \
                ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \
@@ -60,7 +61,7 @@ quiet_cmd_syscall = SYSCALL $@
       cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
                          -Wl,-T,$(filter-out FORCE,$^) -o $@
 
-export CPPFLAGS_vsyscall_32.lds += -P -C -U$(ARCH)
+export CPPFLAGS_vsyscall_32.lds += -P -C -Ui386
 
 vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
                 $(call ld-option, -Wl$(comma)--hash-style=sysv)
index 24671c3838b3bb3e8a4b301be277fcb0ef62d9ee..5a88890d8ee9a4561c956bbd4b6f293c9933cb8f 100644 (file)
@@ -3,7 +3,9 @@
 #
 
 extra-y        := head_64.o head64.o init_task.o vmlinux.lds
+CPPFLAGS_vmlinux.lds += -Ux86_64
 EXTRA_AFLAGS   := -traditional
+
 obj-y  := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \
                ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \
                x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \
index 7a2ba4583939672ff39de6236172dafd1b14228a..e7bff0fbac235715ca5e8601d510414c38e56a9c 100644 (file)
@@ -20,7 +20,7 @@ quiet_cmd_syscall = SYSCALL $@
       cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
                          -Wl,-T,$(filter-out FORCE,$^) -o $@
 
-export CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
+export CPPFLAGS_vdso.lds += -P -C
 
 vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \
                 $(call ld-option, -Wl$(comma)--hash-style=sysv) \