The reasoning behind only warning for symbols which have a size which
cannot be precisely bounded is that there is nothing *requiring* precise
bounds, GCC knowingly avoids changing the size of some symbols for
precise bounds (TLS and symbols with user-specified alignment and
user-specified section), and LLD only warns on imprecise bounds rather
than erroring.
N.b. the reasoning for GCC avoiding padding in these cases is explained
in the commit message of
b302420cb55 in the GCC branch
vendors/ARM/heads/morello.
All in all it's not something that we want in our toolchain as a
requirement, and it's not something that other toolchains have as a
requirement, so there doesn't seem to be much of a reason to include it.
In order to make this warning a little nicer for anyone reading it, we
add the name of the symbol to the warning. Update the testsuite to
account for this.
Co-Author: Alex Coplan <alex.coplan@arm.com>
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;
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)
#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