Prevent an assertion from being triggered when linking an ARM object file with incorr...
authorNick Clifton <nickc@redhat.com>
Tue, 1 Mar 2022 09:51:59 +0000 (09:51 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 1 Mar 2022 09:51:59 +0000 (09:51 +0000)
PR 28848
PR 28859
* elf32-arm.c (elf32_arm_merge_eabi_attributes): If the first
input bfd has a Tag_ABI_HardFP_use set to 3 but does not also have
TAG_FP_arch set then reset the TAG_ABI_HardFP_use.

bfd/ChangeLog
bfd/elf32-arm.c

index 7f0f25159b7750bc166043b3444d03edf67aa604..843bdc8d8a19e4d0162079240d06a05f0e42c0c5 100644 (file)
@@ -1,3 +1,10 @@
+2022-03-01  Nick Clifton  <nickc@redhat.com>
+
+       PR 28848
+       * elf32-arm.c (elf32_arm_merge_eabi_attributes): If the first
+       input bfd has a Tag_ABI_HardFP_use set to 3 but does not also have
+       TAG_FP_arch set then reset the TAG_ABI_HardFP_use.
+
 2022-02-28  Torbjörn Svensson  <torbjorn.svensson@st.com>
 
        PR 25713
index 86da60e768cdf242073c3017c2e7da633bfac060..616efe60ad1fd14f4a2483d30c93daee7b5a3bc0 100644 (file)
@@ -14523,6 +14523,14 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
          out_attr[Tag_MPextension_use_legacy].i = 0;
        }
 
+      /* PR 28859 and 28848:  Handle the case where the first input file,
+        eg crti.o, has a Tag_ABI_HardFP_use of 3 but no Tag_FP_arch set.
+        Using Tag_ABI_HardFP_use in this way is deprecated, so reset the
+        attribute to zero.
+        FIXME: Should we handle other non-zero values of Tag_ABI_HardFO_use ? */
+      if (out_attr[Tag_ABI_HardFP_use].i == 3 && out_attr[Tag_FP_arch].i == 0)
+       out_attr[Tag_ABI_HardFP_use].i = 0;
+
       return result;
     }