This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

GCC: BFD warning on ".ARM.exidx" section when using LD script from nRF51 SDK v8.1.0 or higher

Hi guys,

Has anyone encountered following warning message when using nRF51 SDK v8.1.0 or 9.0.0 and compiling project by GCC arm-none-eabi (I'm on V4.9 2015q2 which is the latest stable I suppose)?

...
BFD: _build/ble-example.elf: warning: sh_link not set for section `.ARM.exidx'
...

It's just warning but when I was looking for some help I just see that "exidx" section is used only during debugging and in most of the binaries is empty (which is the case for Nordic nRF5x binaries as well) and that this error was encountered on other projects but no resolution found (usually ignored as unimportant or fixed by changing loader script). When I play with "components\toolchain\gcc\gcc_nrf51_common.ld" file it looks like excluding . = ALIGN(4);line from section

__exidx_start = .;
.ARM.exidx :
{
	*(.ARM.exidx* .gnu.linkonce.armexidx.*)
	. = ALIGN(4);
} > FLASH
__exidx_end = .;

fixes the problem (no warning). This line was actually included in SDK v8.1.0 so I'm wondering if:

  • This is problem of BFD component in GCC and I should wait for fix there (which can take years).
  • This is problem of LD script and I could get fix with next SDK release by Nordic.

Any idea or feedback are welcome. Cheers Jan

  • Did you get anywhere with this? Getting the same error using the latest nRF52 linker

  • Interesting. Could you elaborate more? Because I've found that this occurs only when I'm using using my custom startup file instead of ASM file (.s) provided in Nordic nRF5x SDK. It looks like stupid bug in the GCC BFD because once the .ARM.exidx section is non-empty (you get 4 or 8 bytes with standard Nordic SDK sources) then ALIGN works and no warning is produced. When my simplified startup code generates empty section (0 bytes) it suddenly pops up the warning. Unfortunately I cannot get any further answer from Nordic (logically bug shouldn't be reproducible with stock SDK projects) and also no change from GCC (latest stable release 4.9 2015q3 still outputs BFD warning).

    If you could reproduce this with stock SDK projects and GCC tool chain then we can raise new ticket in Support zone and Nordic team should be able to help.

    Thanks Jan

  • I've been trying to use Eclipse to generate the makefile and build my project. If the error was occurring when a custom ASM was used I think Eclipse may be ignoring the Nordic startup I've included and using a default one with an empty .ARM.exidx causing the warning. I'll have a play around and see how I solve it - it does sound like it's a problem with the GCC BFD though

  • I bet it is in fact bug in GCC BFD ("if there is nothing to align it throws warning") but let's see. If you have your MAP/LSS/DMP outputs from GCC compilation there should be clear hints on:

    • What "startup" file is compiled (if you use one of ASM files provided in SDK then you should find something like "gcc_startup_nrf52.o").
    • What is the content of .ARM.exidx section before linking.
  • For example in standard MAP file compiled with "gcc_startup_nrf52.s" and nRF5 SDK V11.0.0-2.alpha you will typically see this:

    .ARM.exidx      0x0002a44c        0x8
     *(.ARM.exidx* .gnu.linkonce.armexidx.*)
     .ARM.exidx     0x0002a44c        0x8 c:/gnuarm/4-9_2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/fpu/crt0.o
     .ARM.exidx     0x0002a454        0x0 _build/gcc_startup_nrf52.o
                                      0x8 (size before relaxing)
                    0x0002a454                . = ALIGN (0x4)
                    0x0002a454                __exidx_end = .
                    0x0002a454                __etext = .
    
Related