sys-apps/kexec-tools: fix "Unhandled rela relocation: R_X86_64_PLT32" error
authorThomas Deutschmann <whissi@gentoo.org>
Tue, 28 Aug 2018 22:44:38 +0000 (00:44 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Tue, 28 Aug 2018 22:45:05 +0000 (00:45 +0200)
Package-Manager: Portage-2.3.48, Repoman-2.3.10

sys-apps/kexec-tools/files/kexec-tools-2.0.17-fix-unhandled-rela-relocation-R_X86_64_PLT32-error.patch [new file with mode: 0644]
sys-apps/kexec-tools/kexec-tools-2.0.17-r1.ebuild [new file with mode: 0644]

diff --git a/sys-apps/kexec-tools/files/kexec-tools-2.0.17-fix-unhandled-rela-relocation-R_X86_64_PLT32-error.patch b/sys-apps/kexec-tools/files/kexec-tools-2.0.17-fix-unhandled-rela-relocation-R_X86_64_PLT32-error.patch
new file mode 100644 (file)
index 0000000..5d691b3
--- /dev/null
@@ -0,0 +1,38 @@
+From b9de21ef51a7ceab7122a707c188602eae22c4ee Mon Sep 17 00:00:00 2001
+From: Chris Clayton <chris2553@googlemail.com>
+Date: Mon, 20 Aug 2018 12:00:31 +0100
+Subject: kexec: fix for "Unhandled rela relocation: R_X86_64_PLT32" error
+
+In response to a change in binutils, commit b21ebf2fb4c
+(x86: Treat R_X86_64_PLT32 as R_X86_64_PC32) was applied to
+the linux kernel during the 4.16 development cycle and has
+since been backported to earlier stable kernel series. The
+change results in the failure message in $SUBJECT when
+rebooting via kexec.
+
+Fix this by replicating the change in kexec.
+
+Signed-off-by: Chris Clayton <chris2553@googlemail.com>
+Acked-by: Baoquan He <bhe@redhat.com>
+Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
+Acked-by: Bhupesh Sharma <bhsharma@redhat.com>
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+index 7fdde73..db85b44 100644
+--- a/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
++++ b/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
+@@ -79,6 +79,7 @@ void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
+                       goto overflow;
+               break;
+       case R_X86_64_PC32: 
++      case R_X86_64_PLT32:
+               *(uint32_t *)location = value - address;
+               break;
+       default:
+-- 
+cgit 1.2-0.3.lf.el7
+
diff --git a/sys-apps/kexec-tools/kexec-tools-2.0.17-r1.ebuild b/sys-apps/kexec-tools/kexec-tools-2.0.17-r1.ebuild
new file mode 100644 (file)
index 0000000..fdf7966
--- /dev/null
@@ -0,0 +1,86 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+if [[ ${PV} == "9999" ]] ; then
+       inherit git-r3 autotools
+       EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git"
+else
+       SRC_URI="mirror://kernel/linux/utils/kernel/kexec/${P}.tar.xz"
+       KEYWORDS="~amd64 ~arm64 ~x86"
+fi
+
+inherit flag-o-matic libtool linux-info systemd
+
+DESCRIPTION="Load another kernel from the currently executing Linux kernel"
+HOMEPAGE="https://kernel.org/pub/linux/utils/kernel/kexec/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="booke lzma xen zlib"
+
+REQUIRED_USE="lzma? ( zlib )"
+
+DEPEND="
+       lzma? ( app-arch/xz-utils )
+       zlib? ( sys-libs/zlib )"
+RDEPEND="${DEPEND}"
+
+CONFIG_CHECK="~KEXEC"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.0.4-disable-kexec-test.patch
+       "${FILESDIR}"/${PN}-2.0.4-out-of-source.patch
+       "${FILESDIR}"/${P}-fix-unhandled-rela-relocation-R_X86_64_PLT32-error.patch
+)
+
+pkg_setup() {
+       # GNU Make's $(COMPILE.S) passes ASFLAGS to $(CCAS), CCAS=$(CC)
+       export ASFLAGS="${CCASFLAGS}"
+}
+
+src_prepare() {
+       default
+       if [[ ${PV} == "9999" ]] ; then
+               eautoreconf
+       else
+               elibtoolize
+       fi
+       filter-flags '-mindirect-branch=thunk*'
+}
+
+src_configure() {
+       local myeconfargs=(
+               $(use_with booke)
+               $(use_with lzma)
+               $(use_with xen)
+               $(use_with zlib)
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+
+       dodoc "${FILESDIR}"/README.Gentoo
+
+       newinitd "${FILESDIR}"/kexec.init-2.0.13-r1 kexec
+       newconfd "${FILESDIR}"/kexec.conf-2.0.4 kexec
+
+       insinto /etc
+       doins "${FILESDIR}"/kexec.conf
+
+       insinto /etc/kernel/postinst.d
+       doins "${FILESDIR}"/90_kexec
+
+       systemd_dounit "${FILESDIR}"/kexec.service
+}
+
+pkg_postinst() {
+       if systemd_is_booted || has_version sys-apps/systemd; then
+               elog "For systemd support the new config file is"
+               elog "   /etc/kexec.conf"
+               elog "Please adopt it to your needs as there is no autoconfig anymore"
+       fi
+}