[PATCH] aarch64: ERRAT_NONE is not zero, so test against it

ktkachov@nvidia.com ktkachov@nvidia.com
Thu Aug 6 05:43:54 GMT 2026


From: Kyrylo Tkachov <ktkachov@nvidia.com>

erratum_84319_opts starts at ERRAT_NONE = (1 << 0), so a plain boolean test
on fix_erratum_843419 is true even when no erratum workaround was asked for.
Every other use in the file tests against ERRAT_NONE or masks with ERRAT_ADR /
ERRAT_ADRP.  Two do not.

The bare test dates from the conversion of fix_erratum_843419 from an int to an
enum for PR ld/24373.

Having the workaround on by default all the time is, of course, undesirable as
it costs link-time and is not what the user has asked by default.

Tested on aarch64-none-linux-gnu.
Ok for master?
Thanks,
Kyrill

bfd/
	* elfnn-aarch64.c (elfNN_aarch64_write_section): Test
	fix_erratum_843419 against ERRAT_NONE.
	(elfNN_aarch64_late_size_sections): Likewise.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
---
 bfd/elfnn-aarch64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index cbd4abea12..6194d18225 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -5704,7 +5704,7 @@ elfNN_aarch64_write_section (bfd *output_bfd  ATTRIBUTE_UNUSED,
 			 make_branch_to_erratum_835769_stub, &data);
     }
 
-  if (globals->fix_erratum_843419)
+  if (globals->fix_erratum_843419 != ERRAT_NONE)
     {
       struct erratum_835769_branch_to_stub_data data;
 
@@ -9747,7 +9747,7 @@ elfNN_aarch64_late_size_sections (struct bfd_link_info *info)
 
   /* Init mapping symbols information to use later to distingush between
      code and data while scanning for errata.  */
-  if (htab->fix_erratum_835769 || htab->fix_erratum_843419)
+  if (htab->fix_erratum_835769 || htab->fix_erratum_843419 != ERRAT_NONE)
     for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
       {
 	if (!is_aarch64_elf (ibfd))
-- 
2.50.1 (Apple Git-155)



More information about the Binutils mailing list