Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/linker_set.h
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#define __MAKE_SET_CONST | #define __MAKE_SET_CONST | ||||
#else | #else | ||||
#define __MAKE_SET_CONST const | #define __MAKE_SET_CONST const | ||||
#endif | #endif | ||||
/* | /* | ||||
* Private macros, not to be used outside this header file. | * Private macros, not to be used outside this header file. | ||||
*/ | */ | ||||
#ifdef __GNUCLIKE___SECTION | |||||
/* | /* | ||||
* The userspace address sanitizer inserts redzones around global variables, | * The userspace address sanitizer inserts redzones around global variables, | ||||
* violating the assumption that linker set elements are packed. | * violating the assumption that linker set elements are packed. | ||||
*/ | */ | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#define __NOASAN | #define __NOASAN | ||||
#else | #else | ||||
#define __NOASAN __nosanitizeaddress | #define __NOASAN __nosanitizeaddress | ||||
#endif | #endif | ||||
#define __MAKE_SET_QV(set, sym, qv) \ | #define __MAKE_SET_QV(set, sym, qv) \ | ||||
__WEAK(__CONCAT(__start_set_,set)); \ | __WEAK(__CONCAT(__start_set_,set)); \ | ||||
__WEAK(__CONCAT(__stop_set_,set)); \ | __WEAK(__CONCAT(__stop_set_,set)); \ | ||||
static void const * qv \ | static void const * qv \ | ||||
__NOASAN \ | __NOASAN \ | ||||
__set_##set##_sym_##sym __section("set_" #set) \ | __set_##set##_sym_##sym __section("set_" #set) \ | ||||
__used = &(sym) | __used = &(sym) | ||||
#define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST) | #define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST) | ||||
#else /* !__GNUCLIKE___SECTION */ | |||||
#error this file needs to be ported to your compiler | |||||
#endif /* __GNUCLIKE___SECTION */ | |||||
/* | /* | ||||
* Public macros. | * Public macros. | ||||
*/ | */ | ||||
#define TEXT_SET(set, sym) __MAKE_SET(set, sym) | #define TEXT_SET(set, sym) __MAKE_SET(set, sym) | ||||
#define DATA_SET(set, sym) __MAKE_SET(set, sym) | #define DATA_SET(set, sym) __MAKE_SET(set, sym) | ||||
#define DATA_WSET(set, sym) __MAKE_SET_QV(set, sym, ) | #define DATA_WSET(set, sym) __MAKE_SET_QV(set, sym, ) | ||||
#define BSS_SET(set, sym) __MAKE_SET(set, sym) | #define BSS_SET(set, sym) __MAKE_SET(set, sym) | ||||
Show All 35 Lines |