 |
Zephyr API 3.6.99
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
8#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_COMMON_H_
9#define ZEPHYR_INCLUDE_TOOLCHAIN_COMMON_H_
11#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
12#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
24#define EXTERN_C extern "C"
26#define EXTERN_C extern
32#define TASK_ENTRY_CPP extern "C"
37#define ZRESTRICT restrict
55 #define REQUIRES(sym) .set sym ## _Requires, sym
57 #define REQUIRES(sym) __asm__ (".set " # sym "_Requires, " # sym "\n\t");
61 #define SECTION .section
75#if defined(_ASMLANGUAGE) && !defined(_LINKER)
77 #if defined(CONFIG_X86) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) || \
78 defined(CONFIG_RISCV) || defined(CONFIG_XTENSA) || defined(CONFIG_MIPS) || \
79 defined(CONFIG_ARCH_POSIX) || defined(CONFIG_RX) || defined(CONFIG_OPENRISC)
80 #define ALIGN(x) .balign x
81 #elif defined(CONFIG_ARC)
85 #define ALIGN(x) .align x
86 #elif defined(CONFIG_SPARC)
87 #define ALIGN(x) .align x
89 #error Architecture unsupported
101 #if defined(CONFIG_X86)
104 #define PERFOPT_ALIGN .balign 16
106 #define PERFOPT_ALIGN .balign 1
109 #elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
111 #define PERFOPT_ALIGN .balign 4
113 #elif defined(CONFIG_ARC)
118 #define PERFOPT_ALIGN .align 4
120 #elif defined(CONFIG_RISCV) || defined(CONFIG_XTENSA) || \
121 defined(CONFIG_MIPS) || defined(CONFIG_RX) || \
122 defined(CONFIG_OPENRISC)
123 #define PERFOPT_ALIGN .balign 4
125 #elif defined(CONFIG_ARCH_POSIX)
127 #elif defined(CONFIG_SPARC)
129 #define PERFOPT_ALIGN .align 4
133 #error Architecture unsupported
137 #define GC_SECTION(sym) SECTION .text.##sym, "ax"
143#if !defined(_ASMLANGUAGE)
144 #ifdef CONFIG_COVERAGE
159 #define ALWAYS_INLINE inline
161 #define ALWAYS_INLINE inline __attribute__((always_inline))
165#define Z_STRINGIFY(x) #x
166#define STRINGIFY(s) Z_STRINGIFY(s)
169#define _DO_CONCAT(x, y) x ## y
170#define _CONCAT(x, y) _DO_CONCAT(x, y)
181#ifndef ZTEST_UNITTEST
182#define __syscall static inline
183#define __syscall_always_inline static inline __attribute__((always_inline))
186#define __syscall_always_inline
204#define BUILD_ASSERT(EXPR, MSG...) \
205 enum _CONCAT(__build_assert_enum, __COUNTER__) { \
206 _CONCAT(__build_assert, __COUNTER__) = 1 / !!(EXPR) \
227#define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
230#define IS_PTR_ALIGNED_BYTES(ptr, bytes) ((((uintptr_t)ptr) % bytes) == 0)
233#define IS_PTR_ALIGNED(ptr, type) IS_PTR_ALIGNED_BYTES(ptr, __alignof(type))
242#define LINKER_KEEP(symbol) \
243 static const void * const symbol##_ptr __used \
244 __attribute__((__section__(".symbol_to_keep"))) = (void *)&symbol