deliverable/binutils-gdb.git
2 years agosim: unify various library testing logic
Mike Frysinger [Fri, 18 Jun 2021 05:58:00 +0000 (01:58 -0400)] 
sim: unify various library testing logic

Move these options up to the common dir so we only test & export
them once across all ports.

2 years agoubsan: vax: pointer overflow
Alan Modra [Sat, 19 Jun 2021 00:55:35 +0000 (10:25 +0930)] 
ubsan: vax: pointer overflow

"VAX export class call relocation test" fails with ubsan on a 32-bit
host.

* vax-dis.c (print_insn_vax): Avoid pointer overflow.

2 years agoubsan errors when 32-bit bfd
Alan Modra [Fri, 18 Jun 2021 12:57:01 +0000 (22:27 +0930)] 
ubsan errors when 32-bit bfd

A shift count exceeding the size of the value is undefined behaviour,
and so is negating a signed LONG_MIN.

* config/tc-z80.c (signed_overflow, unsigned_overflow): Avoid UB.

2 years agoppc raw test failure when 32-bit bfd
Alan Modra [Fri, 18 Jun 2021 12:56:11 +0000 (22:26 +0930)] 
ppc raw test failure when 32-bit bfd

The test contained an expression that can't be evaluated unless
expressions are 64-bit.

* testsuite/gas/ppc/raw.s: Use 0 as pli constant.
* testsuite/gas/ppc/raw.d: Update to suit.

2 years agoFix another strncpy warning
Alan Modra [Fri, 18 Jun 2021 12:55:10 +0000 (22:25 +0930)] 
Fix another strncpy warning

* tic30-dis.c (get_register_operand): Don't ask strncpy to fill
entire buffer.

2 years agodwarf.c: string_fortify.h strncpy error
Alan Modra [Fri, 18 Jun 2021 08:54:43 +0000 (18:24 +0930)] 
dwarf.c: string_fortify.h strncpy error

In function 'strncpy',
    inlined from 'display_debug_lines_decoded' at /home/alan/src/binutils-gdb/binutils/dwarf.c:5434:5,
    inlined from 'display_debug_lines' at /home/alan/src/binutils-gdb/binutils/dwarf.c:5567:21:
/usr/include/bits/string_fortified.h:95:10: error: '__builtin_strncpy' specified bound 36 equals destination size [-Werror=stringop-truncation]

No need for strncpy here, the string being copied always fits the
destination buffer.

* dwarf.c (display_debug_lines_decoded): Use memcpy rather than
strncpy when trimming file name length to MAX_FILENAME_LENGTH.
Don't make an unnecessary copy when length is good.

2 years agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Jun 2021 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 years agoFix powerpc-power8.exp test with new mnemonics
Carl Love [Wed, 16 Jun 2021 19:51:46 +0000 (14:51 -0500)] 
Fix powerpc-power8.exp test with new mnemonics

This patch updates the gdb test to use the new bgetar and bnstarl mnemonics
introduced in commit 5a4037661bccd156d65093f1f0cf2cd43f31e9d9.  The test
previously used the bctar and bctarl mnemonics.

gdb/testsuite/ChangeLog
2021-06-17  Carl Love  <cel@us.ibm.com>

