linux/arch/powerpc
Ulrich Weigand a61674bdfc powerpc/module: Handle R_PPC64_ENTRY relocations
GCC 6 will include changes to generated code with -mcmodel=large,
which is used to build kernel modules on powerpc64le.  This was
necessary because the large model is supposed to allow arbitrary
sizes and locations of the code and data sections, but the ELFv2
global entry point prolog still made the unconditional assumption
that the TOC associated with any particular function can be found
within 2 GB of the function entry point:

func:
	addis r2,r12,(.TOC.-func)@ha
	addi  r2,r2,(.TOC.-func)@l
	.localentry func, .-func

To remove this assumption, GCC will now generate instead this global
entry point prolog sequence when using -mcmodel=large:

	.quad .TOC.-func
func:
	.reloc ., R_PPC64_ENTRY
	ld    r2, -8(r12)
	add   r2, r2, r12
	.localentry func, .-func

The new .reloc triggers an optimization in the linker that will
replace this new prolog with the original code (see above) if the
linker determines that the distance between .TOC. and func is in
range after all.

Since this new relocation is now present in module object files,
the kernel module loader is required to handle them too.  This
patch adds support for the new relocation and implements the
same optimization done by the GNU linker.

Cc: stable@vger.kernel.org
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-01-13 12:37:05 +11:00
..
boot powerpc/cell: Remove the Cell QPACE code 2015-12-14 20:41:50 +11:00
configs powerpc/cell: Remove the Cell QPACE code 2015-12-14 20:41:50 +11:00
crypto powerpc: Create disable_kernel_{fp,altivec,vsx,spe}() 2015-12-01 13:52:25 +11:00
include powerpc/module: Handle R_PPC64_ENTRY relocations 2016-01-13 12:37:05 +11:00
kernel powerpc/module: Handle R_PPC64_ENTRY relocations 2016-01-13 12:37:05 +11:00
kvm powerpc: create flush_all_to_thread() 2015-12-02 19:34:40 +11:00
lib powerpc: Create disable_kernel_{fp,altivec,vsx,spe}() 2015-12-01 13:52:25 +11:00
math-emu powerpc: Correct emulated mtfsf instruction 2014-04-07 10:33:11 +10:00
mm powerpc: Fix build break due to paca mm_context_t changes 2016-01-09 08:28:44 +11:00
net ebpf: migrate bpf_prog's flags to bitfield 2015-10-03 05:02:39 -07:00
oprofile powerpc: Remove mtmsrd(), use existing mtmsr() 2015-07-13 15:47:28 +10:00
perf powerpc updates for 4.4 2015-11-05 23:38:43 -08:00
platforms powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages 2016-01-13 12:35:17 +11:00
sysdev powerpc/axonram: Fix module autoload for OF platform driver 2015-11-26 22:11:18 +11:00
xmon powerpc/xmon: Use rtas_call_unlocked() in xmon 2015-12-17 22:40:55 +11:00
Kconfig powerpc/mm: Add page soft dirty tracking 2015-12-17 22:40:58 +11:00
Kconfig.debug powerpc: Fix style of self-test config prompts 2015-12-27 19:12:40 +11:00
Makefile powerpc/cell: Drop CONFIG_TUNE_CELL in favour of CONFIG_CELL_CPU 2015-10-19 19:51:18 +11:00
relocs_check.sh powerpc: Convert relocs_check to a shell script using grep 2015-03-23 14:47:39 +11:00