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