Re: How to properly avoid warning about sh_link not set for section “.ARM.exidx”?

Nick Clifton nickc@redhat.com
Thu Aug 31 13:26:00 GMT 2017
Hi Freddie,

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

> I get following warning when building the project:

> output/./application.elf: warning: sh_link not set for section
> `.ARM.exidx'

> So I move the symbols "out" of the section:

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

> The warning is gone... What's the difference?

For most ELF sections the sh_link field points to the symbol table to 
be used by entries in that section.  (Sometimes it points to a string
table instead, but ignore that for now).  Thus if you have symbols that
are specific to that section then you would expect the sh_link field to 
point to a symbol table section.  If the section does have any symbols 
associated with it, then there is no need to have an initialised sh_link
field.

I find it strange however that the linker is not able to handle this case
as the default ARM linker script also includes a description of the .ARM.exidx
section with symbols inside it.  I would suggest that you file a binutils
bug report here:

  https://sourceware.org/bugzilla

Including a test case will be really helpful.

Cheers
  Nick




More information about the Binutils mailing list