[PATCH v5 1/6] xen: introduce DECL_SECTION_WITH_LADDR

Oleksii Kurochko posted 6 patches 1 month, 3 weeks ago
[PATCH v5 1/6] xen: introduce DECL_SECTION_WITH_LADDR
Posted by Oleksii Kurochko 1 month, 3 weeks ago
Introduce DECL_SECTION_WITH_LADDR in order to signal whether
DECL_SECTION() should specify a load address or not.

Update {ppc,x86}/xen.lds.S to use DECL_SECTION_WITH_LADDR.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
Changes in V5:
 - s/SIMPLE_DECL_SECTION/DECL_SECTION_WITH_LADDR.
 - add space between # and define in x86/xen.lds.S.
 - use DECL_SECTION_WITH_LADDR in ppc/xen.lds.S.
 - update the commit message.
 - add Acked-by: Jan Beulich <jbeulich@suse.com>.
---
Changes in V4:
 - new patch
---
 xen/arch/ppc/xen.lds.S    | 2 ++
 xen/arch/x86/xen.lds.S    | 6 ++++--
 xen/include/xen/xen.lds.h | 6 ++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
index 0c4b94814b..30b4a6ced8 100644
--- a/xen/arch/ppc/xen.lds.S
+++ b/xen/arch/ppc/xen.lds.S
@@ -1,4 +1,6 @@
 #include <xen/lib.h>
+
+#define DECL_SECTION_WITH_LADDR
 #include <xen/xen.lds.h>
 
 OUTPUT_ARCH(powerpc:common64)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index b60d2f0d82..7d2aa2d801 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -3,6 +3,10 @@
 
 #include <xen/cache.h>
 #include <xen/lib.h>
+
+#ifndef EFI
+# define DECL_SECTION_WITH_LADDR
+#endif
 #include <xen/xen.lds.h>
 #include <asm/page.h>
 #undef ENTRY
@@ -12,9 +16,7 @@
 
 #define FORMAT "pei-x86-64"
 #undef __XEN_VIRT_START
-#undef DECL_SECTION
 #define __XEN_VIRT_START __image_base__
-#define DECL_SECTION(x) x :
 
 ENTRY(efi_start)
 
diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index 24b8900ffe..c6178bdc42 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -5,6 +5,8 @@
  * Common macros to be used in architecture specific linker scripts.
  */
 
