More linkscript updates, fixes and cleanup (fixes #123)

This commit is contained in:
fincs 2021-04-25 16:41:04 +02:00
parent 4c816e115e
commit b6ca8b16a1
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
2 changed files with 50 additions and 42 deletions

View File

@ -18,81 +18,89 @@ SECTIONS
.text ALIGN(32) : { .text ALIGN(32) : {
KEEP (*(.crt0)) KEEP (*(.crt0))
KEEP (*(.init)) KEEP (*(SORT_NONE(.init)))
*(.text) *(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.*) *(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(SORT(.text.sorted.*))
*(.text .stub .text.* .gnu.linkonce.t.*)
*(.gnu.warning) *(.gnu.warning)
*(.gnu.linkonce.t.*) *(.glink)
KEEP (*(.fini)) KEEP (*(SORT_NONE(.fini)))
} > codemem } > codemem
. = ORIGIN(datamem); . = ORIGIN(datamem);
.rodata : { .rodata : {
*(.sdata2) *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
*(.sdata2.*) *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
*(.gnu.linkonce.s2.*)
*(.sbss2) *(.rodata .rodata.* .gnu.linkonce.r.*)
*(.sbss2.*) *(.rodata1)
*(.gnu.linkonce.sb2.*)
*(.rodata) *(.gcc_except_table .gcc_except_table.*)
*(.rodata.*) *(.gnu_extab*)
*(.gnu.linkonce.r.*)
*(.preinit_array) . = ALIGN(4);
*(.init_array) PROVIDE_HIDDEN (__preinit_array_start = .);
*(.fini_array) KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
PROVIDE_HIDDEN (__init_array_end = .);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
PROVIDE_HIDDEN (__fini_array_end = .);
KEEP (*crtbegin.o(.ctors)) KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) KEEP (*crtbegin?.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*))) KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors)) KEEP (*(.ctors))
KEEP (*crtbegin.o(.dtors)) KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*))) KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors)) KEEP (*(.dtors))
*(.jcr) KEEP (*(.jcr))
*(.dynamic)
*(.eh_frame_hdr)
KEEP (*(.eh_frame))
*(.fixup) *(.fixup)
*(.gcc_except_table)
*(.gcc_except_table.*)
*(.got)
*(.got1) *(.got1)
*(.got2) *(.got2)
*(.got.plt) *(.branch_lt)
*(.got)
*(.plt) *(.plt)
*(.tm_clone_table) } > datamem
.eh_frame : {
*(.eh_frame_hdr)
*(.eh_frame_entry .eh_frame_entry.*)
KEEP (*(.eh_frame))
*(.eh_frame.*)
} > datamem } > datamem
.data : { .data : {
*(.data) *(.data .data.* .gnu.linkonce.d.*)
*(.data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS) SORT(CONSTRUCTORS)
*(.data1)
*(.sdata) *(.sdata .sdata.* .gnu.linkonce.s.*)
*(.sdata.*)
*(.gnu.linkonce.s.*)
} > datamem } > datamem
.bss (NOLOAD) : { .bss (NOLOAD) : {
*(.dynsbss) *(.dynsbss)
*(.sbss) *(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
*(.scommon) *(.scommon)
*(.dynbss) *(.dynbss)
*(.bss) *(.bss .bss.* .gnu.linkonce.b.*)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON) *(COMMON)
} > datamem } > datamem

View File

@ -1,4 +1,4 @@
%rename link old_link %rename link old_link
*link: *link:
%(old_link) -T %:getenv(DEVKITPRO /wut/share/wut.ld) --gc-sections --emit-relocs -z nocopyreloc %(wut_entry) %(old_link) -T %:getenv(DEVKITPRO /wut/share/wut.ld) --gc-sections --emit-relocs --no-eh-frame-hdr -z nocopyreloc %(wut_entry)