From patchwork Mon Jun 25 21:44:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryce Ferguson X-Patchwork-Id: 934587 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rockwellcollins.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41F2kb15G0z9ryk for ; Tue, 26 Jun 2018 07:44:23 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 43BCF844E9; Mon, 25 Jun 2018 21:44:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5rkVEnCdYi1c; Mon, 25 Jun 2018 21:44:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 589BC84115; Mon, 25 Jun 2018 21:44:17 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 6B0831C0683 for ; Mon, 25 Jun 2018 21:44:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6718C20C7C for ; Mon, 25 Jun 2018 21:44:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K+pLw4tSKjU1 for ; Mon, 25 Jun 2018 21:44:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from da1vs04.rockwellcollins.com (da1vs04.rockwellcollins.com [205.175.227.52]) by silver.osuosl.org (Postfix) with ESMTPS id 756C8207EF for ; Mon, 25 Jun 2018 21:44:15 +0000 (UTC) Received: from ofwda1n02.rockwellcollins.com (HELO dtulimr02.rockwellcollins.com) ([205.175.227.14]) by da1vs04.rockwellcollins.com with ESMTP; 25 Jun 2018 16:44:14 -0500 X-Received: from bacon.rockwellcollins.com (unknown [192.168.6.146]) by dtulimr02.rockwellcollins.com (Postfix) with ESMTP id 6E0C12007B; Mon, 25 Jun 2018 16:44:14 -0500 (CDT) From: Bryce Ferguson To: buildroot@buildroot.org Date: Mon, 25 Jun 2018 16:44:07 -0500 Message-Id: <20180625214407.12687-1-bryce.ferguson@rockwellcollins.com> X-Mailer: git-send-email 2.17.0 Subject: [Buildroot] [PATCH 1/1] patchelf: Add patch to fix relative rpath issue on PPC X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bryce Ferguson MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This commit adds a patch to the host package patchelf to fix an issue with endianness when the --make-rpath-relative option is specified. Currently, patchelf does not take into account the architecture of the target ELF when it performs the fixup on the RPATH. Thus, if it differs from the host in endianness, the RUNPATH field will be invalid. The patch fixes the bug reported here: https://bugs.busybox.net/show_bug.cgi?id=11101 Signed-off-by: Bryce Ferguson --- ...LF-endianness-before-writing-new-run.patch | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 package/patchelf/0004-patchelf-Check-ELF-endianness-before-writing-new-run.patch diff --git a/package/patchelf/0004-patchelf-Check-ELF-endianness-before-writing-new-run.patch b/package/patchelf/0004-patchelf-Check-ELF-endianness-before-writing-new-run.patch new file mode 100644 index 0000000000..4c528a5908 --- /dev/null +++ b/package/patchelf/0004-patchelf-Check-ELF-endianness-before-writing-new-run.patch @@ -0,0 +1,40 @@ +From 8c75599b674c73fbfe9c15afeccad54ae88243f5 Mon Sep 17 00:00:00 2001 +From: Bryce Ferguson +Date: Mon, 25 Jun 2018 13:05:07 -0500 +Subject: [PATCH 1/1] patchelf: Check ELF endianness before writing new runpath + +This commit modifies the way fields are written in the dynamic +section in order to account the architecture of the target ELF +file. Instead of copying the raw data, use the helper functions +to convert endianness. + +Link to upstream PR: https://github.com/NixOS/patchelf/pull/151 + +Signed-off-by: Bryce Ferguson +--- + src/patchelf.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/patchelf.cc b/src/patchelf.cc +index 35b4a33..a33f644 100644 +--- a/src/patchelf.cc ++++ b/src/patchelf.cc +@@ -1315,13 +1315,13 @@ void ElfFile::modifyRPath(RPathOp op, string rootDir, string + debug("new rpath is `%s'\n", newRPath.c_str()); + + if (!forceRPath && dynRPath && !dynRunPath) { /* convert DT_RPATH to DT_RUNPATH */ +- dynRPath->d_tag = DT_RUNPATH; ++ wri(dynRPath->d_tag, DT_RUNPATH); + dynRunPath = dynRPath; + dynRPath = 0; + } + + if (forceRPath && dynRPath && dynRunPath) { /* convert DT_RUNPATH to DT_RPATH */ +- dynRunPath->d_tag = DT_IGNORE; ++ wri(dynRunPath->d_tag, DT_IGNORE); + } + + if (newRPath.size() <= rpathSize) { +-- +2.17.0 +