wut/rules/rpl.ld

253 lines
5.3 KiB
Plaintext
Raw Normal View History

2015-12-27 03:10:38 +01:00
OUTPUT_FORMAT("elf32-powerpc")
OUTPUT_ARCH(powerpc:common)
ENTRY(_start)
MEMORY {
2015-12-28 01:28:29 +01:00
system (rwx) : ORIGIN = 0x01000000, LENGTH = 32M
code (rwx) : ORIGIN = 0x02000000, LENGTH = 224M
data (rw) : ORIGIN = 0x10000000, LENGTH = 800M
load (rwx) : ORIGIN = 0xC0000000, LENGTH = 128M
2015-12-27 03:10:38 +01:00
}
PHDRS {
2015-12-28 01:28:29 +01:00
hdr_text PT_LOAD FILEHDR PHDRS FLAGS(0x01 | 0x04);
hdr_data PT_LOAD FLAGS(0x02 | 0x04);
hdr_srodata PT_LOAD FLAGS(0x04);
hdr_sdata PT_LOAD FLAGS(0x02 | 0x04);
2015-12-27 03:10:38 +01:00
}
SECTIONS {
2015-12-28 01:28:29 +01:00
. = ORIGIN(code);
.syscall ALIGN(32) : { *(.syscall) } : hdr_text
2015-12-28 01:28:29 +01:00
/* Standard code section */
.text ALIGN(32) : {
/* .init */
KEEP( *(.crt0) )
KEEP( *(.init) )
. = ALIGN(4);
/* .text */
*(.text)
*(.text.*)
*(.rodata .rodata.*)
*(.gnu.linkonce.r.*)
*(.rodata1)
*(.glue_7)
*(.glue_7t)
*(.stub)
*(.gnu.warning)
*(.gnu.linkonce.t*)
. = ALIGN(4);
2016-07-23 12:25:30 +02:00
2015-12-28 01:28:29 +01:00
*(.rplTramp.text)
*(SORT(.rplTramp.text.*))
. = ALIGN(4);
2016-07-23 12:25:30 +02:00
/* .fini */
KEEP( *(.fini) )
. = ALIGN(4);
2016-07-23 12:25:30 +02:00
} : hdr_text
2016-07-23 12:25:30 +02:00
/* Standard data sections */
. = ORIGIN(data);
.data ALIGN(256) : {
*(.data)
*(.data.*)
*(.eh_frame)
*(.eh_frame_hdr)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
2016-07-23 12:25:30 +02:00
. = ALIGN(32);
__sdata_start = .;
*(.sdata)
*(.sdata.*)
__sdata_end = .;
2016-07-23 12:25:30 +02:00
. = ALIGN(32);
__sdata2_start = .;
*(.sdata2)
*(.sdata2.*)
*(.gnu.linkonce.s2.*)
__sdata2_end = .;
} : hdr_sdata
2016-07-23 12:25:30 +02:00
.tdata ALIGN(256) :
{
__tdata_lma = .;
*(.tdata)
*(.tdata.*)
*(.gnu.linkonce.td.*)
. = ALIGN(4);
__tdata_lma_end = .;
} : hdr_data
.preinit_array ALIGN(256) :
{
PROVIDE (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE (__preinit_array_end = .);
} : hdr_data
.init_array ALIGN(256) :
{
PROVIDE (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE (__init_array_end = .);
} : hdr_data
.fini_array ALIGN(256) :
{
PROVIDE (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
PROVIDE (__fini_array_end = .);
} : hdr_data
.ctors ALIGN(256) :
{
KEEP (*crtbegin.o(.ctors)) /* MUST be first -- GCC requires it */
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} : hdr_data
.dtors ALIGN(256) :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} : hdr_data
2016-07-23 12:25:30 +02:00
__bss_start__ = .;
.bss ALIGN(256) :
{
*(.dynbss)
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b*)
*(COMMON)
. = ALIGN(32);
2016-07-23 12:25:30 +02:00
__sbss_start = .;
*(.sbss)
*(.sbss.*)
__sbss_end = .;
. = ALIGN(32);
2016-07-23 12:25:30 +02:00
__sbss2_start = .;
*(.sbss2)
*(.sbss2.*)
*(.gnu.linkonce.sb2.*)
__sbss2_end = .;
. = ALIGN(32);
/* Reserve space for the TLS segment of the main thread */
__tls_start = .;
__tbss_start = .;
*(.tbss)
*(.tbss.*)
*(.gnu.linkonce.tb.*)
*(.tcommon)
__tbss_end = .;
. += + SIZEOF(.tdata);
__tls_end = .;
. = ALIGN(32);
} : hdr_data
__bss_end__ = .;
2015-12-28 01:28:29 +01:00
/* System stuff is for our elf2rpl converter to go through */
. = ORIGIN(system);
2016-06-08 01:59:55 +02:00
/* Contains the name of RPLs, referenced by .lib.rplLibs */
2015-12-28 01:28:29 +01:00
.rodata.rplNames ALIGN(32) : {
*(.rodata.rplNames)
} : hdr_data
/*
* List of RPL libraries to import, in format:
* uint32_t nameAddress -> .rodata.rplNames
* uint32_t firstFuncEntry -> .data.rplFuncStubs
*/
.lib.rplLibs ALIGN(32) : {
*(.lib.rplLibs)
}
/*
* List of functions an RPL exports, in format:
* uint32_t trampAddress
*/
.data.rplFuncStubs ALIGN(32) : {
*(.data.rplFuncStubs)
}
2016-06-08 01:59:55 +02:00
/* Required compiler trash */
.fixup ALIGN(32) : { *(.fixup*) }
.got ALIGN(32) : { *(.got*) }
.gcc_except_table ALIGN(32) : { *(.gcc_except_table*) }
2015-12-28 01:28:29 +01:00
.hash ALIGN(32) : { *(.hash) }
.dynsym ALIGN(32) : { *(.dynsym) }
/* Put all dynamic loader relocations into one section */
.rela.dyn ALIGN(32) : {
*(.rela.dyn)
*(.rela.data.rplFuncStubs)
*(.rela.lib.rplLibs)
}
2015-12-28 15:18:35 +01:00
/* Relocations for .rodata sections */
.rela.rodata ALIGN(32) :
2015-12-28 01:28:29 +01:00
{
2016-06-08 01:59:55 +02:00
*(.rela.rodata .rela.rodata.*)
2015-12-28 01:28:29 +01:00
}
2015-12-28 15:18:35 +01:00
/* Relocations for .text sections */
2015-12-28 01:28:29 +01:00
.rela.text ALIGN(32) :
{
2016-06-08 01:59:55 +02:00
*(.rela.text .rela.text.*)
2015-12-28 01:28:29 +01:00
*(.rela.rplTramp.text)
2015-12-28 15:18:35 +01:00
}
/* Relocations for .data sections */
.rela.data ALIGN(32) :
{
2016-06-08 01:59:55 +02:00
*(.rela.data .rela.data.*)
2015-12-28 15:18:35 +01:00
}
/* Relocations for .bss sections */
.rela.bss ALIGN(32) :
{
2016-06-08 01:59:55 +02:00
*(.rela.bss .rela.bss.*)
2015-12-28 01:28:29 +01:00
}
2015-12-28 15:18:48 +01:00
/* Symbol tables */
.shstrtab ALIGN(32) : { *(.shstrtab) }
.symtab ALIGN(32) : { *(.symtab) }
.strtab ALIGN(32) : { *(.strtab) }
2016-06-08 01:59:55 +02:00
/DISCARD/ : {
*(.interp)
*(.dynstr)
*(.dynamic)
*(.comment)
}
__SDATA_START__ = __sdata_start;
__SBSS_END__ = __sbss_end;
__SDATA2_START__ = __sdata2_start;
__SBSS2_END__ = __sbss2_end;
_SDA_BASE_ = __sbss_end;
2016-06-08 01:59:55 +02:00
_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2);
2015-12-27 03:10:38 +01:00
}