aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-01-20Add testcase ld-elf/merge4Michael Matz4-0/+55
to check a situation that once failed with the new section merging when it mishandled offsets pointing into alignment padding in mergable string sections (i.e. pointing to zeros). It made bootstrap.exp fail but that depends on many factors to actually go wrong so this is a more explicit variant of it.
2023-01-20arm32: Fix rodata-merge-mapMichael Matz2-4/+4
the test expects a second, but useless, $d mapping symbol for the partially merged section, and specifically disallows one for the completely merged section. The new merging algorithm makes it so that also the partially merged sections are conceptually SEC_EXCLUDED, except the first merge section (e.g. as if the very first object file already contains all strings). So that second mapping symbol is now missing. It never was needed anyway. So, adjust the test.
2023-01-20Faster string mergingMichael Matz5-304/+739
* use power-of-two hash table * use better hash function (hashing 32bits at once and with better mixing characteristics) * use input-offset-to-entry maps instead of retaining full input contents for lookup time * don't reread SEC_MERGE section multiple times * care for cache behaviour for the hot lookup routine The overall effect is less usage in libz and much faster string merging itself. On a debug-info-enabled cc1 the effect at the time of this writing on the machine I used was going from 14400 perf samples to 9300 perf samples or from 3.7 seconds to 2.4 seconds, i.e. about 33% .
2023-01-20Add OpenBSD ARM GAS support.Frederic Cambus2-1/+5
2023-01-20x86: split i386-gen's opcode hash entry structJan Beulich1-23/+28
All glibc malloc() implementations I've checked have a smallest allocation size worth of 3 pointers, with an increment worth of 2 pointers. Hence mnemonics with multiple templates can be stored more efficiently when maintaining the shared "name" field only in the actual hash entry. (To express the shared nature, also convert "name" to by pointer-to-const.) While doing the conversation also pull out common code from the involved if/else construct in expand_templates().
2023-01-20x86: embed register and alike names in disassemblerJan Beulich1-34/+34
Register names are (including their nul terminators) on average almost 4 bytes long. Otoh no register name is longer than 8 bytes. Hence even for 32-bit builds using a pointer is only slightly more space efficient than embedding the strings. A level of indirection can be also avoided by embedding the names as an array of 8 characters directly in the arrays, and the number of base relocations in libopcodes.so (or PIE builds of statically linked executables) goes down as well. To amortize for the otherwise reduced folding of string literals by the linker, use att_names_seg[] in place of string literals in append_seg() and OP_ESreg().
2023-01-20x86: embed register names in reg_entryJan Beulich1-1/+1
Register names are (including their nul terminators) on average almost 4 bytes long. Otoh no register name is longer than 7 bytes. Hence even for 32-bit builds using a pointer is only slightly more space efficient than embedding the strings. A level of indirection can be also avoided by embedding the names as an array of 8 characters directly in the struct, and the number of base relocations in PIE builds of gas goes down as well.
2023-01-20x86: avoid strcmp() in a few placesJan Beulich1-11/+11
Now that we have identifiers for the mnemonic strings we can avoid strcmp() in a number of places, comparing the offsets into the mnemonic string table instead. While doing this also - convert a leftover strncmp() to startswith() (apparently an oversight when rebasing the original patch introducing the startswith() uses), - use the new shorthand for current_templates->start also elsewhere in md_assemble() (valid up to the point where match_template() is called).
2023-01-20x86: absorb allocation in i386-genJan Beulich1-2/+5
When generating the mnemonic string table we already set up an identifier for the following entry in a number of cases. Re-use that on the next loop iteration rather than re-doing allocation and conversion.
2023-01-20x86: re-use insn mnemonic strings as much as possibleJan Beulich3-4534/+4216
Compact the mnemonic string table such that the tails of longer mnemonics are re-used for shorter ones, going beyond what compilers would typically do, but matching what ELF linkers may do when processing SHF_MERGE|SHF_STRINGS sections. This reduces table size by about 12.5%.
2023-01-20x86: move insn mnemonics to a separate tableJan Beulich9-3838/+8553
Using full pointers to reference the insn mnemonic strings is not very efficient. With overall string size presently just slightly over 20k, even a 16-bit value would suffice. Use "unsigned int" for now, as there's no good use we could presently make of the otherwise saved 16 bits. For 64-bit builds this reduces table size by 6.25% (prior to the recent ISA extension additions it would have been 12.5%), with a similar effect on cache occupation of table entries accessed. For PIE builds of gas this also reduces the number of base relocations quite a bit (obviously independent of bitness).
2023-01-20x86: abstract out obtaining of a template's mnemonicJan Beulich2-75/+79
In preparation for changing the representation of the "name" field introduce a wrapper function. This keeps the mechanical change separate from the functional one.
2023-01-20Automatic date update in version.inGDB Administrator1-1/+1
2023-01-19Use "maint ignore-probes" in no-libstdcxx-probe.expTom Tromey1-5/+4
While looking at some test output, I saw that no-libstdcxx-probe.exp was not being run. However, it occurred to me that Tom de Vries' new "maint ignore-probes" command could be used to enable this test unconditionally. Reviewed-by: Tom de Vries <tdevries@suse.de>
2023-01-19i386: Don't emit unsupported TLS relocs on SolarisRainer Orth1-8/+32
Emit R_386_TLS_LE and R_386_TLS_IE, instead of R_386_TLS_LE_32 and R_386_TLS_IE_32, on Solaris. PR ld/13671 * elf32-i386.c (elf_i386_tls_transition): Only emit R_386_TLS_LE, R_386_TLS_IE on Solaris. (elf_i386_relocate_section): Only use R_386_TLS_GD->R_386_TLS_LE transition on Solaris. Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
2023-01-19GDB/testsuite: Expand for character string limiting optionsAndrew Burgess9-38/+306
Modify test cases that verify the operation of the array element limit with character strings such that they are executed twice, once with the `set print characters' option set to `elements' and the limit controlled with the `set print elements' option, and then again with the limit controlled with the `set print characters' option instead. Similarly with the `-elements' and `-characters' options for the `print' command. Additionally verify that said `print' command options combined yield the expected result. Verify correct $_gdb_setting and $_gdb_setting_str values for the `print characters' setting, in particular the `void' value for the `elements' default, which has no corresponding integer value exposed. Add Guile and Python coverage for the `print characters' GDB setting. There are new tests for Ada and Pascal, as the string printing code for these languages is different than the generic string printing code used by other languages. Modula2 also has different string printing code, but (a) this is similar to Pascal, and (b) there are no existing modula2 tests written in Modula2, so I'm not sure how I'd even test the Modula2 string printing. Co-Authored-By: Maciej W. Rozycki <macro@embecosm.com> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-01-19GDB: Add a character string limiting optionAndrew Burgess18-51/+189
This commit splits the `set/show print elements' option into two. We retain `set/show print elements' for controlling how many elements of an array we print, but a new `set/show print characters' setting is added which is used for controlling how many characters of a string are printed. The motivation behind this change is to allow users a finer level of control over how data is printed, reflecting that, although strings can be thought of as arrays of characters, users often want to treat these two things differently. For compatibility reasons by default the `set/show print characters' option is set to `elements', which makes the limit for character strings follow the setting of the `set/show print elements' option, as it used to. Using `set print characters' with any other value makes the limit independent from the `set/show print elements' setting, however it can be restored to the default with the `set print characters elements' command at any time. A corresponding `-characters' option for the `print' command is added, with the same semantics, i.e. one can use `elements' to make a given `print' invocation follow the limit of elements, be it set with the `-elements' option also given with the same invocation or taken from the `set/show print elements' setting, for characters as well regardless of the current setting of the `set/show print characters' option. The GDB changes are all pretty straightforward, just changing references to the old 'print_max' to use a new `get_print_max_chars' helper which figures out which of the two of `print_max' and `print_max_chars' values to use. Likewise, the documentation is just updated to reference the new setting where appropriate. To make people's life easier the message shown by `show print elements' now indicates if the setting also applies to character strings: (gdb) set print characters elements (gdb) show print elements Limit on string chars or array elements to print is 200. (gdb) set print characters unlimited (gdb) show print elements Limit on array elements to print is 200. (gdb) and the help text shows the dependency as well: (gdb) help set print elements Set limit on array elements to print. "unlimited" causes there to be no limit. This setting also applies to string chars when "print characters" is set to "elements". (gdb) In the testsuite there are two minor updates, one to add `-characters' to the list of completions now shown for the `print' command, and a bare minimum pair of checks for the right handling of `set print characters' and `show print characters', copied from the corresponding checks for `set print elements' and `show print elements' respectively. Co-Authored-By: Maciej W. Rozycki <macro@embecosm.com> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-01-19GDB: Allow arbitrary keywords in integer set commandsMaciej W. Rozycki19-626/+1136
Rather than just `unlimited' allow the integer set commands (or command options) to define arbitrary keywords for the user to use, removing hardcoded arrangements for the `unlimited' keyword. Remove the confusingly named `var_zinteger', `var_zuinteger' and `var_zuinteger_unlimited' `set'/`show' command variable types redefining them in terms of `var_uinteger', `var_integer' and `var_pinteger', which have the range of [0;UINT_MAX], [INT_MIN;INT_MAX], and [0;INT_MAX] each. Following existing practice `var_pinteger' allows extra negative values to be used, however unlike `var_zuinteger_unlimited' any number of such values can be defined rather than just `-1'. The "p" in `var_pinteger' stands for "positive", for the lack of a more appropriate unambiguous letter, even though 0 obviously is not positive; "n" would be confusing as to whether it stands for "non-negative" or "negative". Add a new structure, `literal_def', the entries of which define extra keywords allowed for a command and numerical values they correspond to. Those values are not verified against the basic range supported by the underlying variable type, allowing extra values to be allowed outside that range, which may or may not be individually made visible to the user. An optional value translation is possible with the structure to follow the existing practice for some commands where user-entered 0 is internally translated to UINT_MAX or INT_MAX. Such translation can now be arbitrary. Literals defined by this structure are automatically used for completion as necessary. So for example: const literal_def integer_unlimited_literals[] = { { "unlimited", INT_MAX, 0 }, { nullptr } }; defines an extra `unlimited' keyword and a user-visible 0 value, both of which get translated to INT_MAX for the setting to be used with. Similarly: const literal_def zuinteger_unlimited_literals[] = { { "unlimited", -1, -1 }, { nullptr } }; defines the same keyword and a corresponding user-visible -1 value that is used for the requested setting. If the last member were omitted (or set to `{}') here, then only the keyword would be allowed for the user to enter and while -1 would still be used internally trying to enter it as a part of a command would result in an "integer -1 out of range" error. Use said error message in all cases (citing the invalid value requested) replacing "only -1 is allowed to set as unlimited" previously used for `var_zuinteger_unlimited' settings only rather than propagating it to `var_pinteger' type. It could only be used for the specific case where a single extra `unlimited' keyword was defined standing for -1 and the use of numeric equivalents is discouraged anyway as it is for historical reasons only that they expose GDB internals, confusingly different across variable types. Similarly update the "must be >= -1" Guile error message. Redefine Guile and Python parameter types in terms of the new variable types and interpret extra keywords as Scheme keywords and Python strings used to communicate corresponding parameter values. Do not add a new PARAM_INTEGER Guile parameter type, however do handle the `var_integer' variable type now, permitting existing parameters defined by GDB proper, such as `listsize', to be accessed from Scheme code. With these changes in place it should be trivial for a Scheme or Python programmer to expand the syntax of the `make-parameter' command and the `gdb.Parameter' class initializer to have arbitrary extra literals along with their internal representation supplied. Update the testsuite accordingly. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-01-19libsframe: Use AM_SILENT_RULES macro in configure.acIndu Bhagat2-2/+42
Silence 'make' by default. libsframe/ * configure.ac: Use AM_SILENT_RULES. * configure: Regenerate.
2023-01-19Remove some unused includesTom Tromey3-3/+0
I noticed a few spots that include gnu-stabs.h but that do not need to. This patch removes these unnecessary includes. Tested by rebuilding.
2023-01-19[gdb/tdep, aarch64] Remove fp and sp reg aliases, add x31 reg aliasTom de Vries1-4/+7
In aarch64-tdep.c we find these register aliases: ... { /* 64-bit register names. */ {"fp", AARCH64_FP_REGNUM}, {"lr", AARCH64_LR_REGNUM}, {"sp", AARCH64_SP_REGNUM}, ... The sp alias is superfluous, because the canonical name of x31 is already sp. The fp alias is superfluous, because it's already taken by the default meaning of fp, assigned here in _initialize_frame_reg: ... user_reg_add_builtin ("fp", value_of_builtin_frame_fp_reg, NULL); ... Fix this by removing the fp and sp aliases. While we're at it, add an x31 alias for sp. Approved-By: Luis Machado <luis.machado@arm.com> Tested on aarch64-linux. PR tdep/30012 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30012
2023-01-19[gdb/testsuite] Fix gdb.python/py-value-cc.exp for big endianTom de Vries2-2/+3
On s390x-linux, I run into: ... (gdb) python print(u[u_fields[0]])^M 99^M (gdb) PASS: gdb.python/py-value-cc.exp: u's first field via field python print(u[u_fields[1]])^M 0 '\000'^M (gdb) FAIL: gdb.python/py-value-cc.exp: u's second field via field ... There's a var u of this type: ... union U { int a; char c; }; ... and after assigning 99 to u.a, the test-case expects u.c to contain 99 (which it does on x86_64), but instead it contains 0. Fix this by instead assigning 0x63636363, to ensure that u.c == 99 for both little and big endian. Tested on x86_64-linux and s390x-linux.
2023-01-19Reinitialise macro_nestAlan Modra1-0/+1
* input-scrub.c (input_scrub_begin): Init macro_nest.
2023-01-19PR 30022, concurrent builds can failAlan Modra2-78/+23
So let's not copy .libs/libbfd.a to libbfd.a now that nothing in the binutils-gdb source tries to link against it. PR 30022 * Makefile.am (noinst_LIBRARIES, libbfd_a_SOURCES, stamp-lib), (libbfd.a): Delete rules. (CLEANFILES): Adjust to suit.
2023-01-18toplevel: Makefile.def: add install-strip dependency on libsframeIndu Bhagat2-2/+6
As noted in PR libsframe/30014 - FTBFS: install-strip fails because bfdlib relinks and fails to find libsframe, the install time dependencies of libbfd need to be updated. PR libsframe/30014 * Makefile.def: Reflect that libsframe needs to installed before libbfd. Reorder a bit to better track libsframe dependencies. * Makefile.in: Regenerate.
2023-01-19The fuzzers have found the reloc special functions in coff-aarch64.cAlan Modra1-42/+157
All of them need a bfd_reloc_offset_in_range check before accessing data + reloc_entry->address. This patch adds the missing checks and sanity checks reloc offsets in coff_pe_aarch64_relocate_section too. All of them also need changing to support objdump -W calls to bfd_simple_get_relocated_section_contents. At least, secrel_reloc needs the support, the others might not be present in dwarf debug sections. * coff-aarch64.c (coff_aarch64_rel21_reloc): Range check reloc offset. Support final-linking. (coff_aarch64_po12l_reloc): Likewise. (coff_aarch64_addr32nb_reloc): Likewise. (coff_aarch64_secrel_reloc): Likewise. (coff_pe_aarch64_relocate_section): Range check reloc offset.
2023-01-19Correct coff-aarch64 howtos and delete unnecessary special functionsAlan Modra1-157/+44
The remaining special functions are still broken except when called by gas bfd_install_relocation. * coff-aarch64.c (coff_aarch64_addr64_reloc), (coff_aarch64_addr32_reloc, coff_aarch64_branch26_reloc), (coff_aarch64_branch19_reloc, coff_aarch64_branch14_reloc), (coff_aarch64_po12a_reloc): Delete. (HOWTO_INSTALL_ADDEND): Define as 1. (HOW): Remove pcrel_off. Correct all the howtos. (CALC_ADDEND): Define. (coff_aarch64_rtype_to_howto): New function. (coff_rtype_to_howto): Define.
2023-01-19coff-aarch64.c howtosAlan Modra1-67/+56
This is just a patch to fix overlong lines. Wrapping the HOWTO macro in a new HOW macro helps in this. No functional changes here. * coff-aarch64.c (HOW): Define and use for reloc howtos.
2023-01-19howto install_addendAlan Modra2-231/+67
This adds a new flag to the reloc howtos that can be used to incrementally change targets over to simple bfd_install_relocation that just installs the addend without any weird adjustments. I've made a few other changes to bfd_install_relocation, removing dead code and comments that are really only applicable to bfd_perform_relocation. There is also a reloc offset bounds check change. I've moved the check to where data is accessed, as it seems reasonable to me to not perform the check unless it is needed. There is precedence for this; Relocations against absolute symbols already avoided the check. I also tried always performing the reloc offset check, and ran into testsuite failures due to _NONE and _ALIGN relocs at the end of sections. These likely would be fixed if all such reloc howtos had size set to zero, but I would rather not edit lots of files when it involves checking that target code does not use the size. * reloc.c (struct reloc_howto_struct): Add install_addend. (HOWTO_INSTALL_ADDEND): Define. (HOWTO): Init new field with HOWTO_INSTALL_ADDEND. (bfd_install_relocation): Remove comments copied from bfd_perform_relocation that aren't applicable here. Remove code dealing with output_offset and output_section. Just set relocation to addend if install_addend. Move reloc offset bounds check to just before section data is accessed, avoiding the check when data is not accessed. * bfd-in2.h: Regenerate.
2023-01-18sim: info: convert verbose field to a boolMike Frysinger21-30/+31
The verbose argument has always been an int treated as a bool, so convert it to an explicit bool. Further, update the API docs to match the reality that the verbose value is actually used by some of the internal modules.
2023-01-18sim: unify sim-signal.o buildingMike Frysinger3-8/+14
Now that sim-main.h has been reduced significantly, we can remove it from sim-signal.c and unify it across all boards since it compiles to the same code.
2023-01-18sim: v850: reduce extra header inclusion to igen filesMike Frysinger1-0/+4
Limit these extra header includes to only when specific igen files include us until we can move the includes to the igen fils directly.
2023-01-18sim: v850: drop redundant defineMike Frysinger1-4/+0
This is already in v850/local.mk, so we can drop it from sim-main.h.
2023-01-19sim: mn10300: minimize mn10300-sim.h include in sim-main.hMark Wielaard4-0/+17
sim-main.h is special since it is one of the files automatically included in igen generated files. But this means anything including sim-main.h might get everything included just for the igen files. To prevent clashing symbols/defines only include sim-fpu.h, sim-signal.h, mn10300-sim.h from sim-main.h if it is included from one of the generated igen C files. Add explicit includes of mn10300-sim.h, sim-fpu.h and/or sim-signal.h to dv-mn103cpu.c, interp.c and op_utils.c.
2023-01-19Automatic date update in version.inGDB Administrator1-1/+1
2023-01-18GDB: Add references to erased args in cli-decode.cMaciej W. Rozycki1-11/+6
Complement commit 1d7fe7f01b93 ("gdb: Introduce setting construct within cmd_list_element") and commit 702991711a91 ("gdb: Have setter and getter callbacks for settings") and update inline documentation accordingly for `add_set_or_show_cmd' and `add_setshow_cmd_full_erased', documenting the `args' parameter and removing references to `var', `set_setting_func' and `get_setting_func'. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-01-18GDB: Add missing inline documentation for `add_setshow_cmd_full'Maciej W. Rozycki1-0/+12
Complement commit 1d7fe7f01b93 ("gdb: Introduce setting construct within cmd_list_element") and add missing description for `add_setshow_cmd_full'.
2023-01-18GDB: Correct inline documentation for `add_setshow_cmd_full_erased'Maciej W. Rozycki1-1/+1
Use proper English in the description of SET_LIST and SHOW_LIST.
2023-01-18GDB: Fix documentation for `theclass' parameters in cli-decode.cMaciej W. Rozycki1-11/+11
Rename CLASS to THECLASS in the documentation for `theclass' parameters throughout cli-decode.c, complementing commit fe978cb071b4 ("C++ keyword cleanliness, mostly auto-generated"). Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-01-18Fix 'make TAGS' in gdbserverTom Tromey1-3/+4
PR build/29003 points out that "make TAGS" is broken in gdbserver. This patch fixes the problem that is pointed out there, plus another one I noticed while working on that -- namely that the "sed" computes the wrong names for some source files. Finally, a couple of obsolete variable references are removed. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29003
2023-01-18Revert "X86: reverse-finish fix"Carl Love13-230/+106
This reverts commit b22548ddb30bfb167708e82d3bb932461c1b703a. This patch is being reverted since the patch series is causing regressions.
2023-01-18Revert "PowerPC: fix for gdb.reverse/finish-precsave.exp and ↵Carl Love4-160/+31
gdb.reverse/finish-reverse.exp" This reverts commit 92e07580db6a5572573d5177ca23933064158f89. Reverting patch as the patch series is causing regressions.
2023-01-18gdb: care for dynamic objfiles in build_id_bfd_get ()Jan Vrany2-0/+10
Accessing gdb.Objfile.build_id caused GDB to crash when objfile is dynamic, that is created by JIT reader API. The issue was NULL-pointer dereferencing in build_id_bfd_get () because dynamic objfiles have no underlaying BFD structure. This commit fixes the problem by a NULL-check in build_id_bfd_get ().
2023-01-18Speed up objcopy's note merging.Nick Clifton2-7/+23
PR 29993 * objcopy.c (merge_gnu_build_notes): Remember the last non-deleted note in order to speed up the scan for matching notes.
2023-01-17sim: ppc: drop local psim linkMike Frysinger2-34/+12
This has never been installed, and it's not clear anyone cares about it in the local build dir (when the main program is sim/ppc/run), so drop all the logic to simplify.
2023-01-18Use subsystem to distinguish between pei-arm-little and pei-arm-wince-littleMark Harmstone2-0/+17
Running objdump against a 32-bit ARM PE file currently needs disambiguation, as it gets picked up by both pei-arm-little and pei-arm-wince-little. This adds a check in pe_bfd_object_p so that the subsystem in the PE header is used to do the disambiguation for us, so that WinCE images get assigned to pei-arm-wince-little, and everything else to pei-arm-little.
2023-01-17Revert "gprofng: PR29987 bfd/archive.c:1447: undefined reference to ↵Vladimir Mezentsev7-4/+26
`filename_ncmp'" This reverts commit c2a5d74050ea9d7897b4122ef57c627d395683b3.
2023-01-18Automatic date update in version.inGDB Administrator1-1/+1
2023-01-17Remove two unused fields from gdbarchTom Tromey2-8/+0
When I converted gdbarch to use the registry, I forgot to remove the two fields that were used to implement the previous approach. This patch removes them. Tested by rebuilding.
2023-01-17Use require in paramless.expTom Tromey1-1/+1
The new paramless.exp test was not converted to the new "require" approach. This patch fixes the problem.