linux/arch/powerpc
Ulrich Weigand cd8014be93 powerpc/module: Handle R_PPC64_ENTRY relocations
commit a61674bdfc upstream.

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.

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2016-02-02 19:09:35 +00:00
..
boot powerpc/boot: Specify ABI v2 when building an LE boot wrapper 2015-10-06 11:52:28 +01:00
configs powerpc: Remove platforms/wsp and associated pieces 2014-06-11 16:35:38 +10:00
crypto crypto: add missing crypto module aliases 2015-02-04 10:57:50 +00:00
include powerpc/module: Handle R_PPC64_ENTRY relocations 2016-02-02 19:09:35 +00:00
kernel powerpc/module: Handle R_PPC64_ENTRY relocations 2016-02-02 19:09:35 +00:00
kvm KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR 2016-01-25 10:43:53 +00:00
lib powerpc: Add smp_mb()s to arch_spin_unlock_wait() 2014-10-05 13:41:08 -07:00
math-emu powerpc: Correct emulated mtfsf instruction 2014-04-07 10:33:11 +10:00
mm powerpc/mm: Recompute hash value after a failed update 2015-10-06 11:52:29 +01:00
net net: filter: make JITs zero A for SKF_AD_ALU_XOR_X 2016-01-25 10:44:05 +00:00
oprofile cpufreq: remove unused notifier: CPUFREQ_{SUSPENDCHANGE|RESUMECHANGE} 2014-03-19 14:10:24 +01:00
perf powerpc/perf: Fix book3s kernel to userspace backtraces 2015-07-15 10:00:17 +01:00
platforms powerpc/powernv: pr_warn_once on unsupported OPAL_MSG type 2016-01-25 10:43:41 +00:00
sysdev powerpc/MSI: Fix race condition in tearing down MSI interrupts 2015-09-30 13:20:55 +01:00
xmon powerpc/xmon: Fix another endiannes issue in RTAS call from xmon 2015-02-04 10:58:05 +00:00
Kconfig locking/mutex: Disable optimistic spinning on some architectures 2014-07-16 14:57:07 +02:00
Kconfig.debug powerpc/powernv: Remove OPAL v1 takeover 2014-06-25 13:10:47 +10:00
Makefile Merge branch 'merge' into next 2014-05-28 13:30:12 +10:00
relocs_check.pl Fix warning typo "CONFIG_RELCOATABLE" 2013-05-29 15:11:30 +02:00