Commit | Line | Data |
---|---|---|
42851540 NC |
1 | /* 8 bit data address relocations (R_CRX_NUM8). */ |
2 | d8 = 0x12; | |
3 | /* 16 bit data address relocations (R_CRX_NUM16). */ | |
4 | d16 = 0x1234; | |
5 | /* 32 bit data address relocations (R_CRX_NUM32). */ | |
6 | d32 = 0x12345678; | |
7 | ||
8 | SECTIONS | |
9 | { | |
10 | /* 4 bit relocations: | |
11 | Relative address (R_CRX_REL4) : 0x6 + 2 = 0x8 | |
12 | */ | |
13 | .text_4 0xa : | |
14 | { | |
15 | *(.text_4) | |
16 | foo4 = (. + 0x6); | |
17 | } | |
18 | ||
19 | /* 8 bit relocations: | |
20 | Relative address (R_CRX_REL8): 0x10 + 2 = 0x12 | |
21 | Relative address (R_CRX_REL8_CMP) : 0x10 + 4 = 0x14 | |
22 | */ | |
23 | .text_8 0xe0 : | |
24 | { | |
25 | *(.text_8) | |
26 | foo8 = (. + 0x10); | |
27 | } | |
28 | ||
29 | /* 12 bit relocations: | |
30 | Absolute address (R_CRX_REGREL12) : 0x0101 + 0x700 + 4 = 0x805 | |
31 | */ | |
32 | .text_12 0x0101 : | |
33 | { | |
34 | *(.text_12) | |
35 | foo12 = (. + 0x700); | |
36 | } | |
37 | ||
38 | /* 16 bit relocations: | |
39 | Relative address (R_CRX_REL16) : 0x1000 + 4 = 0x1004 | |
40 | Absolute address (R_CRX_IMM16) : 0x01010 + 0x1000 + 4 = 0x2014 | |
41 | */ | |
42 | .text_16 0x01010 : | |
43 | { | |
44 | *(.text_16) | |
45 | foo16 = (. + 0x1000); | |
46 | } | |
47 | ||
48 | /* 22 bit relocations: | |
49 | Absolute address (R_CRX_REGREL22) : 0x0201400 + 0x100000 + 6 = 0x301406 | |
50 | */ | |
51 | .text_22 0x0201400 : | |
52 | { | |
53 | *(.text_22) | |
54 | foo22 = (. + 0x100000); | |
55 | } | |
56 | ||
57 | /* 24 bit relocations: | |
58 | Relative address (R_CRX_REL24) : 0xe00000 + 6 = 0xe00006 | |
59 | */ | |
60 | .text_24 0x0f01400 : | |
61 | { | |
62 | *(.text_24) | |
63 | foo24 = (. + 0xe00000); | |
64 | } | |
65 | ||
66 | /* 28 bit relocations: | |
67 | Absolute address (R_CRX_REGREL28) : 0x06201400 + 0x3100000 + 6 = 0x9301406 | |
68 | */ | |
69 | .text_28 0x06201400 : | |
70 | { | |
71 | *(.text_28) | |
72 | foo28 = (. + 0x3100000); | |
73 | } | |
74 | ||
75 | /* 32 bit relocations: | |
76 | Absolute address (R_CRX_ABS32, R_CRX_IMM32) : 0x11014000 + 0x11000000 + 6 = 0x22014006 | |
77 | Relative address (R_CRX_REL32) : 0x11000000 + 6 = 0x11000006 | |
78 | */ | |
79 | .text_32 0x11014000 : | |
80 | { | |
81 | *(.text_32) | |
82 | foo32 = (. + 0x11000000); | |
83 | } | |
84 | } |