diff options
author | Anton Blanchard <anton@samba.org> | 2012-11-26 12:41:08 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-01-10 01:00:31 -0500 |
commit | 1fbe9cf2598dae3bd464d860bd89c67b1ff8682b (patch) | |
tree | c07f1fe789777669466bc3077a5f0afa70cf83b6 /arch/powerpc/Makefile | |
parent | 5827d4165ac608d7c26fa68701391e80824ee5c9 (diff) |
powerpc: Build kernel with -mcmodel=medium
Finally remove the two level TOC and build with -mcmodel=medium.
Unfortunately we can't build modules with -mcmodel=medium due to
the tricks the kernel module loader plays with percpu data:
# -mcmodel=medium breaks modules because it uses 32bit offsets from
# the TOC pointer to create pointers where possible. Pointers into the
# percpu data area are created by this method.
#
# The kernel module loader relocates the percpu data section from the
# original location (starting with 0xd...) to somewhere in the base
# kernel percpu data space (starting with 0xc...). We need a full
# 64bit relocation for this to work, hence -mcmodel=large.
On older kernels we fall back to the two level TOC (-mminimal-toc)
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/Makefile')
-rw-r--r-- | arch/powerpc/Makefile | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 78c2b024371a..31d8965e0847 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile | |||
@@ -67,7 +67,24 @@ LDFLAGS_vmlinux-y := -Bstatic | |||
67 | LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie | 67 | LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie |
68 | LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) | 68 | LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) |
69 | 69 | ||
70 | CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=no -mcall-aixdesc | 70 | ifeq ($(CONFIG_PPC64),y) |
71 | ifeq ($(call cc-option-yn,-mcmodel=medium),y) | ||
72 | # -mcmodel=medium breaks modules because it uses 32bit offsets from | ||
73 | # the TOC pointer to create pointers where possible. Pointers into the | ||
74 | # percpu data area are created by this method. | ||
75 | # | ||
76 | # The kernel module loader relocates the percpu data section from the | ||
77 | # original location (starting with 0xd...) to somewhere in the base | ||
78 | # kernel percpu data space (starting with 0xc...). We need a full | ||
79 | # 64bit relocation for this to work, hence -mcmodel=large. | ||
80 | KBUILD_CFLAGS_MODULE += -mcmodel=large | ||
81 | else | ||
82 | export NO_MINIMAL_TOC := -mno-minimal-toc | ||
83 | endif | ||
84 | endif | ||
85 | |||
86 | CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc | ||
87 | CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc) | ||
71 | CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple | 88 | CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple |
72 | 89 | ||
73 | CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4) | 90 | CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4) |