Skip to content

Commit 3bb01b2

Browse files
committed
PC-relative adress for scalar variables (backported from 47bee47)
* Example use of pcrel addressing for variables * const qualifier also puts data into .text section!
1 parent 6654e49 commit 3bb01b2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/cdefs.h

+8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@
1515
#undef __aligned
1616
#define __aligned(x) __attribute__((aligned(x)))
1717

18+
/* Annotate variable to be put into text section. This should be used only on
19+
* scalar variable if you want it to be accessed with PC-relative addressing.
20+
* This saves 4 cycles / 2 bytes of instruction memory / 1 relocation. */
21+
#define __code __attribute__((section(".text")))
22+
/* Annotate initialized variable to be put into memory accessible
23+
* by custom chipset. */
1824
#define __data_chip __attribute__((section(".datachip")))
25+
/* Annotate uninitialized variable to be put into memory accessible
26+
* by custom chipset. */
1927
#define __bss_chip __attribute__((section(".bsschip")))
2028

2129
#if __GNUC_PREREQ__(4, 1)

0 commit comments

Comments
 (0)