From patchwork Sat Nov 23 11:12:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Svendsen X-Patchwork-Id: 293656 X-Patchwork-Delegate: esben@haabendal.dk Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hugin.dotsrc.org (hugin.dotsrc.org [IPv6:2001:878:346::102]) by ozlabs.org (Postfix) with ESMTP id D22882C00C3 for ; Sat, 23 Nov 2013 22:12:28 +1100 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id 02DBE3FF01 for ; Sat, 23 Nov 2013 12:12:27 +0100 (CET) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail02.prevas.se (mail02.prevas.se [62.95.78.10]) by hugin.dotsrc.org (Postfix) with ESMTPS id 3A4603FE8F for ; Sat, 23 Nov 2013 12:12:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=1822; q=dns/txt; s=ironport2; t=1385205144; x=1416741144; h=from:to:cc:subject:date:message-id; bh=ktMt1HuQVerdUyamXcB/uRo6mRfrHP9w4RBBV++uUU0=; b=Mqcvi5K0yGlzxbBSQBAuedNhj+0xqS+zCkjWycNQo0QufTEYjFRehc9/ 3goBs+ho7Qc9HIXiKK1xmhd7t/phvxIR/6Rbq3Hg4zxiG/A7VjG/RRyrh MmyhI1TgD1N61DwwvgbziL0/MXHfDd43LPIz+lrIRATRLBVdDaPRGLqNN M=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtwGAEyNkFJauXn3/2dsb2JhbABZtBmMFoEwdIImAQV5EFFXiB4BwAYXjwcHFoQdA5gUkhKBaoE/Ow X-IPAS-Result: AtwGAEyNkFJauXn3/2dsb2JhbABZtBmMFoEwdIImAQV5EFFXiB4BwAYXjwcHFoQdA5gUkhKBaoE/Ow X-IronPort-AV: E=Sophos;i="4.93,758,1378850400"; d="scan'208";a="62827" Received: from 0128800289.0.fullrate.dk (HELO moth.P-2812HNU-F1) ([90.185.121.247]) by mail02.prevas.se with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Nov 2013 12:12:23 +0100 From: Morten Thunberg Svendsen To: dev@oe-lite.org Subject: [PATCH 4/4] classes/sdk-image: Do not create SO wrapper for ELF files with no rpath Date: Sat, 23 Nov 2013 12:12:17 +0100 Message-Id: <361437153966df06ce27e75c73f87acdbeb9515f.1385196868.git.Morten.ThunbergSvendsen@prevas.dk> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: In-Reply-To: References: Cc: Morten Thunberg Svendsen X-BeenThere: dev@oe-lite.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: OE-lite development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dev-bounces@oe-lite.org Errors-To: dev-bounces@oe-lite.org Calling linker ld-linux on a ELF binary with no rpath will result in the use of the hosts native libraies. Ld-linux will fail if libc is not the same verison as used when creating it. --- classes/sdk-image.oeclass | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/classes/sdk-image.oeclass b/classes/sdk-image.oeclass index 044ec9c..b23cb44 100644 --- a/classes/sdk-image.oeclass +++ b/classes/sdk-image.oeclass @@ -25,6 +25,10 @@ IMAGE_PREPROCESS_NETFILTER = "" IMAGE_PREPROCESS_NETFILTER:HOST_OS_mingw32 = "image_preprocess_linux_netfilter_headers" IMAGE_PREPROCESS_FUNCS += "${IMAGE_PREPROCESS_NETFILTER}" +inherit rpath +image_preprocess_elf_sowrap[import] = "chrpath_get_cmd" +META_EMIT_PREFIX += "rstage:CHRPATH" + SDK_IMAGE_ELF_SOWRAP_DIRS ?= "${base_bindir} ${bindir}" SDK_IMAGE_ELF_SOWRAP_LD_SO ?= "/lib/ld-linux*.so.2" @@ -50,6 +54,14 @@ def image_preprocess_elf_sowrap(d): static_re = re.compile(".*statically.*") return bool(static_re.match(filetype)) + def is_with_rpath(path): + chrpath = chrpath_get_cmd(d,filemagic.file(path)) + print chrpath + cmd = [chrpath, '-l', path] + rpath = oelite.util.shcmd(cmd, quiet=True, + silent_errorcodes=[99]) + return bool(rpath) + def sowrap_dir(dir, recursive=False): if not os.path.exists(dir): return True @@ -72,6 +84,8 @@ def image_preprocess_elf_sowrap(d): continue if is_static(path): continue + if not is_with_rpath(path): + continue os.rename(path, dotpath) with open(path, "w") as wrapper: dirparts = len(os.path.dirname(path).split('/'))