]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd: fix recognition of arch-specific augmentations
authorJose E. Marchesi <jose.marchesi@oracle.com>
Sat, 12 Jul 2025 08:58:06 +0000 (10:58 +0200)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Sat, 12 Jul 2025 09:33:25 +0000 (11:33 +0200)
This patch fixes _bfd_elf_parse_eh_frame so it will not recognize
machine/architecture specific augmentation characters in EH Frame
CFIs.

Regtested in x86_64-linux-gnu and aarch64-linux-gnu.

bfd/ChangeLog:

* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Recognize augmentation
'B' only if targetting aarch64.

bfd/elf-eh-frame.c

index 0250a8f8d116c02ab64d13a8bba5287df7467665..aca16170a566760885ab89cf1d162ac99be6947f 100644 (file)
@@ -802,6 +802,8 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
                switch (*aug++)
                  {
                  case 'B':
+                   if (abfd->arch_info->arch != bfd_arch_aarch64)
+                     goto unrecognized;
                    break;
                  case 'L':
                    REQUIRE (read_byte (&buf, end, &cie->lsda_encoding));
@@ -843,6 +845,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
                      REQUIRE (skip_bytes (&buf, end, per_width));
                    }
                    break;
+                 unrecognized:
                  default:
                    /* Unrecognized augmentation. Better bail out.  */
                    goto free_no_table;