From patchwork Mon Sep 12 20:18:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9327979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9ED846077F for ; Mon, 12 Sep 2016 20:23:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FA7D28EAB for ; Mon, 12 Sep 2016 20:23:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 844A128EB1; Mon, 12 Sep 2016 20:23:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1070028EAB for ; Mon, 12 Sep 2016 20:23:40 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjXj8-00062e-IP; Mon, 12 Sep 2016 20:21:14 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjXj7-00062Y-T6 for xen-devel@lists.xenproject.org; Mon, 12 Sep 2016 20:21:13 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id BB/8E-04595-83E07D75; Mon, 12 Sep 2016 20:21:12 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRWlGSWpSXmKPExsUyZ7p8oK4F3/V wgwPTxSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozZUx8yF3RxVPyd/IqtgfEZWxcjF4eQwEQm idsb97NCOH8ZJW6/bofKbGSUWL5uKjOEM4FRYvOkf0AZTg42AR2Ji18esoPYIgJKEvdWTWYCK WIWmMMkcbV3FxNIQljAS2L6npdgNouAqsSu5S/BGngF3CUapz4Fi0sIKEp0P5sANpRTwEPied cEZhBbCKjmyOrDUDWGEp83LmWewMi3gJFhFaNGcWpRWWqRrrGBXlJRZnpGSW5iZo6uoYGZXm5 qcXFiempOYlKxXnJ+7iZGYLgwAMEOxr9rAw8xSnIwKYnyJgleCxfiS8pPqcxILM6ILyrNSS0+ xCjDwaEkwcvHez1cSLAoNT21Ii0zBxi4MGkJDh4lEd6TPEBp3uKCxNzizHSI1ClGRSlx3hqQh ABIIqM0D64NFi2XGGWlhHkZgQ4R4ilILcrNLEGVf8UozsGoJMx7DGQKT2ZeCdz0V0CLmYAWP9 16GWRxSSJCSqqBUYedfYq/ntuqPtm1Hsu+zha/Evmck2VW0AJ5WRXNbcLrg3NXWTMbV4U6nV1 6XWjG/Ls7e05M3dX/i3Fa53X9U4HLZS7cSjDgFU/ZzVS4wGDjRtYPp9bvXuheEG33Pl0hL+zS k4OBkgf3ZMjttNHvCeazPPhuUeV9SxMZxmeiM/kOJH34zZKxXomlOCPRUIu5qDgRACOMOv+RA gAA X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1473711670!32284920!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60420 invoked from network); 12 Sep 2016 20:21:12 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-3.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 12 Sep 2016 20:21:12 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8CKL2fN026742 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Sep 2016 20:21:03 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u8CKL2FT002319 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Sep 2016 20:21:02 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u8CKL1Lg018147; Mon, 12 Sep 2016 20:21:01 GMT Received: from olila.local.net-space.pl (/10.175.172.57) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Sep 2016 13:21:01 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Mon, 12 Sep 2016 22:18:16 +0200 Message-Id: <1473711511-11931-2-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1473711511-11931-1-git-send-email-daniel.kiper@oracle.com> References: <1473711511-11931-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: jgross@suse.com, sstabellini@kernel.org, andrew.cooper3@citrix.com, cardoe@cardoe.com, pgnet.dev@gmail.com, ning.sun@intel.com, david.vrabel@citrix.com, jbeulich@suse.com, qiaowei.ren@intel.com, gang.wei@intel.com, fu.wei@linaro.org Subject: [Xen-devel] [PATCH v6 01/15] x86: properly calculate ELF end of image address X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Currently ELF end of image address is calculated using first line from "nm -nr xen/xen-syms" output. However, today usually it contains random symbol address not related to end of image in any way. So, it looks that for years that stuff have been working just by lucky coincidence. Hence, it have to be changed to something more reliable. So, let's take ELF end of image address by reading _end symbol address from nm output. Signed-off-by: Daniel Kiper --- xen/arch/x86/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index d3875c5..a4fe740 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -91,7 +91,7 @@ endif $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 ./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TARGET) 0x100000 \ - `$(NM) -nr $(TARGET)-syms | head -n 1 | sed -e 's/^\([^ ]*\).*/0x\1/'` + `$(NM) -nr $(TARGET)-syms | awk '$$3 == "_end" {print "0x"$$1}'` .PHONY: tests tests: