[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/build: make linking work again with ld incapable of generating build ID


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 21 Apr 2022 12:40:03 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZPRI9TBpt7NqvcTDTjDO9kvTzuTJer701WOTHuYIYd4=; b=TRSbRNAKEexT0U3RHsj4llRA0vpDM79rMERKmqQB2l7G2Gdw7Vpa9Zx+fzr+fw+cFtxYZwcTvF9/mJRKQ78CiU3jeV7iYkLqLDtkYJko2jQ1SSDaGmapApMyY68VUYt+04V3Ozo/A2vqBct/6E8iaP831xjMoIoKdrctl5a3pQVPg/7i1jBMZU6MQXcdKqqG9Xe7EZEX/fb3A9hpb7kI8Z2jrAwVBctEFh84wSWCFRIpr9qQdNO2VAhpHlLHTYSViFMeHuPcqN+8oM4V1j8Wuikjil2dBCz26xE/N4H5eBOtX3gfOp+1cU9n/a+GXR2l1N/4T2s2YHu2y4JcEoh6uA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fxqgaOJVIqKd7gvt/mc2X9GbxGYWnp+4pv2nOeh/fgqJqFlENhdQ2QTr6UqQXE88cVmiqZBNFVNM25qVc2raA2nrYVEX976TTGyhP8ZIHWNx7AOcN1VxVPxxb1XqEHrI5uOZws5QY3NIhKl1qRrydPpo4LjzzPDhAunAIwM/kVJTDn2/EDm/D+rEB4EiWfT5U++iEi7eE9go/7WgvN633dnP0s3kJ/5icgM93N0f0Q2O2P7NsAL4mbHwk0Ioahe/Z+Ig4Bh4iPi58PgzfIY0umI1MZFvrEqaSLeGjaUXJFbkYQhFaUvabYmvqT1atUI+9nvUvzY0mWx0huIPUZaBWw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 21 Apr 2022 10:40:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The retaining of .note.* in a PT_NOTE segment requires a matching
program header to be present in the first place. Drop the respective
conditional and adjust mkelf32 to deal with (ignore) the potentially
present but empty extra segment (but have the new code be generic by
dropping any excess trailing entirely empty segments).

Fixes: dedb0aa42c6d ("x86/build: use --orphan-handling linker option if 
available")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/boot/mkelf32.c
+++ b/xen/arch/x86/boot/mkelf32.c
@@ -320,6 +320,19 @@ int main(int argc, char **argv)
                 (int)in64_ehdr.e_phentsize, (int)sizeof(in64_phdr));
         return 1;
     }
+
+    /* Ignore entirely empty trailing program headers. */
+    while ( in64_ehdr.e_phnum > num_phdrs )
+    {
+        (void)lseek(infd,
+                    in64_ehdr.e_phoff + in64_ehdr.e_phnum * sizeof(in64_phdr),
+                    SEEK_SET);
+        do_read(infd, &in64_phdr, sizeof(in64_phdr));
+        endianadjust_phdr64(&in64_phdr);
+        if ( in64_phdr.p_memsz )
+            break;
+        --in64_ehdr.e_phnum;
+    }
     if ( in64_ehdr.e_phnum != num_phdrs )
     {
         fprintf(stderr, "Expect precisly %d program header; found %d.\n",
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -40,9 +40,7 @@ OUTPUT_ARCH(i386:x86-64)
 PHDRS
 {
   text PT_LOAD ;
-#if defined(BUILD_ID) || defined(CONFIG_PVH_GUEST)
   note PT_NOTE ;
-#endif
 }
 #define PHDR(x) :x
 #else




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.