diff mbox series

[XEN,v8,14/47] build: rename __LINKER__ to LINKER_SCRIPT

Message ID 20211125134006.1076646-15-anthony.perard@citrix.com (mailing list archive)
State Superseded
Headers show
Series xen: Build system improvements, now with out-of-tree build! | expand

Commit Message

Anthony PERARD Nov. 25, 2021, 1:39 p.m. UTC
For two reasons: this macro is used to generate a "linker script" and
is not by the linker, and name starting with an underscore '_' are
supposed to be reserved, so better avoid them when not needed.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Rules.mk                      | 2 +-
 xen/arch/arm/include/asm/config.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Julien Grall Dec. 14, 2021, 5:05 p.m. UTC | #1
Hi Anthony,

On 25/11/2021 13:39, Anthony PERARD wrote:
> For two reasons: this macro is used to generate a "linker script" and
> is not by the linker, and name starting with an underscore '_' are
> supposed to be reserved, so better avoid them when not needed.

If that's the case, then shouldn't we also rename __ASSEMBLY__?

> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,

> ---
>   xen/Rules.mk                      | 2 +-
>   xen/arch/arm/include/asm/config.h | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/Rules.mk b/xen/Rules.mk
> index 4624739ca7e2..d32fec0ae037 100644
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -256,7 +256,7 @@ $(obj)/%.s: $(src)/%.S FORCE
>   
>   # Linker scripts, .lds.S -> .lds
>   quiet_cmd_cpp_lds_S = LDS     $@
> -cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -D__LINKER__ -MQ $@ -o $@ $<
> +cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -DLINKER_SCRIPT -MQ $@ -o $@ $<
>   
>   targets := $(filter-out $(PHONY), $(targets))
>   
> diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
> index c7b77912013e..2aced0bc3b8b 100644
> --- a/xen/arch/arm/include/asm/config.h
> +++ b/xen/arch/arm/include/asm/config.h
> @@ -191,7 +191,7 @@ extern unsigned long frametable_virt_end;
>   #define watchdog_disable() ((void)0)
>   #define watchdog_enable()  ((void)0)
>   
> -#if defined(__ASSEMBLY__) && !defined(__LINKER__)
> +#if defined(__ASSEMBLY__) && !defined(LINKER_SCRIPT)
>   #include <asm/asm_defns.h>
>   #include <asm/macros.h>
>   #endif
Jan Beulich Dec. 15, 2021, 7:49 a.m. UTC | #2
On 14.12.2021 18:05, Julien Grall wrote:
> On 25/11/2021 13:39, Anthony PERARD wrote:
>> For two reasons: this macro is used to generate a "linker script" and
>> is not by the linker, and name starting with an underscore '_' are
>> supposed to be reserved, so better avoid them when not needed.
> 
> If that's the case, then shouldn't we also rename __ASSEMBLY__?

I'd rather not - unlike __LINKER__ (afaict at least) __ASSEMBLY__
is a commonly used identifier (which we've actually inherited from
Linux).

Jan
Julien Grall Dec. 15, 2021, 9:20 a.m. UTC | #3
Hi Jan,

On 15/12/2021 07:49, Jan Beulich wrote:
> On 14.12.2021 18:05, Julien Grall wrote:
>> On 25/11/2021 13:39, Anthony PERARD wrote:
>>> For two reasons: this macro is used to generate a "linker script" and
>>> is not by the linker, and name starting with an underscore '_' are
>>> supposed to be reserved, so better avoid them when not needed.
>>
>> If that's the case, then shouldn't we also rename __ASSEMBLY__?
> 
> I'd rather not - unlike __LINKER__ (afaict at least) __ASSEMBLY__

I can't remember where I took __LINKER__ from.

> is a commonly used identifier (which we've actually inherited from
> Linux)

Fair enough.

Cheers,
diff mbox series

Patch

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 4624739ca7e2..d32fec0ae037 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -256,7 +256,7 @@  $(obj)/%.s: $(src)/%.S FORCE
 
 # Linker scripts, .lds.S -> .lds
 quiet_cmd_cpp_lds_S = LDS     $@
-cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -D__LINKER__ -MQ $@ -o $@ $<
+cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -DLINKER_SCRIPT -MQ $@ -o $@ $<
 
 targets := $(filter-out $(PHONY), $(targets))
 
diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index c7b77912013e..2aced0bc3b8b 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -191,7 +191,7 @@  extern unsigned long frametable_virt_end;
 #define watchdog_disable() ((void)0)
 #define watchdog_enable()  ((void)0)
 
-#if defined(__ASSEMBLY__) && !defined(__LINKER__)
+#if defined(__ASSEMBLY__) && !defined(LINKER_SCRIPT)
 #include <asm/asm_defns.h>
 #include <asm/macros.h>
 #endif