-gc-sections and ARM unwinding tables

Paul Brook paul@codesourcery.com
Thu Feb 15 22:00:00 GMT 2007


The ARM EABI includes its own unwinding table format, including a special 
section type (SHT_ARM_EXIDX) to contain these tables. These sections are not 
referenced directly, so -gc-sections thinks they are unused and incorrectly 
removes them. BFD already contains code to avoid discarding GNU .eh_frame 
sections when the corresponding code section is required.

The attached patch adds an ELF linker backend hook and uses it to implement 
something similar for ARM unwinding tables.

Tested on arm-linux-gnueabi.
Ok?

Paul

2007-02-15  Paul Brook  <paul@codesourcery.com>

	bfd/
	* elflink.c (gc_mark_hook_fn): Remove.
	(_bfd_elf_gc_mark): Rename gc_mark_hook_fn to elf_gc_mark_hook_fn.
	(bfd_elf_gc_sections): Ditto.  Call gc_mark_extra_sections.
	* elf-bfd.h (elf_gc_mark_hook_fn): Define.
	(elf_backend_data): Add gc_mark_extra_sections.
	* elfxx-target.h (elf_backend_gc_mark_extra_sections): Provide default
	definition.
	(elfNN_bed): Add elf_backend_gc_mark_extra_sections.
	* elf32-arm.c (elf32_arm_gc_mark_extra_sections): New function.
	(elf_backend_gc_mark_extra_sections): Define.

	ld/testsuite/
	* ld-arm/arm-elf.exp (armelftests): Add gc-unwind.h.
	* ld-arm/gc-unwind.s: New file.
	* ld-arm/gc-unwind.d: New file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.gc_sections_head
Type: text/x-diff
Size: 7901 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20070215/2d8337aa/attachment.bin>


More information about the Binutils mailing list