summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/virtex5/startup/linkcmds
blob: 247bee25c03e54ad8a16c3cfc7db8b86b2e61eea (plain) (blame)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/*
 *  This file contains directives for the GNU linker which are specific to the
 *  Virtex 5 PPC 440.  No assumptions are made on the firmware in the FPGA.
 *  This file is intended to be used together with start.S to generate
 *  downloadable code.
 */

OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
OUTPUT_ARCH(powerpc)

ENTRY(download_entry)

MsgAreaSize       = DEFINED(MsgAreaSize)   ? MsgAreaSize   : 1M;
RamBase           = DEFINED(RamBase)       ? RamBase       : 0x0;
RamSize           = DEFINED(RamSize)       ? RamSize       : 2048M - MsgAreaSize;
IntrStackSize     = DEFINED(IntrStackSize) ? IntrStackSize : 16K;
StackSize         = DEFINED(StackSize)     ? StackSize     : 64K;
HeapSize          = DEFINED(HeapSize)      ? HeapSize      : 0; /* 0=Use def */


MEMORY
{
  VECTORS         : ORIGIN = 0x00000000, LENGTH = 512
  RAM             : ORIGIN = 0x00000200, LENGTH = 2048M - 512
}


SECTIONS
{
  bsp_exc_vector_base = 0;
  __exeentry          = download_entry;
  __exestart          = bsp_exc_vector_base;
  .vectors bsp_exc_vector_base : { *(.vectors)                  } > VECTORS

  /* Read-only sections, merged into text segment: */
  .interp         : { *(.interp)                                } > RAM
  .hash           : { *(.hash)                                  } > RAM
  .dynsym         : { *(.dynsym)                                } > RAM
  .dynstr         : { *(.dynstr)                                } > RAM
  .gnu.version    : { *(.gnu.version)                           } > RAM
  .gnu.version_d  : { *(.gnu.version_d)                         } > RAM
  .gnu.version_r  : { *(.gnu.version_r)                         } > RAM
  .rela.text      : { *(.rela.text) *(.rela.gnu.linkonce.t*)    } > RAM
  .rela.data      : { *(.rela.data) *(.rela.gnu.linkonce.d*)    } > RAM
  .rela.rodata    : { *(.rela.rodata*) *(.rela.gnu.linkonce.r*) } > RAM
  .rela.got       : { *(.rela.got)                              } > RAM
  .rela.got1      : { *(.rela.got1)                             } > RAM
  .rela.got2      : { *(.rela.got2)                             } > RAM
  .rela.ctors     : { *(.rela.ctors)                            } > RAM
  .rela.dtors     : { *(.rela.dtors)                            } > RAM
  .rela.init      : { *(.rela.init)                             } > RAM
  .rela.fini      : { *(.rela.fini)                             } > RAM
  .rela.bss       : { *(.rela.bss)                              } > RAM
  .rela.plt       : { *(.rela.plt)                              } > RAM
  .rela.sdata     : { *(.rela.sdata)                            } > RAM
  .rela.sbss      : { *(.rela.sbss)                             } > RAM
  .rela.sdata2    : { *(.rela.sdata2)                           } > RAM
  .rela.sbss2     : { *(.rela.sbss2)                            } > RAM
  .rela.dyn       : { *(.rela.dyn)                              } > RAM

  /* Initialization code */
  .init           : { PROVIDE (_init = .);
                      *ecrti.o(.init)
                      KEEP(*(.init))
                      *ecrtn.o(.init)
                    } > RAM

  .text           : { *(.entry)
                      *(.text)
                      *(.text.*)

                      /* Special FreeBSD sysctl sections */
                      . = ALIGN (16);
                      __start_set_sysctl_set = .;
                      *(set_sysctl_*);
                      __stop_set_sysctl_set = ABSOLUTE(.);
                      *(set_domain_*);
                      *(set_pseudo_*);

                      /* .gnu.warning sections are handled specially by elf32.em
                       */
                      *(.gnu.warning)
                      *(.gnu.linkonce.t*)
                    } > RAM

  /* Finalization code */
  .fini           : { PROVIDE (_fini = .);
                      *ecrti.o(.fini)
                      KEEP(*(.fini))
                      *ecrtn.o(.fini)
                    } > RAM

  /* Miscellaneous read-only data */
  .rodata         : { *(.rodata.* .gnu.linkonce.r*)                    } > RAM
  .rodata1        : { *(.rodata1)                                      } > RAM

  .tdata : {
    _TLS_Data_begin = .;
    *(.tdata .tdata.* .gnu.linkonce.td.*)
    _TLS_Data_end = .;
  } >RAM

  .tbss : {
    _TLS_BSS_begin = .;
    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
    _TLS_BSS_end = .;
  } >RAM

  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
  _TLS_Alignment = ALIGNOF (.tdata);

  /* Initialised small data addressed as offsets from r2 */
  .sdata2         : { PROVIDE (_SDA2_BASE_ = 32768); *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)          } > RAM

  /* Zeroed small data addressed as offsets from r2 */
  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)

                      /* Avoid empty sdata2/sbss2 area: __eabi would not set up
                       * r2 which may be important if run-time loading is used
                       */
                      . += 1;

                      PROVIDE (__SBSS2_END__ = .);
                    } > RAM

  /* Exception frame info */
  .eh_frame       : { *(.eh_frame .eh_frame.*)                         } > RAM
  .eh_frame_hdr   : { *(.eh_frame_hdr)                                 } > RAM

  /*  Declares where the .text section ends */
  _etext          = .;
  PROVIDE (etext  = .);

  /* Initialized R/W Data section goes in RAM */
  .data           : { PROVIDE(__DATA_START__ = ABSOLUTE(.) );
                      *(.data)
                      *(.data.*)
                      *(.gnu.linkonce.d*)
                    } > RAM

  .data1          : { *(.data1)                                        } > RAM

                        PROVIDE (__EXCEPT_START__ = .);
  .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*)       } > RAM
                        PROVIDE (__EXCEPT_END__ = .);

  .got1           : { *(.got1)                                         } > RAM

  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
   * get relocated with -mrelocatable. Also put in the .fixup pointers.
   * The current compiler no longer needs this, but keep it around for 2.7.2.
   */
                      PROVIDE (_GOT2_START_ = .);
  .got2           : { *(.got2)                                         } > RAM

  .dynamic        : { *(.dynamic)                                      } > RAM

  .ctors          : { /* gcc uses crtbegin.o to find the start of
                       * the constructors, so we make sure it is
                       * first.  Because this is a wildcard, it
                       * doesn't matter if the user does not
                       * actually link against crtbegin.o; the
                       * linker won't look for a file to match a
                       * wildcard.  The wildcard also means that it
                       * doesn't matter which directory crtbegin.o
                       * is in.
                       */
                      KEEP (*crtbegin.o(.ctors))
                      /* We don't want to include the .ctor section from
                       * the crtend.o file until after the sorted ctors.
                       * The .ctor section from the crtend file contains the
                       * end of ctors marker and it must be last.
                       */
                      KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
                      KEEP (*(SORT(.ctors.*)))
                      KEEP (*(.ctors))
                    } > RAM

  .dtors          : { KEEP (*crtbegin.o(.dtors))
                      KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
                      KEEP (*(SORT(.dtors.*)))
                      KEEP (*(.dtors))
                    } > RAM

                      PROVIDE (_FIXUP_START_ = .);
  .fixup          : { *(.fixup)                                        } > RAM
                      PROVIDE (_FIXUP_END_ = .);

                      PROVIDE (_GOT2_END_ = .);

                      PROVIDE (_GOT_START_ = .);
  .got            : { __got_start = .;
                      *(.got)
                    } > RAM

  .got.plt        : { *(.got.plt)                                      } > RAM
                      PROVIDE (_GOT_END_ = .);

  .jcr            : { KEEP (*(.jcr))                                   } > RAM

  /* We want the small data sections together, so single-instruction offsets
   * can access them all, and initialized data all before uninitialized, so
   * we can shorten the on-disk segment size.
   */
  /* Initialised small data addressed as offsets from r13 */
  .sdata          : { PROVIDE (_SDA_BASE_ = 32768); *(.sdata* .gnu.linkonce.s.*)                     } > RAM

  _edata          = .;
  PROVIDE (edata  = .);

  /* Zeroed small data addressed as offsets from r13 */
  .sbss           : { PROVIDE (__sbss_start = .);
                      *(.dynsbss)
                      *(.sbss*)
                      *(.gnu.linkonce.sb.*)
                      *(.scommon)

                      /* Avoid empty sdata/sbss area: __eabi would not set up
                       * r13, which may be important if run-time loading is used
                       */
                      . += 1;

                      PROVIDE (__SBSS_END__ = .);
                      PROVIDE (__sbss_end   = .);
                    } > RAM

  .plt            : { *(.plt)                                          } > RAM
  .iplt           : { *(.iplt)                                         } > RAM

  /* Zeroed large data */
  .bss            : { PROVIDE (__bss_start = .);
                      *(.dynbss)
                      *(.bss)
                      *(.bss.*)
                      *(.gnu.linkonce.b*)
                      *(COMMON)

                      PROVIDE (__bss_end = ALIGN(4));
                      __bss_size = __bss_end - __bss_start;
                    } > RAM

  __exeend        = ALIGN(4);
  __rtems_end     = .;
  .               = ALIGN(0x20);        /* Align to a cache-line boundary */
  PROVIDE(__bsp_ram_start = .);

  /* Interrupt stack: aligned on a cache-line boundary */
  .              += IntrStackSize;
  __intrStack     = .;

  /* Main stack lives here */
  _stack          = ALIGN(0x20); 	/* Align to a cache-line boundary */
  .              += StackSize;
  __stack_base    = .;                  /* Initial stack builds downwards */

  /* RTEMS workspace: size specified by application */
  WorkAreaBase    = ALIGN(0x20); 	/* Align to a cache-line boundary */

  /* The heap comes after the work space */

   .              = RamBase + RamSize;
  PROVIDE(__bsp_ram_end = .);

  /* Message area for capturing early printk output */
  /* Placed here to be easily findable with a debugger */
  MsgAreaBase     = __bsp_ram_end;
  .              += MsgAreaSize;

  __phy_ram_end   = .;                  /* True end of physical memory */

  /DISCARD/ :
  {
    *(.comment)
  }

  /* Some configuration constants */
  __vectors       = 0;
}