xref: /openbmc/qemu/tests/tcg/xtensa/linker.ld.S (revision ba632924)
1#include "core-isa.h"
2
3#if XTENSA_HAVE_BE
4OUTPUT_FORMAT("elf32-xtensa-be")
5#else
6OUTPUT_FORMAT("elf32-xtensa-le")
7#endif
8ENTRY(_start)
9
10__DYNAMIC = 0;
11
12MEMORY {
13    ram : ORIGIN = XCHAL_VECBASE_RESET_VADDR, LENGTH = 0x08000000  /* 128M */
14    rom : ORIGIN = XCHAL_RESET_VECTOR_VADDR, LENGTH = 0x00001000  /* 4k */
15}
16
17SECTIONS
18{
19    .init :
20    {
21        *(.init)
22        *(.init.*)
23    } > rom
24
25    .vector :
26    {
27#if XCHAL_HAVE_WINDOWED
28    . = XCHAL_WINDOW_OF4_VECOFS;
29        *(.vector.window_overflow_4)
30    . = XCHAL_WINDOW_UF4_VECOFS;
31        *(.vector.window_underflow_4)
32    . = XCHAL_WINDOW_OF8_VECOFS;
33        *(.vector.window_overflow_8)
34    . = XCHAL_WINDOW_UF8_VECOFS;
35        *(.vector.window_underflow_8)
36    . = XCHAL_WINDOW_OF12_VECOFS;
37        *(.vector.window_overflow_12)
38    . = XCHAL_WINDOW_UF12_VECOFS;
39        *(.vector.window_underflow_12)
40#endif
41#if XCHAL_NUM_INTLEVELS + XCHAL_HAVE_NMI >= 2
42    . = XCHAL_INTLEVEL2_VECOFS;
43        *(.vector.level2)
44#endif
45#if XCHAL_NUM_INTLEVELS + XCHAL_HAVE_NMI >= 3
46    . = XCHAL_INTLEVEL3_VECOFS;
47        *(.vector.level3)
48#endif
49#if XCHAL_NUM_INTLEVELS + XCHAL_HAVE_NMI >= 4
50    . = XCHAL_INTLEVEL4_VECOFS;
51        *(.vector.level4)
52#endif
53#if XCHAL_NUM_INTLEVELS + XCHAL_HAVE_NMI >= 5
54    . = XCHAL_INTLEVEL5_VECOFS;
55        *(.vector.level5)
56#endif
57#if XCHAL_NUM_INTLEVELS + XCHAL_HAVE_NMI >= 6
58    . = XCHAL_INTLEVEL6_VECOFS;
59        *(.vector.level6)
60#endif
61#if XCHAL_NUM_INTLEVELS + XCHAL_HAVE_NMI >= 7
62    . = XCHAL_INTLEVEL7_VECOFS;
63        *(.vector.level7)
64#endif
65
66    . = XCHAL_KERNEL_VECOFS;
67        *(.vector.kernel)
68    . = XCHAL_USER_VECOFS;
69        *(.vector.user)
70    . = XCHAL_DOUBLEEXC_VECOFS;
71        *(.vector.double)
72    } > ram
73
74    .vector.text :
75    {
76        *(.vector.window_overflow_4.*)
77        *(.vector.window_underflow_4.*)
78        *(.vector.window_overflow_8.*)
79        *(.vector.window_underflow_8.*)
80        *(.vector.window_overflow_12.*)
81        *(.vector.window_underflow_12.*)
82
83        *(.vector.level2.*)
84        *(.vector.level3.*)
85        *(.vector.level4.*)
86        *(.vector.level5.*)
87        *(.vector.level6.*)
88        *(.vector.level7.*)
89
90        *(.vector.kernel.*)
91        *(.vector.user.*)
92        *(.vector.double.*)
93    } > ram
94
95    .text :
96    {
97        _ftext = .;
98        *(.text .stub .text.* .gnu.linkonce.t.* .literal .literal.*)
99        _etext = .;
100    } > ram
101
102    .rodata :
103    {
104        . = ALIGN(4);
105        _frodata = .;
106        *(.rodata .rodata.* .gnu.linkonce.r.*)
107        *(.rodata1)
108        _erodata = .;
109    } > ram
110
111    .data :
112    {
113        . = ALIGN(4);
114        _fdata = .;
115        *(.data .data.* .gnu.linkonce.d.*)
116        *(.data1)
117        _gp = ALIGN(16);
118        *(.sdata .sdata.* .gnu.linkonce.s.*)
119        _edata = .;
120    } > ram
121
122    .bss :
123    {
124        . = ALIGN(4);
125        _fbss = .;
126        *(.dynsbss)
127        *(.sbss .sbss.* .gnu.linkonce.sb.*)
128        *(.scommon)
129        *(.dynbss)
130        *(.bss .bss.* .gnu.linkonce.b.*)
131        *(COMMON)
132        _ebss = .;
133        _end = .;
134    } > ram
135}
136
137PROVIDE(_fstack = (ORIGIN(ram) & 0xf0000000) + LENGTH(ram) - 16);
138