* gdb.arch/powerpc-power8.exp(bctar, bctarl): Update mnemonics
to bgetar and bgetarl.
* gdb.arch/powerpc-power8.s((bctar, bctarl): Update comments
for mnemonics to bgetar and bnstarl.

2 years agold.texi: Move -z unique-symbol after -z undefs.
H.J. Lu [Fri, 18 Jun 2021 14:32:25 +0000 (07:32 -0700)] 
ld.texi: Move -z unique-symbol after -z undefs.

* ld.texi: Move -z unique-symbol after -z undefs.

2 years agosim: unify -Werror build settings
Mike Frysinger [Fri, 18 Jun 2021 05:14:39 +0000 (01:14 -0400)] 
sim: unify -Werror build settings

Move these options up to the common dir so we only test & export
them once across all ports.  It also enables -Werror usage on the
common files we've been pulling out of arch subdirs.

2 years agoelf: Add GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX
H.J. Lu [Fri, 18 Jun 2021 14:18:02 +0000 (07:18 -0700)] 
elf: Add GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX

Implement GNU_PROPERTY_UINT32_AND_XXX/GNU_PROPERTY_UINT32_OR_XXX:

https://sourceware.org/pipermail/gnu-gabi/2021q1/000467.html

1. GNU_PROPERTY_UINT32_AND_LO..GNU_PROPERTY_UINT32_AND_HI

 #define GNU_PROPERTY_UINT32_AND_LO 0xb0000000
 #define GNU_PROPERTY_UINT32_AND_HI 0xb0007fff

A bit in the output pr_data field is set only if it is set in all
relocatable input pr_data fields.  If all bits in the the output
pr_data field are zero, this property should be removed from output.

If the bit is 1, all input relocatables have the feature.  If the
bit is 0 or the property is missing, the info is unknown.

2. GNU_PROPERTY_UINT32_OR_LO..GNU_PROPERTY_UINT32_OR_HI

 #define GNU_PROPERTY_UINT32_OR_LO 0xb0008000
 #define GNU_PROPERTY_UINT32_OR_HI 0xb000ffff

A bit in the output pr_data field is set if it is set in any
relocatable input pr_data fields. If all bits in the the output
pr_data field are zero, this property should be removed from output.

If the bit is 1, some input relocatables have the feature.  If the
bit is 0 or the property is missing, the info is unknown.

bfd/

* elf-properties.c (_bfd_elf_parse_gnu_properties): Handle
GNU_PROPERTY_UINT32_AND_LO, GNU_PROPERTY_UINT32_AND_HI,
GNU_PROPERTY_UINT32_OR_LO and GNU_PROPERTY_UINT32_OR_HI.
(elf_merge_gnu_properties): Likewise.

binutils/

* readelf.c (print_gnu_property_note): Handle
GNU_PROPERTY_UINT32_AND_LO, GNU_PROPERTY_UINT32_AND_HI,
GNU_PROPERTY_UINT32_OR_LO and GNU_PROPERTY_UINT32_OR_HI.

include/

* elf/common.h (GNU_PROPERTY_UINT32_AND_LO): New.
(GNU_PROPERTY_UINT32_AND_HI): Likewise.
(GNU_PROPERTY_UINT32_OR_LO): Likewise.
(GNU_PROPERTY_UINT32_OR_HI): Likewise.

ld/

* testsuite/ld-elf/property-and-1.d: New file.
* testsuite/ld-elf/property-and-1.s: Likewise.
* testsuite/ld-elf/property-and-2.d: Likewise.
* testsuite/ld-elf/property-and-2.s: Likewise.
* testsuite/ld-elf/property-and-3.d: Likewise.
* testsuite/ld-elf/property-and-3.s: Likewise.
* testsuite/ld-elf/property-and-4.d: Likewise.
* testsuite/ld-elf/property-and-empty.s: Likewise.
* testsuite/ld-elf/property-or-1.d: Likewise.
* testsuite/ld-elf/property-or-1.s: Likewise.
* testsuite/ld-elf/property-or-2.d: Likewise.
* testsuite/ld-elf/property-or-2.s: Likewise.
* testsuite/ld-elf/property-or-3.d: Likewise.
* testsuite/ld-elf/property-or-3.s: Likewise.
* testsuite/ld-elf/property-or-4.d: Likewise.
* testsuite/ld-elf/property-or-empty.s: Likewise.

2 years agosim: move -Werror disabling to Makefile
Mike Frysinger [Fri, 18 Jun 2021 06:14:52 +0000 (02:14 -0400)] 
sim: move -Werror disabling to Makefile

For the ports that still don't build with -Werror, rather than disable
the flag at configure time, do it at make time.  This will allow us to
unify these tests in the common sim configure script.

2 years agosim: create a makefile fragment to pass common settings down
Mike Frysinger [Wed, 16 Jun 2021 03:01:45 +0000 (23:01 -0400)] 
sim: create a makefile fragment to pass common settings down

As we merge settings from subdirs into the common configure, we
sometimes need to keep the settings working in both dirs.  Create
a makefile fragment to pass them down so we don't have to run the
checks twice.  For now, the file is empty, but we'll start moving
logic in shortly.

2 years agogas: fold symbol table entries generated for .startof.() / .sizeof.()
Jan Beulich [Fri, 18 Jun 2021 11:51:52 +0000 (13:51 +0200)] 
gas: fold symbol table entries generated for .startof.() / .sizeof.()

When the same such construct is used multiple times in a source file,
there's still no need to emit a separate symbol each time. Under the
assumption that there won't be many of these, use a simple array
lookup method to record previously used symbols.

2 years agosim: split sim-signal.h include out
Mike Frysinger [Mon, 14 Jun 2021 03:16:32 +0000 (23:16 -0400)] 
sim: split sim-signal.h include out

The sim-basics.h is too big and includes too many things.  This leads
to some arch's sim-main.h having circular loop issues with defs, and
makes it hard to separate out common objects from arch-specific defs.
By splitting up sim-basics.h and killing off sim-main.h, it'll make
it easier to separate out the two.

2 years agosim: drop core libiberty.h include
Mike Frysinger [Mon, 14 Jun 2021 02:27:08 +0000 (22:27 -0400)] 
sim: drop core libiberty.h include

This doesn't need to be included for every sim file, so drop it.
Every C file that needs it seems to already include it.

2 years agosim: overhaul & unify endian settings management
Mike Frysinger [Tue, 15 Jun 2021 23:51:52 +0000 (19:51 -0400)] 
sim: overhaul & unify endian settings management

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, the arch is
expected to support both, and the value will be probed based on the
user runtime options or the input program.

Only two arches today set the default value (bpf & mips).  We can
probably let this go as it only shows up in one scenario: the sim
is invoked, but with no inputs, and no user endian selection.  This
means bpf will not behave like the other arches: an error is shown
and forces the user to make a choice.  If an input program is used
though, we'll still switch the default to that.  This allows us to
remove the WITH_DEFAULT_TARGET_BYTE_ORDER setting.

For the ports that set a "wire" endian, move it to the runtime init
of the respective sim_open calls.  This allows us to change the
WITH_TARGET_BYTE_ORDER to purely a user-selected configure setting
if they want to force a specific endianness.

With all the endian logic moved to runtime selection, we can move
the configure call up to the common dir so we only process it once
across all ports.

The ppc arch was picking the wire endian based on the target used,
but since we weren't doing that for other biendian arches, we can
let this go too.  We'll rely on the input selecting the endian, or
make the user decide.

2 years agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Jun 2021 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 years agosim: ppc: avoid "PAGE_SIZE" name
Mike Frysinger [Thu, 17 Jun 2021 23:03:32 +0000 (19:03 -0400)] 
sim: ppc: avoid "PAGE_SIZE" name

This define is used for a particular target and depends on the
simulated CPU hardware.  It has no relation to the host CPU that
the sim is running on.  So rename the common "PAGE_SIZE" here to
better reflect its usage and avoid conflicts with system headers.

2 years agoDon't call sigtimedwait for scoped_ignore_sigttou
Pedro Alves [Thu, 17 Jun 2021 15:23:03 +0000 (16:23 +0100)] 
Don't call sigtimedwait for scoped_ignore_sigttou

Because SIGTTOU is sent to the whole process instead of to a specific
thread, consuming a pending SIGTTOU in the destructor of
scoped_ignore_sigttou could consume a SIGTTOU signal raised due to
actions done by some other thread.  Simply avoid sigtimedwait in
scoped_ignore_sigttou, thus plugging the race.  This works because we
know that when the thread writes to the terminal and the signal is
blocked, the kernel does not raise the signal at all.

Tested on GNU/Linux, Solaris 11 and FreeBSD.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

* scoped_ignore_signal.h (scoped_ignore_signal): Add
ConsumePending template parameter.
(scoped_ignore_signal::~scoped_ignore_signal): Skip calling
sigtimedwait if ConsumePending is false.
(scoped_ignore_sigpipe): Initialize with ConsumePending=true.
* scoped_ignore_sigttou.h (scoped_ignore_sigttou)
<m_ignore_signal>: Initialize with ConsumePending=false.

Change-Id: I92f754dbc45c45819dce2ce68b8c067d8d5c61b1

2 years agox86-64: Use $NOPIE_LDFLAGS/$NOPIE_CFLAGS on protected-func-1
H.J. Lu [Thu, 17 Jun 2021 17:32:27 +0000 (10:32 -0700)] 
x86-64: Use $NOPIE_LDFLAGS/$NOPIE_CFLAGS on protected-func-1

PR ld/27973
* testsuite/ld-x86-64/x86-64.exp: Pass $NOPIE_LDFLAGS and
$NOPIE_CFLAGS to protected-func-1 without PIE.

2 years agox86-64: Test protected function pointers
H.J. Lu [Thu, 17 Jun 2021 17:19:29 +0000 (10:19 -0700)] 
x86-64: Test protected function pointers

On x86-64, function pointers in executable for external funtions may be
resolved to their PLT entries in executable.  If it happens, function
pointers of protected funtions in shared libraries must be resolved to
the PLT entries in executable, not addresses of protected funtions in
shared libraries.

PR ld/27973
* testsuite/ld-x86-64/x86-64.exp: Run protected function tests.
* testsuite/ld-x86-64/protected-func-1.h: New file.
* testsuite/ld-x86-64/protected-func-1a.s: Likewise.
* testsuite/ld-x86-64/protected-func-1b.c: Likewise.

2 years agold: Add ChangeLog entry for -no-pie
Fangrui Song [Thu, 17 Jun 2021 17:18:28 +0000 (10:18 -0700)] 
ld: Add ChangeLog entry for -no-pie

2 years agold: Add -no-pie
Fangrui Song [Thu, 17 Jun 2021 16:57:40 +0000 (09:57 -0700)] 
ld: Add -no-pie

gold has had this option for many years. Not having this option caused
some confusion to users.  The help message clarifies the default state.

ld/
    * ldlex.h (enum option_values): Add OPTION_NO_PIE.
    * lexsup.c (struct ld_options): Add -no-pie.
    (parse_args): Handle -no-pie.
    * ld.texi: Document -no-pie.

2 years agoAdd a unit test for scoped_ignore_sigpipe
Pedro Alves [Thu, 17 Jun 2021 15:16:55 +0000 (16:16 +0100)] 
Add a unit test for scoped_ignore_sigpipe

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

* Makefile.in (SELFTESTS_SRCS): Add
unittests/scoped_ignore_signal-selftests.c.
* unittests/scoped_ignore_signal-selftests.c: New.

Change-Id: Idce24aa9432a3f1eb7065bc9aa030b1d0d7dcad5

2 years agoscoped_ignore_signal: Use sigprocmask+sigtimedwait instead of signal
Pedro Alves [Thu, 17 Jun 2021 15:16:55 +0000 (16:16 +0100)] 
scoped_ignore_signal: Use sigprocmask+sigtimedwait instead of signal

The problem with using signal(...) to temporarily ignore a signal, is
that that changes the the signal disposition for the whole process.
If multiple threads do it at the same time, you have a race.

Fix this by using sigprocmask + sigtimedwait to implement the ignoring
instead, if available, which I think probably means everywhere except
Windows nowadays.  This way, we only change the signal mask for the
current thread, so there's no race.

Change-Id: Idfe3fb08327ef8cae926f3de9ee81c56a83b1738

gdbsupport/ChangeLog:
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

* scoped_ignore_signal.h
(scoped_ignore_signal::scoped_ignore_signal)
[HAVE_SIGPROCMASK]: Use sigprocmask to block the signal instead of
changing the signal disposition for the whole process.
(scoped_ignore_signal::~scoped_ignore_signal) [HAVE_SIGPROCMASK]:
Use sigtimedwait and sigprocmask to flush and unblock the signal.

2 years agoIntroduce scoped_restore_signal
Pedro Alves [Thu, 17 Jun 2021 15:16:54 +0000 (16:16 +0100)] 
Introduce scoped_restore_signal

We currently have scoped_restore_sigttou and scoped_restore_sigpipe
doing basically the same thing -- temporarily ignoring a specific
signal.

This patch introduce a scoped_restore_signal type that can be used for
both.  This will become more important for the next patch which
changes how the signal-ignoring is implemented.

scoped_restore_sigpipe is a straight alias to
scoped_restore_signal<SIGPIPE> on systems that define SIGPIPE, and an
alias to scoped_restore_signal_nop (a no-op version of
scoped_restore_signal) otherwise.

scoped_restore_sigttou is not a straight alias because it wants to
check the job_control global.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

* gdbsupport/scoped_ignore_signal.h: New.
* compile/compile.c: Include gdbsupport/scoped_ignore_signal.h
instead of <signal.h>.  Don't include <unistd.h>.
(scoped_ignore_sigpipe): Remove.
* gdbsupport/scoped_ignore_sigttou.h: Include gdbsupport/scoped_ignore_signal.h
instead of <signal.h>.  Don't include <unistd.h>.
(lazy_init): New.
(scoped_ignore_sigttou): Reimplement using scoped_ignore_signal
and lazy_init.

Change-Id: Ibb44d0bd705e96df03ef0787c77358a4a7b7086c

2 years agoMove scoped_ignore_sigttou to gdbsupport/
Pedro Alves [Thu, 17 Jun 2021 15:16:54 +0000 (16:16 +0100)] 
Move scoped_ignore_sigttou to gdbsupport/

A following patch will want to use scoped_ignore_sigttou in code
shared between GDB and GDBserver.  Move it under gdbsupport/.

Note that despite what inflow.h/inflow.c's first line says, inflow.c
is no longer about ptrace, it is about terminal management.  Some
other files were unnecessarily including inflow.h, I guess a leftover
from the days when inflow.c really was about ptrace.  Those inclusions
are simply dropped.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

* Makefile.in (HFILES_NO_SRCDIR): Remove inflow.h.
* inf-ptrace.c, inflow.c, procfs.c: Don't include "inflow.h".
* inflow.h: Delete, moved to gdbsupport/ under a different name.
* ser-unix.c: Don't include "inflow.h".  Include
"gdbsupport/scoped_ignore_sigttou.h".

gdbsupport/ChangeLog:
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

* scoped_ignore_sigttou.h: New file, moved from gdb/ and renamed.

Change-Id: Ie390abf42c3a78bec6d282ad2a63edd3e623559a

2 years agoFix an assertion failure in the AArch64 assembler triggered by incorrect instruction...
Nick Clifton [Thu, 17 Jun 2021 15:19:20 +0000 (16:19 +0100)] 
Fix an assertion failure in the AArch64 assembler triggered by incorrect instruction syntax.

PR 27904
* config/tc-aarch64.c (ldst_lo12_determine_real_reloc_type):
Generate a syntax error message if the reloc qualifier does not
match the instruction's size.

2 years agogas: handle csect in bss section for XCOFF
Clément Chigot [Tue, 15 Jun 2021 09:06:52 +0000 (11:06 +0200)] 
gas: handle csect in bss section for XCOFF

Latest gcc versions are now generating csects instead of .lcomm
for bss symbols.
Some adjustements are needed in order to handle them.

* config/tc-ppc.c (md_begin): Create bss section with dummy
symbol.
(ppc_frob_symbol): Output XTY_CM for bss csects.
(ppc_fix_adjustable): Adjust condition to avoid bss csects.

2 years agogdb/testsuite: gdb.base/args.exp: add KFAIL for native-extended-gdbserver
Simon Marchi [Thu, 17 Jun 2021 13:41:59 +0000 (09:41 -0400)] 
gdb/testsuite: gdb.base/args.exp: add KFAIL for native-extended-gdbserver

This test tests passing arguments made of exactly two single-quotes
('') or a single newline character through the --args argument of GDB.
For some reason, GDB adds some extra single quotes when transmitting the
arguments to GDBserver.  This produces some FAILs when testing with the
native-extended-gdbserver board:

    FAIL: gdb.base/args.exp: argv[2] for one empty (with single quotes)
    FAIL: gdb.base/args.exp: argv[2] for two empty (with single quotes)
    FAIL: gdb.base/args.exp: argv[3] for two empty (with single quotes)
    FAIL: gdb.base/args.exp: argv[2] for one newline
    FAIL: gdb.base/args.exp: argv[2] for two newlines
    FAIL: gdb.base/args.exp: argv[3] for two newlines

This is documented as PR 27989.  Add some appropriate KFAILs.

gdb/testsuite/ChangeLog:

* gdb.base/args.exp: Check target, KFAIL if remote.
(args_test): Add parameter and use it.

Change-Id: I49225d1c7df7ebaba480ebdd596df80f8fbf62f0

2 years agogdb/testsuite: gdb.base/args.exp: remove trailing parenthesis in test names
Simon Marchi [Thu, 17 Jun 2021 13:41:58 +0000 (09:41 -0400)] 
gdb/testsuite: gdb.base/args.exp: remove trailing parenthesis in test names

Some test names end with a parenthesis, we don't want that:

    https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Do_not_use_.22tail_parentheses.22_on_test_messages

Fix that.

gdb/testsuite/ChangeLog:

* gdb.base/args.exp: Remove trailing parenthesis in test names.

Change-Id: I0306ea202bae3a4ed5bf0bd65e0ab5ed5de52fe1

2 years agogdb/testsuite: gdb.base/args.exp: use $old_gdbflags last two tests
Simon Marchi [Thu, 17 Jun 2021 13:41:58 +0000 (09:41 -0400)] 
gdb/testsuite: gdb.base/args.exp: use $old_gdbflags last two tests

All tests in this file append to GDBFLAGS instead of overwriting it,
except the last two.  I noticed because when testing with the
native-extended-remote board, it removes the "set sysroot" argument, and
it causes the test to be very long to run, due to big glibc debug info
being read through the remote target.

I think this oddity is due to a race condition between these two
commits:

  [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c22261528c50f7760dd6a2e29314662b377eebb4
  [2] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6b8ce727297b1e40738e50f83a75881b290fe6a6

The first one added the two tests.  The second one changes the test to
append to GDBFLAGS instead of overwriting it.  But the second one was
probably written before the first one was it, so missed the new tests.

Change those two tests to be like the others.

gdb/testsuite/ChangeLog:

* gdb.base/args.exp: Use $old_gdbflags in all tests.

Change-Id: I531276125ecb70e80f52adbd320ebb85b0c8eba0

2 years agogdb/testsuite: gdb.base/args.exp: use save_vars
Simon Marchi [Thu, 17 Jun 2021 13:41:58 +0000 (09:41 -0400)] 
gdb/testsuite: gdb.base/args.exp: use save_vars

Use save_vars instead of manually saving/restoring.  This ensures that
if anything throws an error, GDBFLAGS will be correctly restored.

Remove the global GDBFLAGS declaration at the top, it's not necessary.

gdb/testsuite/ChangeLog:

* gdb.base/args.exp: Use save_vars.

Change-Id: I3a45e4fc1635ec0212de2415040f91eecaf4a057

2 years agoMake the TUI command window support the mouse
Pedro Alves [Thu, 17 Jun 2021 10:57:56 +0000 (11:57 +0100)] 
Make the TUI command window support the mouse

Currently, when the focus is on the command window, we disable the
keypad.  This means that when the command window has the focus, keys
such as up/down/home/end etc. are not processed by curses, and their
escape sequences go straight to readline.

A side effect of disabling keypad mode is that wgetch no longer
processes mouse escape sequences, with the end result being the mouse
doesn't work, and worse, the raw mouse escape sequences are printed on
the terminal.

This commit makes the TUI command window support the mouse as well, by
always enabling the keypad, and then to avoid losing support for
up/down browsing the command history, home/end/left/right moving the
cursor position, etc., we forward those keys as raw escape sequences
to readline.  Note we don't make an effort to pass down to readline
all keys returned by curses, only the common ones that readline
understands by default.  Given users can specify their own readline
bindings (inputrc file, bind utility), this approach is good in
practice, though not 100% transparent or perfect.

Note that the patch makes it so that CTLC-L is always passed to
readline even if the command window does not have the focus.  It was
simpler to implement that way, and it just seems correct to me.  I
don't know of a reason we shouldn't do that.

The patch improves the TUI behavior in a related way.  Now we can pass
special keys to readline irrespective of which window has the focus.
First, we try to dispatch the key to a window, via
tui_displatch_ctrl_char.  If the key is dispatched, then we don't pass
it to readline.  E.g., pressing "up" when you have the source window
in focus results in scrolling the source window, and nothing else.  If
however, you press ctrl-del instead, that results in killing the next
word in the command window, no matter which window has has focus.
Before, it would only work if you had the command window in focus.
Similarly, ctrl-left/ctrl-right to move between words, etc.

Similarly, the previous spot where we handled mouse events was
incorrect.  It was never reached if the window with focus can't
scroll, which is the case for the command window.  Mouse scrolling
affects the window under the mouse cursor, not the window in focus.
We now always try to dispatch mouse events.

One last bit in the patch -- now if we don't recognize the non-8-bit
curses key, then we don't pass it down to readline at all.  Before
that would result in bogus characters in the input line.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

* tui/tui-io.c (tui_dispatch_mouse_event): New, factored out from
...
(tui_dispatch_ctrl_char): ... this.  Move CTRL-L handling to
tui_getc_1.
(cur_seq, start_sequence): New.
(tui_getc_1): Pass key escape sequences for curses control keys to
readline.  Handle mouse and ctrl-l here.
(tui_resize_all): Disable/reenable the keypad if the command
window has the focus too.
* tui/tui-win.c (tui_set_focus_command): Don't change keypad
setting.
* tui/tui.c (tui_rl_other_window): Don't change keypad setting.

Change-Id: Ie0a7d849943cfb47f4a6589e1c73341563740fa9

2 years agogas: ensure sections contents is zero for BFD_RELOC_PPC*_TLSM on XCOFF.
Clément Chigot [Mon, 14 Jun 2021 11:25:42 +0000 (13:25 +0200)] 
gas: ensure sections contents is zero for BFD_RELOC_PPC*_TLSM on XCOFF.

AIX ld expects the section contents for relocations BFD_RELOC_PPC_TLSM
or BFD_RELOC_PPC64_TLSM to be zero.
Actually, it seems to be the case for all the TLS relocations
generated by AIX assembly but only these two are mandatory.

* config/tc-ppc.c (md_apply_fix): Adjust addend to nullify
section contents for BFD_RELOC_PPC_TLSM or
BFD_RELOC_PPC64_TLSM.
* testsuite/gas/ppc/xcoff-tlsm-32.d: New test.
* testsuite/gas/ppc/xcoff-tlsm-64.d: New test.
* testsuite/gas/ppc/xcoff-tlsm.s: New test.
* testsuite/gas/ppc/aix.exp: Run new tests.

2 years agopowerpc: move cell "or rx,rx,rx" hints
Alan Modra [Wed, 16 Jun 2021 07:05:53 +0000 (16:35 +0930)] 
powerpc: move cell "or rx,rx,rx" hints

* ppc-opc.c (powerpc_opcodes): Move cell db*cyc to proper location
in table.

2 years agosim: mn10300: tweak static inlines
Mike Frysinger [Thu, 17 Jun 2021 04:12:15 +0000 (00:12 -0400)] 
sim: mn10300: tweak static inlines

Use INLINE2 instead of INLINE to fix builds when -O0 are used -- the
latter define is omitted at -O0 levels while the former is always
set to inline.  These helper funcs are used by defines in here but
the defines aren't always called.

2 years agosim: split sim/callback.h include out
Mike Frysinger [Mon, 14 Jun 2021 02:14:40 +0000 (22:14 -0400)] 
sim: split sim/callback.h include out

The sim-basics.h is too big and includes too many things.  This leads
to some arch's sim-main.h having circular loop issues with defs, and
makes it hard to separate out common objects from arch-specific defs.
By splitting up sim-basics.h and killing off sim-main.h, it'll make
it easier to separate out the two.

Start with splitting out sim/callback.h.

2 years agoAutomatic date update in version.in
GDB Administrator [Thu, 17 Jun 2021 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 years agosim: make some rules silent by default in Make-common.in
Simon Marchi [Wed, 16 Jun 2021 15:55:53 +0000 (11:55 -0400)] 
sim: make some rules silent by default in Make-common.in

Use GDB's silent-rules.mk to make some rules silent by default.  These
rules cover most of what is built in sim/.

gdb/ChangeLog:

* silent-rules.mk (ECHO_CCLD, ECHO_AR, ECHO_RANLIB): New.

sim/ChangeLog:

* common/Make-common.in (COMPILE, libsim.a, run$(EXEEXT),
gentmap.o, gentmap): Make rules silent.

Change-Id: Idf9ba5beaee10c7c614859ace5fbdcd1de0287db

2 years agogdb, doc: Fix missed ChangeLog entry.
Felix Willgerodt [Wed, 16 Jun 2021 13:31:23 +0000 (15:31 +0200)] 
gdb, doc: Fix missed ChangeLog entry.

My previous commit "btrace, doc: Clarify record function-call-history
documentation." didn't add this to the actual ChangeLog file. Fix that.

2 years agobtrace, doc: Clarify record function-call-history documentation.
Felix Willgerodt [Wed, 16 Jun 2021 11:06:11 +0000 (13:06 +0200)] 
btrace, doc: Clarify record function-call-history documentation.

The documentation for 'record function-call-history' mentions lines instead
of functions when talking about the number of functions printed, as currently
there is only one line printed per function.  Yet the code actually handles
this on function granularity not on line basis.  Future patches will
extend the number of lines printed per function.  This also makes it
consistent with the 'record instruction-history' command, where multiple
lines can be printed per instruction.

gdb/doc/ChangeLog:
2021-06-16  Felix Willgerodt  <felix.willgerodt@intel.com>

* gdb.texinfo (Process Record and Replay): Stop mentioning lines
for "record function-call-history" and
"set record function-call-history-size".

2 years ago[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder(), again
Tom de Vries [Wed, 16 Jun 2021 10:44:30 +0000 (12:44 +0200)] 
[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder(), again

This is another attempt at fixing the problem described in commit 4cf88725da1
"[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder()", which was
reverted in commit 3db19b2d724.

First off, some context.

A DWARF CU can be viewed as a symbol table: toplevel children of a CU DIE
represent symbol table entries for that CU.  Furthermore, there is a
hierarchy: a symbol table entry such as a function itself has a symbol table
containing parameters and local variables.

The dwarf reader maintains a notion of current symbol table (that is: the
symbol table a new symbol needs to be entered into) in dwarf2_cu member
list_in_scope.

A problem then presents itself when reading inter-CU references:
- a new symbol read from a CU B needs to be entered into the symbol table of
  another CU A.
- the notion of current symbol table is tracked on a per-CU basis.
This is addressed in inherit_abstract_dies by temporarily overwriting the
list_in_scope for CU B with the one for CU A.

The current symbol table is one aspect of the current dwarf reader context
that is tracked, but there are more, f.i. ones that are tracked via the
dwarf2_cu member m_builder, f.i. m_builder->m_local_using_directives.

A similar problem exists in relation to inter-CU references, but a different
solution was chosen:
- to keep track of an ancestor field in dwarf2_cu, which is updated
  when traversing inter-CU references, and
- to use the ancestor field in dwarf2_cu::get_builder to return the m_builder
  in scope.

There is no actual concept of a CU having an ancestor, it just marks the most
recent CU from which a CU was inter-CU-referenced.  Consequently, when
following inter-CU references from a CU A to another CU B and back to CU A,
the ancestors form a cycle, which causes dwarf2_cu::get_builder to hang or
segfault, as reported in PR26327.

ISTM that the ancestor implementation is confusing and fragile, and should
go.  Furthermore, it seems that keeping track of the m_builder in scope can be
handled simply with a per-objfile variable.

Fix the hang / segfault by:
- keeping track of the m_builder in scope using a new variable
  per_obj->sym_cu, and
- using it in dwarf2_cu::get_builder.

Tested on x86_64-linux (openSUSE Leap 15.2), no regressions for config:
- using default gcc version 7.5.0
  (with 5 unexpected FAILs)
- gcc 10.3.0 and target board
  unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects
  (with 1000 unexpected FAILs)

gdb/ChangeLog:

2021-06-16  Tom de Vries  <tdevries@suse.de>

PR symtab/26327
* dwarf2/cu.h (dwarf2_cu::ancestor): Remove.
(dwarf2_cu::get_builder): Declare and move ...
* dwarf2/cu.c (dwarf2_cu::get_builder): ... here.  Use sym_cu instead
of ancestor.  Assert return value is non-null.
* dwarf2/read.c (read_file_scope): Set per_objfile->sym_cu.
(follow_die_offset, follow_die_sig_1): Remove setting of ancestor.
(dwarf2_per_objfile): Add sym_cu field.

2 years agogas: fix hex float parsing from .dcb.? directives
Jan Beulich [Wed, 16 Jun 2021 06:55:52 +0000 (08:55 +0200)] 
gas: fix hex float parsing from .dcb.? directives

Unlike for .dc.? the parsing here failed to skip the colon before
calling hex_float(). To avoid both variants of parsing going out of sync
again, introduce a helper used by both.

2 years agogas: fix overflow diagnostics
Jan Beulich [Wed, 16 Jun 2021 06:55:20 +0000 (08:55 +0200)] 
gas: fix overflow diagnostics

While the logic in fixup_segment() so far was off by 1 for fixups
dealing with quantities without known signedness, thus failing to report
an overflow when e.g. a byte-sized resulting value is -0x100, the logic
in emit_expr_with_reloc() reported an overflow even on large negative
values when the respective positive ones would not be warned
about, and when fixup_segment() wouldn't do so either. Such diagnostics
all ought to follow a similar pattern of what value range is acceptable.
(If expressions' X_unsigned was reliably set, emit_expr_with_reloc()'s
checking might make sense to tighten based on that flag.)

Note that with commit 80aab57939a0 ("Changes to let cons handle bignums
like general expressions") having added handling of nbytes >
sizeof(valueT) in the O_constant case, converting to O_big, the setting
to zero of "hibit" had become dead. With "hibit" no longer used, this
code now gets dropped altogether. But additionally a respective know()
gets inserted.

2 years agosim: mips: add printf attribute to trace func
Mike Frysinger [Tue, 15 Jun 2021 05:09:49 +0000 (01:09 -0400)] 
sim: mips: add printf attribute to trace func

This helps catch format errors in code, although they're all clean
at this point already.

2 years agosim: mips: rework dynamic printf logic to avoid compiler warnings
Mike Frysinger [Tue, 15 Jun 2021 04:41:22 +0000 (00:41 -0400)] 
sim: mips: rework dynamic printf logic to avoid compiler warnings

The compiler doesn't like passing non-constant strings to printf
functions, so tweak the code to always pass one in.  This code is
a little more verbose, but it's probably the same performance.

The macro usage is a bit ugly, but maybe less than copying &
pasting the extended conditional format logic.

2 years agosim: mips: tweak buffer sign
Mike Frysinger [Tue, 15 Jun 2021 04:40:17 +0000 (00:40 -0400)] 
sim: mips: tweak buffer sign

This model uses unsigned char buffers, but this temporary pointer is
declared as signed.  Switch it to unsigned since it's just a temporary
variable to hold the new pointer.

2 years agosim: mips: fix uninitialized register use
Mike Frysinger [Tue, 15 Jun 2021 04:39:28 +0000 (00:39 -0400)] 
sim: mips: fix uninitialized register use

In the default case, this code will read from this variable before
it is initialized as a dummy access.  Set it to 0 to fix the compiler
warning.

2 years agosim: drop obsolete AC_EXEEXT call
Mike Frysinger [Wed, 16 Jun 2021 02:48:50 +0000 (22:48 -0400)] 
sim: drop obsolete AC_EXEEXT call

The current autoconf 2.69 defines this to nothing because the logic
in AC_PROG_CC takes care of it all the time now.  Delete the call.

2 years agosim: ppc: use common sim-assert setting
Mike Frysinger [Wed, 16 Jun 2021 01:17:55 +0000 (21:17 -0400)] 
sim: ppc: use common sim-assert setting

The common sim code already sets this up for us, so no need to
duplicate the logic.

2 years agosim: ppc: convert to bfd_endian
Mike Frysinger [Wed, 16 Jun 2021 00:58:31 +0000 (20:58 -0400)] 
sim: ppc: convert to bfd_endian

Rather than re-invent endian defines, as well as maintain our own list
of OS & arch-specific includes, punt all that logic in favor of the bfd
ones already set up and maintained elsewhere.  We already rely on the
bfd library, so leveraging the endian aspect should be fine.

This was done for all the other ports years ago, so catch ppc up.

2 years agosim: ppc: replace local __attribute__ fallback
Mike Frysinger [Wed, 16 Jun 2021 00:50:16 +0000 (20:50 -0400)] 
sim: ppc: replace local __attribute__ fallback

The common ansidecl.h provides fallbacks for these so we don't need to.

2 years agosim: ppc: use common ATTRIBUTE_PRINTF macros
Mike Frysinger [Wed, 16 Jun 2021 00:46:10 +0000 (20:46 -0400)] 
sim: ppc: use common ATTRIBUTE_PRINTF macros

Use the common ansidecl.h macros to replace our ad-hoc printf attributes.

2 years agosim: ppc: use common ATTRIBUTE_PACKED macro
Mike Frysinger [Wed, 16 Jun 2021 00:43:22 +0000 (20:43 -0400)] 
sim: ppc: use common ATTRIBUTE_PACKED macro

Drop local packed attribute with the common ansidecl.h define.

2 years agosim: ppc: replace local NORETURN macros with common one
Mike Frysinger [Wed, 16 Jun 2021 00:40:31 +0000 (20:40 -0400)] 
sim: ppc: replace local NORETURN macros with common one

Drop local NORETURN macro with the common ansidecl.h ATTRIBUTE_NORETURN define.

2 years agosim: ppc: replace local UNUSED macros with common one
Mike Frysinger [Wed, 16 Jun 2021 00:38:45 +0000 (20:38 -0400)] 
sim: ppc: replace local UNUSED macros with common one

Drop local UNUSED macro with the common ansidecl.h ATTRIBUTE_UNUSED define.

2 years agosim: ppc: replace local CONCAT macros with common ones
Mike Frysinger [Wed, 16 Jun 2021 00:35:37 +0000 (20:35 -0400)] 
sim: ppc: replace local CONCAT macros with common ones

Drop local copies of CONCAT macros that the common ansidecl.h provides.

2 years agosim: ppc: change bool variable name to boolean
Mike Frysinger [Wed, 16 Jun 2021 00:28:35 +0000 (20:28 -0400)] 
sim: ppc: change bool variable name to boolean

This is a reserved type with stdbool.h.

2 years agosim: ppc: drop host endian configure option
Mike Frysinger [Wed, 16 Jun 2021 00:20:11 +0000 (20:20 -0400)] 
sim: ppc: drop host endian configure option

The --enable-sim-hostendian flag was purely so people had an escape route
for when cross-compiling.  This is because historically, AC_C_BIGENDIAN
did not work in those cases.  That was fixed a while ago though, so we can
require that macro everywhere now and simplify a good bit of code.

This was done for all the other ports years ago, so catch ppc up.

2 years agosim: mips: fix format warnings when setting up memory
Mike Frysinger [Tue, 15 Jun 2021 04:00:29 +0000 (00:00 -0400)] 
sim: mips: fix format warnings when setting up memory

The majority of these inputs are not long's, so don't use %lx.
This fixes compiler warnings about type mismatches.

2 years agosim: drop arch-specific config.h
Mike Frysinger [Sun, 13 Jun 2021 05:54:48 +0000 (01:54 -0400)] 
sim: drop arch-specific config.h

All of the settings in here are handled by the common top-level
config.h, so drop the individual arch-config.h files entirely.

This will also help guarantee that we don't add any new arch
specific defines that would affect common code which will help
with the effort of unifying them.

2 years agosim: move dv-sockser define to CPPFLAGS
Mike Frysinger [Sun, 13 Jun 2021 05:52:01 +0000 (01:52 -0400)] 
sim: move dv-sockser define to CPPFLAGS

This is the only define left in m4/ that is not in the common config.h,
so move it to sim_hw_cflags so we can drop the arch-specific config.h.

2 years agoAutomatic date update in version.in
GDB Administrator [Wed, 16 Jun 2021 00:00:06 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 years agosim: switch modules.c & version.c to stamp files
Mike Frysinger [Tue, 15 Jun 2021 00:38:52 +0000 (20:38 -0400)] 
sim: switch modules.c & version.c to stamp files

This fixes remaking of these files and avoids unnecessary rebuilds.

Also add both to `make clean` to match other stamp files.

2 years agoFix typo in vsx-regs.exp test
Carl Love [Tue, 15 Jun 2021 18:40:11 +0000 (13:40 -0500)] 
Fix typo in vsx-regs.exp test

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.

2 years agoAllow readelf to recognise GO buildid notes.
Nick Clifton [Tue, 15 Jun 2021 10:43:43 +0000 (11:43 +0100)] 
Allow readelf to recognise GO buildid notes.

binutils * readelf.c (get_note_type): Add support for NT_GO_BUILDID.

include  * elf/common.h (NT_GO_BUILDID): Define.

2 years agox86: bring "gas --help" output for --32 etc in sync with reality
Jan Beulich [Tue, 15 Jun 2021 06:01:12 +0000 (08:01 +0200)] 
x86: bring "gas --help" output for --32 etc in sync with reality

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.

2 years agox86: simplify .dispNN setting
Jan Beulich [Tue, 15 Jun 2021 06:00:45 +0000 (08:00 +0200)] 
x86: simplify .dispNN setting

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.

2 years agox86: slightly simplify offset_in_range()
Jan Beulich [Tue, 15 Jun 2021 06:00:17 +0000 (08:00 +0200)] 
x86: slightly simplify offset_in_range()

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.

2 years agox86: harmonize disp with imm handling
Jan Beulich [Tue, 15 Jun 2021 05:59:44 +0000 (07:59 +0200)] 
x86: harmonize disp with imm handling

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.

2 years agox86: make offset_in_range()'s warning contents useful (again)
Jan Beulich [Tue, 15 Jun 2021 05:58:57 +0000 (07:58 +0200)] 
x86: make offset_in_range()'s warning contents useful (again)

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.

2 years agox86: off-by-1 in offset_in_range()
Jan Beulich [Tue, 15 Jun 2021 05:58:18 +0000 (07:58 +0200)] 
x86: off-by-1 in offset_in_range()

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.

2 years agox86: permit parenthesized expressions again as addressing scale factor
Jan Beulich [Tue, 15 Jun 2021 05:57:11 +0000 (07:57 +0200)] 
x86: permit parenthesized expressions again as addressing scale factor

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.

2 years agoreadelf: report DF_1_PIE as "Position-Independent Executable"
Alan Modra [Fri, 11 Jun 2021 04:53:57 +0000 (14:23 +0930)] 
readelf: report DF_1_PIE as "Position-Independent Executable"

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.

2 years agosim: mn10300: enable -Werror
Mike Frysinger [Tue, 15 Jun 2021 03:45:42 +0000 (23:45 -0400)] 
sim: mn10300: enable -Werror

Now that all warnings are fixed in this port, enable -Werror by default.

2 years agosim: mn10300: switch abort to sim_engine_abort
Mike Frysinger [Tue, 15 Jun 2021 03:44:48 +0000 (23:44 -0400)] 
sim: mn10300: switch abort to sim_engine_abort

This allows the caller to catch engine aborts if they want, and fixes
the warning about missing stdlib.h include by not using abort().

2 years agosim: erc32: fix build w/out F_{G,S}ETFL
Mike Frysinger [Tue, 15 Jun 2021 03:25:01 +0000 (23:25 -0400)] 
sim: erc32: fix build w/out F_{G,S}ETFL

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.

2 years agosim: erc32: fix build w/out termios.h
Mike Frysinger [Tue, 15 Jun 2021 03:23:19 +0000 (23:23 -0400)] 
sim: erc32: fix build w/out termios.h

Add conditional logic around termios.h usage to fix builds on systems
that don't have it (e.g. Windows).

2 years agosim: drop redundant SIM_AC_OPTION_WARNINGS
Mike Frysinger [Tue, 15 Jun 2021 03:16:49 +0000 (23:16 -0400)] 
sim: drop redundant SIM_AC_OPTION_WARNINGS

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.

2 years agosim: enable silent rules in common builds
Mike Frysinger [Mon, 14 Jun 2021 23:54:04 +0000 (19:54 -0400)] 
sim: enable silent rules in common builds

We only do the common code as automake simplifies the logic.

2 years agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Jun 2021 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 years agognulib: define the path to gnulib's parent dir
Mike Frysinger [Tue, 8 Jun 2021 22:04:28 +0000 (18:04 -0400)] 
gnulib: define the path to gnulib's parent dir

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.

2 years agofbsd nat: Disable address space randomization when requested.
John Baldwin [Mon, 14 Jun 2021 21:28:26 +0000 (14:28 -0700)] 
fbsd nat: Disable address space randomization when requested.

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.

2 years agoFix silent gdb.base/annota1.exp test coverage regression
Pedro Alves [Mon, 14 Jun 2021 20:29:32 +0000 (21:29 +0100)] 
Fix silent gdb.base/annota1.exp test coverage regression

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:

 \1a\1apre-prompt
 (gdb)
 \1a\1aprompt
 PASS: gdb.base/annota1.exp: breakpoint info
 PASS: gdb.base/annota1.exp: run until main breakpoint
 run

 \1a\1apost-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

2 years agoInclude missing header signal.h
Bernd Edlinger [Mon, 14 Jun 2021 12:49:21 +0000 (14:49 +0200)] 
Include missing header signal.h

2021-06-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* compile/compile.c: Include missing header signal.h.

2 years agoUse consistent type in binutils/dwarf.c
Eric Botcazou [Mon, 14 Jun 2021 13:43:19 +0000 (15:43 +0200)] 
Use consistent type in binutils/dwarf.c

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.

2 years agoGNU gettext introduced this change[0] in version 0.19.8 to fix gettext detection...
Michael Forney [Mon, 14 Jun 2021 13:05:39 +0000 (14:05 +0100)] 
GNU gettext introduced this change[0] in version 0.19.8 to fix gettext 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

2 years agogas: fold three as_warn() in emit_expr_with_reloc()
Jan Beulich [Mon, 14 Jun 2021 06:18:58 +0000 (08:18 +0200)] 
gas: fold three as_warn() in emit_expr_with_reloc()

Simply use the available abstraction instead of, effectively, trying to
open-code it.

2 years agogas: drop TC_ADDRESS_BYTES conditionals
Jan Beulich [Mon, 14 Jun 2021 06:18:07 +0000 (08:18 +0200)] 
gas: drop TC_ADDRESS_BYTES conditionals

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.

2 years agosim: ppc: use common version.o too
Mike Frysinger [Mon, 14 Jun 2021 01:35:05 +0000 (21:35 -0400)] 
sim: ppc: use common version.o too

The common version.o we're building can be used for the ppc subdir,
so switch it over too.

2 years agosim: rx: move cycle-accurate settings to CPPFLAGS
Mike Frysinger [Sun, 13 Jun 2021 05:32:33 +0000 (01:32 -0400)] 
sim: rx: move cycle-accurate settings to CPPFLAGS

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.

2 years agoAutomatic date update in version.in
GDB Administrator [Mon, 14 Jun 2021 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 years agosim: start unifying portability shims
Mike Frysinger [Sat, 29 May 2021 20:07:43 +0000 (16:07 -0400)] 
sim: start unifying portability shims

There are some functions that gnulib does not yet provide fallbacks
for, so start a common file of our own for holding existing stubs.

2 years agosim: unify sim-load.o building
Mike Frysinger [Mon, 7 Jun 2021 05:48:06 +0000 (01:48 -0400)] 
sim: unify sim-load.o building

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.

2 years agosim: rx: replace cycle-stats with common profile settings
Mike Frysinger [Sat, 12 Jun 2021 16:01:27 +0000 (12:01 -0400)] 
sim: rx: replace cycle-stats with common profile settings

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.

2 years agosim: assume sys/select.h always exists
Mike Frysinger [Sat, 29 May 2021 19:20:28 +0000 (15:20 -0400)] 
sim: assume sys/select.h always exists

Now that gnulib provides this, assume it exists.

2 years agosim: erc32: replace caddr_t with void*
Mike Frysinger [Wed, 9 Jun 2021 22:05:25 +0000 (18:05 -0400)] 
sim: erc32: replace caddr_t with void*

This BSDism was never accepted into standards, so replace it with the
portable void* type instead.

2 years agosim: erc32/ppc: fix handling of $EXEEXT
Mike Frysinger [Wed, 9 Jun 2021 22:04:57 +0000 (18:04 -0400)] 
sim: erc32/ppc: fix handling of $EXEEXT

This page took 0.047743 seconds and 4 git commands to generate.