aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
8 hourssim: riscv: Fix build issue due to INSN_CLASS_C was changed to INSN_CLASS_ZCAHEADmasterNelson Chu1-1/+1
8 hourslibiberty: sync with gccMatthieu Longo4-1/+728
Import the following commits from GCC as of r16-2170-g2f2e9bcfb0fd9c: 0fd98b6f9f2 libiberty: add routines to handle type-sensitive doubly linked lists
10 hoursRISC-V: Fixed wrong imply result for zce when -march=rv32id_zceNelson Chu6-40/+32
The entry of "zce imply zcf" needs check_implicit_for_zcf, so it needs to be placed after the entries of "whatever imply f". Otherwise the implicit zcf may be missed. Also merge the march-implu-zce* testcases into imply testcases.
10 hoursRISC-V: Clarify the imply rule of cNelson Chu17-228/+231
This also fix the imply result for .option rvc. Imply zcf when c and f and rv32 Imply zcd when c and d Imply zca when c Changed INSN_CLASS_C to INSN_CLASS_ZCA Changed INSN_CLASS_F_AND_C to INSN_CLASS_ZCF Changed INSN_CLASS_D_AND_C to INSN_CLASS_ZCD Changed INSN_CLASS_ZIHINTNTL_AND_C to INSN_CLASS_ZIHINTNTL_AND_ZCA
11 hoursRISC-V: Deprecate ".option arch, -ext" for users due to its controversial useNelson Chu16-47/+71
Before we figure out the whole remove situations for ".option arch, -ext", and have any RISC-V public spec defines it, we should just deprecate it.
22 hoursAutomatic date update in version.inGDB Administrator1-1/+1
37 hoursgas: ld: sframe: add new internal headerIndu Bhagat4-12/+38
for SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS. The intention of creating an abstraction like SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS is to address the concern that there should be a central place to enforce harmonious flags between GNU as and ld. At the moment, the only flag that needs to be enforced is SFRAME_F_FDE_FUNC_START_PCREL. sframe.h and sframe-api.h are installed headers by libsframe for the specification and implementation respectively. Adding a definition like SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS does not fit in either. Create a new internal header instead to keep the definition uncoupled from sframe.h and sframe-api.h. Rename the previously added SFRAME_F_LD_MUSTHAVE_FLAGS to define the new SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS. bfd/ * elf-sframe.c (_bfd_elf_merge_section_sframe): Use the new internal header and SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS. gas/ * gen-sframe.c (output_sframe_internal): Likewise. include/ * sframe-api.h (SFRAME_F_LD_MUSTHAVE_FLAGS): Move from.. * sframe-internal.h: ..to here. New file.
44 hoursMerge init_private_section_data with copy_private_section_dataAlan Modra28-131/+79
init_private_section_data is used by the linker and is a special case of copy_private_section_data that copies a reduced set of section data from input to output. Merge the two functions, adding a link_info param to copy_private_section_data and remove init_private_section_data.
46 hoursgas remove assorted unnecessary castsAlan Modra44-224/+190
This continues the saga of removing unnecessary casts, and making small code tidies in gas. Hopefully this sees the last of K&R anachronisms.
46 hoursgas standardise md_section_alignAlan Modra25-25/+25
The point here is that when valueT is 64 bits and int is 32 bits, 1 << align doesn't work for shifts larger than the size of int. (Not that anyone is likely to use such large alignments in real code.)
46 hoursgas function arg castsAlan Modra32-117/+104
This patch removes more unnecessary arg casts in various function calls.
46 hoursgas fixupsAlan Modra10-43/+27
Remove unnecessary arg casts in fix_new and similar calls.
46 hoursgas char/unsigned char castsAlan Modra22-101/+93
This patch removes many unneeded casts to char or unsigned char. It's worth noting that safe-ctype.h macros ISDIGIT and the like cope with either signed or unsigned char. In some cases a cast to unsigned char is replaced by anding with 0xff, which accomplishes the same thing but doesn't rely on char being eight bits. The patch also removes pointer casts, and a few unsigned char pointer variables.
46 hoursgas alpha sign extension macrosAlan Modra1-25/+5
Use standard sign extend and range checking using unsigned expressions that don't rely on implementation defined right shifts or size of short and int.
46 hoursgas md_number_to_charsAlan Modra30-187/+159
Calls to md_number_to_chars don't need to cast their value arg (*). Remove those casts. avr_output_property_recode made a call to md_number_to_chars with size of 1. Simplify that. tc-bpf.c md_convert_frag used write_insn_bytes that simply copied input to output. Dispense with that nonsense, and similarly in a couple of other places where md_number_to_chars was called with size 1. *) unless the value arg is an expression that needs a cast, eg. tic54x emit_insn where the shift left could trigger signed overflow UB without a cast.
46 hoursz8k opcode_entry_typeAlan Modra3-5/+5
z8k opcode_entry_type.func is never used as a function pointer, only as a pointer to a pseudo_typeS. Change it to a void*.
46 hoursgas various other void* castsAlan Modra20-63/+55
This removes assorted unneeded casts of void* pointers, and casts when passing args to void* parameters or storing to void* pointers. The patch also changes obj-coff.c stack_push to take a void* parameter, and replaces an odd memcpy in tc-metag.c find_insn_templates with a simple assignment.
46 hoursgas various other const pointer changesAlan Modra16-87/+82
This removes a bunch of casts involving const pointers, in some cases by making variables const pointers so a cast is not needed. In a couple of places the cast hid errors with "&array" written rather than "array", see iq2000_macro_defs and s_pru_align. tc-xgate.c cmp_opcode is changed to be the standard qsort predicate to avoid a function cast.
46 hoursgas d30v_insn plus other non-const pointersAlan Modra2-14/+14
d30v has a bunch of casts that are only needed due to various types missing a const. Fix that.
46 hoursgas alloc castsAlan Modra18-39/+31
All of the various memory allocation function return a "void *" pointer, which needs no cast to assign to other pointer types.
46 hoursgas bfd_put and bfd_get arg castsAlan Modra17-185/+185
bfd_{h_,}put_* and bfd_{h_,}get_* have "void *" pointer params nowadays. We don't need casts on their pointer args. We also don't need to cast values passed to bfd_put.
46 hoursgas NULL castsAlan Modra69-398/+393
This removes many unnecessary NULL casts. I'm also adding a few arg casts in concat calls, to make the code consistent. Advice from quite a few years ago was that it's better to use the exact type for args corresponding to function ellipses, in case NULL is defined as plain 0. (I think that happened with some early 64-bit systems. Plain NULL ought to be OK nowadays.)
46 hoursgas s3_FAIL and s7_FAILAlan Modra2-669/+669
s3_FAIL is defined as 0x80000000 which is unsigned, but everywhere it is used it is cast to int. Get rid of that silliness, and likewise for s7_FAIL.
46 hoursgas more enum castsAlan Modra10-107/+106
Remove more unnecessary enum casts.
46 hoursgas bfd_reloc_code_real_typeAlan Modra17-91/+78
Enumeration constants are integer types, so there should be no need to cast such constants to int in expressions. (Perhaps some older gccs warned, I checked back to gcc-4.5.) Remove some of those unnecessary casts. Also remove unnecessary casts to bfd_reloc_code_real_type.
46 hoursgas add_ecoff_symbolAlan Modra1-49/+19
* ecoff.c: Remove unnecessary arg casts in add_ecoff_symbol calls throughout file.
46 hoursgas frag_varAlan Modra20-93/+52
Many frag_var calls have unnecessary casts on arguments, no doubt from the days when binutils was written for K&R C. (ie. functions were not prototyped so you needed to cast anything that didn't match the expected type after default promotions, as you still do for args matching a function ellipsis.) Remove those casts. * config/tc-alpha.c (s_alpha_comm): Use offset_T for cur_size to avoid need for casts. Remove casts from frag_var args. * config/tc-ia64.c (obj_elf_vms_common): Remove casts from frag_var args. * config/tc-m32r.c (m32r_scomm): Likewise. * config/tc-m68hc11.c (build_jump_insn): Likewise. (build_dbranch_insn): Likewise. * config/tc-m68k.c (md_assemble): Likewise. * config/tc-microblaze.c (microblaze_s_lcomm): Likewise. * config/tc-mmix.c (s_loc): Likewise. * config/tc-ppc.c (ppc_elf_lcomm, ppc_comm): Likewise. * config/tc-score.c (s3_s_score_lcomm): Likewise. * config/tc-score7.c (s7_s_score_lcomm): Likewise. * config/tc-sh.c (sh_cons_align): Likewise. * config/tc-sparc.c (s_reserve, s_common): Likewise. (sparc_cons_align): Likewise. * config/tc-tic4x.c (tic4x_seg_alloc, tic4x_bss): Likewise. * config/tc-tic54x.c (tic54x_bss, tic54x_space): Likewise. (tic54x_usect, tic54x_field): Likewise. * config/tc-tic6x.c (s_tic6x_scomm): Likewise. * config/tc-v850.c (v850_offset, v850_comm): Likewise. * frags.c (frag_align, frag_align_pattern, frag_align_code): Likewise. * gen-sframe.c (output_sframe_row_entry): Likewise. (output_sframe_funcdesc): Likewise. * read.c (s_fill, do_org, s_space, emit_leb128_expr): Likewise. * symbols.c (colon)): Likewise.
46 hoursgas pointer to int and vice versaAlan Modra4-21/+21
Use "intptr_t" or "uintptr_t" for these conversions, not "long" which is wrong on LLP64 systems, or "size_t" which is better but still not the correct type. * config/tc-alpha.c (emit_ldXu, emit_ldX, emit_uldXu, emit_uldX), (emit_stX, emit_ustX, emit_sextX): Use correct type when converting vlgsize pointer to in. Use "int" rather than "long" for result. * config/tc-ia64.c (generate_unwind_image): Use intptr_t cast when passing personality_routine to frag_var. * config/tc-ppc.c (ppc_frob_symbol <coff>): Use uintptr_t cast when converting symbol pointer to valueT. * config/tc-v850.c (md_assemble): Use intptr_t cast when loading integer opindex.
46 hoursAutomatic date update in version.inGDB Administrator1-1/+1
2 daysaarch64: Add support for FEAT_SVE2p2 and FEAT_SME2p2Alice Carlotti15-626/+3318
2 daysaarch64: Reorder virtual feature dependenciesAlice Carlotti1-4/+3
This will improve readability when more combinations of "SVE* or SME*" are added.
2 daysgdb/reverse: Add 2 AVX instructions VADDSUBPS and VADDSUBPDFirst Last3-0/+113
add support to recording 2 missing AVX instructions: vaddsubps and vaddsubpd, and add associated tests. Approved-By: Guinevere Larsen <guinevere@redhat.com>
2 daysgprofng: support external debug infoVladimir Mezentsev15-185/+279
Use bfd_follow_gnu_debuglink() and bfd_follow_gnu_debugaltlink() to find files with debug info. If necessary, gprofng-archive copies these files to EXP/archives. For each executable, gprofng creates the Elf class twice. One of them was a memory leak. Fixed this by adding a new argument to Stabs::Stabs(). gprofng/ChangeLog 2025-07-07 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR 32147 PR 30194 * src/Disasm.cc (get_funcname_in_plt): Use the executable file instead of the debug information file. * src/Dwarf.h: Define debug_alt_strSec. * src/DwarfLib.cc: Add support for DW_FORM_GNU_ref_alt, DW_FORM_GNU_strp_alt. * src/Elf.h (find_gnu_debug_files, get_dwr_section): New functions. * src/Elf.cc: Likewise. * src/Experiment.cc (copy_file): Add the const qualifier. * src/Experiment.h: Likewise. * src/LoadObject.cc (get_elf, openDebugInfo): Find files with debug info. * src/LoadObject.h: Remove unused variables. * src/Module.cc: Remove an argument in openDebugInfo(). * src/Stabs.cc (Stabs::Stabs): Add the Elf* argument. * src/Stabs.h: Likewise. * src/gp-archive.cc: Archive files with debug info. * src/gp-archive.h (archive_file): New function.
2 daysFix wchar.exp test case per reviewTom Tromey1-2/+2
A recent patch of mine modified wchar.exp, but I failed to notice one part of the review. This patch updates the code to conform to the review comments.
2 daysNew Malay translation for bfd/ and new Spanish translation for gas/Nick Clifton2-32/+24262
2 daysRISC-V: Fix libpath_suffix selection for ldscriptMark Goncharov6-6/+6
When building a cross-compiler ld for RISC-V Linux systems, you can specify target=riscv64*-linux* to create a linker that supports both 32-bit (-march=rv32*) and 64-bit (-march=rv64*) architectures. The specified -march value populates the EMULATION_NAME variable, which determines the default linker script selection. For proper riscv64 target support, the build process must prepare both elf32lriscv* and elf64lriscv* linker scripts. These should align with the standard RISC-V Linux sysroot directory structure. Signed-off-by: Mark Goncharov <mark.goncharov@syntacore.com>
3 daysRISC-V: Fixed mapping symbol for .option norvc directiveNelson Chu2-2/+7
3 daysRISC-V: Fixed dis-assembler to set correct xlen from mapping symbolNelson Chu4-8/+10
3 daysRISC-V: Fixed that .option push/pop won't recover the xlenNelson Chu2-4/+7
3 daysRISC-V: Added testcase to show the current rvc and xlen problemsNelson Chu2-0/+94
3 daysRISC-V: Bind defined symbol locally in PIELinsen Zhou6-1/+37
Reference commit 1dcb9720d62cd053a72c31881b7724ce9f74332c bfd/ * elfnn-riscv.c (RISCV_COPY_INPUT_RELOC): Bind defined symbol locally in PIE. ld/ * testsuite/ld-riscv-elf/pie-bind-locally-a.s: New test source. * testsuite/ld-riscv-elf/pie-bind-locally-b.s: Likewise. * testsuite/ld-riscv-elf/pie-bind-locally-rv32.d: New testcase. * testsuite/ld-riscv-elf/pie-bind-locally-rv64.d: Likewise. Signed-off-by: Linsen Zhou <i@lin.moe>
3 daysAutomatic date update in version.inGDB Administrator1-1/+1
3 daysgprofng: remove ElfReloc class and unused functions and declarationsVladimir Mezentsev9-498/+6
class ElfReloc is not used after we started use libbfd. Removed ElfReloc and other unused declarations. gprofng/ChangeLog 2025-07-03 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * src/Disasm.cc: Remove unused functions and variables. * src/Disasm.h: Likewise. * src/Dwarf.cc: Likewise. * src/DwarfLib.cc: Likewise. * src/DwarfLib.h: Likewise. * src/Elf.cc: Likewise. * src/Elf.h: Likewise. * src/Stabs.cc: Likewise. * src/Stabs.h: Likewise.
3 daysCorrectly handle L'\\'Tom Tromey2-11/+19
Hannes filed a bug that pointed out that: print L'\\' ... did not work correctly. The bug is in convert_escape, which simply transcribes the backslash character, rather than convert it between encodings. This patch fixes the error. I also turned a macro into a lambda to clean up this code a little. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33124 Reviewed-By: Tom de Vries <tdevries@suse.de> Tested-By: Hannes Domani <ssbssa@yahoo.de>
3 daysLoongArch: Allow to relax instructions into NOPs after handling alignmentWANG Xuerui5-73/+227
Right now, LoongArch linker relaxation is 2-pass, since after alignment is done, byte deletion can no longer happen. However, as the alignment pass also shrinks text sections, new relaxation chances may well be created after alignment is done. Although at this point we can no longer delete unused instructions without disturbing alignment, we can still replace them with NOPs; popular LoongArch micro-architectures can eliminate NOPs during execution, so we can expect a (very) slight performance improvement from those late-created relaxation chances. To achieve this, the number of relax passes is raised to 3 for LoongArch, and every relaxation handler except loongarch_relax_align is migrated to a new helper loongarch_relax_delete_or_nop, that either deletes bytes or fills the bytes to be "deleted" with NOPs, depending on whether the containing section already has undergone alignment. Also, since no byte can be deleted during this relax pass, in the pass the pending_delete_ops structure is no longer allocated, and loongarch_calc_relaxed_addr(x) degrades to the trivial "return x" in this case. In addition, previously when calculating distances to symbols, an extra segment alignment must be considered, because alignment may increase distance between sites. However in the newly added 3rd pass code size can no longer increase for "closed" sections, so we can skip the adjustment for them to allow for a few more relaxation chances. A simple way to roughly measure this change's effectiveness is to check how many pcalau12i + addi.d pairs are relaxed into pcaddi's. Taking a Firefox 140.0.2 test build of mine as an example: Before: 47842 pcaddi's in libxul.so After: 48089 This is a 0.5% increase, which is kind of acceptable for a peephole optimization like this; of which 9 are due to the "relax"ed symbol distance treatment. Signed-off-by: WANG Xuerui <git@xen0n.name>
4 daysAutomatic date update in version.inGDB Administrator1-1/+1
4 daysld: bfd: sframe: Update section size also for relocatable linksJens Remus1-3/+1
For relocatable links the output .sframe section size may be wrong. This can be observed when dumping the SFrame information from the x86-64 sframe-reloc-1 test: Name Address Off Size .sframe 0000000000000000 000110 00007f Offset Type Symbol's Value Symbol's Name + Addend 000000000000001c R_X86_64_PC32 0000000000000000 .text + 1c 0000000000000030 R_X86_64_PC32 0000000000000000 .text + 65 0x00000000 e2de0201 0300f800 02000000 08000000 ................ 0x00000010 1e000000 00000000 28000000 00000000 ........(....... 0x00000020 35000000 00000000 04000000 00000000 5............... 0x00000030 00000000 25000000 0f000000 04000000 ....%........... offset 1st FRE---^^^^^^^^ ^^^^^^^^---number of FREs 0x00000040 00000000 00030801 0510f004 0410f034 ...............4 FDE info---^^ | begin of FDEs 0x00000050 0508f000 03080105 10f00404 10f02405 ..............$. 11111112222222223333333334444---FRE 1, 2, 3, 4 0x00000060 08f00000 00000000 00000000 00000000 ................ 4444^^^^... 0x00000070 00000000 00000000 00000000 000000 ............... ...^^^^^^---excessive section When running the x86-64 test cross build on a big-endian system, such as s390x, objdump and readelf fail to dump the SFrame information with the following error message: Error: SFrame decode failure: Buffer does not contain SFrame data. This is because the following check in flip_sframe() fails, which gets only invoked if the endianness of the SFrame data is different from the host system one: /* All FDEs and FREs must have been endian flipped by now. */ if ((j != ihp->sfh_num_fres) || (bytes_flipped != (buf_size - hdrsz))) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With: j=8, ihp->sfh_num_fres=8, bytes_flipped=70, buf_size=127, hdrsz=28 While at it, remove the incorrect code comment. There is no relationship between "do not update size" and the fact that the "contents have not been relocated". bfd/ * elf-sframe.c (_bfd_elf_write_section_sframe): Update section size also for relocatable links. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
4 daysNEWS: sframe: mention new semantics for SFrame FDE function start addrIndu Bhagat3-0/+20
The SFrame FDE's function start address is always emitted as follows by GAS and ld: it is the offset of the start PC of the respective function from the FDE field itself. GAS and ld will emit a flag SFRAME_F_FDE_FUNC_START_PCREL set to 1 when emitting the field in this encoding. * binutils/NEWS: Announce the change of encoding for SFrame FDE func start addr field. * gas/NEWS: Announce the emission of new flag SFRAME_F_FDE_FUNC_START_PCREL. * ld/NEWS: Likewise. Relocatable links are now fixed.
4 daysld: bfd: sframe: fix incorrect r_offset in RELA entriesIndu Bhagat5-1/+138
PR/32666 Incorrect .rela.sframe when using ld -r Input SFrame sections are merged using _bfd_elf_merge_section_sframe (), which clubs all SFrame FDEs together in one blob and all SFrame FREs in another. This, of course, means the offset of an SFrame FDE in the output section cannot be simply derived from the output_offset of the sections. Fix this by providing _bfd_elf_sframe_section_offset () which returns the new offset of the SFrame FDE in the merged SFrame section. Unlike EH_Frame sections, which also use the _bfd_elf_section_offset (), to update the r_offset, SFrame sections have distinct merging semantics. In case of SFrame, the SFrame FDE will not simply sit at location "sec->output_offset + offset of SFrame FDE in sec". Recall that information layout in an SFrame section is as follows: SFrame Header SFrame FDE 1 SFrame FDE 2 ... SFrame FDEn SFrame FREs (Frame Row Entries) Note how the SFrame FDEs and SFrame FREs are clubber together in groups of their own. Next, also note how the elf_link_input_bfd () does a: irela->r_offset += o->output_offset; This, however, needs to be avoided for SFrame sections because the placement of all FDEs is at the beginning of the section. So, rather than conditionalizing this as follows: if (o->sec_info_type != SEC_INFO_TYPE_SFRAME) irela->r_offset += o->output_offset; the implementation in _bfd_elf_sframe_section_offset () does a reverse adjustment, so that the generic parts of the linking process in elf_link_input_bfd () are not made to do SFrame specific adjustments. Add a new enum to track the current state of the SFrame input section during the linking process (SFRAME_SEC_DECODED, SFRAME_SEC_MERGED) for each input SFrame section. This is then used to assert an assumption that _bfd_elf_sframe_section_offset () is being used on an input SFrame sections which have not been merged (via _bfd_elf_merge_section_sframe ()) yet. bfd/ * elf-bfd.h: New declaration. * elf-sframe.c (_bfd_elf_sframe_section_offset): New definition. * elf.c (_bfd_elf_section_offset): Adjust offset if SFrame section. ld/testsuite/ * ld-x86-64/x86-64.exp: New test. * ld-x86-64/sframe-reloc-1.d: New test.
4 daysbfd: gas: ld: libsframe: adopt new encoding for FDE func start addr fieldIndu Bhagat45-71/+200
This patch convenes a set of changes in bfd, gas, ld, libsframe towards moving to the new encoding for the 'sfde_func_start_address' field in SFrame FDE. First, gas must now mark all SFrame sections with the new flag SFRAME_F_FDE_FUNC_START_PCREL. gas was already emitting the field in the said encoding. * gas/gen-sframe.c (output_sframe_internal): Emit the flag SFRAME_F_FDE_FUNC_START_PCREL. Similarly for ld, adopt the new semantics of sfde_func_start_address consistently. This means: - When merging SFrame sections, check that all input SFrame sections have the SFRAME_F_FDE_FUNC_START_PCREL flag set. If the check fails, ld errors out. - When merging SFrame sections, keep even the in-memory contents of the FDE function start address (buffer passed to libsframe sframe_encoder_write () for writing out) encoded in the new semantics. While it is, in theory, possible that instead of doing this change here, we adjust the value of sfde_func_start_address at the final write (sframe_encoder_write) time. But latter is not favorable for maintenanance and may be generally confusing for developers. - When creating SFrame for PLT entries, emit flag SFRAME_F_FDE_FUNC_START_PCREL. include/ * sframe-api.h (SFRAME_F_LD_MUSTHAVE_FLAGS): New definition. bfd/ * elf-sframe.c (_bfd_elf_merge_section_sframe): Check for flag combinatation SFRAME_F_LD_MUSTHAVE_FLAGS set for all input and output SFrame sections. If not, error out. Also, adopt the new semantics of function start address encoding. * bfd/elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Emit flag SFRAME_F_FDE_FUNC_START_PCREL. Next, for dumping SFrame sections, now that we are emitting the same encoding in GAS, non-relocatable and relocatable SFrame links, it is the time to set relocate to TRUE in debug_displays[]. binutils/ * dwarf.c (struct dwarf_section_display): Allow sframe sections to now be relocated. gas/testsuite/ * gas/cfi-sframe/cfi-sframe-aarch64-pac-ab-key-1.d: Update the test. Relocatable SFrame sections now display non-zero value (appropriate function start address). Now, as the SFrame sections on-disk and in-memory use the new semantics of sfde_func_start_address encoding (i.e., function start address is the offset from the sfde_func_start_address field to the start PC), the calculation to make it human readable (i.e., relatable to the addresses in .text sections) needs adjustment. libsframe/ * sframe-dump.c (dump_sframe_func_with_fres): Adjust the function start address for dumping. Now that both the emission of the new encoding, and the relocation of sections before dumping them is in place, it is time to adjust the testcases. gas/testsuite/ * gas/cfi-sframe/cfi-sframe-aarch64-1.d: Update expected output to include SFRAME_F_FDE_FUNC_START_PCREL instead of NONE. * gas/cfi-sframe/cfi-sframe-aarch64-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-aarch64-3.d: Likewise. * gas/cfi-sframe/cfi-sframe-aarch64-4.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-1.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-10.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-11.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-3.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-4.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-5.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-6.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-7.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-8.d: Likewise. * gas/cfi-sframe/cfi-sframe-common-9.d: Likewise. * gas/cfi-sframe/cfi-sframe-x86_64-1.d: Likewise. * gas/cfi-sframe/cfi-sframe-x86_64-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-x86_64-empty-1.d: Likewise. * gas/cfi-sframe/cfi-sframe-x86_64-empty-2.d: Likewise. * gas/cfi-sframe/cfi-sframe-x86_64-empty-3.d: Likewise. * gas/cfi-sframe/cfi-sframe-x86_64-empty-4.d: Likewise. * gas/cfi-sframe/common-empty-1.d: Likewise. * gas/cfi-sframe/common-empty-2.d: Likewise. * gas/cfi-sframe/common-empty-3.d: Likewise. * gas/scfi/x86_64/scfi-cfi-sections-1.d: Likewise. * gas/scfi/x86_64/scfi-dyn-stack-1.d: Likewise. ld/testsuite/ * ld-aarch64/sframe-simple-1.d: Update expected output to include SFRAME_F_FDE_FUNC_START_PCREL. * ld-x86-64/sframe-ibt-plt-1.d: Likewise. * ld-x86-64/sframe-plt-1.d: Likewise. * ld-x86-64/sframe-pltgot-1.d: Likewise. * ld-x86-64/sframe-pltgot-2.d: Likewise. * ld-x86-64/sframe-simple-1.d: Likewise. Naturally, the change of semantics for 'SFrame FDE function start address' has consequences on the implementation in libsframe. As per the new semantics: - Function start address in the SFrame FDE (sfde_func_start_address) is an offset from the FDE function start address field to the start PC of the associated function. Note that, the libsframe library brings the SFrame section contents into its own memory to create a sframe_decoder_ctx object via sframe_decode (). Many internal and user-interfacing APIs then may use sframe_decoder_ctx object to interact and fulfill the work. In context of changing semantics for sfde_func_start_address, following relevant examples may help understand the impact: - sframe_find_fre () finds a the SFrame stack trace data (SFrame FRE) given a lookup offset (offset of lookup_pc from the start of SFrame section). Now that the sfde_func_start_address includes the distance from the sfde_func_start_address field to the start of SFrame section itself, the comparison checks of sfde_func_start_address with the incoming lookup offset need adjustment. - Some internal functions (sframe_get_funcdesc_with_addr_internal () finds SFrame FDE by using binary seach comparing sfde_func_start_address fields, etc.) need adjustments. - sframe_encoder_write () sorts the SFrame FDEs before writing out the SFrame data. Sorting of SFrame FDE via the internal function sframe_sort_funcdesc() needs adjustments: the new encoding of sfde_func_start_address means the distances are not from the same anchor, so cannot be sorted directly. This patch takes the approach of adding a new internal function: - sframe_decoder_get_secrel_func_start_addr (): This function returns the offset of the start PC of the function from the start of SFrame section, i.e., it gives a section-relative offset. As the sframe_decoder_get_secrel_func_start_addr () API needs the value of the function index in the FDE list, another internal API needs sframe_fre_check_range_p () adjustments too. Sorting the FDEs (via sframe_sort_funcdesc ()) is done by first bringing all offsets in sfde_func_start_address relative to start of SFrame section, followed by sorting, and then readjusting the offsets accroding to the new position in the FDE list. libsframe/ * sframe.c (sframe_decoder_get_secrel_func_start_addr): New static function. (sframe_fre_check_range_p): Adjust the interface a bit. (sframe_get_funcdesc_with_addr_internal): Use sframe_decoder_get_secrel_func_start_addr () when comparing sfde_func_start_address with user input offset. (sframe_find_fre): Adopt the new semantics. (sframe_sort_funcdesc): Likewise. For the libsframe testsuite, use the new encoding for FDE func start addr: distance between the FDE sfde_func_start_address field and the start PC of the function itself. Use SFRAME_F_FDE_FUNC_START_PCREL flag, though the sframe_encode () interface in libsframe applies no sanity checks for the encoding itself. libsframe/testsuite/ * libsframe.find/findfre-1.c: Adjust to use the new SFRAME_F_FDE_FUNC_START_PCREL specific encoding. * libsframe.find/findfunc-1.c: Likewise. * libsframe.find/plt-findfre-1.c: Likewise. * libsframe/testsuite/libsframe.decode/DATA2: Update data file due to usage of new SFRAME_F_FDE_FUNC_START_PCREL flag. * libsframe/testsuite/libsframe.encode/encode-1.c: Use flag SFRAME_F_FDE_FUNC_START_PCREL.