提交 bb33421d 编写于 作者: A Andi Kleen 提交者: Linus Torvalds

[PATCH] x86_64: Allow compilation on a 32bit biarch toolchain

This might help on distributions that use a 32bit biarch compiler.

First pass -m64 by default.

Secondly add some more .code32s because at least the Ubuntu biarch
32bit as called by gcc doesn't seem to handle -m64 -m32 as generated
by the Makefile without such assistance.

And finally make sure the linker script can be preprocessed
with a 32bit cpp.
Signed-off-by: NAndi Kleen <ak@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 79c62cf1
...@@ -31,6 +31,7 @@ cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8) ...@@ -31,6 +31,7 @@ cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
CFLAGS += $(cflags-y) CFLAGS += $(cflags-y)
CFLAGS += -m64
CFLAGS += -mno-red-zone CFLAGS += -mno-red-zone
CFLAGS += -mcmodel=kernel CFLAGS += -mcmodel=kernel
CFLAGS += -pipe CFLAGS += -pipe
...@@ -52,6 +53,8 @@ CFLAGS += $(call cc-option,-funit-at-a-time) ...@@ -52,6 +53,8 @@ CFLAGS += $(call cc-option,-funit-at-a-time)
# prevent gcc from generating any FP code by mistake # prevent gcc from generating any FP code by mistake
CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
AFLAGS += -m64
head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
libs-y += arch/x86_64/lib/ libs-y += arch/x86_64/lib/
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* by doing ".balign 32" must match in both versions of the page. * by doing ".balign 32" must match in both versions of the page.
*/ */
.code32
.section .text.sigreturn,"ax" .section .text.sigreturn,"ax"
.balign 32 .balign 32
.globl __kernel_sigreturn .globl __kernel_sigreturn
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/segment.h> #include <asm/segment.h>
.code32
.text .text
.section .text.vsyscall,"ax" .section .text.vsyscall,"ax"
.globl __kernel_vsyscall .globl __kernel_vsyscall
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <asm/ia32_unistd.h> #include <asm/ia32_unistd.h>
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
.code32
.text .text
.section .text.vsyscall,"ax" .section .text.vsyscall,"ax"
.globl __kernel_vsyscall .globl __kernel_vsyscall
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <asm/page.h> #include <asm/page.h>
#include <linux/config.h> #include <linux/config.h>
#undef i386 /* in case the preprocessor is a 32bit one */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64) OUTPUT_ARCH(i386:x86-64)
ENTRY(phys_startup_64) ENTRY(phys_startup_64)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册