Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / elfxx-x86.c
index 40aac664f4a060125ecb6b4f540cf64d00ae3cbc..584a75f996054f30a93b0c3f5449ae39f36bbfdf 100644 (file)
@@ -1,5 +1,5 @@
 /* x86 specific support for ELF
-   Copyright (C) 2017-2018 Free Software Foundation, Inc.
+   Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -2422,9 +2422,14 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info,
              aprop->pr_kind = property_remove;
              updated = TRUE;
            }
-         return updated;
        }
-      goto or_property;
+      else
+       {
+         number = aprop->u.number;
+         aprop->u.number = number | bprop->u.number;
+         updated = number != (unsigned int) aprop->u.number;
+       }
+      return updated;
     }
   else if (pr_type == GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED
           || (pr_type >= GNU_PROPERTY_X86_UINT32_OR_LO
@@ -2432,7 +2437,6 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info,
     {
       if (aprop != NULL && bprop != NULL)
        {
-or_property:
          number = aprop->u.number;
          aprop->u.number = number | bprop->u.number;
          /* Remove the property if all bits are empty.  */
@@ -2492,6 +2496,9 @@ or_property:
        }
       else
        {
+         /* There should be no AND properties since some input doesn't
+            have them.  Set IBT and SHSTK properties for -z ibt and -z
+            shstk if needed.  */
          features = 0;
          if (info->ibt)
            features = GNU_PROPERTY_X86_FEATURE_1_IBT;
@@ -2499,18 +2506,15 @@ or_property:
            features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
          if (features)
            {
-             /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
-                GNU_PROPERTY_X86_FEATURE_1_SHSTK.  */
              if (aprop != NULL)
                {
-                 number = aprop->u.number;
-                 aprop->u.number = number | features;
-                 updated = number != (unsigned int) aprop->u.number;
+                 updated = features != (unsigned int) aprop->u.number;
+                 aprop->u.number = features;
                }
              else
                {
-                 bprop->u.number |= features;
                  updated = TRUE;
+                 bprop->u.number = features;
                }
            }
          else if (aprop != NULL)
@@ -2940,8 +2944,9 @@ error_alignment:
 /* Fix up x86 GNU properties.  */
 
 void
-_bfd_x86_elf_link_fixup_gnu_properties (struct bfd_link_info *info,
-                                       elf_property_list **listp)
+_bfd_x86_elf_link_fixup_gnu_properties
+  (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+   elf_property_list **listp)
 {
   elf_property_list *p;
 
@@ -2957,18 +2962,18 @@ _bfd_x86_elf_link_fixup_gnu_properties (struct bfd_link_info *info,
          || (type >= GNU_PROPERTY_X86_UINT32_OR_AND_LO
              && type <= GNU_PROPERTY_X86_UINT32_OR_AND_HI))
        {
-         if (p->property.u.number == 0)
+         if (p->property.u.number == 0
+             && (type == GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED
+                 || (type >= GNU_PROPERTY_X86_UINT32_AND_LO
+                     && type <= GNU_PROPERTY_X86_UINT32_AND_HI)
+                 || (type >= GNU_PROPERTY_X86_UINT32_OR_LO
+                     && type <= GNU_PROPERTY_X86_UINT32_OR_HI)))
            {
              /* Remove empty property.  */
              *listp = p->next;
              continue;
            }
 
-         /* Mark x86-specific properties with X86_UINT32_VALID for
-            non-relocatable output.  */
-         if (!bfd_link_relocatable (info))
-           p->property.u.number |= GNU_PROPERTY_X86_UINT32_VALID;
-
          listp = &p->next;
        }
       else if (type > GNU_PROPERTY_HIPROC)
This page took 0.043284 seconds and 4 git commands to generate.