diff options
author | Alan Modra <amodra@gmail.com> | 2017-04-23 11:03:34 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-04-23 20:33:34 +0930 |
commit | bce964aa6c777d236fbd641f2bc7bb931cfe4bf3 (patch) | |
tree | 0766f8772604e3f7b4df1f2dffb9ee456b9fc6f9 /bfd/elf-bfd.h | |
parent | 97e83a100aa8250be783304bfe0429761c6e6b6b (diff) | |
download | gdb-bce964aa6c777d236fbd641f2bc7bb931cfe4bf3.zip gdb-bce964aa6c777d236fbd641f2bc7bb931cfe4bf3.tar.gz gdb-bce964aa6c777d236fbd641f2bc7bb931cfe4bf3.tar.bz2 |
PR 21412, get_reloc_section assumes .rel/.rela name for SHT_REL/RELA.
This patch fixes an assumption made by code that runs for objcopy and
strip, that SHT_REL/SHR_RELA sections are always named starting with a
.rel/.rela prefix. I'm also modifying the interface for
elf_backend_get_reloc_section, so any backend function just needs to
handle name mapping.
PR 21412
* elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
parameters and comment.
(_bfd_elf_get_reloc_section): Delete.
(_bfd_elf_plt_get_reloc_section): Declare.
* elf.c (_bfd_elf_plt_get_reloc_section, elf_get_reloc_section):
New functions. Don't blindly skip over assumed .rel/.rela prefix.
Extracted from..
(_bfd_elf_get_reloc_section): ..here. Delete.
(assign_section_numbers): Call elf_get_reloc_section.
* elf64-ppc.c (elf_backend_get_reloc_section): Define.
* elfxx-target.h (elf_backend_get_reloc_section): Update.
Diffstat (limited to 'bfd/elf-bfd.h')
-rw-r--r-- | bfd/elf-bfd.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index af377ee..4c0c9e8 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1360,8 +1360,10 @@ struct elf_backend_data bfd_size_type (*maybe_function_sym) (const asymbol *sym, asection *sec, bfd_vma *code_off); - /* Return the section which RELOC_SEC applies to. */ - asection *(*get_reloc_section) (asection *reloc_sec); + /* Given NAME, the name of a relocation section stripped of its + .rel/.rela prefix, return the section in ABFD to which the + relocations apply. */ + asection *(*get_reloc_section) (bfd *abfd, const char *name); /* Called to set the sh_flags, sh_link and sh_info fields of OSECTION which has a type >= SHT_LOOS. Returns TRUE if the fields were initialised, @@ -2448,7 +2450,7 @@ extern bfd_boolean _bfd_elf_is_function_type (unsigned int); extern bfd_size_type _bfd_elf_maybe_function_sym (const asymbol *, asection *, bfd_vma *); -extern asection *_bfd_elf_get_reloc_section (asection *); +extern asection *_bfd_elf_plt_get_reloc_section (bfd *, const char *); extern int bfd_elf_get_default_section_type (flagword); |