diff options
author | Stefano Babic <sbabic@denx.de> | 2014-09-16 16:30:11 +0200 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2014-09-16 16:30:11 +0200 |
commit | d4940fc521db6220a714a800e72b5d700e5c9974 (patch) | |
tree | 757014a2dd4464e8669729f18823c98f722e0c94 /arch/arm/include | |
parent | 067a659317639187fd170f73b10dfc5c2a7df9da (diff) | |
parent | a7f99bf139b3aaa0d5494693fd0395084355e41a (diff) | |
download | u-boot-imx-d4940fc521db6220a714a800e72b5d700e5c9974.zip u-boot-imx-d4940fc521db6220a714a800e72b5d700e5c9974.tar.gz u-boot-imx-d4940fc521db6220a714a800e72b5d700e5c9974.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-arm
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/global_data.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index 63e4ad5..c69d064 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -44,10 +44,35 @@ struct arch_global_data { #include <asm-generic/global_data.h> +#ifdef __clang__ + +#define DECLARE_GLOBAL_DATA_PTR +#define gd get_gd() + +static inline gd_t *get_gd(void) +{ + gd_t *gd_ptr; + +#ifdef CONFIG_ARM64 + /* + * Make will already error that reserving x18 is not supported at the + * time of writing, clang: error: unknown argument: '-ffixed-x18' + */ + __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr)); +#else + __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr)); +#endif + + return gd_ptr; +} + +#else + #ifdef CONFIG_ARM64 #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18") #else #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9") #endif +#endif #endif /* __ASM_GBL_DATA_H */ |