On 05/11/2024 2:55 pm, Frediano Ziglio wrote: > 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')
These are specific to the linker, not the compiler, so really should be _ld and _lld rather than _gnu and _clang. The build environment does have CONFIG_LD_IS_GNU which is used for one LD vs LLD distinction. It seems reasonable to re-use it here (so you're not trying both regexes in the hope that one works), although you'll need to plumb it into the script somehow because it's not exported into the environment currently. But, regexes are utterly opaque, and given that neither Binutils nor LLVM document their map format, you really need to provide at least one example of what a relevant mapfile looks like in a comment. Looking at built-in-32.offset.map in it's gnu form, it's presumably looking for the lines that are just a hex address and a name with no other punctuation. But the lld form is clearly different. ~Andrew