From: Andrew Jones <andrew.jones@linux.dev>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
Nikos Nikoleris <nikos.nikoleris@arm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Nadav Amit <namit@vmware.com>
Subject: Re: [kvm-unit-tests PATCH v2 2/6] lib/stack: print base addresses on efi
Date: Mon, 26 Jun 2023 08:03:52 +0200 [thread overview]
Message-ID: <20230626-96c5e2101071fcb6f3ddc550@orel> (raw)
In-Reply-To: <20230625230716.2922-3-namit@vmware.com>
On Sun, Jun 25, 2023 at 11:07:12PM +0000, Nadav Amit wrote:
> From: Nadav Amit <namit@vmware.com>
>
> Making sense from dumped stacks when running EFI tests is very hard due
> to the relocation. Fix it by adjusting the address back to the original
> address.
>
> Introduce CONFIG_RELOC, which would be set on arm64 and on EFI configs.
>
> Signed-off-by: Nadav Amit <namit@vmware.com>
>
> ---
>
> v1->v2: Introduce CONFIG_RELOC to support ARM64 [Andrew]
> ---
> configure | 3 +++
> lib/stack.c | 31 +++++++++++++++++++++++++++++--
> 2 files changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index b665f7d..8a3c8fe 100755
> --- a/configure
> +++ b/configure
> @@ -416,6 +416,9 @@ EOF
> if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
> echo "TARGET=$target" >> config.mak
> fi
> +if [ "$efi" = "y" ] || [ "$arch" = "arm64" ]; then
> + echo "CONFIG_RELOC=y" >> config.mak
This won't work, because, unlike CONFIG_EFI, nothing is defining
CONFIG_RELOC in the build. We need CONFIG_RELOC in lib/config.h
or to append -DCONFIG_RELOC to CFLAGS in a makefile when some
config.mak variable is set. I think my preference would be
something like
diff --git a/Makefile b/Makefile
index 307bc291844a..ae79059e7e6f 100644
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,7 @@ OBJDIRS += $(LIBFDT_objdir)
# EFI App
ifeq ($(CONFIG_EFI),y)
-EFI_CFLAGS := -DCONFIG_EFI
+EFI_CFLAGS := -DCONFIG_EFI -DCONFIG_RELOC
# The following CFLAGS and LDFLAGS come from:
# - GNU-EFI/Makefile.defaults
# - GNU-EFI/apps/Makefile
diff --git a/arm/Makefile.arm64 b/arm/Makefile.arm64
index 60385e2d2b2b..960880f1c09f 100644
--- a/arm/Makefile.arm64
+++ b/arm/Makefile.arm64
@@ -12,6 +12,7 @@ CFLAGS += -mstrict-align
mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "")
CFLAGS += $(mno_outline_atomics)
+CFLAGS += -DCONFIG_RELOC
define arch_elf_check =
$(if $(shell ! $(READELF) -rW $(1) >&/dev/null && echo "nok"),
diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
index 8ce00340b6be..c2e976e41f20 100644
--- a/powerpc/Makefile.common
+++ b/powerpc/Makefile.common
@@ -24,6 +24,7 @@ CFLAGS += -ffreestanding
CFLAGS += -O2 -msoft-float -mno-altivec $(mabi_no_altivec)
CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt -I lib
CFLAGS += -Wa,-mregnames
+CFLAGS += -DCONFIG_RELOC
# We want to keep intermediate files
.PRECIOUS: %.o
(I also threw in ppc64 since it also relocates.)
Thanks,
drew
next prev parent reply other threads:[~2023-06-26 6:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-25 23:07 [kvm-unit-tests PATCH v2 0/6] arm64: improve debuggability Nadav Amit
2023-06-25 23:07 ` [kvm-unit-tests PATCH v2 1/6] efi: keep efi debug information in a separate file Nadav Amit
2023-06-26 6:15 ` Andrew Jones
2023-06-26 6:18 ` Andrew Jones
2023-06-26 18:30 ` Nadav Amit
2023-06-25 23:07 ` [kvm-unit-tests PATCH v2 2/6] lib/stack: print base addresses on efi Nadav Amit
2023-06-26 6:03 ` Andrew Jones [this message]
2023-06-25 23:07 ` [kvm-unit-tests PATCH v2 3/6] arm64: enable frame pointer and support stack unwinding Nadav Amit
2023-06-25 23:07 ` [kvm-unit-tests PATCH v2 4/6] arm64: stack: update trace stack on exception Nadav Amit
2023-06-25 23:07 ` [kvm-unit-tests PATCH v2 5/6] efi: print address of image Nadav Amit
2023-06-25 23:07 ` [kvm-unit-tests PATCH v2 6/6] arm64: dump stack on bad exception Nadav Amit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230626-96c5e2101071fcb6f3ddc550@orel \
--to=andrew.jones@linux.dev \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=nadav.amit@gmail.com \
--cc=namit@vmware.com \
--cc=nikos.nikoleris@arm.com \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox