diff options
author | Clément Chigot <chigot@adacore.com> | 2023-11-06 10:50:23 +0100 |
---|---|---|
committer | Clément Chigot <chigot@adacore.com> | 2023-11-08 09:07:02 +0100 |
commit | fb2908093576cc469c5ee8404070c8521631c019 (patch) | |
tree | 14c8380cb6d378e8a537c5dfda917b6bed774c17 /bfd | |
parent | 1185b5b79a12ba67eb60bee3f75babf7a222fde0 (diff) | |
download | gdb-fb2908093576cc469c5ee8404070c8521631c019.zip gdb-fb2908093576cc469c5ee8404070c8521631c019.tar.gz gdb-fb2908093576cc469c5ee8404070c8521631c019.tar.bz2 |
ld: print branch fixups into the map file for ppc elf targets
In a safety context, it could interesting to track the trampolines being
generated, ensuring there are expected or not.
bfd/ChangeLog:
* elf32-ppc.c (ppc_elf_relax_section): Log branch fixups.
ld/ChangeLog:
* ld.texi (--print-map): Add new item about fixups.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elf32-ppc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 5622aaa..bdbd1b4 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -6169,7 +6169,7 @@ ppc_elf_relax_section (bfd *abfd, asection *tsec; struct one_branch_fixup *f; size_t insn_offset = 0; - bfd_vma max_branch_offset = 0, val; + bfd_vma max_branch_offset = 0, val, reladdr; bfd_byte *hit_addr; unsigned long t0; struct elf_link_hash_entry *h; @@ -6415,6 +6415,7 @@ ppc_elf_relax_section (bfd *abfd, continue; roff = irel->r_offset; + reladdr = isec->output_section->vma + isec->output_offset + roff; /* Avoid creating a lot of unnecessary fixups when relocatable if the output section size is such that a @@ -6433,10 +6434,9 @@ ppc_elf_relax_section (bfd *abfd, final link, so do not presume they remain in range. */ || tsec->output_section == isec->output_section)) { - bfd_vma symaddr, reladdr; + bfd_vma symaddr; symaddr = tsec->output_section->vma + tsec->output_offset + toff; - reladdr = isec->output_section->vma + isec->output_offset + roff; if (symaddr - reladdr + max_branch_offset < 2 * max_branch_offset) continue; @@ -6507,6 +6507,12 @@ ppc_elf_relax_section (bfd *abfd, irel->r_info = ELF32_R_INFO (0, R_PPC_NONE); } + link_info->callbacks->minfo + (_("%pB: Adjusting branch at 0x%V towards \"%s\" in section %s\n"), + abfd, reladdr, + (h && h->root.root.string? h->root.root.string : "<unknown>"), + f->tsec->name); + /* Get the section contents. */ if (contents == NULL) { |