Stop the BFD library from automatically converting OS and PROC specific symbol section indicies to SHN_ABS, and provide a hook for backends to decide how such indicies should be processed.

* elf-bfd.h (struct elf_backend_data): Add symbol_section_index
	callback.
	* elfxx-target.h (elf_backend_symbol_section_index): Provide
	default definition.
	(elfNN_bed): Initialise the symbol_section_index field.
	* elf.c (swap_out_syms): Call symbol_section_index, if defined, on
	OS and PROC specific section indicies.  Warn if converting other
	reserved incidies to SHN_ABS.
This commit is contained in:
Nick Clifton
2020-02-20 13:08:29 +00:00
parent d13c7322fe
commit 00e49dff20
4 changed files with 40 additions and 1 deletions

View File

@ -1503,6 +1503,12 @@ struct elf_backend_data
/* Opcode representing no unwind. */
int (*cant_unwind_opcode) (struct bfd_link_info *);
/* Called when emitting an ELF symbol whoes input version had an
ST_SHNDX field set to a value in the range SHN_LOPROC..SHN_HIOS.
Returns the value to be installed in the ST_SHNDX field of the
emitted symbol. If not defined, the value is left unchanged. */
unsigned int (*symbol_section_index) (bfd *, elf_symbol_type *);
/* This is non-zero if static TLS segments require a special alignment. */
unsigned static_tls_alignment;