* [PATCH kvm-unit-tests] arm64: Compile with -mno-outline-atomics
@ 2020-07-28 12:17 Andrew Jones
2020-07-28 21:25 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Jones @ 2020-07-28 12:17 UTC (permalink / raw)
To: kvm, kvmarm; +Cc: pbonzini
GCC 10.1.0 introduced the -moutline-atomics option which, when
enabled, use LSE instructions when the processor provides them.
The option is enabled by default and unfortunately causes the
following error at compile time:
aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/10.1.0/libgcc.a(lse-init.o): in function `init_have_lse_atomics':
lse-init.c:(.text.startup+0xc): undefined reference to `__getauxval'
This is happening because we are linking against our own libcflat which
doesn't implement the function __getauxval().
Disable the use of the out-of-line functions by compiling with
-mno-outline-atomics.
Reported-by: Alexandru Elisei <alexandru.elisei@arm.com>
Tested-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
Makefile | 11 +++++------
arm/Makefile.arm64 | 3 +++
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 3ff2f91600f6..0e21a49096ba 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,11 @@ DESTDIR := $(PREFIX)/share/kvm-unit-tests/
.PHONY: arch_clean clean distclean cscope
+# cc-option
+# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
+cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
+ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+
#make sure env CFLAGS variable is not used
CFLAGS =
@@ -43,12 +48,6 @@ OBJDIRS += $(LIBFDT_objdir)
#include architecture specific make rules
include $(SRCDIR)/$(TEST_DIR)/Makefile
-# cc-option
-# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
-
-cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
- > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
-
COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing -fno-common
COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
COMMON_CFLAGS += -Wignored-qualifiers -Werror
diff --git a/arm/Makefile.arm64 b/arm/Makefile.arm64
index dfd0c56fe8fb..dbc7524d3070 100644
--- a/arm/Makefile.arm64
+++ b/arm/Makefile.arm64
@@ -9,6 +9,9 @@ ldarch = elf64-littleaarch64
arch_LDFLAGS = -pie -n
CFLAGS += -mstrict-align
+mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "")
+CFLAGS += $(mno_outline_atomics)
+
define arch_elf_check =
$(if $(shell ! $(OBJDUMP) -R $(1) >&/dev/null && echo "nok"),
$(error $(shell $(OBJDUMP) -R $(1) 2>&1)))
--
2.25.4
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH kvm-unit-tests] arm64: Compile with -mno-outline-atomics
2020-07-28 12:17 [PATCH kvm-unit-tests] arm64: Compile with -mno-outline-atomics Andrew Jones
@ 2020-07-28 21:25 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-07-28 21:25 UTC (permalink / raw)
To: Andrew Jones, kvm, kvmarm
On 28/07/20 14:17, Andrew Jones wrote:
> GCC 10.1.0 introduced the -moutline-atomics option which, when
> enabled, use LSE instructions when the processor provides them.
> The option is enabled by default and unfortunately causes the
> following error at compile time:
>
> aarch64-linux-gnu-ld: /usr/lib/gcc/aarch64-linux-gnu/10.1.0/libgcc.a(lse-init.o): in function `init_have_lse_atomics':
> lse-init.c:(.text.startup+0xc): undefined reference to `__getauxval'
>
> This is happening because we are linking against our own libcflat which
> doesn't implement the function __getauxval().
>
> Disable the use of the out-of-line functions by compiling with
> -mno-outline-atomics.
>
> Reported-by: Alexandru Elisei <alexandru.elisei@arm.com>
> Tested-by: Alexandru Elisei <alexandru.elisei@arm.com>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> Makefile | 11 +++++------
> arm/Makefile.arm64 | 3 +++
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 3ff2f91600f6..0e21a49096ba 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -17,6 +17,11 @@ DESTDIR := $(PREFIX)/share/kvm-unit-tests/
>
> .PHONY: arch_clean clean distclean cscope
>
> +# cc-option
> +# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
> +cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
> + > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
> +
> #make sure env CFLAGS variable is not used
> CFLAGS =
>
> @@ -43,12 +48,6 @@ OBJDIRS += $(LIBFDT_objdir)
> #include architecture specific make rules
> include $(SRCDIR)/$(TEST_DIR)/Makefile
>
> -# cc-option
> -# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
> -
> -cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
> - > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
> -
> COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing -fno-common
> COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
> COMMON_CFLAGS += -Wignored-qualifiers -Werror
> diff --git a/arm/Makefile.arm64 b/arm/Makefile.arm64
> index dfd0c56fe8fb..dbc7524d3070 100644
> --- a/arm/Makefile.arm64
> +++ b/arm/Makefile.arm64
> @@ -9,6 +9,9 @@ ldarch = elf64-littleaarch64
> arch_LDFLAGS = -pie -n
> CFLAGS += -mstrict-align
>
> +mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "")
> +CFLAGS += $(mno_outline_atomics)
> +
> define arch_elf_check =
> $(if $(shell ! $(OBJDUMP) -R $(1) >&/dev/null && echo "nok"),
> $(error $(shell $(OBJDUMP) -R $(1) 2>&1)))
>
Queued, thanks.
Paolo
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-28 21:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 12:17 [PATCH kvm-unit-tests] arm64: Compile with -mno-outline-atomics Andrew Jones
2020-07-28 21:25 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).