blob: dd51d45e058f0cf77cc329b0729e32a0f9d03fdd [file]
#ifndef _LINUX_RANGES_H
#define _LINUX_RANGES_H
#include <linux/sections.h>
/* Linker tables shalt not use this */
#define SECTION_ADDR_IN_RANGE(name, addr) \
(addr >= (unsigned long) LINUX_SECTION_START(name) && \
addr < (unsigned long) LINUX_SECTION_END(name))
#define DECLARE_SECTION_RANGE(name) \
DECLARE_LINUX_SECTION_RO(char, name)
#define SECTION_RANGE_BEGIN(name, __section) \
const __typeof__(name[0]) \
__attribute__((used, \
weak, \
__aligned__(LINUX_SECTION_ALIGNMENT(name)),\
section(SECTION_TBL(__section, name, ))))
#define SECTION_RANGE_END(name, __section) \
const __typeof__(name[0]) \
__attribute__((used, \
__aligned__(LINUX_SECTION_ALIGNMENT(name)),\
section(SECTION_TBL(__section, name, ~))))
#define DEFINE_SECTION_RANGE(name, section) \
DECLARE_LINUX_SECTION_RO(char, name); \
SECTION_RANGE_BEGIN(name, section) VMLINUX_SYMBOL(name)[0] = {};\
LTO_REFERENCE_INITCALL(name); \
SECTION_RANGE_END(name, section) VMLINUX_SYMBOL(name##__end)[0] = {};\
LTO_REFERENCE_INITCALL(name##__end);
/*
* We use the special "any" order, as section ranges need not care
* about that.
*/
#define SECTION_RANGE_ORDER any
#define __LINUX_SECTION(section, name) \
__attribute__((__section__(SECTION_TBL(section, name, SECTION_RANGE_ORDER))))
#endif /* _LINUX_RANGES_H */