aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-crx/crx.ld
blob: 703b934a94765a887fd97f72b4ebe151d39fc855 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* 8 bit data address relocations (R_CRX_NUM8).  */
d8 = 0x12;
/* 16 bit data address relocations (R_CRX_NUM16).  */
d16 = 0x1234;
/* 32 bit data address relocations (R_CRX_NUM32).  */
d32 = 0x12345678;

SECTIONS
{
/* 4 bit relocations:
   Relative address (R_CRX_REL4) : 0x6 + 2 = 0x8
*/
  .text_4 0xa :
  { 
	*(.text_4)   
	foo4 = (. + 0x6);
  }

/* 8 bit relocations:
   Relative address (R_CRX_REL8): 0x10 + 2 = 0x12
   Relative address (R_CRX_REL8_CMP) : 0x10 + 4 = 0x14
*/
  .text_8 0xe0 :
  { 
	*(.text_8)   
	foo8 = (. + 0x10);
  }

/* 12 bit relocations:
   Absolute address (R_CRX_REGREL12) : 0x0101 + 0x700 + 4 = 0x805
*/
  .text_12 0x0101 :
  { 
	*(.text_12)   
	foo12 = (. + 0x700);
  }

/* 16 bit relocations:
   Relative address (R_CRX_REL16) : 0x1000 + 4 = 0x1004
   Absolute address (R_CRX_IMM16) : 0x01010 + 0x1000 + 4 = 0x2014
*/
  .text_16 0x01010 :
  { 
	*(.text_16)   
	foo16 = (. + 0x1000);
  }

/* 22 bit relocations:
   Absolute address (R_CRX_REGREL22) : 0x0201400 + 0x100000 + 6 = 0x301406
*/
  .text_22 0x0201400 :
  { 
	*(.text_22)   
	foo22 = (. + 0x100000);
  }

/* 24 bit relocations:
   Relative address (R_CRX_REL24) : 0xe00000 + 6 = 0xe00006
*/
  .text_24 0x0f01400 :
  { 
	*(.text_24)   
	foo24 = (. + 0xe00000);
  }

/* 28 bit relocations:
   Absolute address (R_CRX_REGREL28) : 0x06201400 + 0x3100000 + 6 = 0x9301406
*/
  .text_28 0x06201400 :
  { 
	*(.text_28)   
	foo28 = (. + 0x3100000);
  }

/* 32 bit relocations:
   Absolute address (R_CRX_ABS32, R_CRX_IMM32) : 0x11014000 + 0x11000000 + 6 = 0x22014006
   Relative address (R_CRX_REL32) : 0x11000000 + 6 = 0x11000006
*/
  .text_32 0x11014000 :
  { 
	*(.text_32)   
	foo32 = (. + 0x11000000);
  }
}