xref: /haiku/src/system/ldscripts/m68k/boot_prg_atari_m68k.ld (revision a72ea36f95951530e0ca6929f4f48bd6ad4d2e68)
1b45b3d7dSFrançois Revol/*
2b45b3d7dSFrançois Revol * ld script to generate a TOS .PRG
3b45b3d7dSFrançois Revol * *ONLY* works for PIC (PCREL) code!
4b45b3d7dSFrançois Revol */
5b45b3d7dSFrançois Revol
6b45b3d7dSFrançois RevolOUTPUT_FORMAT("binary", "binary", "binary")
7b45b3d7dSFrançois RevolOUTPUT_ARCH(m68k)
8b45b3d7dSFrançois Revol
9b45b3d7dSFrançois RevolENTRY(__text_start)
10b45b3d7dSFrançois RevolSEARCH_DIR("libgcc");
11b45b3d7dSFrançois RevolSECTIONS
12b45b3d7dSFrançois Revol{
13b45b3d7dSFrançois Revol	/*. = 0x80000000 + SIZEOF_HEADERS;*/
14b45b3d7dSFrançois Revol	/* fool the alignment of .text */
15b45b3d7dSFrançois Revol	/*. = 0x20 - 0x1c;*/
16b45b3d7dSFrançois Revol	/* should stay in sync with boot_loader_m68k_atari.ld and atari_memory_map.h */
17b45b3d7dSFrançois Revol	. = 0x00080000 - 0x1c ;
18b45b3d7dSFrançois Revol
19b45b3d7dSFrançois Revol	/* .PRG file header */
20b45b3d7dSFrançois Revol	.prgheader : {
21b45b3d7dSFrançois Revol	/*SHORT(0x55aa)*/
22b45b3d7dSFrançois Revol		SHORT(0x601a)				/* MAGIC */
23b45b3d7dSFrançois Revol		LONG(__data_start - __text_start)	/* TEXT SIZE */
24b45b3d7dSFrançois Revol		LONG(__bss_start - __data_start)	/* DATA SIZE */
25b45b3d7dSFrançois Revol		LONG(_end - __bss_start)		/* BSS SIZE */
26b45b3d7dSFrançois Revol		LONG(0)					/* SYMBOL TABLE SIZE */
27b45b3d7dSFrançois Revol		LONG(0x4841494b)			/* (reserved) 'HAIK' */
28b45b3d7dSFrançois Revol		LONG(0x1)				/* PRGFLAGS : PF_FASTLOAD */
29b45b3d7dSFrançois Revol		SHORT(1)				/* ABSFLAG */
30b45b3d7dSFrançois Revol	}
31b45b3d7dSFrançois Revol
32b45b3d7dSFrançois Revol	__text_start = .;
33b45b3d7dSFrançois Revol	/* ".text ." should align to 0x1c but doesn't work as expected, cf top. */
34b45b3d7dSFrançois Revol	.text : {
35b45b3d7dSFrançois Revol		*(.text .gnu.linkonce.t.*)
36b45b3d7dSFrançois Revol	/*	*(.rel.text) *(.rel.gnu.linkonce.t*)
37b45b3d7dSFrançois Revol		*(.rela.text) *(.rela.gnu.linkonce.t*) */
38b45b3d7dSFrançois Revol	}
39b45b3d7dSFrançois Revol	. = ALIGN(0x4);
40b45b3d7dSFrançois Revol	__ctor_list = .;
41b45b3d7dSFrançois Revol	.ctors : { *(.ctors) }
42b45b3d7dSFrançois Revol	__ctor_end = .;
43b45b3d7dSFrançois Revol
44b45b3d7dSFrançois Revol	.rodata : {
45b45b3d7dSFrançois Revol		*(.rodata)
46b45b3d7dSFrançois Revol	/*	*(.rel.rodata) *(.rel.gnu.linkonce.r*)
47b45b3d7dSFrançois Revol		*(.rela.rodata) *(.rela.gnu.linkonce.r*) */
48b45b3d7dSFrançois Revol	}
49*a72ea36fSDavid Karoly	_haiku_revision : { *(_haiku_revision) }
50*a72ea36fSDavid Karoly
51b45b3d7dSFrançois Revol	/* writable data  */
52b45b3d7dSFrançois Revol	/* NO! . = ALIGN(0x1000); */
53b45b3d7dSFrançois Revol	. = ALIGN(0x1000);
54b45b3d7dSFrançois Revol	__data_start = .;
55b45b3d7dSFrançois Revol	.data : {
56b45b3d7dSFrançois Revol		*(.data .gnu.linkonce.d.*)
57b45b3d7dSFrançois Revol	/*	*(.rel.data) *(.rel.gnu.linkonce.d*)
58b45b3d7dSFrançois Revol		*(.rela.data) *(.rela.gnu.linkonce.d*) */
59b45b3d7dSFrançois Revol	}
605d801278SStephan Aßmus	/* uninitialized data (in same segment as writable data) */
61b45b3d7dSFrançois Revol	__bss_start = .;
62b45b3d7dSFrançois Revol	.bss : {
63b45b3d7dSFrançois Revol		*(.bss)
64b45b3d7dSFrançois Revol	/*	*(.rel.bss)
65b45b3d7dSFrançois Revol		*(.rela.bss) */
66b45b3d7dSFrançois Revol	}
67b45b3d7dSFrançois Revol	. = ALIGN(0x1000);
68b45b3d7dSFrançois Revol	_end = . ;
69b45b3d7dSFrançois Revol	.prgtrailer : {
70b45b3d7dSFrançois Revol		LONG(0)					/* FIXUP OFFSET */
71b45b3d7dSFrançois Revol		LONG(0)
72b45b3d7dSFrançois Revol	}
73b45b3d7dSFrançois Revol	/* Strip unnecessary stuff */
74b45b3d7dSFrançois Revol	/DISCARD/ : { *(.comment .note .eh_frame) }
75b45b3d7dSFrançois Revol}
76b45b3d7dSFrançois Revol
77