aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-10-04x86: prune OBJ_MAYBE_... usesJan Beulich3-169/+113
With the removal of emulations, OBJ_MAYBE_... can no longer be defined. Tidy code wherever they're used, which also includes the dropping of most IS_ELF and uses and checks of OUTPUT_FLAVOR. Where touching such constructs anyway, also drop TE_PEP checks when used together with TE_PE ones (the former implies the latter).
2024-10-04x86: drop largely defunct gas emulationsJan Beulich10-185/+2
Both ELF and COFF have various sub-flavors, each of which would then require its own emulation: Right now when configuring a COFF/PE secondary target (with perhaps an ELF primary one), one gets plain COFF emulation rather than COFF/PE one. As such a multitude of emulations would be unwieldy (and likely fragile) drop gas emulations altogether instead.
2024-10-04include: de-duplicate i386.h and x86_64.hJan Beulich4-73/+62
Move common definitions to a new x86.h, thus allowing gas'es obj-coff.h to include just that, getting rid of a TE_PEP compile-time dependency.
2024-10-04gas: drop generate_asm_lineno emulation hookJan Beulich5-14/+0
It's not wired up, so can't be used.
2024-10-04gas: don't use COFF-specific SF_SET_LOCAL() directly from read.cJan Beulich8-3/+23
Make this a proper obj-format hook instead.
2024-10-04gas/dw2gencfi: correct .sframe section conditionalJan Beulich1-6/+5
While originally this was in preparation of a subsequent change making SUPPORT_FRAME_LINKONCE potentially dependent on a global variable, the construct appears unlikely to have been correct in the first place: The variable would have been passed reliably uninitialized when SUPPORT_FRAME_LINKONCE is build-time true. While there correct indentation of the parameters passed to get_cfi_seg().
2024-10-04gas: put emul decls in emul.hJan Beulich3-5/+5
The individual struct emulation instances shouldn't be declared in a .c file; it and the producers of the symbols want to both see the declarations, so declarations and definitions don't go out of sync. Move these declarations to emul.h. While there also adjust the conditional around this_format: That symbol is never #define-d anywhere, and it's needed only when USE_EMULATIONS is defined. (Really, when obj-multi isn't in use, it also is effectively only ever written to.)
2024-10-04gas: drop unused fields from struct emulationJan Beulich9-76/+0
Neither .match not .bfd_name appear to ever have been used in the last about 25 years. Purge them.
2024-10-04MAINTAINERS: move M R Swami Reddy to Past MaintainersJan Beulich1-2/+1
He/she cannot be reached at the given address anymore, and the name is apparently too common to identify the person to attempt to establish another contact. Sadly this orphans the CR16 and CRx ports.
2024-10-04MAINTAINERS: move Matt Thomas to Past MaintainersJan Beulich1-2/+1
Matt cannot be reached at the @netbsd.org address anymore, and I was unable to find another one, even with the help of the NetBSD community (where his resigning was announced over 4 years ago [1]). [1] http://mail-index.netbsd.org/netbsd-announce/2020/05/07/msg000314.html
2024-10-04Automatic date update in version.inGDB Administrator1-1/+1
2024-10-03gdb-dap: disable events when deleting breakpointsoltolm1-3/+3
when I disable a breakpoint in VS Code the breakpoint is removed instead. I compared the behavior to lldb-dap and disabled events when removing a breakpoint. Now it is possible to disable and enable breakpoints in VS Code.
2024-10-03bfd: fix unnecessary bfd.info regenAlexey Izbyshev2-2/+2
When building from an unmodified release tarball, a REGEN_TEXI invocation is supposed to create a symlink to the .texi file in the source directory and discard the newly generated .tmp file. However, after commit bd32be01c997 ("bfd: merge doc subdir up a level") it creates the symlink at the wrong level, and then a .texi with a fresh timestamp, which in turn forces bfd.info regeneration. This breaks builds in environments without makeinfo program. Fix this by creating the symlink at the level of the target stamp. Fixes: bd32be01c997 ("bfd: merge doc subdir up a level") Signed-off-by: Alexey Izbyshev <izbyshev@ispras.ru>
2024-10-03peicode.h formattingAlan Modra1-69/+76
Fix some overlong line, comment block style, whitespace issues.
2024-10-03Enable dlltool --leading-underscore for targets other than x86Alan Modra2-57/+7
This also makes the dlltool tests run more PE targets, finding that sh-pe dlltool reports "Machine 'sh' not supported". I guess no one cares about that. PR19459 * dlltool.c (asm_prefix): Remove "mach" parameter. Return leading_underscore independent of machine. (ASM_PREFIX): Adjust. * testsuite/binutils-all/dlltool.exp: Run on any target satisfying is_pecoff_format for which dlltool is built. Revert commit 0398b8d6c86a. Remove target_xfail.
2024-10-03dlltool leading_underscoreAlan Modra1-42/+25
This patch tidies dlltool code dealing with adding a leading underscore to generated symbol names. There should be no functional change here, but there could be if we ever have a bfd target with symbol_leading_char something other than '_' or 0. * dlltool.c (leading_underscore): Change from an int to a char*. Update all uses. If neither --leading-underscore or --no=leading-underscore is given, set leading_underscore to a string with first char returned by bfd_get_target_info as the target's symbol underscoring.
2024-10-03nm: don't try to print line numbers for symbols without namesAlan Modra1-3/+3
It doesn't make much sense trying to print line numbers for what are usually broken symbols, and there is a possibility of a segfault if we pass strcmp a NULL.
2024-10-03Don't return "(null)" from bfd_elf_sym_nameAlan Modra6-24/+24
A NULL return from bfd_elf_string_from_elf_section indicates an error. That shouldn't be masked by bfd_elf_sym_name but rather passed up to callers such as group_signature. If we want to print "(null)" then that should be done at a higher level. That's what this patch does, except that I chose to print "<null>" instead, like readelf. If we see "(null)" we're probably passing a NULL to printf. I haven't changed aoutx.h or pdp11.c print_symbol functions because they already handle NULL names by omitting the name. I also haven't changed mach-o.c, mmo.c, som.c, srec.c, tekhex.c, vms-alpha.c and wasm-module.c print_symbol function because it looks like they will never have NULL symbol names. bfd/ * elf.c (bfd_elf_sym_name): Don't turn a NULL name into a pointer to "(null)". (bfd_elf_print_symbol): Print "<null>" for NULL symbol names. * coffgen.c (coff_print_symbol): Likewise. * ecoff.c (_bfd_ecoff_print_symbol): Likewise. * pef.c (bfd_pef_print_symbol): Likewise. * syms.c (bfd_symbol_info): Return "<null>" in symbol_info.name if symbol name is NULL. ld/ * ldlang.c (ld_is_local_symbol): Don't check for "(null)" symbol name.
2024-10-03Automatic date update in version.inGDB Administrator1-1/+1
2024-10-02gprofng: fix a problem with hardware event countersRuud van der Pas1-325/+441
Fix a bug where an experiment with hardware event counter data causes the source and disassembly files not to be generated. No longer suppress zero valued metrics and change the name of the man page in a warning message. Adapt line lengths to not exceed 79. gprofng/ChangeLog 2024-09-24 Ruud van der Pas <ruud.vanderpas@oracle.com> PR 32193 PR 32199 PR 32201 * gp-display-html/gp-display-html.in: Implement all the above changes.
2024-10-02gdb: more file name stylingAndrew Burgess4-23/+41
While looking at the recent line number styling commit I noticed a few places where we could add more file name styling. So lets do that. Approved-By: Tom Tromey <tom@tromey.com>
2024-10-02Add support for IMPORT_NAME_EXPORTAS in ILF (MSVC style) import librariesMartin Storsjö2-7/+37
This import name type is formally yet undocumented, but MSVC produces/supports it, primarily for ARM64EC import libraries. LLVM/LLD also supports this import name type. Since recently, llvm-dlltool also uses this type for certain kinds of renamed imports (that are easy to do in the long style import libraries produced by GNU dlltool, but require this name type in short import libraries). This name type contains a third string, in addition to the symbol name and the DLL name, indicating the actual imported name to reference in the import tables - which now can be distinct different from the symbol name on the object file level. https://github.com/llvm/llvm-project/commit/8f23464a5d957242c89ca6f33d4379c42519cd81 and https://github.com/llvm/llvm-project/commit/7b275aa2438c22604505d618dd37ee60052f2800 show how this import name type was added in LLVM. Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-02Automatic date update in version.inGDB Administrator1-1/+1
2024-10-01Introduce and use operation::type_pTom Tromey7-20/+32
There's currently code in gdb that checks if an expression evaluates to a type. In some spots this is done by comparing the opcode against OP_TYPE, but other spots more correctly also compare with OP_TYPEOF and OP_DECLTYPE. This patch cleans up this area, replacing opcode-checking with a new method on 'operation'. Generally, checking the opcode should be considered deprecated, although it's unfortunately difficult to get rid of opcodes entirely. I also took advantage of this change to turn eval_op_type into a method, removing a bit of indirection. Reviewed-by: Keith Seitz <keiths@redhat.com>
2024-10-01Automatic date update in version.inGDB Administrator1-1/+1
2024-10-01Re: dlltool: file name too longAlan Modra1-36/+22
Allow for "snnnnn.o" suffix when testing against NAME_MAX, and tidy TMP_STUB handling by overwriting a prior nnnnn.o string rather than copying the entire name. * dlltool.c (TMP_STUB): Add "nnnnn.o" to format. (make_one_lib_file): Localise variables. Don't copy TMP_STUB, overwrite suffix instead. (gen_lib_file): Similarly. (main): Allow for max suffix when testing against NAME_MAX.
2024-10-01segv in read_a_source_fileAlan Modra1-0/+1
On some paths through read_a_source file, "s" may not be set. * read.c (read_a_source_file): Correct code ignoring comment.
2024-10-01segv in bfd_elf_get_str_sectionAlan Modra2-2/+3
Attempting to write a termination NUL to PROT_READ mmap'd memory was a silly idea. PR 32109 * elf.c (bfd_elf_get_str_section): Don't write terminating NUL if missing. * libbfd.c (_bfd_munmap_readonly_temporary): Correct comment.
2024-09-30Add line-number stylingTom Tromey28-55/+131
This patch adds separate styling for line numbers. That is, whenever gdb prints a source line number, it uses this style. v2 includes a change to ensure that %ps works in query. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Reviewed-by: Keith Seitz <keiths@redhat.com>
2024-09-30Improve the placement of orphan note sections.Nick Clifton14-13/+71
PR 32219
2024-09-30gdb: fix filename completion in the middle of a lineAndrew Burgess2-4/+189
I noticed that filename completion in the middle of a line doesn't work as I would expect it too. For example, assuming '/tmp/filename' exists, and is the only file in '/tmp/' then when I do the following: (gdb) file "/tmp/filen<TAB> GDB completes to: (gdb) file "/tmp/filename" But, if I type this: (gdb) file "/tmp/filen "xxx" Then move the cursor to the end of '/tmp/filen' and press <TAB>, GDB will complete the line to: (gdb) file "/tmp/filename "xxx" But GDB will not insert the trailing double quote character. The reason for this is found in readline/readline/complete.c in the function append_to_match. This is the function that appends the trailing closing quote character, however, the closing quote is only inserted if the cursor (rl_point) is at the end (rl_end) of the line being completed. In this patch, what I do instead is add the closing quote in the function gdb_completer_file_name_quote, which is called from readline through the rl_filename_quoting_function hook. The docs for rl_filename_quoting_function say (see 'info readline'): "... The MATCH_TYPE is either 'SINGLE_MATCH', if there is only one completion match, or 'MULT_MATCH'. Some functions use this to decide whether or not to insert a closing quote character. ..." This is exactly what I'm doing in this patch, and clearly this is not an unusual choice. Now after completing a filename that is not at the end of the line GDB will add the closing quote character if appropriate. I have managed to write some tests for this. I send a line of text to GDB which includes a partial filename followed by a trailing string, I then send the escape sequence to move the cursor left, and finally I send the tab character. Obviously, expect doesn't actually see the complete output with the extra text "in place", instead expect sees the original line followed by some escape sequences to reflect the cursor movement, then an escape sequence to indicate that text is being inserted in the middle of a line, followed by the new characters ... it's a bit messy, but I think it holds together. Reviewed-By: Tom Tromey <tom@tromey.com>
2024-09-30gdb: fix for completing a second filename for a commandAndrew Burgess2-103/+121
After the recent filename completion changes I noticed that the following didn't work as expected: (gdb) file "/path/to/some/file" /path/to/so<TAB> Now, I know that the 'file' command doesn't actually take multiple filenames, but currently (and this was true before the recent filename completion changes too) the completion function doesn't know that the command only expects a single filename, and should complete any number of filenames. And indeed, this works: (gdb) file "/path/to/some/file" "/path/to/so<TAB> In this case I quoted the second path, and now GDB is happy to offer completions. It turns out that the problem in the first case is an off-by-one bug in gdb_completer_file_name_char_is_quoted. This function tells GDB if a character within the line being completed is escaped or not. An escaped character cannot be a word separator. The algorithm in gdb_completer_file_name_char_is_quoted is to scan forward through the line keeping track of whether we are inside double or single quotes, or if a character follows a backslash. When we find an opening quote we skip forward to the closing quote and then check to see if we skipped over the character we are looking for, if we did then the character is within the quoted string. The problem is that this "is character inside quoted string" check used '>=' instead if '>'. As a consequence a character immediately after a quoted string would be thought of as inside the quoted string. In our first example this means that the single white space character after the quoted string was thought to be quoted, and was not considered a word breaking character. As such, GDB would not try to complete the second path. And indeed, if we tried this: (gdb) file "/path/to/some/file" /path/to/so<TAB> That is, place multiple spaces after the first path, then GDB would consider the first space as quoted, but the second space is NOT quoted, and would be a word break. Now GDB does complete the second path. By changing '>=' to '>' in gdb_completer_file_name_char_is_quoted this bug is resolved, now the original example works and GDB will correctly complete the second path. For testing I've factored out the core of one testing proc, and I now run those tests multiple times, once with no initial path, once with an initial path in double quotes, once with an initial path in single quotes, and finally, with an unquoted initial path. Reviewed-By: Tom Tromey <tom@tromey.com>
2024-09-30gdb/MAINTAINERS: add myself to maintainersGerlicher, Klaus1-0/+1
2024-09-30gdb: Remove myself as x86 maintainer and update my emailFelix Willgerodt1-3/+2
2024-09-30gdb, testsuite: clean duplicate header includesGerlicher, Klaus14-15/+0
Some of the gdb and testsuite files double include some headers. While all headers use include guards, it helps a bit keeping the code base tidy. No functional change. Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-09-30Automatic date update in version.inGDB Administrator1-1/+1
2024-09-29Automatic date update in version.inGDB Administrator1-1/+1
2024-09-28[gdb/symtab] Dump m_all_parents_map for verbose debug dwarf-readTom de Vries4-7/+75
[ This is based on "[gdb/symtab] Add parent_map::dump" [1]. ] When building the cooked index, gdb builds up a parent map. This map is currently only visible at user level through the effect of using it, but it's useful to be able to inspect it as well. Add dumping of this parent map for "set debug dwarf-read 2". As example, take test-case gdb.dwarf2/enum-type-c++.exp with target board debug-types. The parent map looks like: ... $ gdb -q -batch \ -iex "maint set worker-threads 0" \ -iex "set debug dwarf-read 2" \ outputs/gdb.dwarf2/enum-type-c++/enum-type-c++ ... [dwarf-read] print_stats: Final m_all_parents_map: map start: 0x0000000000000000 0x0 0x0000000000000037 0x20f27d30 (0x36: ec) 0x0000000000000051 0x0 0x000000000000008b 0x20f27dc0 (0x8a: A) 0x00000000000000a6 0x0 ... There's no parent entry at address 0xd6, which is part of what causes this: ... (gdb) FAIL: gdb.dwarf2/enum-type-c++.exp: val1 has a parent ... With the series containing the proposed fix applied [2], we get instead: ... [dwarf-read] print_stats: Final m_all_parents_map: map start: 0x0000000000000000 0x0 0x0000000000000026 0x7e0bdc0 (0x25: ns) 0x0000000000000036 0x0 0x0000000000000037 0x7e0bdf0 (0x36: ns::ec) 0x0000000000000051 0x0 0x000000000000007f 0x7e0be80 (0x7e: ns) 0x000000000000008a 0x0 0x000000000000008b 0x7e0beb0 (0x8a: ns::A) 0x00000000000000a6 0x0 0x00000000000000cc 0x7e0bf10 (0xcb: ns) 0x00000000000000d4 0x7e0bf40 (0xd3: ns::A) 0x00000000000000dc 0x7e0bf10 (0xcb: ns) 0x00000000000000dd 0x7e0bf40 (0xd3: ns::A) 0x00000000000000f6 0x0 ... and find at 0xd6 parent ns::A. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> [1] https://sourceware.org/pipermail/gdb-patches/2023-October/202883.html [2] https://sourceware.org/pipermail/gdb-patches/2024-September/211958.html
2024-09-28gas buffer overflow with --listing-rhs-widthAlan Modra1-5/+18
With listings enabled, gas keeps a small cache of source lines. They are stored in buffers of size LISTING_RHS_WIDTH, ie. 100. Given listing-rhs-width larger than 100 it is of course possible to overflow the buffer. Fix that by allocating as needed. We could allocate all buffers on the first call to print_source using listing_rhs_width, but I chose not to do that in case some future assembly directive allows changes to listing_rhs_width similarly to the way paper_width can change during assembly.
2024-09-28Move uses_elf_em to ld-lib.expAlan Modra2-21/+9
and add a missing entry from uses_genelf. binutils/ * testsuite/lib/binutils-common.exp (uses_elf_em): Delete. ld/ * testsuite/lib/ld-lib.exp (uses_genelf): Add moxie-*-moxiebox. (uses_elf_em): New.
2024-09-28Automatic date update in version.inGDB Administrator1-1/+1
2024-09-27Re-run 'isort' on gdb testsTom Tromey1-0/+1
Re-running 'isort' (via pre-commit) showed that the file py-read-memory-leak.py (from the gdb test suite) needed a small patch.
2024-09-27gdb/symtab: pass program space to lookup_symtab and iterate_over_symtabsSimon Marchi9-46/+37
Make the current program space references bubble up. In collect_symtabs_from_filename, remove the calls to set_current_program_space and just pass the relevant pspaces. This appears safe to do, because nothing in the `collector` callback cares about the current pspace. Change-Id: I00a7ed484bfbe5264f01a6abf0d33b51de373cbb Reviewed-by: Keith Seitz <keiths@redhat.com>
2024-09-27x86: fix Solaris gas testsuite runJan Beulich1-1/+9
Commits 8015b1b0c1a1 ("x86-64: Never make R_X86_64_GOT64 section relative"), d774bf9b3623 ("x86: Add tls check in gas"), and 1b714c14e40f ("x86: Turn PLT32 to PC32 only for PC-relative relocations") all should have adjusted the Solaris counterpart of the reloc64 test as well.
2024-09-27RISC-V: odd data padding vs mapping symbolsJan Beulich3-5/+30
Odd data padding has a $d label inserted at its beginning. When a $x... label is removed instead, a replacement is inserted after the padding. The same, however, needs to also happen when there's no $x to replace.
2024-09-27RISC-V: correct alignment directive handling for text sectionsJan Beulich7-18/+218
.insn or data emitted inside text sections can lead to positions not being at insn granularity. In such situations using alignment directives should reliably enforce the requested alignment. Specifically requests to align back to insn granularity may not be ignored (where, as a subcase thereof, the ordering of ".option norvc" and e.g. ".p2align 2" should not matter; so far the alignment directive needs to come first to have any effect). Similarly ahead of emitting NOPs alignment first needs to be forced back to insn granularity. The new testcases actually point out a corner case issue in the disassembler as well, which is being corrected at the same time: We don't want to print "0x" without any subsequent digits.
2024-09-27x86: optimize {,V}INSERTPS with certain immediatesJan Beulich12-7/+209
They are equivalent to simple moves or xors, which are up to 3 bytes shorter to encode (and maybe/likely also cheaper to execute).
2024-09-27x86: optimize {,V}EXTRACT{F,I}{128,32x{4,8},64x{2,4}} with immediate 0Jan Beulich11-20/+316
They, too, are equivalent to simple moves, which are up to 3 bytes shorter to encode (and maybe also cheaper to execute).
2024-09-27x86: optimize {,V}EXTRACTPS with immediate 0Jan Beulich12-12/+126
They are equivalent to simple moves, which are up to 2 bytes shorter to encode (and maybe also cheaper to execute).
2024-09-27x86: correct {,V}PEXTR{D,Q} optimizationJan Beulich1-0/+1
A possible relocation associated with a memory operand also needs moving.