Skip to content

Commit 68f8c1b

Browse files
VeijoPesonenkartben
authored andcommitted
toolchain: gcc: ramfunc with Clang
With Clang you can't set long_call attribute on function basis. Instead of converting all calls to long calls let the linker create veneers when necessary. Signed-off-by: Veijo Pesonen <[email protected]>
1 parent 35cf9ad commit 68f8c1b

File tree

1 file changed

+9
-0
lines changed
  • include/zephyr/toolchain

1 file changed

+9
-0
lines changed

include/zephyr/toolchain/gcc.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,17 @@ do { \
209209
#define __ramfunc
210210
#elif defined(CONFIG_ARCH_HAS_RAMFUNC_SUPPORT)
211211
#if defined(CONFIG_ARM)
212+
#if defined(__clang__)
213+
/* No long_call attribute for Clang.
214+
* Rely on linker to place required veneers.
215+
* https://github.com/llvm/llvm-project/issues/39969
216+
*/
217+
#define __ramfunc __attribute__((noinline)) __attribute__((section(".ramfunc")))
218+
#else
219+
/* GCC version */
212220
#define __ramfunc __attribute__((noinline)) \
213221
__attribute__((long_call, section(".ramfunc")))
222+
#endif
214223
#else
215224
#define __ramfunc __attribute__((noinline)) \
216225
__attribute__((section(".ramfunc")))

0 commit comments

Comments
 (0)