Skip to contentSkip to conversation

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

PATCH In review Jan Beulich 3 participants 3 messages Sep 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Arm64: force gcc 10+ to always inline generic atomics helpers

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.

---
v2: Title and description redone.

xen/arch/arm/arch.mk +1 -0
@@ -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)
Reviewed-by on v2 1/1
#1 lore raw

Hi Jan,

Quoted 8 lines · Jan Beulich

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).

Quoted 8 lines

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.

Cheers,

Signature · 1 line
Julien Grall
Reviewed-by on v2 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 12 lines · Jan Beulich

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).

Quoted 8 lines

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.

Quoted 14 lines

---
v2: Title and description redone.

xen/arch/arm/arch.mk +0 -0
@@ -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)