aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-06-15sim: switch modules.c & version.c to stamp filesMike Frysinger5-7/+26
This fixes remaking of these files and avoids unnecessary rebuilds. Also add both to `make clean` to match other stamp files.
2021-06-15Fix typo in vsx-regs.exp testCarl Love1-1/+1
gdb/ChangeLog 2021-06-15 Carl Love <cel@us.ibm.com> * testsuite/gdb.arch/vsx-regs.exp (gdb_test_no_output): Fix typo in set \$vs$i.v2_double.
2021-06-15Allow readelf to recognise GO buildid notes.Nick Clifton4-0/+11
binutils * readelf.c (get_note_type): Add support for NT_GO_BUILDID. include * elf/common.h (NT_GO_BUILDID): Define.
2021-06-15x86: bring "gas --help" output for --32 etc in sync with realityJan Beulich3-4/+15
The testsuite uses the output to determine whether BFD64 is in effect. --x32 is supported for ELF only; don't advertise it for PE/COFF. --64 is also supported for Mach-O; advertise it. Adjust the testsuite's BFD64 check accordingly. Also replace "code" by "object", since it's the object format that the options primarily control. It's also _initial_ code bitness, but this can be changed by directives.
2021-06-15x86: simplify .dispNN settingJan Beulich2-51/+24
First of all eliminate the disp{16,32,32s} static variables, which are used solely for setting a temporary variable in build_modrm_byte(). The effect there can be had without use of such a temporary and without operand_type_or(), by just setting the single bit each that needs setting. Then use operand_type_and_not(..., anydisp) when all dispNN bits want clearing together.
2021-06-15x86: slightly simplify offset_in_range()Jan Beulich2-2/+7
Applying a mask with all bits set (or its inverse, with hence all bits clear) won't alter the result (or won't trigger the warning). Re-arrange the code to eliminate two more of the somewhat odd (2 << width_minus_1) constructs.
2021-06-15x86: harmonize disp with imm handlingJan Beulich5-23/+79
Certain disp values may trigger "... shortened to ..." warnings when equivalent imm ones don't. In some of the cases there are also differences (for non-64-bit code) between BFD64 and !BFD64 builds. The resulting encodings (i.e. use [or not] of the shorter disp8 / imm8 forms) are also different in some cases. Make this handling consistent. Note that using equivalent 16-bit mode displacements / immediates continues to expose entirely different behavior (see the disp-imm-16 testcase added by an earlier patch). This may want to be the subject of further changes, but it'll then quickly become obvious that e.g. keying use of extend_to_32bit_address() to non-64-bit mode isn't appropriate either: Once we allow wrapping operands, we would better do so consistently, in which case all of this would need to become dependent upon address or operand size instead of mode.
2021-06-15x86: make offset_in_range()'s warning contents useful (again)Jan Beulich2-6/+7
In case there is something which gets shortened (perhaps only on a BFD64 build targeting a 32-bit binary), seeing the full original value is often helpful to understand what's actually going wrong. Of course for non-64-bit binaries we better wouldn't be seeing such warnings at all, as they're often indicative of a behavioral difference between BFD64 and !BFD64 builds. Prior to "gas: drop sprint_value()", which introduced the use of bfd_sprintf_vma(), the output had other shortcomings.
2021-06-15x86: off-by-1 in offset_in_range()Jan Beulich7-1/+89
Just like e.g. 0x10000 triggers a warning for size 2, -0x10000 ought to as well. Note that some of the encodings produced aren't ones one would expect, and hence the generated code is not being checked for in the new testcases.
2021-06-15x86: permit parenthesized expressions again as addressing scale factorJan Beulich5-2/+26
The description of e68c3d59acd0 ("x86: better respect quotes in parse_operands()") wrongly states: "In i386_att_operand(), which needs adjustment to remain in sync, besides respecting double quotes now, also change the logic such that we don't count parentheses anymore: Finding any opening or closing parenthesis or any double quote means we're done, because the subsequent parsing code wouldn't accept (extra) instances of these anyway." I didn't pay attention to the possibility of the scale factor being specified as an expression, which may contain parentheses. Thanks to Martin for pointing this out. Restore prior behavior or matching parentheses (backwards), while giving the variable a more suitable name. Note that this simple and immediate fix is not ging to be enough: This expression could itself involve quoted symbols. However, to address this backwards parsing needs to be done away with altogether here (such that parentheses which are part of such a quoted symbol name can also properly be accounted for), which is going to be a more intrusive change.
2021-06-15readelf: report DF_1_PIE as "Position-Independent Executable"Alan Modra7-44/+155
I finally found time to teach readelf to identify PIEs in the file header display and program header display. So in place of "DYN (Shared object file)" which isn't completely true, show "DYN (Position-Independent Executable file)". It requires a little bit of untangling code in readelf due to process_program_headers setting up dynamic_addr and dynamic_size, needed to scan .dynamic for the DT_FLAGS_1 entry, and process_program_headers itself wanting to display the file type in some cases. At first I modified process_program_header using a "probe" parameter similar to get_section_headers in order to inhibit output, but decided it was cleaner to separate out locate_dynamic_sections. binutils/ * readelf.c (locate_dynamic_section, is_pie): New functions. (get_file_type): Replace e_type parameter with filedata. Call is_pie for ET_DYN. Update all callers. (process_program_headers): Use local variables dynamic_addr and dynamic_size, updating filedata on exit from function. Set dynamic_size of 1 to indicate no dynamic section or segment. Update tests of dynamic_size throughout. * testsuite/binutils-all/x86-64/pr27708.dump: Update expected output. ld/ * testsuite/ld-pie/vaddr-0.d: Update expected output. gdb/ * testsuite/lib/gdb.exp (exec_is_pie): Match new PIE readelf output.
2021-06-14sim: mn10300: enable -WerrorMike Frysinger3-106/+113
Now that all warnings are fixed in this port, enable -Werror by default.
2021-06-14sim: mn10300: switch abort to sim_engine_abortMike Frysinger2-1/+5
This allows the caller to catch engine aborts if they want, and fixes the warning about missing stdlib.h include by not using abort().
2021-06-14sim: erc32: fix build w/out F_{G,S}ETFLMike Frysinger3-2/+13
Add conditional logic around fcntl.h F_{G,S}ETFL usage to fix builds on systems that don't have it (e.g. Windows). The code is only used to save & restore limited terminal stdin state.
2021-06-14sim: erc32: fix build w/out termios.hMike Frysinger2-0/+20
Add conditional logic around termios.h usage to fix builds on systems that don't have it (e.g. Windows).
2021-06-14sim: drop redundant SIM_AC_OPTION_WARNINGSMike Frysinger27-214/+250
The common code already calls this, so no need to do so in arch dirs. We leave the calls that disable -Werror. This will help unify the configure scripts.
2021-06-14sim: enable silent rules in common buildsMike Frysinger8-30/+84
We only do the common code as automake simplifies the logic.
2021-06-15Automatic date update in version.inGDB Administrator1-1/+1
2021-06-14gnulib: define the path to gnulib's parent dirMike Frysinger8-12/+35
The current setting assumes that gnulib is only used by dirs immediately under the source root. Trying to build it two or more levels deep fails. Switch GNULIB_BUILDDIR to a relative GNULIB_PARENT_DIR so that it can be used to construct both the build & source paths.
2021-06-14fbsd nat: Disable address space randomization when requested.John Baldwin6-2/+96
Use procctl(2) with PROC_ASLR_CTL to disable address space randomization in the current gdb process before forking a child process for a new inferior when address space randomization is disabled. gdb/ChangeLog: * configure.ac: Check for <sys/procctl.h>. * config.in, configure: Regenerate. * fbsd-nat.c: Include <sys/procctl.h> if present. [PROC_ASLR_CTL] (maybe_disable_address_space_randomization): New. (fbsd_nat_target::create_inferior) (fbsd_nat_target::supports_disable_randomization): New. * fbsd-nat.h (fbsd_nat_target::create_inferior) (fbsd_nat_target::supports_disable_randomization): New.
2021-06-14Fix silent gdb.base/annota1.exp test coverage regressionPedro Alves2-3/+12
This commit fixes a test coverage regression caused by: commit b001de2320446ec803b4ee5e0b9710b025b84469 Author: Andrew Burgess <andrew.burgess@embecosm.com> AuthorDate: Mon Nov 26 17:56:39 2018 +0000 Commit: Andrew Burgess <andrew.burgess@embecosm.com> CommitDate: Wed Dec 12 17:33:52 2018 +0000 gdb: Update test pattern to deal with native-extended-gdbserver While looking at a regression caused by a local patch I was working on, I noticed this: pre-prompt (gdb) prompt PASS: gdb.base/annota1.exp: breakpoint info PASS: gdb.base/annota1.exp: run until main breakpoint run post-prompt Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.base/annota1/annota1 next Note how above, we get the "run until main breakpoint" pass even before "run" shows up in the log! The issue is that the test isn't really testing anything, it always passes regardless of the gdb output. There are a few problems here, fixed by this commit: - using {} to build the list for [join], when the strings we're joining include variable names that must be expanded. Such list need to be built with [list] instead. - [join] joins strings with a space character by default. We need to pass the empty string as second parameter so that it just concats the strings. - doing too much in a "-re" (calling procedures), which doesn't work correctly. I've seen this before and never digged deeper into why. Probably something to do with how gdb_test_multiple is implemented. Regardless, easy and clear enough to build the pattern first into a variable. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves <pedro@palves.net> * gdb.base/annota1.exp: Build list using [list] instead of {}. Tell [join] to join with no character. Build expected pattern in separate variable instead of in the -re expression directly. Change-Id: Ib3c89290f0e9ae4a0a43422853fcd4a7a7e12b18
2021-06-14Include missing header signal.hBernd Edlinger2-0/+5
2021-06-14 Bernd Edlinger <bernd.edlinger@hotmail.de> * compile/compile.c: Include missing header signal.h.
2021-06-14Use consistent type in binutils/dwarf.cEric Botcazou2-10/+17
If you look at the type used for implicit_const objects in binutils/dwarf.c, you'll get sometimes bfd_signed_vma and sometimes dwarf_signed_vma. They are the same on 64-bit hosts, but not on 32-bit hosts, and the latter discrepancy, in particular in process_abbrev_set, is responsible for the following error issued by objdump on some object files containing DWARF 5: binutils/dwarf.c:1108: read LEB value is too large to store in destination variable binutis/ * dwarf.c (struct abbrev_attr): Change type of implicit_const. (add_abbrev_attr): Likewise. (process_abbrev_set): Likewise. (display_debug_abbrev): Adjust to above change.
2021-06-14GNU gettext introduced this change[0] in version 0.19.8 to fix gettext ↵Michael Forney4-20/+67
detection with musl libc, since it does not define these internal symbols. This allows binutils to build with musl gettext rather than falling back to the bundled version. [0] https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commit;h=b67399b4 2021-06-13 Michael Forney <mforney@mforney.org> config/ChangeLog: * gettext.m4 (AM_GNU_GETTEXT): Skip checks for the internal symbols _nl_msg_cat_cntr, _nl_domain_bindings, and _nl_expand_alias, if __GNU_GETTEXT_SUPPORTED_REVISION is defined. Backport of gettext serial 68 patch. intl/ChangeLog: * configure: Regenerate. --- Thi
2021-06-14gas: fold three as_warn() in emit_expr_with_reloc()Jan Beulich2-12/+6
Simply use the available abstraction instead of, effectively, trying to open-code it.
2021-06-14gas: drop TC_ADDRESS_BYTES conditionalsJan Beulich3-5/+8
I've been repeatedly confused by, in particular, the .dc.a potable[] entry being conditional. Grepping in gas/config/ reveals only very few targets actually #define-ing it. But as of 7be1c4891a20 the symbol is always defined, so #ifdef-s are pointless (and, as said, potentially confusing). Also adjust documentation to reflect this.
2021-06-13sim: ppc: use common version.o tooMike Frysinger2-7/+10
The common version.o we're building can be used for the ppc subdir, so switch it over too.
2021-06-13sim: rx: move cycle-accurate settings to CPPFLAGSMike Frysinger5-10/+15
This is the last unique setting that rx has in its config.h, so by moving this to CPPFLAGS, we can drop its config.h entirely.
2021-06-14Automatic date update in version.inGDB Administrator1-1/+1
2021-06-12sim: start unifying portability shimsMike Frysinger12-19/+157
There are some functions that gnulib does not yet provide fallbacks for, so start a common file of our own for holding existing stubs.
2021-06-12sim: unify sim-load.o buildingMike Frysinger6-5/+74
Since this file does not rely on any port-specific settings, move it up to building as part of the common step so we only do it once in a multibuild.
2021-06-12sim: rx: replace cycle-stats with common profile settingsMike Frysinger7-63/+29
The common sim-profile option controls whether to keep track of runtime execution (like cycle count), so switch the rx-specific cycle-stats option over to that.
2021-06-12sim: assume sys/select.h always existsMike Frysinger13-15/+25
Now that gnulib provides this, assume it exists.
2021-06-12sim: erc32: replace caddr_t with void*Mike Frysinger2-10/+18
This BSDism was never accepted into standards, so replace it with the portable void* type instead.
2021-06-12sim: erc32/ppc: fix handling of $EXEEXTMike Frysinger4-6/+14
2021-06-12sim: overhaul alignment settings managementMike Frysinger136-1616/+334
Currently, the sim-config module will abort if alignment settings haven't been specified by the port's configure.ac. This is a bit weird when we've allowed SIM_AC_OPTION_ALIGNMENT to seem like it's optional to use. Thus everyone invokes it. There are 4 alignment settings, but really only 2 matters: strict and nonstrict. The "mixed" setting is just the default ("unset"), and "forced" isn't used directly by anyone (it's available as a runtime option for some ports). The m4 macro has 2 args: the "wire" settings (which represents the hardwired port behavior), and the default settings (which are used if nothing else is specified). If none are specified, then the build won't work (see above as if SIM_AC_OPTION_ALIGNMENT wasn't called). If default settings are provided, then that is used, but we allow the user to override at runtime. Otherwise, the "wire" settings are used and user runtime options to change are ignored. Most ports specify a default, or set the "wire" to nonstrict. A few set "wire" to strict, but it's not clear that's necessary as it doesn't make the code behavior, by default, any different. It might make things a little faster, but we should provide the user the choice of the compromises to make: force a specific mode at compile time for faster runtime, or allow the choice at runtime. More likely it seems like an oversight when these ports were initially created, and/or copied & pasted from existing ports. With all that backstory, let's get to what this commit does. First kill off the idea of a compile-time default alignment and set it to nonstrict in the common code. For any ports that want strict alignment by default, that code is moved to sim_open while initializing the sim. That means WITH_DEFAULT_ALIGNMENT can be completely removed. Moving the default alignment to the runtime also allows removal of setting the "wire" settings at configure time. Which allows removing of all arguments to SIM_AC_OPTION_ALIGNMENT and moving that call to common code. The macro logic can be reworked to not pass WITH_ALIGNMENT as -D CPPFLAG and instead move it to config.h. All of these taken together mean we can hoist the macro up to the top level and share it among all sims so behavior is consistent among all the ports.
2021-06-12sim: unify bug & package settingsMike Frysinger105-2785/+165
Move these options up to the common dir so we only test & export them once across all ports. The AC_INIT macro does a lot of the heavy lifting already which allows further simplification.
2021-06-12sim: unify debug/stdio/trace/profile build settingsMike Frysinger73-4742/+244
Move these options up to the common dir so we only test & export them once across all ports. The ppc code needs a little extra care with its trace settings as it's not exactly the same API as the common code. The other knobs are the same though.
2021-06-12sim: split debug/stdio/trace/profile options into dedicated m4 filesMike Frysinger6-95/+178
This follows existing organizational structure with one configure option per m4 file, and will make it easier to move to the common configure dir.
2021-06-13Automatic date update in version.inGDB Administrator1-1/+1
2021-06-12sim: ppc: unify header & function & type tests tooMike Frysinger8-1081/+902
Since ppc now shares a config.h with the top-level, move all of its relevant settings up a level. The ppc port tests a lot more funcs, but that's because its syscall emulation is a lot more complete. We'll probably utilize some of these in the common code too.
2021-06-12remote: Fix indentation in remote_new_objfile.John Baldwin2-2/+6
gdb/remote.c:14541:5: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation] if (current_inferior ()->in_initial_library_scan) ^ gdb/remote.c:14527:3: note: previous statement is here if (remote == nullptr) ^ gdb/ChangeLog: * remote.c (remote_new_objfile): Fix indentation.
2021-06-12sim: ppc: unify env settings tooMike Frysinger6-45/+23
The ppc port doesn't share a lot of the common logic, but there are a few bits that bleed across. Have it use the common configure for environment settings too to avoid duplicate define errors after the recent unification with the other ports.
2021-06-12sim: unify environment build settingsMike Frysinger100-993/+100
Move the --sim-enable-environment option up to the common dir so we only test & export it once across all ports.
2021-06-12sim: unify assert build settingsMike Frysinger131-869/+222
Move the --sim-enable-assert option up to the common dir so we only test & export it once across all ports.
2021-06-12sim: unify platform function & header testsMike Frysinger109-17440/+1478
Move the various platform tests up a level to avoid duplication across the ports. When building multiple versions, this speeds things up a bit. For now we move the obvious stuff up a level, but we don't turn own the config.h entirely just yet -- we still have some tests related to libraries that need consideration.
2021-06-12readelf: don't clear section_headers in process_file_headerAlan Modra2-2/+4
* readelf.c (process_file_header): Don't clear section_headers.
2021-06-12Re: readelf section readingAlan Modra2-3/+12
Fix commit 4de91c10cdd9, which cached the single section header read to pick up file header extension fields. Also, testing e_shoff in get_section_headers opened a hole for fuzzers where we'd end up with segfaults due to non-zero e_shnum but NULL section_headers. * readelf.c (get_section_headers): Don't test e_shoff here, leave that to get_32bit_section_headers or get_64bit_section_headers. (process_object): Throw away section header read to print file header extension.
2021-06-12Automatic date update in version.inGDB Administrator1-1/+1
2021-06-11Fix ChangeLog entry locationSimon Marchi2-14/+14
This ChangeLog entry is in the wrong file, fix that. Change-Id: I43464e1bdb94d2f40d4c7dfaf425fc498851964c