X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felf32-i386.c;h=90efba8dc9bc824f2e0397f6eb3bb4fedf225d12;hb=fc633e5b9780011f74f2c23837968e43e262a239;hp=0790af5eb0b15bf725f499453ac24eb0ec1779c1;hpb=5f771d47c711c5292df87c35ac726c0ac18a3820;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 0790af5eb0..90efba8dc9 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -231,11 +231,14 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst) cache_ptr->howto = &elf32_i386_vtinherit_howto; else if (type == R_386_GNU_VTENTRY) cache_ptr->howto = &elf32_i386_vtentry_howto; + else if (type < R_386_max + && (type < FIRST_INVALID_RELOC || type > LAST_INVALID_RELOC)) + cache_ptr->howto = &elf_howto_table[(int) type]; else { - BFD_ASSERT (type < R_386_max); - BFD_ASSERT (type < FIRST_INVALID_RELOC || type > LAST_INVALID_RELOC); - cache_ptr->howto = &elf_howto_table[(int) type]; + (*_bfd_error_handler) (_("%s: invalid relocation type %d"), + bfd_get_filename (abfd), (int) type); + cache_ptr->howto = &elf_howto_table[(int) R_386_NONE]; } } @@ -591,6 +594,9 @@ elf_i386_check_relocs (abfd, info, sec, relocs) case R_386_32: case R_386_PC32: + if (h != NULL) + h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + /* If we are creating a shared library, and this is a reloc against a global symbol, or a non PC relative reloc against a local symbol, then we need to copy the reloc @@ -889,6 +895,11 @@ elf_i386_adjust_dynamic_symbol (info, h) if (info->shared) return true; + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + return true; + /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1077,7 +1088,7 @@ elf_i386_size_dynamic_sections (output_bfd, info) if (strip) { - _bfd_strip_section_from_output (s); + _bfd_strip_section_from_output (info, s); continue; } @@ -1308,7 +1319,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, + (!info->shared || info->no_undefined)))) return false; relocation = 0; }