diff options
author | Alan Modra <amodra@gmail.com> | 2002-11-12 07:55:43 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-11-12 07:55:43 +0000 |
commit | d6fe2dc1025ff668354949649d24933115b1b570 (patch) | |
tree | 15bcc6c9977cd5e2e0caf0382c7230429dbe194e /bfd/elflink.h | |
parent | 126495ed15554a735f74a9414c2e417f9b2de4c2 (diff) | |
download | gdb-d6fe2dc1025ff668354949649d24933115b1b570.zip gdb-d6fe2dc1025ff668354949649d24933115b1b570.tar.gz gdb-d6fe2dc1025ff668354949649d24933115b1b570.tar.bz2 |
* elflink.h (elf_link_add_object_symbols): Optimize stabs for
relocatable link too.
(elf_link_input_bfd): When emitting relocs, adjust offsets for
eh_frame and stab sections. Zap deleted relocs.
(elf_reloc_symbol_deleted_p): Return true for zero r_symndx.
(elf_bfd_discard_info): Run for relocatable link too.
* elf64-ppc.c (ppc64_elf_edit_opd): Rename from edit_opd. Make global.
Handle ld -r case.
(ppc64_elf_size_dynamic_sections): Don't call edit_opd from here.
* elf64-ppc.h (ppc64_elf_edit_opd): Declare.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r-- | bfd/elflink.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h index 0f59fec..721b361 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -2208,10 +2208,9 @@ elf_link_add_object_symbols (abfd, info) } } - /* If this is a non-traditional, non-relocateable link, try to - optimize the handling of the .stab/.stabstr sections. */ + /* If this is a non-traditional link, try to optimize the handling + of the .stab/.stabstr sections. */ if (! dynamic - && ! info->relocateable && ! info->traditional_format && info->hash->creator->flavour == bfd_target_elf_flavour && is_elf_hash_table (info) @@ -6982,6 +6981,16 @@ elf_link_input_bfd (finfo, input_bfd) next_erel = 0; } + irela->r_offset = _bfd_elf_section_offset (output_bfd, + finfo->info, o, + irela->r_offset); + if (irela->r_offset >= (bfd_vma) -2) + { + /* This is a reloc for a deleted entry or somesuch. */ + memset (irela, 0, sizeof (*irela)); + continue; + } + irela->r_offset += o->output_offset; /* Relocs in an executable have to be virtual addresses. */ @@ -8334,7 +8343,7 @@ elf_reloc_symbol_deleted_p (offset, cookie) for (; rcookie->rel < rcookie->relend; rcookie->rel++) { - unsigned long r_symndx = ELF_R_SYM (rcookie->rel->r_info); + unsigned long r_symndx; if (! rcookie->bad_symtab) if (rcookie->rel->r_offset > offset) @@ -8342,6 +8351,10 @@ elf_reloc_symbol_deleted_p (offset, cookie) if (rcookie->rel->r_offset != offset) continue; + r_symndx = ELF_R_SYM (rcookie->rel->r_info); + if (r_symndx == SHN_UNDEF) + return true; + if (r_symndx >= rcookie->locsymcount || ELF_ST_BIND (rcookie->locsyms[r_symndx].st_info) != STB_LOCAL) { @@ -8400,8 +8413,7 @@ elf_bfd_discard_info (output_bfd, info) unsigned int count; boolean ret = false; - if (info->relocateable - || info->traditional_format + if (info->traditional_format || info->hash->creator->flavour != bfd_target_elf_flavour || ! is_elf_hash_table (info)) return false; |