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>

authored by Guenter Roeck and committed by Benjamin Herrenschmidt 7998eb3d 8050936c

Changed files
+9 -2
arch
powerpc
include
asm
+3 -1
arch/powerpc/Makefile
··· 150 150 151 151 CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell) 152 152 153 - KBUILD_CPPFLAGS += -Iarch/$(ARCH) 153 + asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) 154 + 155 + KBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr) 154 156 KBUILD_AFLAGS += -Iarch/$(ARCH) 155 157 KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y) 156 158 CPP = $(CC) -E $(KBUILD_CFLAGS)
+6 -1
arch/powerpc/include/asm/ppc_asm.h
··· 318 318 addi reg,reg,(name - 0b)@l; 319 319 320 320 #ifdef __powerpc64__ 321 + #ifdef HAVE_AS_ATHIGH 322 + #define __AS_ATHIGH high 323 + #else 324 + #define __AS_ATHIGH h 325 + #endif 321 326 #define LOAD_REG_IMMEDIATE(reg,expr) \ 322 327 lis reg,(expr)@highest; \ 323 328 ori reg,reg,(expr)@higher; \ 324 329 rldicr reg,reg,32,31; \ 325 - oris reg,reg,(expr)@h; \ 330 + oris reg,reg,(expr)@__AS_ATHIGH; \ 326 331 ori reg,reg,(expr)@l; 327 332 328 333 #define LOAD_REG_ADDR(reg,name) \