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

[PATCH] x86/boot: Fix build with LLVM toolchain



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@xxxxxxxxx>
---
 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




 


Rackspace

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