STR9 ld-file anomalies

OP #1173907
Rate this post
• ▲ useful
▼ not useful
Okay, I've gone back to building with gcc calling ld, vs calling ld
directly.
I'm using Yagarto 20080408.

If I have this in SECTIONS:
/**********************************************/
    /* the program code is stored in the .text section, which goes to
Flash */
    .text :
    {
       . = ALIGN(4);

        *(.text)                   /* remaining code */
        *(.text.*)                 /* remaining code */
        *(.rodata)                 /* read-only data (constants) */
        *(.rodata*)
        *(.glue_7)
        *(.glue_7t)

       . = ALIGN(4);
       _etext = .;
       /* This is used by the startup in order to initialize the .data
secion */
    } >FLASH

    /* .data section which is used for initialized data */
    /* This is used by the startup in order to initialize the .data
secion */
    _sidata = .;
    .data : AT (_sidata)
    {
       . = ALIGN(4);
        /* This is used by the startup in order to initialize the .data
secion */
        _sdata = . ;

        *(.data)
        *(.data.*)

       . = ALIGN(4);
       /* This is used by the startup in order to initialize the .data
secion */
       _edata = . ;
    } >DATA
/**********************************************/
My build fails:
c:/yagarto/bin/arm-elf-gcc -Todu-gnuarm.ld -Wall -I. -Iinclude
-gdwarf-2 -MD -DGNUARM -mcpu=arm9e -std=c99 -mlittle-endian -Os -g
-Wl,-Map=odu.map,--cref,--no-warn-mismatch,-static startup/91x_initga.o
main.o 91x_it.o feprom.o atmel_flash_memory.o Internal_flash_memory.o
source/91x_adc.o source/91x_caps.o source/91x_gpio.o source/91x_lib.o
source/91x_rtc.o source/91x_uart.o source/91x_vic.o source/91x_wdg.o
source/91x_fmi.o source/91x_scu.o source/91x_emi.o source/91x_dma.o  -o
odu.elf
c:/yagarto/bin/../lib/gcc/arm-elf/4.2.2/../../../../arm-elf/bin/ld.exe:
section .data [0002cf48 -> 0002db77] overlaps section .init [0002cf48 ->
0002cf67]
c:/yagarto/bin/../lib/gcc/arm-elf/4.2.2/../../../../arm-elf/bin/ld.exe:
section .fini [0002cf68 -> 0002cf83] overlaps section .data [0002cf48 ->
0002db77]
collect2: ld returned 1 exit status
make: *** [odu.elf] Error 1

/**********************************************/
However, if I change it to
   .data : /* collect all initialized .data sections that go into RAM
*/
It builds successfully!!
So what's the difference??  Does omitting the "AT (location)" statement
actually put the data somewhere else??  I don't understand why that
would be the case.  What is actually being done with the data in each
case, and how do the two statements differ??

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.