This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bfd warning patrol


On Fri, Oct 11, 2002 at 05:59:17PM +0930, Alan Modra wrote:
> Fixes numerous occurrences of
> warning: dereferencing type-punned pointer will break strict-aliasing rules

And one in ld/.

	* pe-dll.c (make_import_fixup_mark): Avoid type-punned pointer.

Index: ld/pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.42
diff -u -p -r1.42 pe-dll.c
--- ld/pe-dll.c	7 Oct 2002 16:36:11 -0000	1.42
+++ ld/pe-dll.c	11 Oct 2002 07:24:21 -0000
@@ -1978,7 +1978,7 @@ make_import_fixup_mark (rel)
   struct symbol_cache_entry *sym = *rel->sym_ptr_ptr;
 
   bfd *abfd = bfd_asymbol_bfd (sym);
-  struct coff_link_hash_entry *myh = NULL;
+  struct bfd_link_hash_entry *bh;
 
   if (!fixup_name)
     {
@@ -2000,15 +2000,20 @@ make_import_fixup_mark (rel)
 
   sprintf (fixup_name, "__fu%d_%s", counter++, sym->name);
 
+  bh = NULL;
   bfd_coff_link_add_one_symbol (&link_info, abfd, fixup_name, BSF_GLOBAL,
 				current_sec, /* sym->section, */
-				rel->address, NULL, true, false,
-				(struct bfd_link_hash_entry **) &myh);
+				rel->address, NULL, true, false, &bh);
+
+  if (0)
+    {
+      struct coff_link_hash_entry *myh;
+
+      myh = (struct coff_link_hash_entry *) bh;
+      printf ("type:%d\n", myh->type);
+      printf ("%s\n", myh->root.u.def.section->name);
+    }
 
-#if 0
-  printf ("type:%d\n", myh->type);
-  printf ("%s\n", myh->root.u.def.section->name);
-#endif
   return fixup_name;
 }
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]