xref: /haiku/src/system/ldscripts/sparc/boot_loader_openfirmware.ld (revision 076b19023f391d3ebb0015e4524f38b98b2afc2d)
1e8f58ba4SPulkoMandyOUTPUT_FORMAT("elf64-sparc")
2e8f58ba4SPulkoMandyOUTPUT_ARCH(sparc:v9)
3e8f58ba4SPulkoMandy
4e8f58ba4SPulkoMandyENTRY(_start)
5e8f58ba4SPulkoMandy
6*076b1902SAdrien DestuguesPHDRS
7*076b1902SAdrien Destugues{
8*076b1902SAdrien Destugues	/* have a non-loadable program chunk with the headers, then a loadable one
9*076b1902SAdrien Destugues	 * with the actual data. This eases the work of elf2aout. */
10*076b1902SAdrien Destugues	headers PT_NULL FILEHDR PHDRS ;
11*076b1902SAdrien Destugues	text PT_LOAD ;
12*076b1902SAdrien Destugues}
13*076b1902SAdrien Destugues
14e8f58ba4SPulkoMandySECTIONS
15e8f58ba4SPulkoMandy{
16864a3f99SPulkoMandy	/* Execution address. The file is loaded at 0x4000 with its header,
17864a3f99SPulkoMandy	 * then relocated here. */
1894ba4f64SPulkoMandy	. = 0x202000;
19e8f58ba4SPulkoMandy	__text_begin = .;
20e8f58ba4SPulkoMandy
21864a3f99SPulkoMandy	/* keep text and data sections next to each other, as the loader in openboot
22864a3f99SPulkoMandy	 * is not able to handle a hole between them.
23864a3f99SPulkoMandy	 */
24864a3f99SPulkoMandy
25e8f58ba4SPulkoMandy	/* text/read-only data */
26864a3f99SPulkoMandy	.text :	{
27864a3f99SPulkoMandy			  /* Make sure entry point is at start of file. Not required, since
28864a3f99SPulkoMandy			   * it is set using ENTRY above, but it looks nicer and makes it
29864a3f99SPulkoMandy			   * clearer we jumped at the correct address. */
30864a3f99SPulkoMandy              *(.text.start)
31864a3f99SPulkoMandy
3294ba4f64SPulkoMandy			  *(.text .text.* .gnu.linkonce.t.*)
33e8f58ba4SPulkoMandy	          *(.rodata .rodata.* .gnu.linkonce.r.*)
34*076b1902SAdrien Destugues	          *(.sdata2) } :text
35e8f58ba4SPulkoMandy
36e8f58ba4SPulkoMandy	.data : {
37e8f58ba4SPulkoMandy		__ctor_list = .;
38e8f58ba4SPulkoMandy		*(.ctors)
39e8f58ba4SPulkoMandy		__ctor_end = .;
40e8f58ba4SPulkoMandy
41e8f58ba4SPulkoMandy		__data_start = .;
42e8f58ba4SPulkoMandy		*(.data .gnu.linkonce.d.*)
43e8f58ba4SPulkoMandy		*(.data.rel.ro.local .data.rel.ro*)
44e8f58ba4SPulkoMandy		*(.got .got2)
45*076b1902SAdrien Destugues		*(.sdata .sdata.* .gnu.linkonce.s.* .fixup) } :text
46e8f58ba4SPulkoMandy
47e8f58ba4SPulkoMandy	/* uninitialized data (in same segment as writable data) */
48e8f58ba4SPulkoMandy	__bss_start = .;
49e8f58ba4SPulkoMandy	.bss : { *(.sbss .sbss.* .gnu.linkonce.sb.*)
50e8f58ba4SPulkoMandy
51e8f58ba4SPulkoMandy		*(.bss .bss.* .gnu.linkonce.b.*)
52e8f58ba4SPulkoMandy		. = ALIGN(0x1000);
53*076b1902SAdrien Destugues	} :text
54e8f58ba4SPulkoMandy
55e8f58ba4SPulkoMandy	_end = . ;
56e8f58ba4SPulkoMandy
57e8f58ba4SPulkoMandy	/* Strip unnecessary stuff */
58e8f58ba4SPulkoMandy	/DISCARD/ : { *(.comment .note .eh_frame .dtors .debug_* .gnu.attributes) }
59e8f58ba4SPulkoMandy}
60