aboutsummaryrefslogtreecommitdiffstats
path: root/src/declfunc.lds.S
blob: ba564bbff1867e15fb3ee207585fe48bbea2c1fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Linker script that defines symbols around sections.  The DECL_X()
// macros need this linker script to place _start and _end symbols
// around the list of declared items.
#include "autoconf.h" // CONFIG_MACH_AVR
#include "compiler.h" // __PASTE

#if CONFIG_MACH_AVR
#define DECL_SECTION .progmem.data.
#else
#define DECL_SECTION .rodata.
#endif

#define DECLWRAPPER(NAME)                       \
    __PASTE(DECL_SECTION, NAME) : SUBALIGN(1) { \
        NAME ## _start = . ;                    \
        *( .rodata. ## NAME ##.pre* )           \
        *( .rodata. ## NAME ##* )               \
        *( .rodata. ## NAME ##.post* )          \
        NAME ## _end = . ;                      \
    }

SECTIONS
{
    DECLWRAPPER(taskfuncs)
    DECLWRAPPER(initfuncs)
    DECLWRAPPER(shutdownfuncs)
}