diff mbox series

[v2] Arm64: force gcc 10+ to always inline generic atomics helpers

Message ID 0ad3619d-8be9-99bc-552f-675156c47dfe@suse.com (mailing list archive)
State New, archived
Headers show
Series [v2] Arm64: force gcc 10+ to always inline generic atomics helpers | expand

Commit Message

Jan Beulich Sept. 11, 2020, 10:45 a.m. UTC
Recent versions of gcc (at least 10.x) will not inline generic atomics 
helpers by default. Instead they will expect the software to either link
with libatomic.so or implement the helpers, which would result in

undefined reference to `__aarch64_ldadd4_acq_rel'

for us (not having any local implementation).

To keep the previous behavior, force gcc to always inline the generic
atomics helpers.

Long term we probably want to avoid relying on gcc atomics helpers as
this doesn't allow us to switch between LSE and LL/SC atomics.

Suggested-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Title and description redone.

Comments

Julien Grall Sept. 11, 2020, 12:32 p.m. UTC | #1
Hi Jan,

On 11/09/2020 11:45, Jan Beulich wrote:
> Recent versions of gcc (at least 10.x) will not inline generic atomics
> helpers by default. Instead they will expect the software to either link
> with libatomic.so or implement the helpers, which would result in
> 
> undefined reference to `__aarch64_ldadd4_acq_rel'
> 
> for us (not having any local implementation).
> 
> To keep the previous behavior, force gcc to always inline the generic
> atomics helpers.
> 
> Long term we probably want to avoid relying on gcc atomics helpers as
> this doesn't allow us to switch between LSE and LL/SC atomics.
> 
> Suggested-by: Julien Grall <jgrall@amazon.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

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

Cheers,
Bertrand Marquis Sept. 11, 2020, 12:36 p.m. UTC | #2
> On 11 Sep 2020, at 11:45, Jan Beulich <jbeulich@suse.com> wrote:
> 
> Recent versions of gcc (at least 10.x) will not inline generic atomics 
> helpers by default. Instead they will expect the software to either link
> with libatomic.so or implement the helpers, which would result in
> 
> undefined reference to `__aarch64_ldadd4_acq_rel'
> 
> for us (not having any local implementation).
> 
> To keep the previous behavior, force gcc to always inline the generic
> atomics helpers.
> 
> Long term we probably want to avoid relying on gcc atomics helpers as
> this doesn't allow us to switch between LSE and LL/SC atomics.
> 
> Suggested-by: Julien Grall <jgrall@amazon.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

> ---
> v2: Title and description redone.
> 
> --- a/xen/arch/arm/arch.mk
> +++ b/xen/arch/arm/arch.mk
> @@ -12,6 +12,7 @@ CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-
> 
> CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
> CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
> +$(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
> 
> ifneq ($(filter command line environment,$(origin CONFIG_EARLY_PRINTK)),)
>     $(error You must use 'make menuconfig' to enable/disable early printk now)
>
diff mbox series

Patch

--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -12,6 +12,7 @@  CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-
 
 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
 CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
+$(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
 
 ifneq ($(filter command line environment,$(origin CONFIG_EARLY_PRINTK)),)
     $(error You must use 'make menuconfig' to enable/disable early printk now)