From nobody Thu Apr 25 12:36:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617270279; cv=none; d=zohomail.com; s=zohoarc; b=PfIaVQDO0uHGNs4HgPg8/O+4/t/+OYDlxk9O4xfqrsOtghxGACLpwsbRLqaZZXK222AE5qY3QQFu4Am8lc/ayouo0G7S74SZRtsC/KKGD1TWsiwY6103UPy8DIzv1sh0PyCTLWhx3XTygPydLI/Kskre5g83eeethLi89aFzae0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617270279; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T3WVBUNZlwkjFctAwYGueyDD3YPIMV4/P6HSt5pzgHA=; b=CpRZQO+PQaaKznUXyvsUHDyhIBnKyNVv8TwimRPbse7I+q7bMJXdJzYKWhmaUQCkdFgLhFQq9sFdzJzBUmI0ppUKvzupwgBqYkCQyHS9zx7pxp+/OvRJ9jApcCyKGtppDUoF0Kpo4njCVCjSjfc4fRw1K/UBasDDWza2TVCHYQo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617270279389482.3155663782949; Thu, 1 Apr 2021 02:44:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104225.199085 (Exim 4.92) (envelope-from ) id 1lRtsH-0004PQ-Au; Thu, 01 Apr 2021 09:44:25 +0000 Received: by outflank-mailman (output) from mailman id 104225.199085; Thu, 01 Apr 2021 09:44:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtsH-0004PJ-6I; Thu, 01 Apr 2021 09:44:25 +0000 Received: by outflank-mailman (input) for mailman id 104225; Thu, 01 Apr 2021 09:44:23 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtsF-0004OP-5T for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 09:44:23 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f93c7e43-ff02-4be7-8954-a579a24e35d6; Thu, 01 Apr 2021 09:44:22 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 97E67AEA6; Thu, 1 Apr 2021 09:44:21 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f93c7e43-ff02-4be7-8954-a579a24e35d6 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617270261; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T3WVBUNZlwkjFctAwYGueyDD3YPIMV4/P6HSt5pzgHA=; b=NUcZU/GoXoDLtUTyg8NorkhNCs9ED7+rX+WfQPPsdOcH6v1cFfA9JS/pISL1iVJFY84d5g sUE62iTiyq9PFQdB1700hkojGl0u5V+cOIAp5qAEfX+tC6Ejt8VnYof4AVjN0OR4o5UYZY ysql3Jogls1tBttB2PzqOMxx/2nPu6s= Subject: [PATCH 1/8] x86/EFI: drop stale section special casing when generating base relocs From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <63ad859f-82f0-62ea-5e55-9c6d3db6816e@suse.com> Date: Thu, 1 Apr 2021 11:44:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" As of commit a6066af5b142 ("xen/init: Annotate all command line parameter infrastructure as const") .init.setup has been part of .init. As of commit 544ad7f5caf5 ("xen/init: Move initcall infrastructure into .init.data") .initcall* have been part of .init. Hence neither can be encountered as a stand-alone section in the final binaries anymore. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/xen/arch/x86/efi/mkreloc.c +++ b/xen/arch/x86/efi/mkreloc.c @@ -346,9 +346,7 @@ int main(int argc, char *argv[]) * Don't generate relocations for sections that definitely * aren't used by the boot loader code. */ - if ( memcmp(sec1[i].name, ".initcal", sizeof(sec1[i].name)) =3D=3D= 0 || - memcmp(sec1[i].name, ".init.se", sizeof(sec1[i].name)) =3D=3D= 0 || - memcmp(sec1[i].name, ".buildid", sizeof(sec1[i].name)) =3D=3D= 0 || + if ( memcmp(sec1[i].name, ".buildid", sizeof(sec1[i].name)) =3D=3D= 0 || memcmp(sec1[i].name, ".lockpro", sizeof(sec1[i].name)) =3D=3D= 0 ) continue; =20 From nobody Thu Apr 25 12:36:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617270303; cv=none; d=zohomail.com; s=zohoarc; b=Whuibcg9uBLOtqd02tikXlY+IBhbwydjasLkBoq38J/xpL+y1R2XDxEfJ/h57oZMC4kZmA17EASVcB9k8fpeKoGQRb+qnOVNZt0H1+gQPPjsBzAbQj0ZPrhpCj1s9077i6kF/zr/TJ1sSXV2ZNuwW2pRf+qTsG7xbTyWjTutM8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617270303; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DTY3+YpVaKr0M5lxEi40/UGmLAUNw4TGq/wK3vHEKos=; b=Kqz97JspNnopbp8Gy8OBg45WMBa+4gTvuR0QtQsP+SEyXTUPk7Uyvz2xRimYesEosdgZgeWifFzjTQ0+A2bEbIKK8FEwDqL9laSkSDMrH6cC0x6UGKvFNpbr8tn6cZySPPSyUiBrV56Kd5unS2kS7/INeLG0wJptbXXW58m0VuQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617270303305895.0033394086678; Thu, 1 Apr 2021 02:45:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104227.199098 (Exim 4.92) (envelope-from ) id 1lRtsf-0004Vf-Hw; Thu, 01 Apr 2021 09:44:49 +0000 Received: by outflank-mailman (output) from mailman id 104227.199098; Thu, 01 Apr 2021 09:44:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtsf-0004VY-Ep; Thu, 01 Apr 2021 09:44:49 +0000 Received: by outflank-mailman (input) for mailman id 104227; Thu, 01 Apr 2021 09:44:48 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtsd-0004VQ-Um for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 09:44:47 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id fe3208f1-ecda-432e-992b-d7c37b5347b1; Thu, 01 Apr 2021 09:44:46 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 103B1AEB6; Thu, 1 Apr 2021 09:44:46 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fe3208f1-ecda-432e-992b-d7c37b5347b1 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617270286; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DTY3+YpVaKr0M5lxEi40/UGmLAUNw4TGq/wK3vHEKos=; b=RMb8FYQPGQ4y2QUArjxQ8e8E9Ki9Di/g32LAqqoALfhUEAYYcyRsoG6ubbRT+syvdahlPu lXOaLpqN4iKXypG7Dci1xCZ5NpTMPOqT1r5+HjsoJ3UbWNQVFfiwMyVHhWGHGcLdoHIwBu gVDLQzqmktH+1xJiyWBW2AilaEM3PEc= Subject: [PATCH 2/8] x86/EFI: sections may not live at VA 0 in PE binaries From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <5d7c61b0-8441-dccc-4917-cc8a436fd96f@suse.com> Date: Thu, 1 Apr 2021 11:44:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" PE binaries specify section addresses by (32-bit) RVA. GNU ld up to at least 2.36 would silently truncate the (negative) difference when a section is placed below the image base. Such sections would also be wrongly placed ahead of all "normal" ones. Since, for the time being, we build xen.efi with --strip-debug anyway, .stab* can't appear. And .comment has an entry in /DISCARD/ already anyway in the EFI case. Because of their unclear origin, keep the directives for the ELF case though. Signed-off-by: Jan Beulich --- It's certainly odd that we have stabs section entries in the script, but no Dwarf ones. --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -347,6 +347,7 @@ SECTIONS #endif } =20 +#ifndef EFI /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } @@ -355,6 +356,7 @@ SECTIONS .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } +#endif } =20 ASSERT(__2M_rwdata_end <=3D XEN_VIRT_END - XEN_VIRT_START + __XEN_VIRT_STA= RT - From nobody Thu Apr 25 12:36:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617270329; cv=none; d=zohomail.com; s=zohoarc; b=dvJTtHjwX+byCL3VGo963JpTVMnBfX8wd0cEUKAXQbp4yNRokV+iBeeBsoDzdd8/5wivTzHb0wx9kCpmnWUqt+USI0EBp1SkFv5FcHJj0U4pnoIZOCltM+oo94/x9kBZQmr7d0aYs2CjtHZOaICXPYmRY7E3psWZ0WRU2G3TGY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617270329; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zGF5/no4yyDySevuLNlCcruxFje6e6BtvrRRyJsweIc=; b=aQOQR2b41qPnQtRwoojSFGTHrbv5SysyxOs0gGeyuYemvt42A+Eo0YeQzN+baf3s+18YrGimV9wjuJ9I41p6SEMOLtyxwGGE4GmCZDAqWacT6iR7o6M3oCVN7O1nfVh4FMVRTvoTG+8yeWwBpPKRjC1L3/bxYnfGKmMGr8pf/8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617270329118420.4682289698627; Thu, 1 Apr 2021 02:45:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104230.199110 (Exim 4.92) (envelope-from ) id 1lRtt2-0004cl-Vj; Thu, 01 Apr 2021 09:45:12 +0000 Received: by outflank-mailman (output) from mailman id 104230.199110; Thu, 01 Apr 2021 09:45:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtt2-0004cc-Ru; Thu, 01 Apr 2021 09:45:12 +0000 Received: by outflank-mailman (input) for mailman id 104230; Thu, 01 Apr 2021 09:45:11 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtt1-0004cP-P5 for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 09:45:11 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id fdc01e63-a97f-4d35-a452-27dddd54c2a6; Thu, 01 Apr 2021 09:45:10 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 25BD5AEC2; Thu, 1 Apr 2021 09:45:10 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fdc01e63-a97f-4d35-a452-27dddd54c2a6 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617270310; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zGF5/no4yyDySevuLNlCcruxFje6e6BtvrRRyJsweIc=; b=QUl1VmTsvmGOtkCxbMHlKH6XDNRr9b7AwnLSaHzocfueemup8rnq/nu2jKjyszFeQrYutJ SNbJT0+x7uqF1oj9w54L+o8q/r+E8kMivj2Flaicqsdws1y3n5zm31BM/OcOUyyxXZN7j3 lkLiPaFKQGTkXhj/dR9EGEPor/nN7T8= Subject: [PATCH 3/8] x86/EFI: program headers are an ELF concept From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <017478f9-76d2-4dc4-de93-b662c4552968@suse.com> Date: Thu, 1 Apr 2021 11:45:09 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" While they apparently do no harm when building xen.efi, their use is potentially misleading. Conditionalize their use to be for just the ELF binary we produce. No change to the resulting binaries. Signed-off-by: Jan Beulich --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -34,13 +34,19 @@ OUTPUT_FORMAT(FORMAT, FORMAT, FORMAT) =20 OUTPUT_ARCH(i386:x86-64) =20 +#ifndef EFI PHDRS { text PT_LOAD ; -#if (defined(BUILD_ID) || defined (CONFIG_PVH_GUEST)) && !defined(EFI) +#if defined(BUILD_ID) || defined(CONFIG_PVH_GUEST) note PT_NOTE ; #endif } +#define PHDR(x) :x +#else +#define PHDR(x) +#endif + SECTIONS { #if !defined(EFI) @@ -83,7 +89,7 @@ SECTIONS *(.text.kexec) *(.gnu.warning) _etext =3D .; /* End of text section */ - } :text =3D 0x9090 + } PHDR(text) =3D 0x9090 =20 . =3D ALIGN(SECTION_ALIGN); __2M_text_end =3D .; @@ -134,7 +140,7 @@ SECTIONS *(SORT(.data.vpci.*)) __end_vpci_array =3D .; #endif - } :text + } PHDR(text) =20 #if defined(CONFIG_PVH_GUEST) && !defined(EFI) DECL_SECTION(.note.Xen) { @@ -160,7 +166,7 @@ SECTIONS __note_gnu_build_id_start =3D .; *(.buildid) __note_gnu_build_id_end =3D .; - } :text + } #endif #endif =20 @@ -260,7 +266,7 @@ SECTIONS *(SORT(.data.vpci.*)) __end_vpci_array =3D .; #endif - } :text + } PHDR(text) =20 . =3D ALIGN(SECTION_ALIGN); __init_end =3D .; @@ -281,7 +287,7 @@ SECTIONS *(.data.paramhypfs) __paramhypfs_end =3D .; #endif - } :text + } PHDR(text) =20 DECL_SECTION(.data) { *(.data.page_aligned) @@ -289,7 +295,7 @@ SECTIONS *(.data.rel) *(.data.rel.*) CONSTRUCTORS - } :text + } PHDR(text) =20 DECL_SECTION(.bss) { __bss_start =3D .; @@ -306,7 +312,7 @@ SECTIONS *(.bss) . =3D ALIGN(POINTER_ALIGN); __bss_end =3D .; - } :text + } PHDR(text) _end =3D . ; =20 . =3D ALIGN(SECTION_ALIGN); @@ -316,12 +322,12 @@ SECTIONS . =3D ALIGN(4); DECL_SECTION(.reloc) { *(.reloc) - } :text + } /* Trick the linker into setting the image size to exactly 16Mb. */ . =3D ALIGN(__section_alignment__); DECL_SECTION(.pad) { . =3D ALIGN(MB(16)); - } :text + } #endif =20 #ifndef XEN_BUILD_EFI From nobody Thu Apr 25 12:36:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617270358; cv=none; d=zohomail.com; s=zohoarc; b=BL83z42/DiBeweLM/cZHLgSVHWx73cwzvUg+XhjvA4BUDMNHglWtdI7ynYbnoMtyLXFb+3Ewpxo4GNZZyTYNy/JzPFPuQLYZ65cOePVSkUs3InnfsHBIsx2wlnQsRDpslw0XOcSNcaVJA9PdDHwod6rO4OcUeIl9r9l4HjiUk7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617270358; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UKBqIqEP4Yay9/oLsxxVgXNUOGzjbOD2XiVhg/zRm+8=; b=fyfBZsevNxoOcjliGd2g3D9yoyS3u89YxPgDHQFXMKpV/gUg48DlQ/tmLULZDKTPLxRKNBG1k2+32+MY+Jz4vMEymLmzTwGmS1ZNtwQ9G1Ze7CJzX4ZYUCcYmTtjbuPkp5ym7qU2YG84UsKCXAXYL/yHLdsHb1ATyhWLZnFn1Gk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617270358056979.2755698081947; Thu, 1 Apr 2021 02:45:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104236.199121 (Exim 4.92) (envelope-from ) id 1lRttV-0004ju-87; Thu, 01 Apr 2021 09:45:41 +0000 Received: by outflank-mailman (output) from mailman id 104236.199121; Thu, 01 Apr 2021 09:45:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRttV-0004jn-55; Thu, 01 Apr 2021 09:45:41 +0000 Received: by outflank-mailman (input) for mailman id 104236; Thu, 01 Apr 2021 09:45:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRttU-0004je-7R for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 09:45:40 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 36a9c5e2-07e6-440f-9656-22fac216e603; Thu, 01 Apr 2021 09:45:39 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 888FEAEF5; Thu, 1 Apr 2021 09:45:38 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 36a9c5e2-07e6-440f-9656-22fac216e603 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617270338; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UKBqIqEP4Yay9/oLsxxVgXNUOGzjbOD2XiVhg/zRm+8=; b=OMjhq7Xrj0Yd6y7h4Txz18Q+XpBGF/zE1K7PXE6yQA8Dnb68sum0FQamoFRoYm+rhaf9Mp 9DPcAVdioNm+lB6A6aoQEkGQZW/m8ihhqdi6JCJ7kxAz0FBFAxX2dHElsiH/qotTclg+lu yri3lBTmdwAEgOrFbmvbDdk17nOY8Dw= Subject: [PATCH 4/8] x86/EFI: redo .reloc section bounds determination From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: Date: Thu, 1 Apr 2021 11:45:38 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There's no need to link relocs-dummy.o into the ELF binary. The two symbols needed can as well be provided by the linker script. Then our mkreloc tool also doesn't need to put them in the generated assembler source. Signed-off-by: Jan Beulich --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -133,7 +133,6 @@ XEN_NO_PE_FIXUPS :=3D $(if $(XEN_BUILD_EFI endif =20 ALL_OBJS :=3D $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/= built_in.o $(ALL_OBJS) -EFI_OBJS-$(XEN_BUILD_EFI) :=3D efi/relocs-dummy.o =20 ifeq ($(CONFIG_LTO),y) # Gather all LTO objects together @@ -141,13 +140,13 @@ prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS) $(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --= end-group =20 # Link it with all the binary objects -prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o $(EFI_OBJS-y) FORCE +prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o FORCE $(call if_changed,ld) =20 prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) preli= nk_lto.o FORCE $(call if_changed,ld) else -prelink.o: $(ALL_OBJS) $(ALL_LIBS) $(EFI_OBJS-y) FORCE +prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE $(call if_changed,ld) =20 prelink-efi.o: $(ALL_OBJS) $(ALL_LIBS) FORCE --- a/xen/arch/x86/efi/mkreloc.c +++ b/xen/arch/x86/efi/mkreloc.c @@ -320,9 +320,7 @@ int main(int argc, char *argv[]) } =20 puts("\t.section .reloc, \"a\", @progbits\n" - "\t.balign 4\n" - "\t.globl __base_relocs_start, __base_relocs_end\n" - "__base_relocs_start:"); + "\t.balign 4"); =20 for ( i =3D 0; i < nsec; ++i ) { @@ -373,8 +371,6 @@ int main(int argc, char *argv[]) =20 diff_sections(NULL, NULL, NULL, 0, 0, 0, 0); =20 - puts("__base_relocs_end:"); - close(in1); close(in2); =20 --- a/xen/arch/x86/efi/relocs-dummy.S +++ b/xen/arch/x86/efi/relocs-dummy.S @@ -1,10 +1,8 @@ =20 .section .reloc, "a", @progbits .balign 4 -GLOBAL(__base_relocs_start) .long 0 .long 8 -GLOBAL(__base_relocs_end) =20 .globl VIRT_START, ALT_START .equ VIRT_START, XEN_VIRT_START --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -170,18 +170,6 @@ SECTIONS #endif #endif =20 -/* - * ELF builds are linked to a fixed virtual address, and in principle - * shouldn't have a .reloc section. However, due to the way EFI support is - * currently implemented, retaining the .reloc section is necessary. - */ -#if defined(XEN_BUILD_EFI) && !defined(EFI) - . =3D ALIGN(4); - DECL_SECTION(.reloc) { - *(.reloc) - } :text -#endif - _erodata =3D .; =20 . =3D ALIGN(SECTION_ALIGN); @@ -319,18 +307,27 @@ SECTIONS __2M_rwdata_end =3D .; =20 #ifdef EFI - . =3D ALIGN(4); - DECL_SECTION(.reloc) { + .reloc ALIGN(4) : { + __base_relocs_start =3D .; *(.reloc) + __base_relocs_end =3D .; } /* Trick the linker into setting the image size to exactly 16Mb. */ . =3D ALIGN(__section_alignment__); DECL_SECTION(.pad) { . =3D ALIGN(MB(16)); } -#endif - -#ifndef XEN_BUILD_EFI +#elif defined(XEN_BUILD_EFI) + /* + * Due to the way EFI support is currently implemented, these two symbols + * need to be defined. Their precise values shouldn't matter (the consu= ming + * function doesn't get called), but to be on the safe side both values = would + * better match. Of course the need to be reachable by the relocations + * referencing them. + */ + PROVIDE(__base_relocs_start =3D .); + PROVIDE(__base_relocs_end =3D .); +#else efi =3D .; #endif =20 From nobody Thu Apr 25 12:36:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617270379; cv=none; d=zohomail.com; s=zohoarc; b=EVpU5Kcfk1X8GfImr8jHxi8jXReCuYzZyFnf+9HDB1VT/u91vUY2PtfzjDwf7RvA8Zrfg2o8GJXhDvoGIA4OMuKAUdWzqsYDoQowgsQTlXxCPFAXor9VmnSzRG6a7oagW2cNuOKw7IjHkD824UhOv6GMkp3k0jXfi5JpT2ARZmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617270379; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Qw1kb41OPZcRbU+DKLj0F67252xeEtyBQIm85C/nQy0=; b=ffE0zsn/5VGh3la5bClmK9dFztTY9CDRN6DX+hU94jqVmVMmu/htE6Amtffxn/dRvFXcImRhXpoumciN9GSg/eZ3qeBeYim9QkcH47yL3Ia+k6UNU2Krdk020D0Wo7R4nJrb48NZyeC25HukHqdYjQkZPURBSwdtx35ANL4zL1M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617270379986863.4036256665078; Thu, 1 Apr 2021 02:46:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104237.199134 (Exim 4.92) (envelope-from ) id 1lRttr-0004qH-Gi; Thu, 01 Apr 2021 09:46:03 +0000 Received: by outflank-mailman (output) from mailman id 104237.199134; Thu, 01 Apr 2021 09:46:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRttr-0004qA-Dg; Thu, 01 Apr 2021 09:46:03 +0000 Received: by outflank-mailman (input) for mailman id 104237; Thu, 01 Apr 2021 09:46:02 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRttq-0004pv-8H for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 09:46:02 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 07af8a97-5e05-44aa-8f35-8a8b086b82e3; Thu, 01 Apr 2021 09:46:01 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CBB9FAEB6; Thu, 1 Apr 2021 09:46:00 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 07af8a97-5e05-44aa-8f35-8a8b086b82e3 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617270360; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qw1kb41OPZcRbU+DKLj0F67252xeEtyBQIm85C/nQy0=; b=G9I0SyuKAvHYvcionj9PHoTEsg5cT12638o2mJHraetOulmhy92uf9M3s2SS6EGY1EOu3/ JgN00BRJrlCtxgFlWgatXv5m4KFUTSniFS151jC/nnIHGPXhlOx+aXJJcDCKvlhfemE9nY LY1tGzynz+Rv5PCBEZUAzhusjvm5mRY= Subject: [PATCH 5/8] x86: drop use of prelink-efi.o From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: Date: Thu, 1 Apr 2021 11:46:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Now that its contents matches prelink.o, use that one uniformly. Signed-off-by: Jan Beulich --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -142,18 +142,12 @@ prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS) # Link it with all the binary objects prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o FORCE $(call if_changed,ld) - -prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) preli= nk_lto.o FORCE - $(call if_changed,ld) else prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE $(call if_changed,ld) - -prelink-efi.o: $(ALL_OBJS) $(ALL_LIBS) FORCE - $(call if_changed,ld) endif =20 -targets +=3D prelink.o prelink-efi.o +targets +=3D prelink.o =20 $(TARGET)-syms: prelink.o xen.lds $(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \ @@ -214,7 +208,7 @@ endif note_file_option ?=3D $(note_file) =20 ifeq ($(XEN_BUILD_PE),y) -$(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o efi/m= kreloc +$(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkrel= oc $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-d= ummy.o \ $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o = $(@D)/.$(@F).$(base).0 &&) : From nobody Thu Apr 25 12:36:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617270422; cv=none; d=zohomail.com; s=zohoarc; b=lsMSxnl/jHjzafytUGfKfVOUhk5DS7nIX/ELkJjF51E0yjzbQI+S2ZM8WJJIXvyfLBtj0PzBmiLjZ4yJLRnKBttlJRG/yR8A9t4LaD4S6fUXM1HDeJr8kt9aw8mikCAFc8EnJE1hDnSrBpVuIYwsAf7WT25why8wYeEgy57bGwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617270422; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BW+wzkzMZPCZQCOdltyTqhUeMxSr4FMBEpHB0pwsBlk=; b=OLnEPl8StvrMu0lBj7Mi4fGBHW1YNn8QbheYV6jtcigrXM7VIzXAcFc+BPmM+oIQNaa6EVOJBcWIkfZUgRv3yvPJgHEydptC3AJQ2EbLqAypfAq7abXh5qnhnHRqsoEpCt06DSy4xgsN1/VDL1fODfOpTBotjl2MYi5TxStNXHk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 161727042226850.98641766095932; Thu, 1 Apr 2021 02:47:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104243.199146 (Exim 4.92) (envelope-from ) id 1lRtuZ-0004ym-RC; Thu, 01 Apr 2021 09:46:47 +0000 Received: by outflank-mailman (output) from mailman id 104243.199146; Thu, 01 Apr 2021 09:46:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtuZ-0004yf-O0; Thu, 01 Apr 2021 09:46:47 +0000 Received: by outflank-mailman (input) for mailman id 104243; Thu, 01 Apr 2021 09:46:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtuZ-0004ya-6A for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 09:46:47 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cc901f13-5f8e-4bce-96b6-4acdf0a0893d; Thu, 01 Apr 2021 09:46:46 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4E513AEB6; Thu, 1 Apr 2021 09:46:45 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cc901f13-5f8e-4bce-96b6-4acdf0a0893d X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617270405; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BW+wzkzMZPCZQCOdltyTqhUeMxSr4FMBEpHB0pwsBlk=; b=QA0d1jBVxRK9qyx0STCHg7XtbyTxZB614ga8ZOiQZDa7LJYDb9fpTIVSEgX0wpCAj5Uj/A PTMiFHE9C3KtfcDB069FojpWeBMvgco0MXy3CsEtMM9gTspbvzWklIQSyMY3PLvggsg57L 8s29XUIpgzcdhotAk7necnZHqSNmYUw= Subject: [PATCH 6/8] x86/EFI: avoid use of GNU ld's --disable-reloc-section when possible From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: Date: Thu, 1 Apr 2021 11:46:44 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" As of commit 6fa7408d72b3 ("ld: don't generate base relocations in PE output for absolute symbols") I'm feeling sufficiently confident in GNU ld to use its logic for generating base relocations, which was enabled for executables at some point last year (prior to that this would have got done only for DLLs). GNU ld, seeing the original relocations coming from the ELF object files, generates different relocation types for our page tables (64-bit ones, while mkreloc produces 32-bit ones). This requires also permitting and handling that type in efi_arch_relocate_image(). Signed-off-by: Jan Beulich --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -120,18 +120,37 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/ mv $(TMP) $(TARGET) =20 ifneq ($(efi-y),) + # Check if the compiler supports the MS ABI. export XEN_BUILD_EFI :=3D $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o ef= i/check.o 2>/dev/null && echo y) +CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI + # Check if the linker supports PE. EFI_LDFLAGS =3D $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=3D10 = --strip-debug XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(shell $(LD) $(EFI_LDFLAGS) -o ef= i/check.efi efi/check.o 2>/dev/null && echo y)) -CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI -# Check if the linker produces fixups in PE by default (we need to disable= it doing so for now). -XEN_NO_PE_FIXUPS :=3D $(if $(XEN_BUILD_EFI), \ - $(shell $(LD) $(EFI_LDFLAGS) --disable-reloc-sect= ion -o efi/check.efi efi/check.o 2>/dev/null && \ - echo --disable-reloc-section)) + +ifeq ($(XEN_BUILD_PE),y) + +# Check if the linker produces fixups in PE by default +nr-fixups :=3D $(shell $(OBJDUMP) -p efi/check.efi | grep '^[[:blank:]]*re= loc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l) +ifeq ($(nr-fixups),2) +MKRELOC :=3D : +relocs-dummy :=3D +else +MKRELOC :=3D efi/mkreloc +relocs-dummy :=3D efi/relocs-dummy.o +# If the linker produced fixups but not precisely two of them, we need to +# disable it doing so. But if it didn't produce any fixups, it also would= n't +# recognize the option. +ifneq ($(nr-fixups),0) +EFI_LDFLAGS +=3D --disable-reloc-section +endif endif =20 +endif # $(XEN_BUILD_PE) + +endif # $(efi-y) + ALL_OBJS :=3D $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/= built_in.o $(ALL_OBJS) =20 ifeq ($(CONFIG_LTO),y) @@ -175,7 +194,7 @@ note.o: $(TARGET)-syms --rename-section=3D.data=3D.note.gnu.build-id -S $@.bin $@ rm -f $@.bin =20 -EFI_LDFLAGS +=3D --image-base=3D$(1) --stack=3D0,0 --heap=3D0,0 $(XEN_NO_P= E_FIXUPS) +EFI_LDFLAGS +=3D --image-base=3D$(1) --stack=3D0,0 --heap=3D0,0 EFI_LDFLAGS +=3D --section-alignment=3D0x200000 --file-alignment=3D0x20 EFI_LDFLAGS +=3D --major-image-version=3D$(XEN_VERSION) EFI_LDFLAGS +=3D --minor-image-version=3D$(XEN_SUBVERSION) @@ -189,7 +208,11 @@ EFI_LDFLAGS +=3D --no-insert-timestamp endif =20 $(TARGET).efi: VIRT_BASE =3D 0x$(shell $(NM) efi/relocs-dummy.o | sed -n '= s, A VIRT_START$$,,p') +ifeq ($(MKRELOC),:) +$(TARGET).efi: ALT_BASE :=3D +else $(TARGET).efi: ALT_BASE =3D 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's= , A ALT_START$$,,p') +endif =20 ifneq ($(build_id_linker),) ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y) @@ -210,16 +233,16 @@ note_file_option ?=3D $(note_file) ifeq ($(XEN_BUILD_PE),y) $(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkrel= oc $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ - $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-d= ummy.o \ + $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< $(relocs-dum= my) \ $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o = $(@D)/.$(@F).$(base).0 &&) : - efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).= 0) >$(@D)/.$(@F).0r.S + $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0= ) >$(@D)/.$(@F).0r.S $(NM) -pa --format=3Dsysv $(@D)/.$(@F).$(VIRT_BASE).0 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s= .S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \ $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) -= o $(@D)/.$(@F).$(base).1 &&) : - efi/mkreloc $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).= 1) >$(@D)/.$(@F).1r.S + $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1= ) >$(@D)/.$(@F).1r.S $(NM) -pa --format=3Dsysv $(@D)/.$(@F).$(VIRT_BASE).1 \ | $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s= .S $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o --- a/xen/arch/x86/efi/check.c +++ b/xen/arch/x86/efi/check.c @@ -2,3 +2,17 @@ int __attribute__((__ms_abi__)) test(int { return i; } + +/* + * Populate an array with "addresses" of relocatable and absolute values. + * This is to probe ld for (a) emitting base relocations at all and (b) not + * emitting base relocations for absolute symbols. + */ +extern const unsigned char __image_base__[], __file_alignment__[], + __section_alignment__[]; +const void *const data[] =3D { + __image_base__, + __file_alignment__, + __section_alignment__, + data, +}; --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -86,10 +86,12 @@ static void __init efi_arch_relocate_ima } break; case PE_BASE_RELOC_DIR64: - if ( in_page_tables(addr) ) - blexit(L"Unexpected relocation type"); if ( delta ) + { *(u64 *)addr +=3D delta; + if ( in_page_tables(addr) ) + *(u64 *)addr +=3D xen_phys_start; + } break; default: blexit(L"Unsupported relocation type"); From nobody Thu Apr 25 12:36:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617270443; cv=none; d=zohomail.com; s=zohoarc; b=ft1dV2cm/ynmP2mGcRHSB8TJmX8xCN+YKgxfeoglmwf92SY0CPI/7K64r89nOypojR9/mLxOm5YVaeZwFFZqy/uPo2PRYmt+czRLwPyG/NBpRucBQTqlhWy3TEhRdmT+Q/r2dplXqE5lUK+bkJRbqTuc8JDefnboPM073MNnUo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617270443; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=o2EMpahlSBM5Magli3m1RMCkPQybjV8l/PK9GMnPLmI=; b=hiONsSRJ3B7g8rxgj+xzLUTT4Ft7KyGjSClN7+/jwab4kZo+bdBYuIAwtg+rV9ZlLG849WmXRJt4Aa0P84FaeLWZaysYsxegjm7sPwPaCz0nW9Z19z9yF2ySnmxXSU2Hp5K0IYjhZViL1dIfMV3Qm2jetquKbCxxFa4ux4w8gRE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617270443643737.0484976923715; Thu, 1 Apr 2021 02:47:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104245.199158 (Exim 4.92) (envelope-from ) id 1lRtus-00054u-41; Thu, 01 Apr 2021 09:47:06 +0000 Received: by outflank-mailman (output) from mailman id 104245.199158; Thu, 01 Apr 2021 09:47:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtus-00054m-0K; Thu, 01 Apr 2021 09:47:06 +0000 Received: by outflank-mailman (input) for mailman id 104245; Thu, 01 Apr 2021 09:47:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtur-00054Z-HI for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 09:47:05 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1cedc735-e67c-4fd3-b3fd-a3ade7a64f7d; Thu, 01 Apr 2021 09:47:04 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C87BFB0B6; Thu, 1 Apr 2021 09:47:03 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1cedc735-e67c-4fd3-b3fd-a3ade7a64f7d X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617270423; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o2EMpahlSBM5Magli3m1RMCkPQybjV8l/PK9GMnPLmI=; b=pyG33BoBKNqh7bKndDihnYJWbrqGNE5DK7MQa6a7s730/1pOyToVOEbh1ElA+RW8aP8mGI j6ExHf/YppHC+gqjtAicxfELVry+5DFPYeW1Ma1D2PcIFRKeQBxiJwmv/434TONklvlSWY ZyYuUyaFNeCaKtIWlLKyLb2shXC5okQ= Subject: [PATCH 7/8] x86/EFI: keep debug info in xen.efi From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <96cb4039-5f43-8eac-d855-c9f1587ed2d0@suse.com> Date: Thu, 1 Apr 2021 11:47:03 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" ... provided the linker supports it (which it does as of commit 2dfa8341e079 ["ELF DWARF in PE output"]). Without mentioning debugging sections, the linker would put them at VA 0, thus making them unreachable by 32-bit (relative or absolute) relocations. If relocations were resolvable (or absent) the resulting binary would have invalid section RVAs (0 - __image_base__, truncated to 32 bits). Mentioning debugging sections without specifying an address will result in the linker putting them all on the same RVA. A loader is, afaict, free to reject loading such an image, as sections shouldn't overlap. (The above describes GNU ld 2.36 behavior, which - if deemed buggy - could change.) Make sure our up-to-16Mb padding doesn't unnecessarily further extend the image. Take the opportunity and also switch to using $(call ld-option,...). Requested-by: Andrew Cooper Signed-off-by: Jan Beulich --- This way we could also avoid discarding .comment for xen.efi. I'd like to point out that the linking of the debug info takes far longer than the linking of the "normal" parts of the image. The change therefore has the downside of slowing down debug builds. --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -126,8 +126,14 @@ export XEN_BUILD_EFI :=3D $(shell $(CC) $( CFLAGS-$(XEN_BUILD_EFI) +=3D -DXEN_BUILD_EFI =20 # Check if the linker supports PE. -EFI_LDFLAGS =3D $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=3D10 = --strip-debug -XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(shell $(LD) $(EFI_LDFLAGS) -o ef= i/check.efi efi/check.o 2>/dev/null && echo y)) +EFI_LDFLAGS =3D $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=3D10 +XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --= image-base=3D0x100000000 -o efi/check.efi efi/check.o)) +# If the above failed, it may be merely because of the linker not dealing = well +# with debug info. Try again with stripping it. +ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n) +EFI_LDFLAGS +=3D --strip-debug +XEN_BUILD_PE :=3D $(call ld-option,$(EFI_LDFLAGS) --image-base=3D0x1000000= 00 -o efi/check.efi efi/check.o) +endif =20 ifeq ($(XEN_BUILD_PE),y) =20 @@ -232,6 +238,9 @@ note_file_option ?=3D $(note_file) =20 ifeq ($(XEN_BUILD_PE),y) $(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkrel= oc +ifeq ($(CONFIG_DEBUG_INFO),y) + $(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug inf= o from $(@F)" +endif $(foreach base, $(VIRT_BASE) $(ALT_BASE), \ $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< $(relocs-dum= my) \ $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o = $(@D)/.$(@F).$(base).0 &&) : --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -312,10 +312,60 @@ SECTIONS *(.reloc) __base_relocs_end =3D .; } - /* Trick the linker into setting the image size to exactly 16Mb. */ - . =3D ALIGN(__section_alignment__); - DECL_SECTION(.pad) { - . =3D ALIGN(MB(16)); + .debug_abbrev ALIGN(1) (NOLOAD) : { + *(.debug_abbrev) + } + .debug_info ALIGN(1) (NOLOAD) : { + *(.debug_info) + *(.gnu.linkonce.wi.*) + } + .debug_types ALIGN(1) (NOLOAD) : { + *(.debug_types) + } + .debug_str ALIGN(1) (NOLOAD) : { + *(.debug_str) + } + .debug_line ALIGN(1) (NOLOAD) : { + *(.debug_line) + *(.debug_line.*) + } + .debug_line_str ALIGN(1) (NOLOAD) : { + *(.debug_line_str) + } + .debug_names ALIGN(4) (NOLOAD) : { + *(.debug_names) + } + .debug_frame ALIGN(4) (NOLOAD) : { + *(.debug_frame) + } + .debug_loc ALIGN(1) (NOLOAD) : { + *(.debug_loc) + } + .debug_loclists ALIGN(4) (NOLOAD) : { + *(.debug_loclists) + } + .debug_ranges ALIGN(8) (NOLOAD) : { + *(.debug_ranges) + } + .debug_rnglists ALIGN(4) (NOLOAD) : { + *(.debug_rnglists) + } + .debug_addr ALIGN(8) (NOLOAD) : { + *(.debug_addr) + } + .debug_aranges ALIGN(1) (NOLOAD) : { + *(.debug_aranges) + } + .debug_pubnames ALIGN(1) (NOLOAD) : { + *(.debug_pubnames) + } + .debug_pubtypes ALIGN(1) (NOLOAD) : { + *(.debug_pubtypes) + } + /* Trick the linker into setting the image size to no less than 16Mb. */ + __image_end__ =3D .; + .pad ALIGN(__section_alignment__) : { + . =3D __image_end__ < __image_base__ + MB(16) ? ALIGN(MB(16)) : .; } #elif defined(XEN_BUILD_EFI) /* From nobody Thu Apr 25 12:36:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617270471; cv=none; d=zohomail.com; s=zohoarc; b=WR5M3UxYhRolkt2Ty5ooNnRZKpcSYLWh5akw86KGRvILL4fQCaN8CsHFVPP9OCGaYzVdMZ8I5oeQWlBchCT71Kw2J7J1NaE0rjir0beqGvUQ3U+J350MqVfBEE7I/QbtQFdHfME6Zd2h/CoNbRClftIlhG3isShytvUOEakO06M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617270471; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JPanjNLWZj0sfyOALMrDaazSMh9LoXOd8c9exdMQnew=; b=Wkn6qeLRh+Y+ayUpxdTI+10ZfJ+kG2z1FhaDj5RmXS7WVUXh2ZsMrC5GLCBJDO50l3v2E2KbIWtOlDwqOKJztDA9Rmb4PEXaw1X6IbEsyFIOrx1U/tozd8PgGDFwASc5RxnjZfqgA90rEhEIaS3Z1OS7zmeqhhRRDzQBVeMdTM8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617270471823726.4706983922202; Thu, 1 Apr 2021 02:47:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104251.199170 (Exim 4.92) (envelope-from ) id 1lRtvO-0005DI-KV; Thu, 01 Apr 2021 09:47:38 +0000 Received: by outflank-mailman (output) from mailman id 104251.199170; Thu, 01 Apr 2021 09:47:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtvO-0005DB-HK; Thu, 01 Apr 2021 09:47:38 +0000 Received: by outflank-mailman (input) for mailman id 104251; Thu, 01 Apr 2021 09:47:37 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRtvN-0005Cz-4u for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 09:47:37 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 44e4df5d-2e9a-4bf3-98ab-d0a39461290f; Thu, 01 Apr 2021 09:47:36 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9BECEAEB6; Thu, 1 Apr 2021 09:47:35 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 44e4df5d-2e9a-4bf3-98ab-d0a39461290f X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617270455; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JPanjNLWZj0sfyOALMrDaazSMh9LoXOd8c9exdMQnew=; b=IGPv4OtotCts8m+MoUtRP6JYnk/FVJHi1tVHu/JVgErsRzCK/DksCt6VfCJYbaS2WHPC8/ dSl1Uso+7FMg0+S8GuLdj8/bLIO6JZupV0hAEY3eCi+vaSuCR79TyOkSdqOjFJ1QX3ntow VjABFEfXljVhN/pf9XhU83uNOl4knKM= Subject: [PATCH 8/8] x86/EFI: don't have an overly large image size From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <26ec4a83-cda9-5193-d797-357c05b26ab7@suse.com> Date: Thu, 1 Apr 2021 11:47:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" While without debug info the difference is benign (so far), since we pad the image to 16Mb anyway, forcing the .reloc section to a 2Mb boundary causes subsequent .debug_* sections to go farther beyond 16Mb than needed. There's no reason to advance . for establishing __2M_rwdata_end, as all data past _end is of no interest at runtime anymore anyway. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- This makes more explicit a possible latent problem with the ELF image: It ends at _end, not __2M_rwdata_end (advancing . as was done here does not have the effect of increasing the image size). Interestingly the conversion xen-syms =3D> xen rounds up the program header specified size suitably, as per the comment "Do not use p_memsz: it does not include BSS alignment padding" in mkelf32.c. I do think this would instead want taking care of in the linker script. Commit 7a95e0a2c572 ("x86: properly calculate xen ELF end of image address") clearly only hacked an existing hack rather than addressing the root cause. Thoughts? --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -303,8 +303,7 @@ SECTIONS } PHDR(text) _end =3D . ; =20 - . =3D ALIGN(SECTION_ALIGN); - __2M_rwdata_end =3D .; + __2M_rwdata_end =3D ALIGN(SECTION_ALIGN); =20 #ifdef EFI .reloc ALIGN(4) : {