diff options
author | Tom Rini <trini@konsulko.com> | 2025-05-26 16:07:19 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-05-26 16:07:19 -0600 |
commit | 39b815d02d7ce6af32bcf023d20243c404b75a84 (patch) | |
tree | 68cd13fa83e90f69bf8c989fbcde768b676eb6d7 /arch/riscv/include/asm/global_data.h | |
parent | bab54f5942c428be698216224fd10b91d974d4da (diff) | |
parent | 2ca1398a5ece8d33d8feb6b410e6e38588b5d2bc (diff) |
Merge tag 'v2025.07-rc3' into next
Prepare v2025.07-rc3
Diffstat (limited to 'arch/riscv/include/asm/global_data.h')
-rw-r--r-- | arch/riscv/include/asm/global_data.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h index d356752a56a..47b5e2cfc8f 100644 --- a/arch/riscv/include/asm/global_data.h +++ b/arch/riscv/include/asm/global_data.h @@ -14,6 +14,7 @@ #include <asm/smp.h> #include <asm/u-boot.h> #include <compiler.h> +#include <config.h> /* Architecture-specific global data */ struct arch_global_data { @@ -47,8 +48,26 @@ struct arch_global_data { #include <asm-generic/global_data.h> +#if defined(__clang__) || CONFIG_IS_ENABLED(LTO) + +#define DECLARE_GLOBAL_DATA_PTR +#define gd get_gd() + +static inline gd_t *get_gd(void) +{ + gd_t *gd_ptr; + + __asm__ volatile ("mv %0, gp\n" : "=r" (gd_ptr)); + + return gd_ptr; +} + +#else + #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("gp") +#endif + static inline void set_gd(volatile gd_t *gd_ptr) { #ifdef CONFIG_64BIT |