Set proper union selector tag
authorAlan Modra <amodra@gmail.com>
Mon, 27 Mar 2023 05:51:05 +0000 (16:21 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 27 Mar 2023 11:28:46 +0000 (21:58 +1030)
* coff-bfd.c (bfd_coff_get_auxent): After converting sym pointer
to an index, reset the union tag.

bfd/coff-bfd.c

index 068ecebc8df77dbfa4f693ac07d9b7ce4e6393f4..9660b6b14e52aea6ac1fe9083e4f61c0389a518b 100644 (file)
@@ -82,19 +82,28 @@ bfd_coff_get_auxent (bfd *abfd,
   *pauxent = ent->u.auxent;
 
   if (ent->fix_tag)
-    pauxent->x_sym.x_tagndx.l =
-      ((combined_entry_type *) pauxent->x_sym.x_tagndx.p
-       - obj_raw_syments (abfd));
+    {
+      pauxent->x_sym.x_tagndx.l =
+       ((combined_entry_type *) pauxent->x_sym.x_tagndx.p
+        - obj_raw_syments (abfd));
+      ent->fix_tag = 0;
+    }
 
   if (ent->fix_end)
-    pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l =
-      ((combined_entry_type *) pauxent->x_sym.x_fcnary.x_fcn.x_endndx.p
-       - obj_raw_syments (abfd));
+    {
+      pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l =
+       ((combined_entry_type *) pauxent->x_sym.x_fcnary.x_fcn.x_endndx.p
+        - obj_raw_syments (abfd));
+      ent->fix_end = 0;
+    }
 
   if (ent->fix_scnlen)
-    pauxent->x_csect.x_scnlen.l =
-      ((combined_entry_type *) pauxent->x_csect.x_scnlen.p
-       - obj_raw_syments (abfd));
+    {
+      pauxent->x_csect.x_scnlen.l =
+       ((combined_entry_type *) pauxent->x_csect.x_scnlen.p
+        - obj_raw_syments (abfd));
+      ent->fix_scnlen = 0;
+    }
 
   return true;
 }