On 15.09.2021 10:21, Roger Pau Monne wrote:
> LLVM ld seems to require section names to be quoted at both definition
> and when referencing them for a match to happen, or else we get the
> following errors:
> 
> ld: error: xen.lds:45: undefined section ".text"
> ld: error: xen.lds:69: undefined section ".rodata"
> ld: error: xen.lds:104: undefined section ".note.gnu.build-id"
> [...]
> 
> The original fix for GNU ld 2.37 only quoted the section name when
> referencing it in the ADDR function. Fix by also quoting the section
> names when declaring them.
> 
> Fixes: 58ad654ebce7 ("x86: work around build issue with GNU ld 2.37")
> Reported-by: Andrew Cooper <[email protected]>
> Signed-off-by: Roger Pau MonnĂ© <[email protected]>

Reviewed-by: Jan Beulich <[email protected]>

> I'm slightly worried that LLVM ld requires quotes to be present always
> in order to match, but I can confirm such quotes are not present in
> the sections names in the output binary.

They're "drop in replacement" statement clearly is too ambitious.

> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -18,7 +18,7 @@ ENTRY(efi_start)
>  #else /* !EFI */
>  
>  #define FORMAT "elf64-x86-64"
> -#define DECL_SECTION(x) x : AT(ADDR(#x) - __XEN_VIRT_START)
> +#define DECL_SECTION(x) #x : AT(ADDR(#x) - __XEN_VIRT_START)

Indeed much neater an adjustment. Thanks!

Jan


Reply via email to