+#ifdef DECL_SECTION_WITH_LADDR
+
 /*
  * Declare a section whose load address is based at PA 0 rather than
  * Xen's virtual base address.
@@ -15,6 +17,10 @@
 # define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START)
 #endif
 
+#else /* !DECL_SECTION_WITH_LADDR */
+#define DECL_SECTION(x) x :
+#endif
+
 /*
  * To avoid any confusion, please note that the EFI macro does not correspond
  * to EFI support and is used when linking a native EFI (i.e. PE/COFF) binary,
-- 
2.46.1
Re: [PATCH v5 1/6] xen: introduce DECL_SECTION_WITH_LADDR
Posted by oleksii.kurochko@gmail.com 1 month, 2 weeks ago
Hello Shawn,

On Fri, 2024-09-27 at 18:32 +0200, Oleksii Kurochko wrote:
> Introduce DECL_SECTION_WITH_LADDR in order to signal whether
> DECL_SECTION() should specify a load address or not.
> 
> Update {ppc,x86}/xen.lds.S to use DECL_SECTION_WITH_LADDR.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>

Could you please take a look at this patch as it requires your Ack?

Thanks in advance.

~ Oleksii

> ---
> Changes in V5:
>  - s/SIMPLE_DECL_SECTION/DECL_SECTION_WITH_LADDR.
>  - add space between # and define in x86/xen.lds.S.
>  - use DECL_SECTION_WITH_LADDR in ppc/xen.lds.S.
>  - update the commit message.
>  - add Acked-by: Jan Beulich <jbeulich@suse.com>.
> ---
> Changes in V4:
>  - new patch
> ---
>  xen/arch/ppc/xen.lds.S    | 2 ++
>  xen/arch/x86/xen.lds.S    | 6 ++++--
>  xen/include/xen/xen.lds.h | 6 ++++++
>  3 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
> index 0c4b94814b..30b4a6ced8 100644
> --- a/xen/arch/ppc/xen.lds.S
> +++ b/xen/arch/ppc/xen.lds.S
> @@ -1,4 +1,6 @@
>  #include <xen/lib.h>
> +
> +#define DECL_SECTION_WITH_LADDR
>  #include <xen/xen.lds.h>
>  
>  OUTPUT_ARCH(powerpc:common64)
> diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
> index b60d2f0d82..7d2aa2d801 100644
> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -3,6 +3,10 @@
>  
>  #include <xen/cache.h>
>  #include <xen/lib.h>
> +
> +#ifndef EFI
> +# define DECL_SECTION_WITH_LADDR
> +#endif
>  #include <xen/xen.lds.h>
>  #include <asm/page.h>
>  #undef ENTRY
> @@ -12,9 +16,7 @@
>  
>  #define FORMAT "pei-x86-64"
>  #undef __XEN_VIRT_START
> -#undef DECL_SECTION
>  #define __XEN_VIRT_START __image_base__
> -#define DECL_SECTION(x) x :
>  
>  ENTRY(efi_start)
>  
> diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
> index 24b8900ffe..c6178bdc42 100644
> --- a/xen/include/xen/xen.lds.h
> +++ b/xen/include/xen/xen.lds.h
> @@ -5,6 +5,8 @@
>   * Common macros to be used in architecture specific linker scripts.
>   */
>  
> +#ifdef DECL_SECTION_WITH_LADDR
> +
>  /*
>   * Declare a section whose load address is based at PA 0 rather than
>   * Xen's virtual base address.
> @@ -15,6 +17,10 @@
>  # define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START)
>  #endif
>  
> +#else /* !DECL_SECTION_WITH_LADDR */
> +#define DECL_SECTION(x) x :
> +#endif
> +
>  /*
>   * To avoid any confusion, please note that the EFI macro does not
> correspond
>   * to EFI support and is used when linking a native EFI (i.e.
> PE/COFF) binary,
Re: [PATCH v5 1/6] xen: introduce DECL_SECTION_WITH_LADDR
Posted by Jan Beulich 1 month, 3 weeks ago
On 27.09.2024 18:32, Oleksii Kurochko wrote:
> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -3,6 +3,10 @@
>  
>  #include <xen/cache.h>
>  #include <xen/lib.h>
> +
> +#ifndef EFI
> +# define DECL_SECTION_WITH_LADDR
> +#endif

I think either this wants inserting at the very top or it wants moving down
together with ...

>  #include <xen/xen.lds.h>

... this line, past all the #includes (and, much you have it, separated by a
blank line, just at both sides). Can adjust while committing of course.

Jan
Re: [PATCH v5 1/6] xen: introduce DECL_SECTION_WITH_LADDR
Posted by oleksii.kurochko@gmail.com 1 month, 3 weeks ago
On Mon, 2024-09-30 at 09:20 +0200, Jan Beulich wrote:
> On 27.09.2024 18:32, Oleksii Kurochko wrote:
> > --- a/xen/arch/x86/xen.lds.S
> > +++ b/xen/arch/x86/xen.lds.S
> > @@ -3,6 +3,10 @@
> >  
> >  #include <xen/cache.h>
> >  #include <xen/lib.h>
> > +
> > +#ifndef EFI
> > +# define DECL_SECTION_WITH_LADDR
> > +#endif
> 
> I think either this wants inserting at the very top or it wants
> moving down
> together with ...
> 
> >  #include <xen/xen.lds.h>
> 
> ... this line, past all the #includes (and, much you have it,
> separated by a
> blank line, just at both sides). Can adjust while committing of
> course.

Personally, I prefer to move that down. It would be great if you could
do that during committing.

Thanks a lot.

~ Oleksii