diff mbox series

[2/4] trace: clang compatible handling of gd register

Message ID 20200527180424.39395-3-xypron.glpk@gmx.de
State Accepted
Delegated to: Tom Rini
Headers show
Series arm: fix clang build errors | expand

Commit Message

Heinrich Schuchardt May 27, 2020, 6:04 p.m. UTC
On ARM systems gd is stored in register r9 or x18. When compiling with
clang gd is defined as a macro calling function gd_ptr(). So we can not
make assignments to gd.

Use function set_gd() for setting the register on ARM.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/trace.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
2.26.2

Comments

Simon Glass May 31, 2020, 2:08 p.m. UTC | #1
On Wed, 27 May 2020 at 12:04, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On ARM systems gd is stored in register r9 or x18. When compiling with
> clang gd is defined as a macro calling function gd_ptr(). So we can not
> make assignments to gd.
>
> Use function set_gd() for setting the register on ARM.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  lib/trace.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini July 8, 2020, 3:03 a.m. UTC | #2
On Wed, May 27, 2020 at 08:04:22PM +0200, Heinrich Schuchardt wrote:

> On ARM systems gd is stored in register r9 or x18. When compiling with
> clang gd is defined as a macro calling function gd_ptr(). So we can not
> make assignments to gd.
> 
> Use function set_gd() for setting the register on ARM.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/lib/trace.c b/lib/trace.c
index ea8c8e0d40..831283c283 100644
--- a/lib/trace.c
+++ b/lib/trace.c
@@ -57,12 +57,12 @@  static inline uintptr_t __attribute__((no_instrument_function))
 	return offset / FUNC_SITE_SIZE;
 }

-#ifdef CONFIG_EFI_LOADER
+#if defined(CONFIG_EFI_LOADER) && defined(CONFIG_ARM)

 /**
  * trace_gd - the value of the gd register
  */
-static volatile void *trace_gd;
+static volatile gd_t *trace_gd;

 /**
  * trace_save_gd() - save the value of the gd register
@@ -82,10 +82,10 @@  static void __attribute__((no_instrument_function)) trace_save_gd(void)
  */
 static void __attribute__((no_instrument_function)) trace_swap_gd(void)
 {
-	volatile void *temp_gd = trace_gd;
+	volatile gd_t *temp_gd = trace_gd;

 	trace_gd = gd;
-	gd = temp_gd;
+	set_gd(temp_gd);
 }

 #else