From 9ad15e8896557e9526a12e868801ed5e7d320298 Mon Sep 17 00:00:00 2001 From: Albert Ou Date: Wed, 7 Dec 2016 15:06:20 -0800 Subject: Place .init_array/.fini_array sections in flash instead of RAM This appears to resolve the issue of .sdata being assigned an incorrect LMA (ld warning "section `.sdata' can't be allocated in segment 1"). --- bsp/env/freedom-e300-hifive1/link.lds | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'bsp/env/freedom-e300-hifive1') diff --git a/bsp/env/freedom-e300-hifive1/link.lds b/bsp/env/freedom-e300-hifive1/link.lds index e25baf4..e224273 100644 --- a/bsp/env/freedom-e300-hifive1/link.lds +++ b/bsp/env/freedom-e300-hifive1/link.lds @@ -46,24 +46,14 @@ SECTIONS *(.gnu.linkonce.r.*) } >flash AT>flash :flash - .lalign : - { - . = ALIGN(4); - PROVIDE( _data_lma = . ); - } >flash AT>flash :flash - - .dalign : - { - . = ALIGN(4); - PROVIDE( _data = . ); - } >ram AT>flash :ram_init + . = ALIGN(4); .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >ram AT>flash :ram_init + } >flash AT>flash :flash .init_array : { @@ -71,7 +61,7 @@ SECTIONS 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 = .); - } >ram AT>flash :ram_init + } >flash AT>flash :flash .fini_array : { @@ -79,7 +69,7 @@ SECTIONS 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 = .); - } >ram AT>flash :ram_init + } >flash AT>flash :flash .ctors : { @@ -101,7 +91,7 @@ SECTIONS KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) - } >ram AT>flash :ram_init + } >flash AT>flash :flash .dtors : { @@ -110,6 +100,18 @@ SECTIONS KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) + } >flash AT>flash :flash + + .lalign : + { + . = ALIGN(4); + PROVIDE( _data_lma = . ); + } >flash AT>flash :flash + + .dalign : + { + . = ALIGN(4); + PROVIDE( _data = . ); } >ram AT>flash :ram_init .data : -- cgit v1.2.3