This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
type pun warning fix
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Tue, 4 Nov 2003 21:16:13 +1030
- Subject: type pun warning fix
* elf-m10300.c (_bfd_mn10300_elf_create_got_section): Fix
"dereferencing type-punned pointer" warnings.
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.41
diff -u -p -r1.41 elf-m10300.c
--- bfd/elf-m10300.c 3 Nov 2003 15:17:38 -0000 1.41
+++ bfd/elf-m10300.c 4 Nov 2003 10:02:39 -0000
@@ -561,6 +561,7 @@ _bfd_mn10300_elf_create_got_section (abf
flagword flags;
flagword pltflags;
asection * s;
+ struct bfd_link_hash_entry * bh;
struct elf_link_hash_entry * h;
const struct elf_backend_data * bed = get_elf_backend_data (abfd);
int ptralign;
@@ -604,13 +605,13 @@ _bfd_mn10300_elf_create_got_section (abf
{
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
.plt section. */
- struct elf_link_hash_entry *h = NULL;
+ bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, "_PROCEDURE_LINKAGE_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_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
@@ -638,12 +639,13 @@ _bfd_mn10300_elf_create_got_section (abf
(or .got.plt) section. 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,
bed->got_symbol_offset, (const char *) NULL, FALSE,
- bed->collect, (struct bfd_link_hash_entry **) &h)))
+ bed->collect, &bh)))
return FALSE;
+ h = (struct elf_link_hash_entry *) bh;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
--
Alan Modra
IBM OzLabs - Linux Technology Centre