toolchain: xcc: Avoid undefs

Re-order some definitions and header inclusion to avoid undef symbols.

Signed-off-by: Flavio Ceolin <flavio.ceolin@gmail.com>
This commit is contained in:
Flavio Ceolin 2024-11-27 09:30:10 -08:00 committed by Benjamin Cabé
parent e0f94f8823
commit 7e32b2069d

View file

@ -11,6 +11,20 @@
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead #error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
#endif #endif
/*
* XCC does not support using deprecated attribute in enum,
* so just nullify it here to avoid compilation errors.
*/
#define __deprecated
#define __in_section_unique(seg) \
__attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__))))
#define __in_section_unique_named(seg, name) \
__attribute__((section("." STRINGIFY(seg) \
"." STRINGIFY(__COUNTER__) \
"." STRINGIFY(name))))
/* toolchain/gcc.h errors out if __BYTE_ORDER__ cannot be determined /* toolchain/gcc.h errors out if __BYTE_ORDER__ cannot be determined
* there. However, __BYTE_ORDER__ is actually being defined later in * there. However, __BYTE_ORDER__ is actually being defined later in
* this file. So define __BYTE_ORDER__ to skip the check in gcc.h * this file. So define __BYTE_ORDER__ to skip the check in gcc.h
@ -121,16 +135,6 @@
#define __COUNTER__ __LINE__ #define __COUNTER__ __LINE__
#endif #endif
#undef __in_section_unique
#define __in_section_unique(seg) \
__attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__))))
#undef __in_section_unique_named
#define __in_section_unique_named(seg, name) \
__attribute__((section("." STRINGIFY(seg) \
"." STRINGIFY(__COUNTER__) \
"." STRINGIFY(name))))
#ifndef __GCC_LINKER_CMD__ #ifndef __GCC_LINKER_CMD__
#include <xtensa/config/core.h> #include <xtensa/config/core.h>
@ -155,13 +159,4 @@
#define __sync_synchronize() do { __asm__ __volatile__ ("" ::: "memory"); } \ #define __sync_synchronize() do { __asm__ __volatile__ ("" ::: "memory"); } \
while (false) while (false)
#ifdef __deprecated
/*
* XCC does not support using deprecated attribute in enum,
* so just nullify it here to avoid compilation errors.
*/
#undef __deprecated
#define __deprecated
#endif
#endif #endif