Arm64: fix build with gcc 10
PATCH 1/1 Arm64: fix build with gcc 10
With gcc10 inlining is (no longer?) the default for certain atomics.
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)
Hi Jan,
I would suggest: "xen/arm64: Force GCC to always inline generic atomics helpers".
Quoted 1 line · Jan Beulich
With gcc10 inlining is (no longer?) the default for certain atomics.
How about the following:
"Recent versions of GCC (at least GCC10) will not inline generic atomics helpers. Instead it will expect the software to either link with libatomic.so or implement the helpers.
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 atomic. "
Quoted 15 lines
Suggested-by Julien Grall <[email protected]>Signed-off-by Jan Beulich <[email protected]>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)
Signature · 1 line
Julien Grall
Quoted 12 lines · Julien Grall
I would suggest: "xen/arm64: Force GCC to always inline generic atomics helpers".
Quoted 1 line · Jan Beulich
With gcc10 inlining is (no longer?) the default for certain atomics.
How about the following:
"Recent versions of GCC (at least GCC10) will not inline generic atomics helpers. Instead it will expect the software to either link with libatomic.so or implement the helpers.
Quoted 6 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 atomic. "
Fine with me; I've edited it further very slightly.
Jan
Quoted 12 lines · Jan Beulich
With gcc10 inlining is (no longer?) the default for certain atomics.
Suggested-by Julien Grall <[email protected]>Signed-off-by Jan Beulich <[email protected]>xen/arch/arm/arch.mk +0
-0@@ -12,6 +12,7 @@ CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-
Quoted 3 lines
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)
Why not adding this before with the other “call cc-option” ?
Also it might be a good idea to have a sentence in the commit message with the error happening when this is not added:
undefined reference to `__aarch64_ldadd4_acq_rel’
Because some might need to backport this to other Xen releases if they switch to a new compiler (although i could not reproduce that with Xen 4.14).
I tested the patch with Yocto master which is using gcc 10.2 and this works.
Bertrand
Quoted 4 lines
ifneq ($(filter command line environment,$(origin
CONFIG_EARLY_PRINTK)),)$(error You must use 'make menuconfig' to enable/disable early printk now)
Quoted 10 lines · Bertrand Marquis
Quoted 10 lines · Jan Beulich
With gcc10 inlining is (no longer?) the default for certain atomics.
Suggested-by Julien Grall <[email protected]>Signed-off-by Jan Beulich <[email protected]>xen/arch/arm/arch.mk +0
-0@@ -12,6 +12,7 @@ CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-
Quoted 5 lines
Quoted 3 lines
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)
Why not adding this before with the other “call cc-option” ?
I elected to group it with the other Arm64 specific ones.
Quoted 6 lines
Also it might be a good idea to have a sentence in the commit message with the error happening when this is not added:
undefined reference to `__aarch64_ldadd4_acq_rel’Because some might need to backport this to other Xen releases if they switch to a new compiler (although i could not reproduce that with Xen 4.14).
I guess I'll go with Julien's suggested description (with some minor adjustments perhaps).
Jan
Quoted 15 lines · Jan Beulich
Quoted 10 lines · Bertrand Marquis
Quoted 10 lines · Jan Beulich
With gcc10 inlining is (no longer?) the default for certain atomics.
Suggested-by Julien Grall <[email protected]>Signed-off-by Jan Beulich <[email protected]>xen/arch/arm/arch.mk +0
-0@@ -12,6 +12,7 @@ CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
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)
Why not adding this before with the other “call cc-option” ?
I elected to group it with the other Arm64 specific ones.
ok
Quoted 10 lines
Quoted 7 lines
Also it might be a good idea to have a sentence in the commit message with the error happening when this is not added:
undefined reference to `__aarch64_ldadd4_acq_rel’Because some might need to backport this to other Xen releases if they switch to a new compiler (although i could not reproduce that with Xen 4.14).
I guess I'll go with Julien's suggested description (with some minor adjustments perhaps).
Ok but please mention the error so that it appear somewhere :-)
Bertrand
Quoted 2 lines
Jan