linux-stable/arch/x86
H.J. Lu a971fc44c9 x86: Treat R_X86_64_PLT32 as R_X86_64_PC32
commit b21ebf2fb4 upstream.

On i386, there are 2 types of PLTs, PIC and non-PIC.  PIE and shared
objects must use PIC PLT.  To use PIC PLT, you need to load
_GLOBAL_OFFSET_TABLE_ into EBX first.  There is no need for that on
x86-64 since x86-64 uses PC-relative PLT.

On x86-64, for 32-bit PC-relative branches, we can generate PLT32
relocation, instead of PC32 relocation, which can also be used as
a marker for 32-bit PC-relative branches.  Linker can always reduce
PLT32 relocation to PC32 if function is defined locally.   Local
functions should use PC32 relocation.  As far as Linux kernel is
concerned, R_X86_64_PLT32 can be treated the same as R_X86_64_PC32
since Linux kernel doesn't use PLT.

R_X86_64_PLT32 for 32-bit PC-relative branches has been enabled in
binutils master branch which will become binutils 2.31.

[ hjl is working on having better documentation on this all, but a few
  more notes from him:

   "PLT32 relocation is used as marker for PC-relative branches. Because
    of EBX, it looks odd to generate PLT32 relocation on i386 when EBX
    doesn't have GOT.

    As for symbol resolution, PLT32 and PC32 relocations are almost
    interchangeable. But when linker sees PLT32 relocation against a
    protected symbol, it can resolved locally at link-time since it is
    used on a branch instruction. Linker can't do that for PC32
    relocation"

  but for the kernel use, the two are basically the same, and this
  commit gets things building and working with the current binutils
  master   - Linus ]

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 08:42:44 +01:00
..
boot x86/mm/pti: Add infrastructure for page table isolation 2018-01-02 20:30:56 +01:00
configs x86/unwind: Rename unwinder config options to 'CONFIG_UNWINDER_*' 2017-12-25 14:26:13 +01:00
crypto crypto: x86/twofish-3way - Fix %rbp usage 2018-02-25 11:07:49 +01:00
entry Revert "x86/retpoline: Simplify vmexit_fill_RSB()" 2018-03-15 10:54:36 +01:00
events perf/x86/intel: Plug memory leak in intel_pmu_init() 2018-03-03 10:24:31 +01:00
hyperv x86/virt: Add enum for hypervisors to replace x86_hyper 2017-12-25 14:26:20 +01:00
ia32 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
include x86/kprobes: Fix kernel crash when probing .entry_trampoline code 2018-03-15 10:54:38 +01:00
kernel x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 2018-03-19 08:42:44 +01:00
kvm KVM: x86: fix backward migration with async_PF 2018-03-11 16:23:23 +01:00
lib Revert "x86/retpoline: Simplify vmexit_fill_RSB()" 2018-03-15 10:54:36 +01:00
math-emu License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mm x86/mm/sme, objtool: Annotate indirect call in sme_encrypt_execute() 2018-03-15 10:54:37 +01:00
net bpf, x64: implement retpoline for tail call 2018-03-11 16:23:22 +01:00
oprofile x86/oprofile: Fix bogus GCC-8 warning in nmi_setup() 2018-02-28 10:19:41 +01:00
pci x86/PCI: Make broadcom_postcore_init() check acpi_disabled 2017-12-14 09:52:53 +01:00
platform x86/platform/intel-mid: Handle Intel Edison reboot correctly 2018-03-08 22:41:07 -08:00
power x86/entry: Remap the TSS into the CPU entry area 2017-12-25 14:26:22 +01:00
purgatory License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ras License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
realmode x86-64/realmode: Add instruction suffix 2018-03-15 10:54:36 +01:00
tools x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 2018-03-19 08:42:44 +01:00
um x86/entry: Use SYSCALL_DEFINE() macros for sys_modify_ldt() 2017-12-10 13:40:41 +01:00
video
xen x86/xen: Zero MSR_IA32_SPEC_CTRL before suspend 2018-03-08 22:41:06 -08:00
.gitignore
Kbuild Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-09-07 09:25:15 -07:00
Kconfig objtool, retpolines: Integrate objtool with retpoline support more closely 2018-03-15 10:54:38 +01:00
Kconfig.cpu License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig.debug x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig for 64-bit 2017-12-25 14:26:14 +01:00
Makefile objtool, retpolines: Integrate objtool with retpoline support more closely 2018-03-15 10:54:38 +01:00
Makefile.um License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile_32.cpu License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00