arm-none-eabi-ld: section .ARM.exidx overlaps section .data

9k views Asked by At

I'm developing a project using a TI Tiva Microcontroller (TM4C123GH6PM), TivaWare (was StellarisWare) and GCC 4.8.2 (-14ubuntu1+6) on Linux.

While linking I started to get these error message:

arm-none-eabi-ld: section .ARM.exidx loaded at [00000000000027d8,00000000000027df] overlaps section .data loaded at [00000000000027d7,00000000000027d8]

I've done quite some googling but nothing I found seems to help.

  1. I found this question which is on the same topic but I don't do any stacktracing: When is .ARM.exidx is used

  2. It seems this section is mainly used in debugging C++ code. But I'm not using C++ ...

  3. I've tried to dump all my object files with -h to show the sections included. The only file containing ARM.exidx is libgcc.a.

  4. The error appears with no apparent patten (at least that I could find).

For example in main.c:

while( 1 ){
    debug_getc()
    uartA_getc()
}

produces that error. while

while( 1 ){
    debug_getc();
    //uartA_getc();
}

while( 1 ){
    debug_getc();
    //uartA_getc();
}

does not. (Both functions are in their own object file but do similiar things. This error is not restricted to these two. I'v encountered It on some other places,too.)

I've tried to add

.ARM.exidx :                     
{                                
    *(.ARM.exidx*)
    *(.gnu.linkonce.armexidx.*)  
} > SRAM                         

to my linker script. Now the error message is gone but I get strange crashes.

So can someone tell me what is going on? I have the feeling that there is something fundamentally wrong but I can't figure out what it is.

** ======= REFERENCE =============== **:

linkerscript.ld:

MEMORY
{
    FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00100000
    SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000
}

SECTIONS
{
    .text :
    {
        _text = .;
        KEEP(*(.isr_vector))
        *(.text*)
        *(.rodata*)
        _etext = .;
    } > FLASH

    .data : AT(ADDR(.text) + SIZEOF(.text))
    {
        _data = .;
        *(vtable)
        *(.data*)
        _edata = .;
    } > SRAM

    .bss :
    {
        _bss = .;
        *(.bss*)
        *(COMMON)
        _ebss = .;
    } > SRAM

/*
    .ARM.exidx :
    {
        *(.ARM.exidx*)
        *(.gnu.linkonce.armexidx.*)
    } > SRAM
*/
}

Commands used for building: (excerpt)

arm-none-eabi-gcc -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -std=gnu99 -Wall -pedantic -DPART_TM4C123GH6PM -c -Os -DTARGET_IS_TM4C129_RA1 -I. -I../tivalib -I../TivaWare -Dgcc -o../tivalib/weather/wind.o ../tivalib/weather/wind.c

arm-none-eabi-ld -T weatherlight.ld \
            --entry ResetISR \
            --gc-sections \
            -o weatherlight.axf weatherlight.o startup_gcc.o pwmA.o pwmB.o ../tivalib/board.o ../tivalib/debug.o ../tivalib/uartA.o ../tivalib/calc.o ../tivalib/rgb.o ../tivalib/color.o ../tivalib/data/data_sin.o ../tivalib/data/data_gamma.o ../tivalib/net/rgb/gen/solid.o ../tivalib/net/rgb/filter/filter_scale_gamma.o ../tivalib/net/rgb/filter/filter_white_balance.o ../tivalib/net/rgb/filter/filter_darken.o ../tivalib/net/rgb/filter/filter_lighten.o ../tivalib/net/val/gen/slider.o ../tivalib/net/val/gen/value_sin.o ../tivalib/net/val/gen/value_noise.o ../tivalib/net/val/gen/value_weightedsin.o ../tivalib/net/val/filter/value_filter_delay.o ../tivalib/net/val/filter/value_filter_scale_down.o ../tivalib/net/val/mixer/value_mixer.o ../tivalib/net/rgb/mixer/mixer.o ../tivalib/weather/sunny.o ../tivalib/weather/rainy.o ../tivalib/weather/cloudy.o ../tivalib/weather/wind.o ../TivaWare/utils/ustdlib.o \
            ../TivaWare/driverlib/gcc/libdriver.a \
            /usr/lib/gcc/arm-none-eabi/4.8.2/../../../arm-none-eabi/lib/armv7e-m/softfp/libm.a \
            /usr/lib/gcc/arm-none-eabi/4.8.2/../../../arm-none-eabi/lib/armv7e-m/softfp/libc.a \
            /usr/lib/gcc/arm-none-eabi/4.8.2/armv7e-m/softfp/libgcc.a
2

There are 2 answers

4
lkamp On

Have you tried to just discard the relevant output section?

/DISCARD/ :
{
    *(.ARM.exidx*)
    *(.gnu.linkonce.armexidx.*)
}

Edit:

I've looked at one of my ARM projects and I've put the sections into flash.

Try this:

.ARM.exidx :
{
    *(.ARM.exidx*)
    *(.gnu.linkonce.armexidx.*)
} >FLASH

Edit2:

Try to put a label after all sections that go into flash and put your .data section there:

SECTIONS
{
.text :
{
    _text = .;
    KEEP(*(.isr_vector))
    *(.text*)
    *(.rodata*)
    _etext = .;
} > FLASH

.ARM.exidx :
{
    *(.ARM.exidx*)
    *(.gnu.linkonce.armexidx.*)
} > FLASH

_begin_data = .;

.data : AT ( _begin_data )
{
    _data = .;
    *(vtable)
    *(.data*)
    _edata = .;
} > SRAM

.bss :
{
    _bss = .;
    *(.bss*)
    *(COMMON)
    _ebss = .;
} > SRAM

}
1
Ning Lian On

I added the -funwind-tables option at the COMPILE_OPTS in Makefile and now there is no error when compiled.