aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2014-05-15 12:33:42 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-05-27 23:24:05 -0400
commit7998eb3dc700aaf499f93f50b3d77da834ef9e1d (patch)
tree0db8ecf61690574aee6ee53b57ad2444db2b8cfd /arch
parent8050936caf125fbe54111ba5e696b68a360556ba (diff)
powerpc: Fix 64 bit builds with binutils 2.24
With binutils 2.24, various 64 bit builds fail with relocation errors such as arch/powerpc/kernel/built-in.o: In function `exc_debug_crit_book3e': (.text+0x165ee): relocation truncated to fit: R_PPC64_ADDR16_HI against symbol `interrupt_base_book3e' defined in .text section in arch/powerpc/kernel/built-in.o arch/powerpc/kernel/built-in.o: In function `exc_debug_crit_book3e': (.text+0x16602): relocation truncated to fit: R_PPC64_ADDR16_HI against symbol `interrupt_end_book3e' defined in .text section in arch/powerpc/kernel/built-in.o The assembler maintainer says: I changed the ABI, something that had to be done but unfortunately happens to break the booke kernel code. When building up a 64-bit value with lis, ori, shl, oris, ori or similar sequences, you now should use @high and @higha in place of @h and @ha. @h and @ha (and their associated relocs R_PPC64_ADDR16_HI and R_PPC64_ADDR16_HA) now report overflow if the value is out of 32-bit signed range. ie. @h and @ha assume you're building a 32-bit value. This is needed to report out-of-range -mcmodel=medium toc pointer offsets in @toc@h and @toc@ha expressions, and for consistency I did the same for all other @h and @ha relocs. Replacing @h with @high in one strategic location fixes the relocation errors. This has to be done conditionally since the assembler either supports @h or @high but not both. Cc: <stable@vger.kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Makefile4
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h7
2 files changed, 9 insertions, 2 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 4c0cedf4e2c7..ce4c68a4a823 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -150,7 +150,9 @@ endif
150 150
151CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell) 151CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell)
152 152
153KBUILD_CPPFLAGS += -Iarch/$(ARCH) 153asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
154
155KBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr)
154KBUILD_AFLAGS += -Iarch/$(ARCH) 156KBUILD_AFLAGS += -Iarch/$(ARCH)
155KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y) 157KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
156CPP = $(CC) -E $(KBUILD_CFLAGS) 158CPP = $(CC) -E $(KBUILD_CFLAGS)
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 6586a40a46ce..cded7c1278ef 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -318,11 +318,16 @@ n:
318 addi reg,reg,(name - 0b)@l; 318 addi reg,reg,(name - 0b)@l;
319 319
320#ifdef __powerpc64__ 320#ifdef __powerpc64__
321#ifdef HAVE_AS_ATHIGH
322#define __AS_ATHIGH high
323#else
324#define __AS_ATHIGH h
325#endif
321#define LOAD_REG_IMMEDIATE(reg,expr) \ 326#define LOAD_REG_IMMEDIATE(reg,expr) \
322 lis reg,(expr)@highest; \ 327 lis reg,(expr)@highest; \
323 ori reg,reg,(expr)@higher; \ 328 ori reg,reg,(expr)@higher; \
324 rldicr reg,reg,32,31; \ 329 rldicr reg,reg,32,31; \
325 oris reg,reg,(expr)@h; \ 330 oris reg,reg,(expr)@__AS_ATHIGH; \
326 ori reg,reg,(expr)@l; 331 ori reg,reg,(expr)@l;
327 332
328#define LOAD_REG_ADDR(reg,name) \ 333#define LOAD_REG_ADDR(reg,name) \