diff options
Diffstat (limited to 'recipes-kernel/linux/files/powerpc-Fix-64-bit-builds-with-binutils-2.24.patch')
-rw-r--r-- | recipes-kernel/linux/files/powerpc-Fix-64-bit-builds-with-binutils-2.24.patch | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/recipes-kernel/linux/files/powerpc-Fix-64-bit-builds-with-binutils-2.24.patch b/recipes-kernel/linux/files/powerpc-Fix-64-bit-builds-with-binutils-2.24.patch new file mode 100644 index 0000000..2fdcc9f --- /dev/null +++ b/recipes-kernel/linux/files/powerpc-Fix-64-bit-builds-with-binutils-2.24.patch | |||
@@ -0,0 +1,80 @@ | |||
1 | From 7998eb3dc700aaf499f93f50b3d77da834ef9e1d Mon Sep 17 00:00:00 2001 | ||
2 | From: Guenter Roeck <linux@roeck-us.net> | ||
3 | Date: Thu, 15 May 2014 09:33:42 -0700 | ||
4 | Subject: powerpc: Fix 64 bit builds with binutils 2.24 | ||
5 | |||
6 | Upstream-Status: Backport | ||
7 | |||
8 | With binutils 2.24, various 64 bit builds fail with relocation errors | ||
9 | such as | ||
10 | |||
11 | arch/powerpc/kernel/built-in.o: In function `exc_debug_crit_book3e': | ||
12 | (.text+0x165ee): relocation truncated to fit: R_PPC64_ADDR16_HI | ||
13 | against symbol `interrupt_base_book3e' defined in .text section | ||
14 | in arch/powerpc/kernel/built-in.o | ||
15 | arch/powerpc/kernel/built-in.o: In function `exc_debug_crit_book3e': | ||
16 | (.text+0x16602): relocation truncated to fit: R_PPC64_ADDR16_HI | ||
17 | against symbol `interrupt_end_book3e' defined in .text section | ||
18 | in arch/powerpc/kernel/built-in.o | ||
19 | |||
20 | The assembler maintainer says: | ||
21 | |||
22 | I changed the ABI, something that had to be done but unfortunately | ||
23 | happens to break the booke kernel code. When building up a 64-bit | ||
24 | value with lis, ori, shl, oris, ori or similar sequences, you now | ||
25 | should use @high and @higha in place of @h and @ha. @h and @ha | ||
26 | (and their associated relocs R_PPC64_ADDR16_HI and R_PPC64_ADDR16_HA) | ||
27 | now report overflow if the value is out of 32-bit signed range. | ||
28 | ie. @h and @ha assume you're building a 32-bit value. This is needed | ||
29 | to report out-of-range -mcmodel=medium toc pointer offsets in @toc@h | ||
30 | and @toc@ha expressions, and for consistency I did the same for all | ||
31 | other @h and @ha relocs. | ||
32 | |||
33 | Replacing @h with @high in one strategic location fixes the relocation | ||
34 | errors. This has to be done conditionally since the assembler either | ||
35 | supports @h or @high but not both. | ||
36 | |||
37 | Cc: <stable@vger.kernel.org> | ||
38 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
39 | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> | ||
40 | |||
41 | diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile | ||
42 | index 4c0cedf..ce4c68a 100644 | ||
43 | --- a/arch/powerpc/Makefile | ||
44 | +++ b/arch/powerpc/Makefile | ||
45 | @@ -150,7 +150,9 @@ endif | ||
46 | |||
47 | CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell) | ||
48 | |||
49 | -KBUILD_CPPFLAGS += -Iarch/$(ARCH) | ||
50 | +asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) | ||
51 | + | ||
52 | +KBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr) | ||
53 | KBUILD_AFLAGS += -Iarch/$(ARCH) | ||
54 | KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y) | ||
55 | CPP = $(CC) -E $(KBUILD_CFLAGS) | ||
56 | diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h | ||
57 | index 6586a40..cded7c1 100644 | ||
58 | --- a/arch/powerpc/include/asm/ppc_asm.h | ||
59 | +++ b/arch/powerpc/include/asm/ppc_asm.h | ||
60 | @@ -318,11 +318,16 @@ n: | ||
61 | addi reg,reg,(name - 0b)@l; | ||
62 | |||
63 | #ifdef __powerpc64__ | ||
64 | +#ifdef HAVE_AS_ATHIGH | ||
65 | +#define __AS_ATHIGH high | ||
66 | +#else | ||
67 | +#define __AS_ATHIGH h | ||
68 | +#endif | ||
69 | #define LOAD_REG_IMMEDIATE(reg,expr) \ | ||
70 | lis reg,(expr)@highest; \ | ||
71 | ori reg,reg,(expr)@higher; \ | ||
72 | rldicr reg,reg,32,31; \ | ||
73 | - oris reg,reg,(expr)@h; \ | ||
74 | + oris reg,reg,(expr)@__AS_ATHIGH; \ | ||
75 | ori reg,reg,(expr)@l; | ||
76 | |||
77 | #define LOAD_REG_ADDR(reg,name) \ | ||
78 | -- | ||
79 | cgit v0.10.1 | ||
80 | |||