From 71347f8f430e28b5e5ed565bc5c5f5142c2314e0 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Wed, 11 Apr 2012 16:56:20 -0400 Subject: Fix linking and C runtime initialization on F1. Reorder the .data and .rodata sections in common.inc. This seems necessary to get the linker to place the data ROM disk and the pointer to it in the right places. Switch from long long to int in start_c.c. I have no idea why this helps, but it does. F1 will crash if you don't do this. It will probably slow things down unnecessarily on F2, but I don't care. Signed-off-by: Marti Bolivar --- support/ld/common.inc | 53 ++++++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) (limited to 'support') diff --git a/support/ld/common.inc b/support/ld/common.inc index 926f9eb..f749b19 100644 --- a/support/ld/common.inc +++ b/support/ld/common.inc @@ -101,29 +101,6 @@ SECTIONS KEEP (*crtend.o(.dtors)) } > REGION_TEXT - /* - * Read-only data - */ - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) - - /* ROM image configuration; for C startup */ - . = ALIGN(4); - _lm_rom_img_cfgp = .; - LONG(LOADADDR(.data)); - } > REGION_RODATA - - /* - * .ARM.exidx exception unwinding; mandated by ARM's C++ ABI - */ - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > REGION_RODATA - __exidx_end = .; - /* * End of text */ @@ -134,12 +111,14 @@ SECTIONS } > REGION_TEXT /* - * .USER_FLASH: We allow users to allocate into Flash here + * .ARM.exidx exception unwinding; mandated by ARM's C++ ABI */ - .USER_FLASH : + __exidx_start = .; + .ARM.exidx : { - *(.USER_FLASH) + *(.ARM.exidx* .gnu.linkonce.armexidx.*) } > REGION_RODATA + __exidx_end = .; /* * .data @@ -152,6 +131,22 @@ SECTIONS *(.got.plt) *(.got) *(.data .data.* .gnu.linkonce.d.*) + . = ALIGN(8); + _edata = .; + } > REGION_DATA AT> REGION_RODATA + + /* + * Read-only data + */ + .rodata : + { + *(.rodata .rodata.* .gnu.linkonce.r.*) + /* .USER_FLASH: We allow users to allocate into Flash here */ + *(.USER_FLASH) + /* ROM image configuration; for C startup */ + . = ALIGN(4); + _lm_rom_img_cfgp = .; + LONG(LOADADDR(.data)); /* * Heap: Linker scripts may choose a custom heap by overriding * _lm_heap_start and _lm_heap_end. Otherwise, the heap is in @@ -163,9 +158,7 @@ SECTIONS */ _lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : _end; _lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init; - . = ALIGN (8); - _edata = .; - } > REGION_DATA AT> REGION_TEXT + } > REGION_RODATA /* * .bss @@ -179,7 +172,7 @@ SECTIONS . = ALIGN (8); _ebss = .; _end = _ebss; - } > REGION_BSS AT> REGION_TEXT + } > REGION_BSS /* * Debugging sections -- cgit v1.2.3