m68k/uC5282: linkcmds KEEP and SORT sections

Fixes a problem with bad epilog code in _fini and to keep sections
necessary with the -ffunction/data-sections.
This commit is contained in:
Gedare Bloom
2021-07-01 12:32:57 -06:00
parent 97d5fd9553
commit 24e8ddca5c

View File

@@ -91,13 +91,13 @@ SECTIONS
* crtn.o are in. * crtn.o are in.
*/ */
PROVIDE (_init = .); PROVIDE (_init = .);
*crti.o(.init) KEEP (*crti.o(.init))
*(.init) KEEP (*(.init))
*crtn.o(.init) KEEP (*crtn.o(.init))
PROVIDE (_fini = .); PROVIDE (_fini = .);
*crti.o(.fini) KEEP (*crti.o(.fini))
*(.fini) KEEP (*(.fini))
*crtn.o(.fini) KEEP (*crtn.o(.fini))
/* /*
* Special FreeBSD sysctl sections. * Special FreeBSD sysctl sections.
@@ -122,18 +122,22 @@ SECTIONS
* crtend.o. The same comments apply to it. * crtend.o. The same comments apply to it.
*/ */
. = ALIGN (16); . = ALIGN (16);
*crtbegin.o(.ctors) KEEP (*crtbegin.o(.ctors))
*(.ctors) KEEP (*crtbegin?.o(.ctors))
*crtend.o(.ctors) KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
*crtbegin.o(.dtors) KEEP (*(SORT(.ctors.*)))
*(.dtors) KEEP (*(.ctors))
*crtend.o(.dtors) KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
/* /*
* Exception frame info * Exception frame info
*/ */
. = ALIGN (16); . = ALIGN (16);
*(.eh_frame) KEEP (*(.eh_frame))
/* /*
* Read-only data * Read-only data
@@ -179,7 +183,7 @@ SECTIONS
KEEP (*(SORT(.rtemsrwset.*))) KEEP (*(SORT(.rtemsrwset.*)))
*(.gnu.linkonce.d*) *(.gnu.linkonce.d*)
*(.gcc_except_table*) *(.gcc_except_table*)
*(.jcr) KEEP (*(.jcr))
. = ALIGN (16); . = ALIGN (16);
PROVIDE (_edata = .); PROVIDE (_edata = .);
PROVIDE (_copy_end = .); PROVIDE (_copy_end = .);