All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frediano Ziglio <frediano.ziglio@cloud.com>
To: xen-devel@lists.xenproject.org
Cc: "Frediano Ziglio" <frediano.ziglio@cloud.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>
Subject: [PATCH] x86/boot: Fix build with LLVM toolchain
Date: Tue,  5 Nov 2024 14:55:07 +0000	[thread overview]
Message-ID: <20241105145507.613981-1-frediano.ziglio@cloud.com> (raw)

This toolchain generates different object and map files.
Account for these changes.
Added sections need to have special type so we put them in
separate sections as linker will copy type from input sections.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/boot/build32.lds.S   |  9 +++++++++
 xen/tools/combine_two_binaries.py | 17 +++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S
index f20fc18977..2e565180d5 100644
--- a/xen/arch/x86/boot/build32.lds.S
+++ b/xen/arch/x86/boot/build32.lds.S
@@ -66,6 +66,15 @@ SECTIONS
        *(.comment.*)
        *(.note.*)
   }
+  .shstrtab : {
+       *(.shstrtab)
+  }
+  .strtab : {
+       *(.strtab)
+  }
+  .symtab : {
+       *(.symtab)
+  }
   /* Dynamic linkage sections.  Collected simply so we can check they're empty. */
   .got : {
         *(.got)
diff --git a/xen/tools/combine_two_binaries.py b/xen/tools/combine_two_binaries.py
index 447c0d3bdb..79ae8900b1 100755
--- a/xen/tools/combine_two_binaries.py
+++ b/xen/tools/combine_two_binaries.py
@@ -67,13 +67,22 @@ if args.exports is not None:
 
 # Parse mapfile, look for ther symbols we want to export.
 if args.mapfile is not None:
-    symbol_re = re.compile(r'\s{15,}0x([0-9a-f]+)\s+(\S+)\n')
+    symbol_re_clang = \
+        re.compile(r'\s+([0-9a-f]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s+([0-9a-f]+)\s{15,}(\S+)\n')
+    symbol_re_gnu = re.compile(r'\s{15,}0x([0-9a-f]+)\s+(\S+)\n')
     for line in open(args.mapfile):
-        m = symbol_re.match(line)
-        if not m or m.group(2) not in exports:
+        name = None
+        m = symbol_re_clang.match(line)
+        if m:
+            name = m.group(5)
+        else:
+            m = symbol_re_gnu.match(line)
+            if m:
+                name = m.group(2)
+        if name is None or name not in exports:
             continue
         addr = int(m.group(1), 16)
-        exports[m.group(2)] = addr
+        exports[name] = addr
 for (name, addr) in exports.items():
     if addr is None:
         raise Exception("Required export symbols %s not found" % name)
-- 
2.34.1



             reply	other threads:[~2024-11-05 14:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 14:55 Frediano Ziglio [this message]
2024-11-05 15:32 ` [PATCH] x86/boot: Fix build with LLVM toolchain Jan Beulich
2024-11-05 16:35   ` Frediano Ziglio
2024-11-05 17:06     ` Jan Beulich
2024-11-06  6:56       ` Frediano Ziglio
2024-11-06 10:59         ` Jan Beulich
2024-11-06 11:34           ` Frediano Ziglio
2024-11-06 11:45             ` Jan Beulich
2024-11-06 11:58               ` Frediano Ziglio
2024-11-06 12:37                 ` Roger Pau Monné
2024-11-07  9:46                 ` Jan Beulich
2024-11-05 19:23 ` Andrew Cooper
2024-11-06 10:32   ` Alejandro Vallejo
2024-11-06 10:50     ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241105145507.613981-1-frediano.ziglio@cloud.com \
    --to=frediano.ziglio@cloud.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.