aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-12-02aarch64: adapt bti-plt-so to use selectable GNU propertiesMatthieu Longo2-16/+3
2024-12-02aarch64: delete old tests covering the merge of feature markingsMatthieu Longo3-35/+0
2024-12-02aarch64: new tests covering the merge of feature markingsMatthieu Longo13-1/+290
2024-12-02aarch64: move tests for AArch64 protections (BTI, PAC) into a subfolderMatthieu Longo38-64/+122
- moved all the BTI and PAC tests into a new subfolder: "protections". bti-far-* bti-plt-* bti-pac-plt-* - move several procedures used only for AArch64 linker tests to a new exp library file aarch64-elf-lib.exp in ld/testsuite/ld-aarch64/lib. - use aarch64-elf-lib.exp in aarch64-ld.exp and aarch64-protections.exp.
2024-12-02gdb: handle DW_AT_entry_pc pointing at an empty sub-rangeAndrew Burgess4-1/+356
The test gdb.cp/step-and-next-inline.exp creates a test binary called step-and-next-inline-no-header. This test includes a function `tree_check` which is inlined 3 times. When testing with some older versions of gcc (I've tried 8.4.0, 9.3.1) we see the following DWARF representing one of the inline instances of tree_check: <2><8d9>: Abbrev Number: 38 (DW_TAG_inlined_subroutine) <8da> DW_AT_abstract_origin: <0x9ee> <8de> DW_AT_entry_pc : 0x401165 <8e6> DW_AT_GNU_entry_view: 0 <8e7> DW_AT_ranges : 0x30 <8eb> DW_AT_call_file : 1 <8ec> DW_AT_call_line : 52 <8ed> DW_AT_call_column : 10 <8ee> DW_AT_sibling : <0x92d> ... <1><9ee>: Abbrev Number: 46 (DW_TAG_subprogram) <9ef> DW_AT_external : 1 <9ef> DW_AT_name : (indirect string, offset: 0xe8): tree_check <9f3> DW_AT_decl_file : 1 <9f4> DW_AT_decl_line : 38 <9f5> DW_AT_decl_column : 1 <9f6> DW_AT_linkage_name: (indirect string, offset: 0x2f2): _Z10tree_checkP4treei <9fa> DW_AT_type : <0x9e8> <9fe> DW_AT_inline : 3 (declared as inline and inlined) <9ff> DW_AT_sibling : <0xa22> ... Contents of the .debug_ranges section: Offset Begin End ... 00000030 0000000000401165 0000000000401165 (start == end) 00000030 0000000000401169 0000000000401173 00000030 0000000000401040 0000000000401045 00000030 <End of list> ... Notice that one of the sub-ranges of tree-check is empty, this is the line marked 'start == end'. As the end address is the first address after the range, this range cover absolutely no code. But notice too that the DW_AT_entry_pc for the inline instance points at this empty range. Further, notice that despite the ordering of the sub-ranges, the empty range is actually in the middle of the region defined by the lowest address to the highest address. The ordering is not a problem, the DWARF spec doesn't require that ranges be in any particular order. However, this empty range is causing issues with GDB newly acquire DW_AT_entry_pc support. GDB already rejects, and has done for a long time, empty sub-ranges, after all, the DWARF spec is clear that such a range covers no code. The recent DW_AT_entry_pc patch also had GDB reject an entry-pc which was outside of the low/high bounds of a block. But in this case, the entry-pc value is within the bounds of a block, it's just not within any useful sub-range. As a consequence, GDB is storing the entry-pc value, and making use of it, but when GDB stops, and tries to work out which block the inferior is in, it fails to spot that the inferior is within tree_check, and instead reports the function into which tree_check was inlined. I've tested with newer versions of gcc (12.2.0 and 14.2.0) and with these versions gcc is still generating the empty sub-range, but now this empty sub-range is no longer the entry point. Here's the corresponding ranges table from gcc 14.2.0: Contents of the .debug_rnglists section: Table at Offset: 0: Length: 0x56 DWARF version: 5 Address size: 8 Segment size: 0 Offset entries: 0 Offset Begin End ... 00000021 0000000000401165 000000000040116f 0000002b 0000000000401040 (base address) 00000034 0000000000401040 0000000000401040 (start == end) 00000037 0000000000401041 0000000000401046 0000003a <End of list> ... The DW_AT_entry_pc is 0x401165, but this is not the empty sub-range, as a result, when GDB stops at the entry-pc, GDB will correctly spot that the inferior is in the tree_check function. The fix I propose here is, instead of rejecting entry-pc values that are outside the block's low/high range, instead reject entry-pc values that are not inside any of the block's sub-ranges. Now, GDB will ignore the prescribed entry-pc, and will instead select a suitable default entry-pc based on either the block's low-pc value, or the first address of the first range. I have extended the gdb.cp/step-and-next-inline.exp test to check this case, but this does depend on the compiler version being used (newer compilers will always pass, even without the fix). So I have also added a DWARF assembler test to cover this case. Reviewed-By: Kevin Buettner <kevinb@redhat.com>
2024-12-02x86: default to not accepting MPX insnsJan Beulich30-32/+38
Gcc9 had MPX support removed. While we don't want to remove support, require these deprecated insns (and registers) to be enabled explicitly.
2024-12-02x86: always set ISA_1_BASELINE property for 64-bit objectsJan Beulich22-23/+24
The baseline was, afaik, specifically chosen to align with the baseline ISA of x86-64. It therefore makes no sense to emit that property only conditionally; if anything it confuses tools analyzing the difference between generated object files, which may result from just added / changed / removed (entirely ISA-independent) code, without any change to the enabled extensions. Compilers, after all, are free to use these baseline "extensions" when generating 64-bit code. While changing the one testcase that needs adjustment, also correct its misleading name (to be in sync with the filename).
2024-12-02x86/COFF: support section-index relocations in insn operandsJan Beulich6-2/+63
On the grounds of the principle put down near the bottom of [1], along with image and section relative operations, let's also support as insn operands what .secidx is for on the data side (of course like elsewhere the reloc operator can then also be used for data generation, albeit a small tweak to x86_cons() is needed for this to work). [1] https://sourceware.org/pipermail/binutils/2024-November/137617.html
2024-12-02x86/COFF: support RVA (image-relative) relocations in insn operandsJan Beulich7-2/+154
As was pointed out in [1] compilers produce code using such constructs, and hence we'd better support this. In analogy to the .rva directive permit @rva to be used for this, and in analogy with other architectures (plus to not diverge from e.g. Clang's integrated assembler, albeit I haven't been able myself to confirm it knows this form) also permit @imgrel. While there also adjust the operand type specifier for the adjacent @secrel32 - 64-bit fields cannot be used with a 32-bit relocation. Further while there also deal with *-*-pe* in x86-64.exp, even if (right now) perhaps only for completeness. [1] https://sourceware.org/pipermail/binutils/2024-November/137548.html
2024-12-02testsuite, threads: add missing return statementsRohr, Stephan2-0/+5
Add missing return statements in * gdb.threads/process-exit-status-is-leader-exit-status.c * gdb.threads/next-fork-exec-other-thread.c to fix 'no return statement' compiler warnings, e.g.: process-exit-status-is-leader-exit-status.c: In function ‘start’: process-exit-status-is-leader-exit-status.c:46:1: warning: no return statement in function returning non-void [-Wreturn-type] 46 | } | ^ Approved-By: Simon Marchi <simon.marchi@efficios.com>
2024-12-02RISC-V: Add support for ssdbltrp and smdbltrp extension.Dongyan Chen5-2/+13
This implements the ssdbltrp extensons, version 1.0[1] and the smdbltrp extensions, version1.0[2]. [1] https://github.com/riscv/riscv-isa-manual/blob/main/src/ssdbltrp.adoc [2] https://github.com/riscv/riscv-isa-manual/blob/main/src/smdbltrp.adoc bfd/ChangeLog: * elfxx-riscv.c: Add 'ssdbltrp' and 'smdbltrp' to the list of konwn standard extensions. gas/ChangeLog: * NEWS: Updated. * testsuite/gas/riscv/imply.d: Ditto. * testsuite/gas/riscv/imply.s: Ditto. * testsuite/gas/riscv/march-help.l: Ditto.
2024-12-02Automatic date update in version.inGDB Administrator1-1/+1
2024-12-01Correct hpux-core.c thread_section_p signatureAlan Modra1-1/+1
Fix fallout from commit 0a1b45a20eaa.
2024-12-01Re: PR32399, buffer overflow printing core_file_failing_commandAlan Modra6-21/+31
Fix more potential buffer overflows, and correct trad-code.c and cisco-core.c where they should be using bfd_{z}alloc rather than bfd_{z}malloc. To stop buffer overflows with fuzzed objects that don't have a terminator on the core_file_failing_command string, this patch allocates an extra byte at the end of the entire header buffer rather than poking a NUL at the end of the name array (u_comm[] or similar) because (a) it's better to not overwrite the file data, and (b) it is possible that some core files make use of fields in struct user beyond the end of u_comm to extend the command name. The patch also changes some unnecessary uses of bfd_zalloc to bfd_alloc. There's not much point in clearing memeory that will shortly be completely overwritten. PR 32399 * aix5ppc-core.c (xcoff64_core_p): Allocate an extra byte to ensure the core_file_failing_command string is terminated. * netbsd-core.c (netbsd_core_file_p): Likewise. * ptrace-core.c (ptrace_unix_core_file_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * trad-core.c (trad_unix_core_file_p): Likewise, and bfd_alloc tdata rather than bfd_zmalloc. * cisco-core.c (cisco_core_file_validate): bfd_zalloc tdata.
2024-12-01Remove more remnants of old Mach-O workaroundoltolm1-1/+0
Remove another adjustment for section address, this time for the offset into .debug_str{,.dwo} read from .debug_str_offsets{,.dwo} by fetch_indexed_string. Signed-off-by: oltolm <oleg.tolmatcev@gmail.com>
2024-12-01Automatic date update in version.inGDB Administrator1-1/+1
2024-11-30Automatic date update in version.inGDB Administrator1-1/+1
2024-11-29s390: Fix linker test TLS -fpic and -fno-pic exec transitionsJens Remus1-5/+5
Commit 36bbf8646c8b ("s390: Treat addressing operand sequence as one in disassembler") changed how plain "nop" gets disassembled and missed to update any affected linker tests accordingly. ld/testsuite/ * ld-s390/tlsbin.dd: "nop" disassembles into "nop". Fixes: 36bbf8646c8b ("s390: Treat addressing operand sequence as one in disassembler") Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29s390: Simplify parsing of omitted index register operandJens Remus1-16/+8
The index register operand X in D(X,B) can optionally be omitted by coding D(,B) or D(B). Simplify the parsing logic. gas/ * config/tc-s390.c (md_gather_operands): Rename omitted_base_or_index to omitted_index and simplify logic. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29s390: Treat addressing operand sequence as one in disassemblerJens Remus2-19/+67
Reuse logic introduced with the preceding commit in the assembler to treat addressing operand sequences D(X,B), D(B), and D(L,B) as one with regards to optional last operands (i.e. optparm and optparm2). With this "nop" now disassembles into "nop" instead of "nop 0". opcodes/ * s390-dis.c (operand_count): New helper to count the remaining operands, treating D(X,B), D(B), and D(L,B) as one. (skip_optargs_p): New helper to test whether remaining operands are optional. (skip_optargs_zero_p): New helper to test whether remaining operands are optional and their values are zero. (s390_print_insn_with_opcode): Use skip_optargs_zero_p to skip optional last operands with a value of zero. gas/testsuite/ * gas/s390/zarch-optargs.d (nop): Adjust test case accordingly. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29s390: Treat addressing operand sequence as one in assemblerJens Remus1-14/+34
The assembler erroneously treated any number of operands as optional, if the instruction was flagged to have one or two optional operands (i.e. optparm or optparm2). Only treat the exact specified number of operands as optional while treating addressing operand sequences D(X,B), D(B), and D(L,B) as one operand. gas/ * config/tc-s390.c (operand_count): New helper to count the remaining operands, treating D(X,B), D(B), and D(L,B) as one. (skip_optargs_p): Use new helper operand_count to treat D(X,B), D(B), and D(L,B) as one operand. (md_gather_operands): Use skip_optargs_p to skip only the optional last operands. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29s390: Fix disassembly of optional addressing operandsJens Remus3-20/+106
"nop D1(B1)" erroneously disassembled into "nop D1(B1" (missing closing parenthesis). "nop D1(X1,0)" and "nop D1(X1,)" erroneously disassembled into "nop D1(X1)" (missing zero base register) instead of "nop D1(X1,0)". Do not skip disassembly of optional operands if they are index (X) or base (B) registers or length (L) in an addressing operand sequence "D(X,B)", "D(B)", or "D(L,B). Index and base register operand values of zero are being handled separately, as they may not be omitted unconditionally. For instance a base register value of zero must be printed in above mentioned case, to distinguish the index from the base register. This also ensures proper formatting of addressing operand sequences. While at it add further test cases for instructions with optional operands. opcodes/ * s390-dis.c (s390_print_insn_with_opcode): Do not unconditionally skip disassembly of optional operands with a value of zero, if within an addressing operand sequence. gas/testsuite/ * gas/s390/zarch-optargs.d: Add further test cases for instructions with optional operands. * gas/s390/zarch-optargs.s: Likewise. Reported-by: Florian Krohm <flo2030@eich-krohm.de> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2024-11-29x86: restrict gas'es recognition of -s to SolarisJan Beulich1-3/+8
When there for Solaris compatibility only, also recognize it only there. This way the option becomes available for other possible uses. While adjusting md_shortopts[], also re-arrange things such that we have only a single, uniform definition of it.
2024-11-29x86/Solaris: support Sun form of CMOVccJan Beulich4-0/+80
Sun specifies an alternative form for CMOVcc [1], which for some reason we never cared to support, even if - as per gcc's configure checking for it - it may have been the only permitted form at some point. While documentation doesn't indicate FCMOVcc to have similar alternative forms, gcc assumes so. Hence cover FCMOVcc as well. [1] https://docs.oracle.com/cd/E37838_01/html/E61064/ennbz.html#XALRMeoizm
2024-11-29x86: purge most *avx512*ig*-intel testsJan Beulich24-6996/+4
Having just one each (AVX512F) ought to be sufficient to cover Intel syntax disassembly. In x86-64.exp also reorder tests some, so that related ones are again next to each other, rather than being interspersed with APX ones.
2024-11-29x86: SETcc doesn't permit W suffixJan Beulich2-31/+31
Accidentally I had removed No_wSuf when cloning the extra template.
2024-11-29MAINTAINERS: Update Peter Bergner's e-mail addressSurya Kumari Jangala1-1/+1
2024-11-29PR32399, buffer overflow printing core_file_failing_commandAlan Modra6-7/+12
Assorted targets do not check, as the ELF targets do, that the program name in a core file is NUL terminated. Fix some of them. I haven't attempted to fix all targets because editing host specific code can easily result in build bugs, which aren't discovered until someone build binutils for that host. (Of the files edited here, I can't easily compile hpux-core.c and osf-core.c on a linux system.) PR 32399 * hppabsd-core.c (hppabsd_core_core_file_p): Ensure core_command string is terminated. * hpux-core.c (hpux_core_core_file_p): Likewise. * irix-core.c (irix_core_core_file_p): Likewise. * lynx-core.c (lynx_core_file_p): Likewise. * osf-core.c (osf_core_core_file_p): Likewise. * mach-o.c (bfd_mach_o_core_file_failing_command): Likewise.
2024-11-29Automatic date update in version.inGDB Administrator1-1/+1
2024-11-28Sync include/dwarf.h with gcc up to commit c4073a3d154Alexandra Hájková1-0/+26
Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-11-28[gdb/syscalls] Add syscalls {set,get,list,remove}xattratTom de Vries24-0/+96
In commit 58776901074 ("[gdb/syscalls] Update to linux v6.11") I updated to linux v6.11, but a recent submission for loongarch [1] used a current trunk version, so it makes sense to do this as well elsewhere. Using linux current trunk with update-linux-from-src.sh gets us 4 more syscalls: - setxattrat - getxattrat - listxattrat - removexattrat Tested on x86_64-linux. [1] https://sourceware.org/pipermail/gdb-patches/2024-November/213613.html
2024-11-28Automatic date update in version.inGDB Administrator1-1/+1
2024-11-27Fix 32392 [2.44 Regression] gprofng fails to build on i686-linux-gnuVladimir Mezentsev1-42/+9
gprofng/ChangeLog 2024-11-26 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/32392 * libcollector/libcol_util.c (__collector_util_init): Fix warning.
2024-11-27gprofng: skip unrecognized input commandVladimir Mezentsev3-3/+18
gprofng crashes when the GUI sends an invalid command. Skip unrecognized commands and return an error status to the GUI. gprofng/ChangeLog 2024-11-26 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * src/ipc.cc (ipc_doWork): Skip unrecognized commands. * src/ipcio.cc (writeError): New function. * src/ipcio.h: Add RESPONSE_STATUS_ERROR.
2024-11-27gdb/testsuite: skip gdb.threads/omp-par-scope.exp with clangGuinevere Larsen1-0/+8
Since 2020 it has been reported to clang[1] that the debug information around OpenMP is insufficient. The OpenMP section is not declared within the correct scope, and instead clang marks as if the section was a function in the global scope. This causes several failures in the test gdb.threads/omp-par-scope.exp when using clang to test GDB. Since this isn't a true failure of GDB, and there is little expectation that clang will be able to fix this soon, this commit disables the aforementioned test when clang is being used. [1] https://github.com/llvm/llvm-project/issues/44236 Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-11-27[gdb/symtab] Fix parent map dumpTom de Vries4-12/+36
Before the fix for PR symtab/32225, the parent map dump showed a mapping from section offsets to cooked index entries: ... 0x0000000000000035 0x3ba9560 (0x34: sp1::A) ... but now that's no longer the case: ... 0x00000000406f5405 0x410a04d0 (0x34: sp1::A) ... Fix this by extending the annotation somewhat, such that we get: ... map start: 0x0000000012c52405 0x135fd550 (section: .debug_info, offset: 0x35) -> (0x34: sp1::A) ... Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32225
2024-11-27[gdb/testsuite] Add gdb.dwarf2/dw2-tu-dwarf-4-5.expTom de Vries3-0/+173
Add a regression test for PR symtab/32225. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32225
2024-11-27[gdb/symtab] Fix parent map when handling .debug_info and .debug_typesAuthor: Tom Tromey2-14/+9
Consider test-case: ... $ cat test.c namespace sp1 { class A { int i; const int f1 = 1; ... const int f29 = 1; }; } sp1::A a; void _start (void) {} $ cat test2.c namespace sp2 { class B { float f; const float f1 = 1; ... const float f29 = 1; }; } sp2::B b; ... compiled like this: ... $ g++ test.c -gdwarf-4 -c -g -fdebug-types-section $ g++ test2.c -gdwarf-5 -c -g -fdebug-types-section $ g++ -g test.o test2.o -nostdlib ... Using: ... $ gdb -q -batch -iex "maint set worker-threads 0" a.out -ex "maint print objfiles" ... we get a cooked index entry with incorrect parent: ... [29] ((cooked_index_entry *) 0x3c57d1a0) name: B canonical: B qualified: sp1::A::B DWARF tag: DW_TAG_class_type flags: 0x0 [] DIE offset: 0x154 parent: ((cooked_index_entry *) 0x3c57d110) [A] ... The problem is that the parent map assumes that all offsets are in the same section. Fix this by using dwarf2_section_info::buffer-relative addresses instead, which get us instead: ... [29] ((cooked_index_entry *) 0x3f0962b0) name: B canonical: B qualified: sp2::B DWARF tag: DW_TAG_class_type flags: 0x0 [] DIE offset: 0x154 parent: ((cooked_index_entry *) 0x3f096280) [sp2] ... Tested on x86_64-linux. PR symtab/32225 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32225
2024-11-27[gdb/tdep] s390: Add arch15 record/replay supportAndreas Arnez1-3/+75
Enable recording of the new "arch15" instructions on z/Architecture targets.
2024-11-27PE LD: Merge .CRT .ctors and .dtors into .rdataLiu Hao17-165/+172
PR 32264
2024-11-27Tidy up the default ELF linker scriptNick Clifton1-122/+352
2024-11-27Re: nios2: Remove binutils support for Nios II targetAlan Modra6-14/+1
Remove a now unused config file, regenerate POTFILES to remove nios2 refs, and modify config.bfd to report the target is obsolete.
2024-11-27Automatic date update in version.inGDB Administrator1-1/+1
2024-11-26nios2: Remove binutils support for Nios II target.Sandra Loosemore337-23162/+12
The Nios II architecture has been EOL'ed by the vendor. This patch removes all binutils, bfd, gas, binutils, and opcodes support for this target with the exception of the readelf utility. (The ELF EM_* number remains valid and the relocation definitions from the Nios II ABI will never change in future, so retaining the readelf support seems consistent with its purpose as a utility that tries to parse the headers in any ELF file provided as an argument regardless of target.)
2024-11-26nios2: Remove all GDB support for Nios II targets.Sandra Loosemore24-3326/+6
Intel has EOL'ed the Nios II architecture, and it's time to remove support from all toolchain components before it gets any more bit-rotten from lack of maintenance or regular testing.
2024-11-26[gdb/syscalls] Update aarch64-linux.xml to linux v6.11Tom de Vries3-9/+144
Use gdb/syscalls/update-linux.sh to update aarch64-linux.xml.in to linux v6.11, and update aarch64-linux.xml by running make. Noteworthy changes are removal of entries: - arch_specific_syscall - syscalls which look like they were added accidentally. I modified update-linux.sh to keep the copyright start date. Verified with shellcheck. Tested-By: Luis Machado <luis.machado@arm.com> Approved-By: Luis Machado <luis.machado@arm.com>
2024-11-26PR32387 ppc64 TLS optimization bug with -fno-plt codeAlan Modra1-0/+9
The inline plt code emitted by gcc is incompatible with the linker/ld.so --tls-get-addr-optimize scheme. This is the runtime optimisation where the first call to __tls_get_addr results in __tls_get_addr updating the tls_index pair, then the special linker stub using that to short-circuit second and subsequent calls for a given tls symbol. Enabled by default when the linker sees __tls_get_addr_opt is preseent, and enabled in ld.so when DT_PPC64_OPT has PPC64_OPT_TLS set. Note that this is distinct from link-time tls optimisation. PR 32387 * elf64-ppc.c (ppc64_elf_check_relocs): Disable tls_get_addr_opt on detecting inline plt calls to __tls_get_addr.
2024-11-26[gdb/syscalls] Sync with strace v6.12Tom de Vries13-12/+13
I ran gdb/syscalls/update-linux-defaults.sh with strace sources v6.12, and got one difference in gdb/syscalls/linux-defaults.xml.in: ... + <syscall name="mseal" groups="memory"/> ... Rerun make to propagate this change to the xml files.
2024-11-26[gdb/syscalls] Use update-linux-from-src.sh for arm-linuxTom de Vries4-85/+235
I tried to use arm-linux.py to regenerate arm-linux.xml.in, but it didn't work. Fix this by: - adding handling of arm-linux.xml.in in update-linux-from-src.sh, - regenerating arm-linux.xml.in using update-linux-from-src.sh and linux 6.11 sources, - regenerating arm-linux.xml using make, and - removing arm-linux.py. This changes the name "oldolduname" into "olduname". Tested on arm-linux. Verified with shellcheck.
2024-11-26[gdb/syscalls] Restructure update-linux-from-src.shTom de Vries1-13/+72
Restructure update-linux-from-src.sh to do the generation of each line in the script it self rather than in awk. Tested on aarch64-linux. Verified with shellcheck.