diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index cd54beec7b7d9f6b6977634dcd82501b80ab6cd4..939fac197d5dab3dcee8b9d820957e68419ca0af 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -6460,6 +6460,18 @@ c64_fixup_frag (bfd *input_bfd, struct bfd_link_info *info, asection *perm_sec = sym_sec; bfd_boolean bounds_ok = FALSE; + const char *sym_name; + + if (sym) + { + Elf_Internal_Shdr *symtab_hdr = &elf_symtab_hdr (input_bfd); + sym_name = (bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name)); + } + else + sym_name = h->root.root.string; + if (size == 0 && sym_sec) { bounds_ok = TRUE; @@ -6492,11 +6504,13 @@ c64_fixup_frag (bfd *input_bfd, struct bfd_link_info *info, if (!bounds_ok && !c64_valid_cap_range (&base, &limit)) { + /* Just warn about this. It's not a requirement that bounds on + objects should be precise, so there's no reason to error out on + such an object. */ /* xgettext:c-format */ - _bfd_error_handler (_("%pB: capability range may exceed object bounds"), - input_bfd); - bfd_set_error (bfd_error_bad_value); - return bfd_reloc_notsupported; + _bfd_error_handler + (_("%pB: capability range for '%s' may exceed object bounds"), + input_bfd, sym_name); } if (perm_sec && perm_sec->flags & SEC_CODE) diff --git a/ld/testsuite/ld-aarch64/emit-relocs-morello-5.d b/ld/testsuite/ld-aarch64/emit-relocs-morello-5.d index 05bbef145e03786dbb489b40441e78fbff69ddb5..7fa7909bdffd47c6877df709ad74d17bf0fc9c1f 100644 --- a/ld/testsuite/ld-aarch64/emit-relocs-morello-5.d +++ b/ld/testsuite/ld-aarch64/emit-relocs-morello-5.d @@ -1,6 +1,4 @@ #source: emit-relocs-morello-5.s #as: -march=morello+c64 #ld: -static -#error: .*: capability range may exceed object bounds -#error: .*: in function `_start':.* -#error: .*: dangerous relocation: unsupported relocation +#warning: .*: capability range for 'bigarray' may exceed object bounds