From 56b8edd4e3fc64c23a4b58f09b01016d2d0ca2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 22 Oct 2007 00:00:32 +0000 Subject: [PATCH] ld scripts for m68k. Actually mostly untouched ppc from r22648. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22651 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/ldscripts/m68k/add-on.ld | 65 ++++++++++++ src/system/ldscripts/m68k/app.ld | 72 ++++++++++++++ .../ldscripts/m68k/boot_loader_amiga.ld | 45 +++++++++ .../ldscripts/m68k/boot_loader_apple.ld | 45 +++++++++ .../ldscripts/m68k/boot_loader_atari.ld | 45 +++++++++ src/system/ldscripts/m68k/kernel.ld | 98 +++++++++++++++++++ src/system/ldscripts/m68k/library.ld | 74 ++++++++++++++ src/system/ldscripts/m68k/runtime_loader.ld | 63 ++++++++++++ src/system/ldscripts/m68k/stage2.ld | 32 ++++++ 9 files changed, 539 insertions(+) create mode 100644 src/system/ldscripts/m68k/add-on.ld create mode 100644 src/system/ldscripts/m68k/app.ld create mode 100644 src/system/ldscripts/m68k/boot_loader_amiga.ld create mode 100644 src/system/ldscripts/m68k/boot_loader_apple.ld create mode 100644 src/system/ldscripts/m68k/boot_loader_atari.ld create mode 100644 src/system/ldscripts/m68k/kernel.ld create mode 100644 src/system/ldscripts/m68k/library.ld create mode 100644 src/system/ldscripts/m68k/runtime_loader.ld create mode 100644 src/system/ldscripts/m68k/stage2.ld diff --git a/src/system/ldscripts/m68k/add-on.ld b/src/system/ldscripts/m68k/add-on.ld new file mode 100644 index 0000000000..37aca02854 --- /dev/null +++ b/src/system/ldscripts/m68k/add-on.ld @@ -0,0 +1,65 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") +OUTPUT_ARCH(m68k) + +ENTRY(_start) +SEARCH_DIR("libgcc"); +SECTIONS +{ + . = 0x00000000 + SIZEOF_HEADERS; + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0x9090 + .plt : { *(.plt) } + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } =0x9090 + + .rodata : { *(.rodata) } + + /* writable data */ + . = ALIGN(0x1000) + (. & (0x1000 - 1)); + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + __dtor_list = .; + .dtors : { *(.dtors) } + __dtor_end = .; + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + + /* unintialized data (in same segment as writable data) */ + __bss_start = .; + .bss : { *(.bss) } + + . = ALIGN(0x1000); + _end = . ; + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame) } +} diff --git a/src/system/ldscripts/m68k/app.ld b/src/system/ldscripts/m68k/app.ld new file mode 100644 index 0000000000..9c46e7f21c --- /dev/null +++ b/src/system/ldscripts/m68k/app.ld @@ -0,0 +1,72 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") +OUTPUT_ARCH(m68k) + +ENTRY(_start) +SEARCH_DIR("libgcc"); +SECTIONS +{ + . = 0x00200000 + SIZEOF_HEADERS; + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0x9090 + .fini : { *(.fini) } =0x9090 + .plt : { *(.plt) } + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + .rodata : { *(.rodata) } + + /* writable data */ + . = ALIGN(0x1000) + (. & (0x1000 - 1)); + __data_start = .; + PROVIDE(_data_start = .); + .data : { *(.data .gnu.linkonce.d.*) } + + __ctor_list = .; + PROVIDE (_ctor_list = .); + .ctors : { *(.ctors) } + __ctor_end = .; + PROVIDE (_ctor_end = .); + + __dtor_list = .; + PROVIDE (_dtor_list = .); + .dtors : { *(.dtors) } + __dtor_end = .; + PROVIDE (_dtor_end = .); + + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + + /* unintialized data (in same segment as writable data) */ + PROVIDE (__bss_start = .); + .bss : { *(.bss) } + + . = ALIGN(0x1000); + PROVIDE (_end = .); + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame) } +} diff --git a/src/system/ldscripts/m68k/boot_loader_amiga.ld b/src/system/ldscripts/m68k/boot_loader_amiga.ld new file mode 100644 index 0000000000..07d8044ba2 --- /dev/null +++ b/src/system/ldscripts/m68k/boot_loader_amiga.ld @@ -0,0 +1,45 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") +OUTPUT_ARCH(m68k) + +ENTRY(_start) + +SECTIONS +{ + . = 0x102000 + SIZEOF_HEADERS; + + __text_begin = .; + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .sdata2 : { *(.sdata2) } + + /* writable data */ + /* align to the same offset in the next page (for performance reasons + (not that it really matters in the boot loader)) */ + . = ALIGN(0x1000) + 0x1000 + (. & (0x1000 - 1)); + + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + .data.rel.ro : { *(.data.rel.ro.local .data.rel.ro*) } + .got : { *(.got .got2) } + .sdata : { *(.sdata .sdata.* .gnu.linkonce.s.*) } + + /* unintialized data (in same segment as writable data) */ + __bss_start = .; + .sbss : { *(.sbss .sbss.* .gnu.linkonce.sb.*) } + .bss : { + *(.bss .bss.* .gnu.linkonce.b.*) + . = ALIGN(0x1000); + } + + _end = . ; + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame .dtors .debug_*) } +} diff --git a/src/system/ldscripts/m68k/boot_loader_apple.ld b/src/system/ldscripts/m68k/boot_loader_apple.ld new file mode 100644 index 0000000000..07d8044ba2 --- /dev/null +++ b/src/system/ldscripts/m68k/boot_loader_apple.ld @@ -0,0 +1,45 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") +OUTPUT_ARCH(m68k) + +ENTRY(_start) + +SECTIONS +{ + . = 0x102000 + SIZEOF_HEADERS; + + __text_begin = .; + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .sdata2 : { *(.sdata2) } + + /* writable data */ + /* align to the same offset in the next page (for performance reasons + (not that it really matters in the boot loader)) */ + . = ALIGN(0x1000) + 0x1000 + (. & (0x1000 - 1)); + + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + .data.rel.ro : { *(.data.rel.ro.local .data.rel.ro*) } + .got : { *(.got .got2) } + .sdata : { *(.sdata .sdata.* .gnu.linkonce.s.*) } + + /* unintialized data (in same segment as writable data) */ + __bss_start = .; + .sbss : { *(.sbss .sbss.* .gnu.linkonce.sb.*) } + .bss : { + *(.bss .bss.* .gnu.linkonce.b.*) + . = ALIGN(0x1000); + } + + _end = . ; + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame .dtors .debug_*) } +} diff --git a/src/system/ldscripts/m68k/boot_loader_atari.ld b/src/system/ldscripts/m68k/boot_loader_atari.ld new file mode 100644 index 0000000000..07d8044ba2 --- /dev/null +++ b/src/system/ldscripts/m68k/boot_loader_atari.ld @@ -0,0 +1,45 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") +OUTPUT_ARCH(m68k) + +ENTRY(_start) + +SECTIONS +{ + . = 0x102000 + SIZEOF_HEADERS; + + __text_begin = .; + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .sdata2 : { *(.sdata2) } + + /* writable data */ + /* align to the same offset in the next page (for performance reasons + (not that it really matters in the boot loader)) */ + . = ALIGN(0x1000) + 0x1000 + (. & (0x1000 - 1)); + + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + .data.rel.ro : { *(.data.rel.ro.local .data.rel.ro*) } + .got : { *(.got .got2) } + .sdata : { *(.sdata .sdata.* .gnu.linkonce.s.*) } + + /* unintialized data (in same segment as writable data) */ + __bss_start = .; + .sbss : { *(.sbss .sbss.* .gnu.linkonce.sb.*) } + .bss : { + *(.bss .bss.* .gnu.linkonce.b.*) + . = ALIGN(0x1000); + } + + _end = . ; + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame .dtors .debug_*) } +} diff --git a/src/system/ldscripts/m68k/kernel.ld b/src/system/ldscripts/m68k/kernel.ld new file mode 100644 index 0000000000..7e4f004696 --- /dev/null +++ b/src/system/ldscripts/m68k/kernel.ld @@ -0,0 +1,98 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") +OUTPUT_ARCH(m68k) + +ENTRY(_start) +SEARCH_DIR("libgcc"); +SECTIONS +{ + . = 0x80000000 + SIZEOF_HEADERS; + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + + .rel.dyn : { + *(.rel.init) + *(.rel.text .rel.text.* .rel.gnu.linkonce.t*) + *(.rel.fini) + *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r*) + *(.rel.data.rel.ro*) + *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) + *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) + *(.rel.ctors) + *(.rel.dtors) + *(.rel.got) + *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) + *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) + *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) + *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) + *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) + } + + .rela.dyn : { + *(.rela.init) + *(.rela.text .rela.text.* .rela.gnu.linkonce.t*) + *(.rela.fini) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) + *(.rela.ctors) + *(.rela.dtors) + *(.rela.got) + *(.rela.got1) + *(.rela.got2) + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + } + .init : { *(.init) } =0x60000000 + + /* text/read-only data */ + .text : { + *(.text .stub .text.* .gnu.linkonce.t.*) + } =0x60000000 + + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } + .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } + + /* writable data */ + /* align to the same offset in the next page (for performance reasons + (not that it really matters in the kernel)) */ + . = ALIGN(0x1000) + 0x1000 + (. & (0x1000 - 1)); + + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + + .dynamic : { *(.dynamic) } + + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + + .got : { *(.got.plt) *(.got) } + + .sdata : { *(.sdata .sdata.* .gnu.linkonce.s.*) } + + /* unintialized data (in same segment as writable data) */ + __bss_start = .; + __bss_start = .; + .sbss : { *(.sbss .sbss.* .gnu.linkonce.sb.*) } + .bss : { + *(.bss .bss.* .gnu.linkonce.b.*) + . = ALIGN(0x1000); + } + + _end = . ; + + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame .dtors .debug_*) } +} diff --git a/src/system/ldscripts/m68k/library.ld b/src/system/ldscripts/m68k/library.ld new file mode 100644 index 0000000000..9231d54e6c --- /dev/null +++ b/src/system/ldscripts/m68k/library.ld @@ -0,0 +1,74 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") +OUTPUT_ARCH(m68k) + +ENTRY(_start) +SEARCH_DIR("libgcc"); +SECTIONS +{ + . = 0x00200000 + SIZEOF_HEADERS; + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0x9090 + .fini : { *(.fini) } =0x9090 + .plt : { *(.plt) } + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + .rodata : { *(.rodata) } + + /* writable data */ + . = ALIGN(0x1000) + (. & (0x1000 - 1)); + __data_start = .; + PROVIDE(_data_start = .); + .data : { *(.data .gnu.linkonce.d.*) } + + __ctor_list = .; + PROVIDE (_ctor_list = .); + .ctors : { *(.ctors) } + __ctor_end = .; + PROVIDE (_ctor_end = .); + + __dtor_list = .; + PROVIDE (_dtor_list = .); + .dtors : { *(.dtors) } + __dtor_end = .; + PROVIDE (_dtor_end = .); + + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + + + /* unintialized data (in same segment as writable data) */ + PROVIDE (__bss_start = .); + .bss : { *(.bss) } + + . = ALIGN(0x1000); + PROVIDE (_end = .); + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame) } +} diff --git a/src/system/ldscripts/m68k/runtime_loader.ld b/src/system/ldscripts/m68k/runtime_loader.ld new file mode 100644 index 0000000000..8c89c18985 --- /dev/null +++ b/src/system/ldscripts/m68k/runtime_loader.ld @@ -0,0 +1,63 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") +OUTPUT_ARCH(m68k) + +ENTRY(runtime_loader) +SEARCH_DIR("libgcc"); +SECTIONS +{ + . = 0x00100000 + SIZEOF_HEADERS; + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0x9090 + .plt : { *(.plt) } + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + .rodata : { *(.rodata) } + + /* writable data */ + . = ALIGN(0x1000) + (. & (0x1000 - 1)); + __data_start = .; + PROVIDE(_data_start = .); + .data : { *(.data .gnu.linkonce.d.*) } + + __ctor_list = .; + PROVIDE (_ctor_list = .); + .ctors : { *(.ctors) } + PROVIDE (__ctor_end = .); + + + /* unintialized data (in same segment as writable data) */ + PROVIDE (__bss_start = .); + .bss : { *(.bss) } + + . = ALIGN(0x1000); + PROVIDE (_end = .); + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame .dtors) } +} diff --git a/src/system/ldscripts/m68k/stage2.ld b/src/system/ldscripts/m68k/stage2.ld new file mode 100644 index 0000000000..26ff7d2eb0 --- /dev/null +++ b/src/system/ldscripts/m68k/stage2.ld @@ -0,0 +1,32 @@ +OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") +OUTPUT_ARCH(m68k) + +ENTRY(_start) +SECTIONS +{ + . = 0x102000 + SIZEOF_HEADERS; + + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } + + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + + .rodata : { *(.rodata) } + + /* writable data */ + . = ALIGN(0x1000); + __data_start = .; + .data : { *(.data .gnu.linkonce.d.*) } + + /* unintialized data (in same segment as writable data) */ + __bss_start = .; + .bss : { *(.bss) } + + . = ALIGN(0x1000); + _end = . ; + + /* Strip unnecessary stuff */ + /DISCARD/ : { *(.comment .note .eh_frame .dtors) } +}