/* x86 specific support for ELF
- Copyright (C) 2017-2022 Free Software Foundation, Inc.
+ Copyright (C) 2017-2023 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
}
else
{
+ bfd_byte *contents;
+
if (rel.r_offset >= sec->size)
abort ();
+
+ if (elf_section_data (sec)->this_hdr.contents
+ != NULL)
+ contents
+ = elf_section_data (sec)->this_hdr.contents;
+ else
+ {
+ if (!bfd_malloc_and_get_section (sec->owner,
+ sec,
+ &contents))
+ info->callbacks->einfo
+ /* xgettext:c-format */
+ (_("%F%P: %pB: failed to allocate memory for section `%pA'\n"),
+ info->output_bfd, sec);
+
+ /* Cache the section contents for
+ elf_link_input_bfd. */
+ elf_section_data (sec)->this_hdr.contents
+ = contents;
+ }
htab->elf_write_addend
(info->output_bfd, outrel->r_addend,
- (elf_section_data (sec)->this_hdr.contents
- + rel.r_offset));
+ contents + rel.r_offset);
}
}
}
SFRAME_PLT_SEC = 2
};
-/* Create SFrame unwind info for the plt entries in the .plt section
+/* Create SFrame stack trace info for the plt entries in the .plt section
of type PLT_SEC_TYPE. */
static bool
unsigned int plt0_entry_size;
unsigned char func_info;
unsigned int fre_type;
- /* The dynamic plt section for which .sframe unwind information is being
+ /* The dynamic plt section for which .sframe stack trace information is being
created. */
asection *dpltsec;
bed = get_elf_backend_data (output_bfd);
htab = elf_x86_hash_table (info, bed->target_id);
- /* Whether SFrame unwind info for plt0 is to be generated. */
+ /* Whether SFrame stack trace info for plt0 is to be generated. */
plt0_generated_p = htab->plt.has_plt0;
plt0_entry_size
= (plt0_generated_p) ? htab->sframe_plt->plt0_entry_size : 0;
/* pltn entries use an SFrame FDE of type
SFRAME_FDE_TYPE_PCMASK to exploit the repetitive
pattern of the instructions in these entries. Using this SFrame FDE
- type helps in keeping the unwind information for pltn entries
+ type helps in keeping the SFrame stack trace info for pltn entries
compact. */
func_info = sframe_fde_create_func_info (fre_type,
SFRAME_FDE_TYPE_PCMASK);