some tests
[megadrive.git] / testpico / sega.ld
diff --git a/testpico/sega.ld b/testpico/sega.ld
new file mode 100644 (file)
index 0000000..d4054ad
--- /dev/null
@@ -0,0 +1,117 @@
+OUTPUT_ARCH(m68k)\r
+SEARCH_DIR(.)\r
+/*GROUP(-lbcc -lc -lgcc)*/\r
+__DYNAMIC  =  0;\r
+\r
+/*\r
+ * Setup the memory map of the SEGA Genesis.\r
+ * stack grows down from high memory.\r
+ *\r
+ * The memory map look like this:\r
+ * +--------------------+ <- low memory\r
+ * | .text              |\r
+ * |        _etext      |\r
+ * |        ctor list   | the ctor and dtor lists are for\r
+ * |        dtor list   | C++ support\r
+ * +--------------------+\r
+ * | .data              | initialized data goes here\r
+ * |        _edata      |\r
+ * +--------------------+\r
+ * | .bss               |\r
+ * |        __bss_start | start of bss, cleared by crt0\r
+ * |        _end        | start of heap, used by sbrk()\r
+ * +--------------------+\r
+ * .                    .\r
+ * .                    .\r
+ * .                    .\r
+ * |        __stack     | top of stack\r
+ * +--------------------+\r
+ */\r
+MEMORY\r
+{\r
+       rom : ORIGIN = 0x00000000, LENGTH = 0x00400000\r
+       ram : ORIGIN = 0x00ff0000, LENGTH = 0x00010000\r
+}\r
+\r
+/*\r
+ * allocate the stack to be at the top of memory, since the stack\r
+ * grows down\r
+ */\r
+\r
+PROVIDE (__stack = 0x00fffff0);\r
+\r
+/*\r
+ * Initalize some symbols to be zero so we can reference them in the\r
+ * crt0 without core dumping. These functions are all optional, but\r
+ * we do this so we can have our crt0 always use them if they exist. \r
+ * This is so BSPs work better when using the crt0 installed with gcc.\r
+ * We have to initalize them twice, so we cover a.out (which prepends\r
+ * an underscore) and coff object file formats.\r
+ */\r
+PROVIDE (hardware_init_hook = 0);\r
+PROVIDE (_hardware_init_hook = 0);\r
+PROVIDE (software_init_hook = 0);\r
+PROVIDE (_software_init_hook = 0);\r
+\r
+SECTIONS\r
+{\r
+  .text 0x00000000:\r
+  {\r
+    *(.text)\r
+    . = ALIGN(0x4);\r
+     __CTOR_LIST__ = .;\r
+    LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)\r
+    *(.ctors)\r
+    LONG(0)\r
+    __CTOR_END__ = .;\r
+    __DTOR_LIST__ = .;\r
+    LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)\r
+    *(.dtors)\r
+     LONG(0)\r
+    __DTOR_END__ = .;\r
+    *(.rodata*)\r
+/*\r
+    *(.gcc_except_table)\r
+\r
+    __INIT_SECTION__ = . ;\r
+    *(.init)\r
+    SHORT (0x4e75)\r
+\r
+    __FINI_SECTION__ = . ;\r
+    *(.fini)\r
+    SHORT (0x4e75)\r
+*/\r
+    _etext = .;\r
+    *(.lit)\r
+  } > rom\r
+\r
+  .data 0xff0100 :\r
+  {\r
+    *(.shdata)\r
+    *(.data)\r
+    _edata = .;\r
+  } > ram\r
+\r
+  /* .bss 0xff0100 : */\r
+  .bss BLOCK (0x4) :\r
+  {\r
+    __bss_start = . ;\r
+    *(.shbss)\r
+    *(.bss)\r
+    *(COMMON)\r
+    *(.eh_fram)\r
+    *(.eh_frame)\r
+    _end =  ALIGN (0x8);\r
+    __end = _end;\r
+  } > ram\r
+\r
+  .stab 0 (NOLOAD) :\r
+  {\r
+    *(.stab)\r
+  }\r
+\r
+  .stabstr 0 (NOLOAD) :\r
+  {\r
+    *(.stabstr)\r
+  }\r
+}\r