From 53d8d3f0c19e1365fdbb78c5824fe1d7e3d13aa0 Mon Sep 17 00:00:00 2001 From: Indu Bhagat Date: Thu, 2 Feb 2023 00:49:29 -0800 Subject: [PATCH] bfd: use "stack trace" instead of "unwind" for SFrame SFrame format is meant for generating stack traces only. bfd/ * elf-bfd.h: Replace the use of "unwind" with "stack trace". * elf-sframe.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-x86.c: Likewise. include/ * elf/common.h: Likewise. --- bfd/elf-bfd.h | 2 +- bfd/elf-sframe.c | 11 ++++++----- bfd/elf64-x86-64.c | 2 +- bfd/elfxx-x86.c | 8 ++++---- include/elf/common.h | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 2b7c574f540..dff19822547 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -702,7 +702,7 @@ struct elf_link_hash_table /* Used by eh_frame code when editing .eh_frame. */ struct eh_frame_hdr_info eh_info; - /* Used to link unwind data in .sframe sections. */ + /* Used to link stack trace info in .sframe sections. */ struct sframe_enc_info sfe_info; /* A linked list of local symbols to be added to .dynsym. */ diff --git a/bfd/elf-sframe.c b/bfd/elf-sframe.c index 8a7fd021931..d2954ba9193 100644 --- a/bfd/elf-sframe.c +++ b/bfd/elf-sframe.c @@ -206,7 +206,7 @@ _bfd_elf_parse_sframe (bfd *abfd, return false; } - /* Read the SFrame unwind information from abfd. */ + /* Read the SFrame stack trace information from abfd. */ if (!bfd_malloc_and_get_section (abfd, sec, &sfbuf)) goto fail_no_free; @@ -438,10 +438,11 @@ _bfd_elf_merge_section_sframe (bfd *abfd, } else { - /* Expected to land here for SFrame unwind info as created - for the .plt* sections. These sections can have upto two - FDE entries. Although the code should work for > 2, - leaving this assert here for safety. */ + /* Expected to land here when SFrame stack trace info is + created dynamically for the .plt* sections. These + sections are expected to have upto two SFrame FDE entries. + Although the code should work for > 2, leaving this + assert here for safety. */ BFD_ASSERT (num_fidx <= 2); /* For the first entry, we know the offset of the SFrame FDE's sfde_func_start_address. Side note: see how the value diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 914f82d0151..5f89190a6a0 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -895,7 +895,7 @@ static const struct elf_x86_sframe_plt elf_x86_64_sframe_plt = { &elf_x86_64_sframe_pltn_fre1, &elf_x86_64_sframe_pltn_fre2 }, NON_LAZY_PLT_ENTRY_SIZE, 1, /* Number of FREs for PLTn for second PLT. */ - /* FREs for second plt ( unwind info for .plt.got is + /* FREs for second plt (stack trace info for .plt.got is identical). Used when IBT or non-lazy PLT is in effect. */ { &elf_x86_64_sframe_sec_pltn_fre1 } }; diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 42af84b8e04..132fb791ac6 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -1804,7 +1804,7 @@ enum dynobj_sframe_plt_type 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 @@ -1819,7 +1819,7 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd, 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; @@ -1832,7 +1832,7 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd, 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; @@ -1906,7 +1906,7 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd, /* 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); diff --git a/include/elf/common.h b/include/elf/common.h index bb93123d14a..d19d6f9927d 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -489,7 +489,7 @@ #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */ #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */ #define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) /* GNU property */ -#define PT_GNU_SFRAME (PT_LOOS + 0x474e554) /* SFrame unwind information */ +#define PT_GNU_SFRAME (PT_LOOS + 0x474e554) /* SFrame stack trace information */ /* OpenBSD segment types. */ #define PT_OPENBSD_RANDOMIZE (PT_LOOS + 0x5a3dbe6) /* Fill with random data. */ -- 2.30.2