All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: quote section names when defining them in linker script
@ 2021-09-15  8:21 Roger Pau Monne
  2021-09-15  8:50 ` Jan Beulich
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Pau Monne @ 2021-09-15  8:21 UTC (permalink / raw)
  To: xen-devel; +Cc: Roger Pau Monne, Jan Beulich, Andrew Cooper, Wei Liu

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 <andrew.cooper3@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
This seems to make all versions that we test in gitlab happy:
https://gitlab.com/xen-project/people/royger/xen/-/pipelines/370610794
Plus the FreeBSD Cirrus-CI:
https://cirrus-ci.com/build/6690836768358400

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.
---
 xen/arch/x86/xen.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 955d5cf4a0..11b1da2154 100644
--- 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)
 
 ENTRY(start_pa)
 
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: quote section names when defining them in linker script
  2021-09-15  8:21 [PATCH] x86: quote section names when defining them in linker script Roger Pau Monne
@ 2021-09-15  8:50 ` Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2021-09-15  8:50 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: Andrew Cooper, Wei Liu, xen-devel

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 <andrew.cooper3@citrix.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

> 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-15  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15  8:21 [PATCH] x86: quote section names when defining them in linker script Roger Pau Monne
2021-09-15  8:50 ` Jan Beulich

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.