diff options
author | Alan Modra <amodra@gmail.com> | 2002-10-11 08:33:11 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-10-11 08:33:11 +0000 |
commit | 14a793b2f2d16ac51e6ac53e817a60a520a83200 (patch) | |
tree | f61585eba76e731da279ee2a157c23c0496c0354 /bfd/elfxx-mips.c | |
parent | 2d801b0fa01bf6af6d34f000ab55096ff1064acc (diff) | |
download | gdb-14a793b2f2d16ac51e6ac53e817a60a520a83200.zip gdb-14a793b2f2d16ac51e6ac53e817a60a520a83200.tar.gz gdb-14a793b2f2d16ac51e6ac53e817a60a520a83200.tar.bz2 |
Fix numerous occurrences of
warning: dereferencing type-punned pointer will break strict-aliasing rules
Diffstat (limited to 'bfd/elfxx-mips.c')
-rw-r--r-- | bfd/elfxx-mips.c | 84 |
1 files changed, 35 insertions, 49 deletions
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 359587d..9584bde 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -1901,6 +1901,7 @@ mips_elf_create_got_section (abfd, info) flagword flags; register asection *s; struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh; struct mips_got_info *g; bfd_size_type amt; @@ -1920,13 +1921,14 @@ mips_elf_create_got_section (abfd, info) /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the linker script because we don't want to define the symbol if we are not creating a global offset table. */ - h = NULL; + bh = NULL; if (! (_bfd_generic_link_add_one_symbol (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) + get_elf_backend_data (abfd)->collect, &bh))) return false; + + h = (struct elf_link_hash_entry *) bh; h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_OBJECT; @@ -3829,15 +3831,17 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) && strcmp (*namep, "__rld_obj_head") == 0) { struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh; /* Mark __rld_obj_head as dynamic. */ - h = NULL; + bh = NULL; if (! (_bfd_generic_link_add_one_symbol (info, abfd, *namep, BSF_GLOBAL, *secp, (bfd_vma) *valp, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) + get_elf_backend_data (abfd)->collect, &bh))) return false; + + h = (struct elf_link_hash_entry *) bh; h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_OBJECT; @@ -3893,6 +3897,7 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) struct bfd_link_info *info; { struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh; flagword flags; register asection *s; const char * const *namep; @@ -3951,13 +3956,14 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) { for (namep = mips_elf_dynsym_rtproc_names; *namep != NULL; namep++) { - h = NULL; + bh = NULL; if (! (_bfd_generic_link_add_one_symbol (info, abfd, *namep, BSF_GLOBAL, bfd_und_section_ptr, (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) + get_elf_backend_data (abfd)->collect, &bh))) return false; + + h = (struct elf_link_hash_entry *) bh; h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_SECTION; @@ -3993,26 +3999,17 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) if (!info->shared) { - h = NULL; - if (SGI_COMPAT (abfd)) - { - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "_DYNAMIC_LINK", BSF_GLOBAL, bfd_abs_section_ptr, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - } - else - { - /* For normal mips it is _DYNAMIC_LINKING. */ - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "_DYNAMIC_LINKING", BSF_GLOBAL, - bfd_abs_section_ptr, (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - } + const char *name; + + name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; + bh = NULL; + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, + (bfd_vma) 0, (const char *) NULL, false, + get_elf_backend_data (abfd)->collect, &bh))) + return false; + + h = (struct elf_link_hash_entry *) bh; h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_SECTION; @@ -4029,26 +4026,15 @@ _bfd_mips_elf_create_dynamic_sections (abfd, info) s = bfd_get_section_by_name (abfd, ".rld_map"); BFD_ASSERT (s != NULL); - h = NULL; - if (SGI_COMPAT (abfd)) - { - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "__rld_map", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - } - else - { - /* For normal mips the symbol is __RLD_MAP. */ - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "__RLD_MAP", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, false, - get_elf_backend_data (abfd)->collect, - (struct bfd_link_hash_entry **) &h))) - return false; - } + name = SGI_COMPAT (abfd) ? "__rld_map" : "__RLD_MAP"; + bh = NULL; + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, name, BSF_GLOBAL, s, + (bfd_vma) 0, (const char *) NULL, false, + get_elf_backend_data (abfd)->collect, &bh))) + return false; + + h = (struct elf_link_hash_entry *) bh; h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; h->type = STT_OBJECT; |