Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
Commit Message
A comment in cris check_relocs bemoans not being able to access the
output bfd in adjust_dynamic_symbol. A little over three years after
the comment was written, commit f13a99db51c0 gave that access. So
let's make use of it and remove a restriction.
* elf32-cris.c (elf_cris_adjust_dynamic_symbol): Get mach from
output bfd, not dynobj.
(cris_elf_check_relocs): Remove dynobj mach check.
Comments
On Mon, 11 May 2026, Alan Modra wrote:
> A comment in cris check_relocs bemoans not being able to access the
> output bfd in adjust_dynamic_symbol. A little over three years after
> the comment was written, commit f13a99db51c0 gave that access. So
> let's make use of it and remove a restriction.
>
> * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Get mach from
> output bfd, not dynobj.
> (cris_elf_check_relocs): Remove dynobj mach check.
For those so interested: regarding utility, this is now fuzzer
land. If someone outside binutils testing ever does dynamic
linking, I'll raise my eyebrows. Though, that's certainly not a
reason to leave the code as is.
It removes a headscratcher (requiring git investigation as you
most likely did) and makes the code shorter, so absolutely,
thanks!
brgds, H-P
@@ -2676,7 +2676,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
&& !h->def_regular)));
plt_entry_size
- = (bfd_get_mach (dynobj) == bfd_mach_cris_v32
+ = (bfd_get_mach (info->output_bfd) == bfd_mach_cris_v32
? PLT_ENTRY_SIZE_V32 : PLT_ENTRY_SIZE);
/* If this is a function, put it in the procedure linkage table. We
@@ -3033,22 +3033,7 @@ cris_elf_check_relocs (bfd *abfd,
case R_CRIS_16_GOTPLT:
case R_CRIS_32_GOTPLT:
if (dynobj == NULL)
- {
- elf_hash_table (info)->dynobj = dynobj = abfd;
-
- /* We could handle this if we can get a handle on the
- output bfd in elf_cris_adjust_dynamic_symbol. Failing
- that, we must insist on dynobj being a specific mach. */
- if (bfd_get_mach (dynobj) == bfd_mach_cris_v10_v32)
- {
- _bfd_error_handler
- /* xgettext:c-format */
- (_("%pB, section %pA: v10/v32 compatible object"
- " must not contain a PIC relocation"),
- abfd, sec);
- return false;
- }
- }
+ elf_hash_table (info)->dynobj = dynobj = abfd;
if (sgot == NULL)
{