From: Jean Marie Diaz Date: Mon, 1 Aug 1994 23:11:18 +0000 (+0000) Subject: ELF linker patches from Eric Youngdale . X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=99dd775492859223d3d1981684d9b81646a8440f;p=binutils-gdb.git ELF linker patches from Eric Youngdale . * elfcode.h (elf_link_create_dynamic_sections): Set type of _DYNAMIC to STT_OBJECT. (NAME(bfd_elf,record_link_assignment)): Always create hash table entry. Set type to STT_OBJECT. (elf_link_output_extsym): Don't set type of weak defined symbol to STB_WEAK if symbol was referenced. * elf32-i386.c (elf_i386_create_dynamic_sections): Set type of _GLOBAL_OFFSET_TABLE to STT_OBJECT. (elf_i386_check_relocs): Ignore local PLT32 relocs. (elf_i386_relocate_section): Treat local PLT32 relocs as PC32. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f65ec481df6..139a5d3319f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -5,6 +5,18 @@ Mon Aug 1 17:55:53 1994 Fred Fish (fnf@cygnus.com) Mon Aug 1 12:04:40 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) + ELF linker patches from Eric Youngdale . + * elfcode.h (elf_link_create_dynamic_sections): Set type of + _DYNAMIC to STT_OBJECT. + (NAME(bfd_elf,record_link_assignment)): Always create hash table + entry. Set type to STT_OBJECT. + (elf_link_output_extsym): Don't set type of weak defined symbol to + STB_WEAK if symbol was referenced. + * elf32-i386.c (elf_i386_create_dynamic_sections): Set type of + _GLOBAL_OFFSET_TABLE to STT_OBJECT. + (elf_i386_check_relocs): Ignore local PLT32 relocs. + (elf_i386_relocate_section): Treat local PLT32 relocs as PC32. + * elfcode.h (elf_adjust_dynamic_symbol): Correct weak symbol handling again. diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 980e11c28c3..d05af807cac 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -4600,7 +4600,8 @@ elf_link_create_dynamic_sections (abfd, info) (struct bfd_link_hash_entry **) &h))) return false; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - + h->type = STT_OBJECT; + if (info->shared && ! elf_link_record_dynamic_symbol (info, h)) return false; @@ -4787,17 +4788,12 @@ NAME(bfd_elf,record_link_assignment) (output_bfd, info, name) { struct elf_link_hash_entry *h; - /* This is called after we have examined all the input objects. If - we are generating a shared library, we always output these - symbols. Otherwise, if the symbol does not exist, it merely - means that no object refers to it, and we can just ignore it at - this point. */ - h = elf_link_hash_lookup (elf_hash_table (info), name, - info->shared, info->shared, false); + h = elf_link_hash_lookup (elf_hash_table (info), name, true, true, false); if (h == NULL) - return ! info->shared; + return false; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->type = STT_OBJECT; if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_DYNAMIC)) != 0 @@ -5813,7 +5809,10 @@ elf_link_output_extsym (h, data) sym.st_size = h->size; sym.st_other = 0; if (h->root.type == bfd_link_hash_weak - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEFINED_WEAK) != 0) + || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEFINED_WEAK) != 0 + && ((h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_DYNAMIC)) + == 0))) sym.st_info = ELF_ST_INFO (STB_WEAK, h->type); else sym.st_info = ELF_ST_INFO (STB_GLOBAL, h->type);