deliverable/binutils-gdb.git
4 years agoIntroduce switch_to_inferior_no_thread
Pedro Alves [Fri, 10 Jan 2020 20:05:47 +0000 (20:05 +0000)] 
Introduce switch_to_inferior_no_thread

Several places want to switch context to an inferior and its pspace,
while at the same time switch to "no thread selected".  This commit
adds a function that does that, and uses it in a few places.

gdb/ChangeLog:
2020-01-10  Pedro Alves <palves@redhat.com>

* inferior.c (switch_to_inferior_no_thread): New function,
factored out from ...
(inferior_command): ... here.
* inferior.h (switch_to_inferior_no_thread): Declare.
* mi/mi-main.c (run_one_inferior): Use
switch_to_inferior_no_thread.

4 years agoDelete unnecessary code from kill_command
Pedro Alves [Fri, 10 Jan 2020 20:05:46 +0000 (20:05 +0000)] 
Delete unnecessary code from kill_command

I believe this comment:

      /* Killing off the inferior can leave us with a core file.  If
 so, print the state we are left in.  */

Referred to the fact that a decade ago, by design, GDB would let you
type "run" when debugging a core dump, keeping the core open.  That
"run" would push a process_stratum target on the target stack for the
live process, and, the core would remain open -- we used to have a
core_stratum.  When the live process was killed/detached or exited,
GDB would go back to debugging the core, since the core_stratum target
was now at the top of the stack.  That design had a number of
problems, see here for example:

  https://sourceware.org/ml/gdb-patches/2008-08/msg00290.html

In 2010, core_stratum was finaly eliminated and cores now have
process_stratum too, with commit c0edd9edadfe ("Make core files the
process_stratum.").  Pushing a live process on the stack while you're
debugging a core discards the core completely.

I also thought that this might be in use with checkpoints, but it does
not -- "kill" when you have multiple checkpoints kills all the
checkpoints.

gdb/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

* infcmd.c (kill_command): Remove dead code.

4 years agoDon't check target is running in remote_target::mourn_inferior
Pedro Alves [Fri, 10 Jan 2020 20:05:45 +0000 (20:05 +0000)] 
Don't check target is running in remote_target::mourn_inferior

I believe the tail end of remote_target::mourn_inferior is broken, and
it's been broken for too long to even bother trying to fix.  Most
probably nobody needs it.  If the code is reached and we find the
target is running, we'd need to resync the thread list, at least,
since generic_mourn_inferior got rid of all the threads in the
inferior, otherwise, we'd hit an assertion on the next call to
inferior_thread(), for example.  A "correct" fix would probably
involve restarting the whole remote_target::start_remote requence,
exactly as if we had completely disconnected and reconnected from
scratch.

Note that regular stub debugging usually uses plain target remote, but
this code is only reachable in target extended-mode:

- The !remote_multi_process_p check means that it's only reacheable if
  the stub does not support multi-process.  I.e., there can only ever
  be one live process.

- remote_target::mourn_inferior has this at the top:

  /* In 'target remote' mode with one inferior, we close the connection.  */
  if (!rs->extended && number_of_live_inferiors () <= 1)
    {
      unpush_target (this);

      /* remote_close takes care of doing most of the clean up.  */
      generic_mourn_inferior ();
      return;
    }

  Which means that if we only had one live inferior (which for our
  case, must be true), we'll have closed the connection already,
  unless we're in extended-remote mode.

gdb/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

* remote.c (remote_target::mourn_inferior): No longer check
whether the target is running.

4 years agoMake target_ops::has_execution take an 'inferior *' instead of a ptid_t
Pedro Alves [Fri, 10 Jan 2020 20:05:44 +0000 (20:05 +0000)] 
Make target_ops::has_execution take an 'inferior *' instead of a ptid_t

With the multi-target work, each inferior will have its own target
stack, so to call a target method, we'll need to make sure that the
inferior in question is the current one, otherwise target->beneath()
calls will find the target beneath in the wrong inferior.

In some places, it's much more convenient to be able to check whether
an inferior has execution without having to switch to it in order to
call target_has_execution on the right inferior/target stack, to avoid
side effects with switching inferior/thread/program space.

The current target_ops::has_execution method takes a ptid_t as
parameter, which, in a multi-target world, isn't sufficient to
identify the target.  This patch prepares to address that, by changing
the parameter to an inferior pointer instead.  From the inferior,
we'll be able to query its target stack to tell which target is
beneath.

Also adds a new inferior::has_execution() method to make callers a bit
more natural to read.

gdb/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

* corelow.c (core_target::has_execution): Change parameter type to
inferior pointer.
* inferior.c (number_of_live_inferiors): Use
inferior::has_execution instead of target_has_execution_1.
* inferior.h (inferior::has_execution): New.
* linux-thread-db.c (thread_db_target::update_thread_list): Use
inferior::has_execution instead of target_has_execution_1.
* process-stratum-target.c
(process_stratum_target::has_execution): Change parameter type to
inferior pointer.  Check the inferior's PID instead of
inferior_ptid.
* process-stratum-target.h
(process_stratum_target::has_execution): Change parameter type to
inferior pointer.
* record-full.c (record_full_core_target::has_execution): Change
parameter type to inferior pointer.
* target.c (target_has_execution_1): Change parameter type to
inferior pointer.
(target_has_execution_current): Adjust.
* target.h (target_ops::has_execution): Change parameter type to
inferior pointer.
(target_has_execution_1): Change parameter type to inferior
pointer.  Change return type to bool.
* tracefile.h (tracefile_target::has_execution): Change parameter
type to inferior pointer.

4 years agoexceptions.c:print_flush: Remove obsolete check
Pedro Alves [Fri, 10 Jan 2020 20:05:43 +0000 (20:05 +0000)] 
exceptions.c:print_flush: Remove obsolete check

Commit 20f0d60db4fb ("Avoid crash when calling warning too early"),
added a "current_top_target () != NULL" check to
target_supports_terminal_ours, so this check in exceptions.c is now
obsolete.

gdb/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

* exceptions.c (print_flush): Remove current_top_target() check.

4 years agoMake "show remote exec-file" inferior-aware
Pedro Alves [Fri, 10 Jan 2020 20:05:42 +0000 (20:05 +0000)] 
Make "show remote exec-file" inferior-aware

The "set remote exec-file" setting is per-inferior, but the "show
remote exec-file" command always shows the last set exec-file,
irrespective of the current inferior.  E.g.:

 # Set inferior 1's exec-file:
 (gdb) set remote exec-file prog1

 # Add inferior 2, switch to it, and set its exec-file:
 (gdb) add-inferior
 Added inferior 2
 (gdb) inferior 2
 (gdb) set remote exec-file prog2

 # Switch back to inferior 1, and show its exec-file:
 (gdb) inferior 1
 (gdb) show remote exec-file
 prog2
 ^^^^^ should show "prog1" instead here.

gdb/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

* remote.c (show_remote_exec_file): Show the current inferior's
exec-file instead of the command variable's value.

gdb/testsuite/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

* gdb.base/remote-exec-file.exp: New file.

4 years agoDon't rely on inferior_ptid in record_full_wait
Pedro Alves [Fri, 10 Jan 2020 20:05:41 +0000 (20:05 +0000)] 
Don't rely on inferior_ptid in record_full_wait

The multi-target patch sets inferior_ptid to null_ptid before handling
a target event, and thus before calling target_wait, in order to catch
places in target_ops::wait implementations that are incorrectly
relying on inferior_ptid (which could otherwise be a ptid of a
different target, for example).  That caught this instance in
record-full.c.

Fix it by saving the last resumed ptid, and then using it in
record_full_wait_1, just like how the last "step" argument passed to
record_full_target::resume is handled too.

gdb/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

* record-full.c (record_full_resume_ptid): New global.
(record_full_target::resume): Set it.
(record_full_wait_1): Use record_full_resume_ptid instead of
inferior_ptid.

4 years agoPreserve selected thread in all-stop w/ background execution
Pedro Alves [Fri, 10 Jan 2020 20:05:41 +0000 (20:05 +0000)] 
Preserve selected thread in all-stop w/ background execution

In non-stop mode, if you resume the program in the background (with
"continue&", for example), then gdb makes sure to not switch the
current thread behind your back.  That means that you can be sure that
the commands you type apply to the thread you selected, even if some
other thread that was running in the background hits some event just
while you're typing.

In all-stop mode, however, if you resume the program in the
background, gdb let's the current thread switch behind your back.

This is bogus, of course.  All-stop and non-stop background
resumptions should behave the same.

This patch fixes that, and adds a testcase that exposes the bad
behavior in current master.

The fork-running-state.exp changes are necessary because that
preexisting testcase was expecting the old behavior:

Before:

  continue &
  Continuing.
  (gdb)
  [Attaching after process 8199 fork to child process 8203]
  [New inferior 2 (process 8203)]
  info threads
    Id   Target Id                      Frame
    1.1  process 8199 "fork-running-st" (running)
  * 2.1  process 8203 "fork-running-st" (running)
  (gdb)

After:

  continue &
  Continuing.
  (gdb)
  [Attaching after process 24660 fork to child process 24664]
  [New inferior 2 (process 24664)]
  info threads
    Id   Target Id                       Frame
  * 1.1  process 24660 "fork-running-st" (running)
    2.1  process 24664 "fork-running-st" (running)
  (gdb)

Here we see that before this patch GDB switches current inferior to
the new inferior behind the user's back, as a side effect of handling
the fork.

The delete_exited_threads call in inferior_appeared is there to fix an
issue that Baris found in a previous version of this patch.  The
fetch_inferior_event change increases the refcount of the current
thread, and in case the fetched inferior event denotes a thread exit,
the thread will not be deleted right away.  A non-deleted but exited
thread stays in the inferior's thread list.  This, in turn, causes the
"init_thread_list" call in inferior.c to be skipped.  A consequence is
that the global thread ID counter is not restarted if the current
thread exits, and then the inferior is restarted:

 (gdb) start
 Temporary breakpoint 1 at 0x4004d6: file main.c, line 21.
 Starting program: /tmp/main

 Temporary breakpoint 1, main () at main.c:21
 21        foo ();
 (gdb) info threads -gid
   Id   GId  Target Id            Frame
 * 1    1    process 16106 "main" main () at main.c:21
 (gdb) c
 Continuing.
 [Inferior 1 (process 16106) exited normally]
 (gdb) start
 Temporary breakpoint 2 at 0x4004d6: file main.c, line 21.
 Starting program: /tmp/main

 Temporary breakpoint 2, main () at main.c:21
 21        foo ();
 (gdb) info threads -gid
   Id   GId  Target Id            Frame
 * 1    2    process 16138 "main" main () at main.c:21
       ^^^

Notice that GId == 2 above.  It should have been "1" instead.

The new tids-git-reset.exp testcase exercises the problem above.

gdb/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

* gdbthread.h (scoped_restore_current_thread)
<dont_restore, restore, m_dont_restore>: Declare.
* thread.c (thread_alive): Add assertion.  Return bool.
(switch_to_thread_if_alive): New.
(prune_threads): Switch inferior/thread.
(print_thread_info_1): Switch thread before calling target methods.
(scoped_restore_current_thread::restore): New, factored out from
...
(scoped_restore_current_thread::~scoped_restore_current_thread):
... this.
(scoped_restore_current_thread::scoped_restore_current_thread):
Add assertion.
(thread_apply_all_command, thread_select): Use
switch_to_thread_if_alive.

gdb/testsuite/ChangeLog:
2020-01-10  Pedro Alves  <palves@redhat.com>

* gdb.base/fork-running-state.exp (do_test): Adjust expected
output.
* gdb.threads/async.c: New.
* gdb.threads/async.exp: New.
* gdb.multi/tids-gid-reset.c: New.
* gdb.multi/tids-gid-reset.exp: New.

4 years agoFix handling of null stap semaphores
George Barrett [Fri, 10 Jan 2020 19:30:28 +0000 (06:30 +1100)] 
Fix handling of null stap semaphores

According to the SystemTap documentation on user-space probes[0], stap
probe points without semaphores are denoted by setting the semaphore
address in the probe's note to zero. At present the code does do a
comparison of the semaphore address against zero, but only after it's
been relocated; as such it will (almost?) always fail, commonly
resulting in GDB trying to overwrite the ELF magic located at the
image's base address.

This commit tests the address as specified in the SDT note rather than
the relocated value in order to correctly detect absent probe
semaphores.

[0]: https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation

gdb/Changelog:
2020-01-11  George Barrett  <bob@bob131.so>

* stap-probe.c (stap_modify_semaphore): Don't check for null
semaphores.
(stap_probe::set_semaphore, stap_probe::clear_semaphore): Check
for null semaphores.

gdb/testsuite/ChangeLog:
2020-01-11  George Barrett  <bob@bob131.so>

* gdb.base/stap-probe.c (relocation_marker): Add dummy variable
to help in finding the image relocation offset.
* gdb.base/stap-probe.exp (stap_test): Accept arbitrary compile
options in arguments.
(stap_test_no_debuginfo): Likewise.
(stap-probe-nosem-noopt-pie, stap-probe-nosem-noopt-nopie): Add
test variants.
(stap_test): Add null semaphore relocation test.

4 years agogdb/testsuite/gdb.base/stap-probe: Minor clean-up
George Barrett [Fri, 10 Jan 2020 19:30:01 +0000 (06:30 +1100)] 
gdb/testsuite/gdb.base/stap-probe: Minor clean-up

This patch resolves a couple of issues with the test case for SystemTap
user-space probe points:
  1. The preprocessor macro guarding the semaphore variables in the C
     file is (rather confusingly) named USE_PROBES. This has been
     renamed to USE_SEMAPHORES, to better reflect its function.
  2. The test procedures in the expect file improperly pass the flag
     defining USE_PROBES to prepare_for_testing; as such, the test
     binary that's supposed to have probes with semaphores is the same
     as the one without. This has also been fixed.
  3. No test is performed to check that `info probes' returns
     information about probe semaphores. Such a test is included in this
     patch.

gdb/testsuite/ChangeLog
2020-01-10  George Barrett  <bob@bob131.so>

* gdb.base/stap-probe.c: Rename USE_PROBES to USE_SEMAPHORES.
* gdb.base/stap-probe.exp: Likewise.
(stap_test): Pass argument as an additional flag.
(stap_test_no_debuginfo): Likewise.
(stap_test): Check `info probes stap' output for semaphore
addresses if the test binary is supposed to have them.

4 years ago[PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIE
Szabolcs Nagy [Thu, 9 Jan 2020 17:20:56 +0000 (17:20 +0000)] 
[PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIE

With static PIE linking undefined weak symbols are resolved to 0, so no
dynamic relocation is needed for them. The UNDEFWEAK_NO_DYNAMIC_RELOC
macro was introduced so this case can be handled easily, but it was not
applied consistently in the first attempt to fix ld/22269 for arm:

  commit 95b03e4ad68e7a90f5096b47df595636344b783a
  arm: Check UNDEFWEAK_NO_DYNAMIC_RELOC

This patch fixes spurious relative relocs in static PIE binaries against
GOT entries created for undefined weak symbols on arm*-*, this fixes

FAIL: pr22269-1 (static pie undefined weak)

bfd/ChangeLog:

PR ld/22269
* elf32-arm.c (elf32_arm_final_link_relocate): Use
UNDEFWEAK_NO_DYNAMIC_RELOC.
(allocate_dynrelocs_for_symbol): Likewise.

4 years agoAArch64: Revert setting of elf class in linker stub.
Tamar Christina [Fri, 10 Jan 2020 13:48:57 +0000 (13:48 +0000)] 
AArch64: Revert setting of elf class in linker stub.

This changes the fix to PR 25210 by removing the ELF class change.
As it turns out the correct change was only the change in compress.c.

Everything else is unneeded and setting the elf class is making the linker
behave very oddly under LTO.  The first stub is correctly written out but for
the rest the suddenly don't have a pointer to the stub section anymore.

This caused SPEC to fail as the program would branch to the stub and it wouldn't
be filled in.

Committed to master under the trivial rule as this is partially reverting a previous commit.

bfd/ChangeLog:

PR 25210
* elfnn-aarch64.c (_bfd_aarch64_create_stub_section): Remove elfclass.

4 years agoHPUX gas testsuite fixes
Alan Modra [Fri, 10 Jan 2020 06:59:59 +0000 (17:29 +1030)] 
HPUX gas testsuite fixes

* testsuite/gas/elf/pr14891.s: Don't start directives in first column.
* testsuite/gas/elf/pr21661.d: Don't run on hpux.

4 years agoubsan: tilepro: signed integer overflow
Alan Modra [Thu, 9 Jan 2020 21:57:33 +0000 (08:27 +1030)] 
ubsan: tilepro: signed integer overflow

* tilepro-opc.c (parse_insn_tilepro): Make opval unsigned.
* tilegx-opc.c (parse_insn_tilegx): Likewise.  Delete raw_opval.

4 years agoubsan: m10300: shift exponent -4
Alan Modra [Wed, 8 Jan 2020 20:29:42 +0000 (06:59 +1030)] 
ubsan: m10300: shift exponent -4

* m10300-dis.c (disassemble): Move extraction of DREG, AREG, RREG,
and XRREG value earlier to avoid a shift with negative exponent.
* m10200-dis.c (disassemble): Similarly.

4 years agoubsan: spu: left shift of negative value
Alan Modra [Wed, 8 Jan 2020 20:14:16 +0000 (06:44 +1030)] 
ubsan: spu: left shift of negative value

Also fixes a real bug.  The DECODE_INSN_I9a and DECODE_INSN_I9b both
use UNSIGNED_EXTRACT for 7 low bits of the result, but this was an
unsigned value due to "insn" being unsigned.  DECODE_INSN_I9* is
therefore unsigned too, leading to a zero extension in an expression
using a bfd_vma if bfd_vma is 64 bits.

* opcode/spu.h: Formatting.
(UNSIGNED_EXTRACT): Use 1u.
(SIGNED_EXTRACT): Don't sign extend with shifts.
(DECODE_INSN_I9a, DECODE_INSN_I9b): Avoid left shift of signed value.
Keep result signed.
(DECODE_INSN_U9a, DECODE_INSN_U9b): Delete.

4 years agoubsan: alpha-coff: signed integer overflow
Alan Modra [Wed, 8 Jan 2020 20:11:25 +0000 (06:41 +1030)] 
ubsan: alpha-coff: signed integer overflow

* coff-alpha.c (alpha_ecoff_object_p): Calculate size in bfd_size_type.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 10 Jan 2020 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogdb/tui: Link source and assembler scrolling .... again
Andrew Burgess [Tue, 7 Jan 2020 11:39:17 +0000 (11:39 +0000)] 
gdb/tui: Link source and assembler scrolling .... again

Until recently when the source window was scrolled the assembler
window would scroll in sync - keeping the disassembly for the current
line in view.

This was broken in commit:

  commit b4b49dcbff6b437fa8b4e2fc0c3f27b457f11310
  Date:   Wed Nov 13 16:47:58 2019 -0700

      Don't call tui_show_source from tui_ui_out

This commit restores the synchronised scrolling and also maintains the
horizontal scroll within the source view when it is vertically
scrolled, something that was broken before.

This commit does not mean that scrolling the assembler view scrolls
the source view.  The connection this way never existed, though maybe
it should, but I'll leave adding this feature for a separate commit.

gdb/ChangeLog:

* tui/tui-source.c (tui_source_window::do_scroll_vertical): Update
all source windows, and maintain horizontal scroll status while
doing so.

gdb/testsuite/ChangeLog:

* gdb.tui/basic.exp: Add more scrolling tests.

Change-Id: I250114a3bc670040a6a759d41905776771b2f818

4 years agogdb: Fix scrolling in TUI
Tom Tromey [Sun, 22 Dec 2019 23:52:56 +0000 (16:52 -0700)] 
gdb: Fix scrolling in TUI

Hannes Domani pointed out that my previous patch to fix the "list"
command in the TUI instead broke vertical scrolling.  While looking at
this, I found that do_scroll_vertical calls print_source_lines, which
seems like a very roundabout way to change the source window.  This
patch removes this oddity and fixes the bug at the same time.

I've added a new test case.  This is somewhat tricky, because the
obvious approach of sending a dummy command after the scroll did not
work -- due to how the TUI works, sennding a command causes the scroll
to take effect.

gdb/ChangeLog
2019-12-22  Tom Tromey  <tom@tromey.com>

PR tui/18932:
* tui/tui-source.c (tui_source_window::do_scroll_vertical): Call
update_source_window, not print_source_lines.

gdb/testsuite/ChangeLog
2019-12-22  Tom Tromey  <tom@tromey.com>

PR tui/18932:
* lib/tuiterm.exp (Term::wait_for): Rename from _accept.  Return a
meangingful value.
(Term::command, Term::resize): Update.
* gdb.tui/basic.exp: Add scrolling test.

Change-Id: I9636a7c8a8cade37431c6165ee996a9d556ef1c8

4 years agogdb/tui: Fix 'layout asm' before the inferior has started
Andrew Burgess [Tue, 7 Jan 2020 00:41:08 +0000 (00:41 +0000)] 
gdb/tui: Fix 'layout asm' before the inferior has started

Currently if a user starts the tui with 'layout asm' then they will be
presented with the 'src' layout.

What happens is:

  1. Layout command enables TUI, selecting the SRC layout by default.

  2. As part of tui_enable we call tui_display_main, which calls
     tui_get_begin_asm_address, which calls
     set_default_source_symtab_and_line.  This changes core GDBs
     current symtab and line, which triggers a call to the symtab
     changed hook tui_symtab_changed, which sets the flag
     from_source_symtab.

  3. Back in the layout command, the layout is changed from SRC to
     ASM.  After this the layout command completes and we return to
     core GDB which prints the prompt, however...

  4. The before prompt hook is called which sees the
     from_source_symtab flag is set and forces the SRC window to be
     displayed.  This switches us back to SRC view.

The solution I propose here is to delay installing the hooks into core
GDB until after we have finished setting up the tui and selecting the
default frame to view.  In this way we effectively ignore the first
symtab changed event triggered when making main the default symtab.

gdb/ChangeLog:

* tui/tui.c (tui_enable): Register tui hooks after calling
tui_display_main.

gdb/testsuite/ChangeLog:

* gdb.tui/tui-layout-asm.exp: New file.

Change-Id: I858ab81a17ffb4aa72deb3f36c3755228a9c9d9a

4 years agogdb/testsuite/tui: Introduce check_box_contents
Andrew Burgess [Tue, 7 Jan 2020 00:35:02 +0000 (00:35 +0000)] 
gdb/testsuite/tui: Introduce check_box_contents

A new test procedure for matching the contents of one screen box
against a regexp.  This can be used to match the contents of one TUI
window against a regexp without any of the borders, or other windows
being included in the matched output (as is currently the case with
check_contents).

This will be used in a later commit.

gdb/testsuite/ChangeLog:

* lib/tuiterm.exp (Term::check_box_contents): New proc.

Change-Id: Icf795bf38dd9295e282a34eecc318a9cdbc73926

4 years agogdb/testsuite/tui: Split enter_tui into two procs
Andrew Burgess [Tue, 7 Jan 2020 00:30:35 +0000 (00:30 +0000)] 
gdb/testsuite/tui: Split enter_tui into two procs

Split Term::enter_tui into two procedures, a core which does the
setup, but doesn't actually enable tui mode, and the old enter_tui
that calls the new core, and then enables tui mode.

This is going to be useful in a later commit.

gdb/testsuite/ChangeLog:

* lib/tuiterm.exp (Term::prepare_for_tui): New proc.
(Term::enter_tui): Use Term::prepare_for_tui.

Change-Id: I501dfb2ddaa4a4e7246a5ad319ab428e4f42b3af

4 years agogdb/testsuite/tui: Always dump_screen when asked
Andrew Burgess [Tue, 7 Jan 2020 00:26:22 +0000 (00:26 +0000)] 
gdb/testsuite/tui: Always dump_screen when asked

The Term::dump_screen routine currently dumps the screen using calls
to 'verbose', this means it will only dump the screen when the
testsuite is running in verbose mode.

However, the Term::dump_screen is most often called when a test fails,
in this case I think it is useful to have the screen dumped even when
we're not in verbose mode.

This commit changes the calls to 'verbose' to be 'verbose -log' so we
always get the screen dump.

gdb/testsuite/ChangeLog:

* lib/tuiterm.exp (Term::dump_screen): Always dump the screen when
called.

Change-Id: I5f0a7f5ac2ece04d6fe6e9c5a28ea2a0dda38955

4 years agogdb/testsuite: Fix race condition in gdb.base/skip.exp
Andrew Burgess [Thu, 9 Jan 2020 22:38:22 +0000 (22:38 +0000)] 
gdb/testsuite: Fix race condition in gdb.base/skip.exp

In this commit:

  commit 5024637fac653914d471808288dc3221bc7ec089
  Date:   Sun Dec 15 11:05:47 2019 +0100

      Fix skip.exp test failure observed with gcc-9.2.0

A race condition was introduced into the gdb.base/skip.exp test when
this line:

    gdb_test "step" "foo \\(\\) at.*" "step 3"

Was changed to this:

    gdb_test "step" "foo \\(\\) at.*" "step 3" "main \\(\\) at .*" "step"

Before the above change we expected GDB to behave like this:

  (gdb) step
  foo () at /path/to/gdb/testsuite/gdb.base/skip.c:42
  42        return 0;
  (gdb)

However, when the test is compiled with GCC 9.2.0 we get a different
behaviour, and so we need a second 'step', like this:

  (gdb) step
  main () at /path/to/gdb.base/skip.c:32
  32        x = baz ((bar (), foo ()));
  (gdb) step
  foo () at /path/to/gdb/testsuite/gdb.base/skip.c:42
  42        return 0;
  (gdb)

Now the change to the test matches against 'main () at .*', however if
GDB or expect is being slow then we might only get to see output like
this:

  (gdb) step
  main () at /path/to/g

This will happily match the question pattern, so we send 'step' to GDB
again.  Now GDB continues to produce output which expect accepts, we
now see this:

  b.base/skip.c:32
  32        x = baz ((bar (), foo ()));
  (gdb)

This has carried on from where the previous block of output left off.
This doesn't match the final pattern 'foo \\(\\) at.*', but it does
match the prompt pattern that gdb_test_multiple adds, and so we report
the test as failing.

The solution is to simply ensure that the question consumes everything
up to, and including the prompt.  This ensures that the prompt can't
then match the failure case.  The new test line becomes:

    gdb_test "step" "foo \\(\\) at.*" "step 3" \
       "main \\(\\) at .*\r\n$gdb_prompt " "step"

gdb/testsuite/ChangeLog:

* gdb.base/skip.exp: Fix race condition in test.

Change-Id: I9f0b0b52ef1b4f980bfaa8fe405ff06d520f3482

4 years agoDon't define _FORTIFY_SOURCE on MinGW
Christian Biesinger [Wed, 18 Dec 2019 18:06:43 +0000 (12:06 -0600)] 
Don't define _FORTIFY_SOURCE on MinGW

Recent MinGW versions require -lssp when using _FORTIFY_SOURCE, which
gdb does (in common-defs.h)
https://github.com/msys2/MINGW-packages/issues/5868#issuecomment-544107564

To avoid all the complications with checking for -lssp and making sure it's
linked statically, just don't define it.

gdb/ChangeLog:

2020-01-09  Christian Biesinger  <cbiesinger@google.com>

* gdbsupport/common-defs.h: Don't define _FORTIFY_SOURCE on MinGW.

Change-Id: Ide6870ab57198219a2ef78bc675768a789ca2b1d

4 years agoFix indentation in print_thread_info_1
Simon Marchi [Wed, 8 Jan 2020 21:55:03 +0000 (16:55 -0500)] 
Fix indentation in print_thread_info_1

The body of this this big "for" loop is missing an indentation level,
this patch fixes that.

gdb/ChangeLog:

* thread.c (print_thread_info_1): Fix indentation.

4 years agoFix memory leak of the demangled symbol name
Christian Biesinger [Wed, 8 Jan 2020 01:10:40 +0000 (19:10 -0600)] 
Fix memory leak of the demangled symbol name

compute_and_set_names would only free the name if we did not find the name
in the hashtable, but it needs to always free it.  Solve this by moving the
smart pointer outside the if.

Thanks to PhilippeW for finding this.

gdb/ChangeLog:

2020-01-09  Christian Biesinger  <cbiesinger@google.com>

* symtab.c (general_symbol_info::compute_and_set_names): Move the
unique_xmalloc_ptr outside the if to always free the demangled name.

Change-Id: Id7c6b8408432183700ccb5ff634818d6c5a3ac95

4 years agoFix an attempt to free a static pointer when using objcopy's symbol addition feature.
Nick Clifton [Thu, 9 Jan 2020 16:51:04 +0000 (16:51 +0000)] 
Fix an attempt to free a static pointer when using objcopy's symbol addition feature.

PR 25220
* objcopy.c (empty_name): New variable.
(need_sym_before): Prevent an attempt to free a static variable.
(filter_symbols): Avoid strcmp test by checking for pointer
equality.

4 years agoFix an illegal memory access triggered when trying to examine an input file containin...
Nick Clifton [Thu, 9 Jan 2020 15:49:08 +0000 (15:49 +0000)] 
Fix an illegal memory access triggered when trying to examine an input file containing corrupt compressed sections.

PR 25221
* bfd.c (bfd_convert_section_contents): Check for a compress
header size that is larger than the actual section size.

4 years agoFix the cast used to prevent compile time warning about an always false test.
Nick Clifton [Thu, 9 Jan 2020 14:32:49 +0000 (14:32 +0000)] 
Fix the cast used to prevent compile time warning about an always false test.

PR 25224
* z80-dis.c (ld_ii_ii): Use correct cast.

4 years agooops - toplevel changelog entry for previous delta.
Aaron Merey [Thu, 9 Jan 2020 13:37:26 +0000 (13:37 +0000)] 
oops - toplevel changelog entry for previous delta.

       * config/debuginfod.m4: New file. Add macro AC_DEBUGINFOD. Adds
        new configure option --with-debuginfod.
        * configure: Regenerate.
        * configure.ac: Call AC_DEBUGINFOD.

4 years agoUpdate Traditional Chinese translation for the binutils sub-directory.
Nick Clifton [Thu, 9 Jan 2020 13:36:22 +0000 (13:36 +0000)] 
Update Traditional Chinese translation for the binutils sub-directory.

* po/zh_TW.po: Updated Traditional Chinese translation.

4 years agoAdd support for debuginfod to the binutils (disable by default, enabled via a configu...
Aaron Merey [Thu, 9 Jan 2020 13:19:20 +0000 (13:19 +0000)] 
Add support for debuginfod to the binutils (disable by default, enabled via a configure time option).

debuginfod is a lightweight web service that indexes ELF/DWARF
debugging resources by build-id and serves them over HTTP. This patch
enables objdump and readelf to query debuginfod servers when they are
otherwise not able to find separate debug files. Binutils can be built
with debuginfod using the --with-debuginfod configure option. This
requires that libdebuginfod be installed and found at configure time.
debuginfod is packaged with elfutils, starting with version 0.178. For
more information see https://sourceware.org/elfutils/.

toplevel* config/debuginfod.m4: New file. Add macro AC_DEBUGINFOD. Adds
        new configure option --with-debuginfod.
        * configure: Regenerate.
        * configure.ac: Call AC_DEBUGINFOD.

binutils* Makefile.am (readelf_LDADD, objdump_LDADD): Add libdebuginfod.
        * Makefile.in: Regenerate.
        * NEWS: Update.
        * config.in: Regenerate.
        * configure: Regenerate.
        * configure.ac: Call AC_DEBUGINFOD.
        * doc/Makefile.in: Regenerate.
        * doc/binutils.texi: Add section on using binutils
        with debuginfod.
        * dwarf.c (debuginfod_fetch_separate_debug_info): New function.
        Query debuginfod servers for the target debug file.
        (load_separate_debug_info): Call
        debuginfod_fetch_separate_debug_info if configured with
        debuginfod.
        (load_separate_debug_files): Add file argument to
        load_separate_debug_info calls.
        * dwarf.h (get_build_id): Add declaration.
        * objdump.c (get_build_id): New function. Get build-id of file.
        * readelf.c (get_build_id): Likewise.
        * testsuite/binutils-all/debuginfod.exp: New tests.
        * testsuite/binutils-all/linkdebug.s: Add .note.gnu.build-id
        section.

4 years agoFix compile time warnings about comparisons always being false.
Sergey Belyashov [Thu, 9 Jan 2020 11:47:44 +0000 (11:47 +0000)] 
Fix compile time warnings about comparisons always being false.

PR 25224
gas * config/tc-z80.c (emit_ld_m_rr): Use integer types when checking
opcode byte values.
(emit_ld_r_r): Likewise.
(emit_ld_rr_m): Likewise.
(emit_ld_rr_nn): Likewise.

opcodes * z80-dis.c (ld_ii_ii): Use character constant when checking
opcode byte value.

4 years agox86: refine when to trigger optimizations
Jan Beulich [Thu, 9 Jan 2020 10:40:04 +0000 (11:40 +0100)] 
x86: refine when to trigger optimizations

Checking just the base opcode without also checking this isn't a VEX
encoding, and without there being other insn properties avoiding a match
once respective VEX/XOP/EXEX-encoded insns would appear, is at least
dangerous. Add respective checks. At the same time there's no real need
to check the extension opcode to be None for the 0xA8 form - there's
nothing it can be confused with, and non-VEX-and-alike forms also can't
appear.

4 years agox86-64: assert sane internal state for REX conversions
Jan Beulich [Thu, 9 Jan 2020 10:39:33 +0000 (11:39 +0100)] 
x86-64: assert sane internal state for REX conversions

For the comments about "hi" registers to be really applicable, RegRex
may not be set on the respective registers. Assert this is the case.

4 years agox86: consistently convert to byte registers for TEST w/ imm optimization
Jan Beulich [Thu, 9 Jan 2020 10:38:59 +0000 (11:38 +0100)] 
x86: consistently convert to byte registers for TEST w/ imm optimization

Commit ac0ab1842d ("i386: Also check R12-R15 registers when optimizing
testq to testb") didn't go quite far enough: In order to avoid confusing
other code registers would better be converted to byte ones uniformly.

4 years agox86: SYSENTER/SYSEXIT are unavailable in 64-bit mode on AMD
Jan Beulich [Thu, 9 Jan 2020 10:38:01 +0000 (11:38 +0100)] 
x86: SYSENTER/SYSEXIT are unavailable in 64-bit mode on AMD

The disassembler change is such that in default mode we'd disassemble
the insns (for there not ebing any conflicts), but when AMD64 mode was
explicitly requested, we'd show them as "(bad)".

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 9 Jan 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoChange section_offsets to a std::vector
Tom Tromey [Mon, 6 Jan 2020 21:34:52 +0000 (14:34 -0700)] 
Change section_offsets to a std::vector

This changes section_offsets to be specialization of a std::vector and
updates all the users.  It also removes the ANOFFSET and
SIZEOF_N_SECTION_OFFSETS macros.

Most of this is just a generic sort of cleanup, that reduces the
number of lines of code.  However, a couple spots were doing weird
things.

objfile_relocate did:

-      std::vector<struct section_offsets>
- new_debug_offsets (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections));

... which seems to greatly over-estimate the number of elements
needed.

This appeared in set_objfile_default_section_offset:

-  std::vector<struct section_offsets> offsets (objf->num_sections,
-        { { offset } });

... which makes sense due to type safety, but is also actively
confusing given that section_offsets was previously also a kind of
vector type.

Tested on x86-64 Fedora 30.

gdb/ChangeLog
2020-01-08  Tom Tromey  <tromey@adacore.com>

* xcoffread.c (enter_line_range, read_xcoff_symtab)
(process_xcoff_symbol, xcoff_symfile_offsets): Update.
* symtab.h (MSYMBOL_VALUE_ADDRESS): Update.
(struct section_offsets, ANOFFSET, SIZEOF_N_SECTION_OFFSETS):
Remove.
(section_offsets): New typedef.
* symtab.c (fixup_section, get_msymbol_address): Update.
* symmisc.c (dump_msymbols): Update.
* symfile.h (relative_addr_info_to_section_offsets)
(symfile_map_offsets_to_segments): Update.
* symfile.c (build_section_addr_info_from_objfile)
(init_objfile_sect_indices): Update.
(struct place_section_arg): Change type of "offsets".
(place_section): Update.
(relative_addr_info_to_section_offsets): Change type of
"section_offsets".  Remove "num_sections" parameter.
(default_symfile_offsets, syms_from_objfile_1)
(set_objfile_default_section_offset): Update.
(reread_symbols): No need to preserve section offsets by hand.
(symfile_map_offsets_to_segments): Change type of "offsets".
* stap-probe.c (relocate_address): Update.
* stabsread.h (process_one_symbol): Update.
* solib-target.c (struct lm_info_target) <offsets>: Change type.
(solib_target_relocate_section_addresses): Update.
* solib-svr4.c (enable_break, svr4_relocate_main_executable):
Update.
* solib-frv.c (frv_relocate_main_executable): Update.
* solib-dsbt.c (dsbt_relocate_main_executable): Update.
* solib-aix.c (solib_aix_get_section_offsets): Change return
type.
(solib_aix_solib_create_inferior_hook): Update.
* remote.c (remote_target::get_offsets): Update.
* psymtab.c (find_pc_sect_psymtab): Update.
* psympriv.h (struct partial_symbol) <address, text_low,
text_high>: Update.
* objfiles.h (obj_section_offset): Update.
(struct objfile) <section_offsets>: Change type.
<num_sections>: Remove.
(objfile_relocate): Update.
* objfiles.c (entry_point_address_query): Update
(relocate_one_symbol): Change type of "section_offsets".
(objfile_relocate1, objfile_relocate1): Change type of
"new_offsets".
(objfile_rebase1): Update.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Remove "section_offsets"
parameter.
* mdebugread.c (parse_symbol): Change type of "section_offsets".
(parse_external, psymtab_to_symtab_1): Update.
* machoread.c (macho_symfile_offsets): Update.
* ia64-tdep.c (ia64_find_unwind_table): Update.
* hppa-tdep.c (read_unwind_info): Update.
* hppa-bsd-tdep.c (hppabsd_find_global_pointer): Update.
* dwarf2read.c (create_addrmap_from_index)
(create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab)
(process_psymtab_comp_unit_reader, add_partial_symbol)
(add_partial_subprogram, process_full_comp_unit)
(read_file_scope, read_func_scope, read_lexical_block_scope)
(read_call_site_scope, dwarf2_rnglists_process)
(dwarf2_ranges_process, dwarf2_ranges_read)
(dwarf_decode_lines_1, var_decode_location, new_symbol)
(dwarf2_fetch_die_loc_sect_off, dwarf2_per_cu_text_offset):
Update.
* dwarf2-frame.c (execute_cfa_program, dwarf2_frame_find_fde):
Update.
* dtrace-probe.c (dtrace_probe::get_relocated_address): Update.
* dbxread.c (read_dbx_symtab, read_ofile_symtab): Update.
(process_one_symbol): Change type of "section_offsets".
* ctfread.c (get_objfile_text_range): Update.
* coffread.c (coff_symtab_read, enter_linenos)
(process_coff_symbol): Update.
* coff-pe-read.c (add_pe_forwarded_sym): Update.
* amd64-windows-tdep.c (amd64_windows_find_unwind_info): Update.

Change-Id: I147eb967e9b44d82f4048039de7bb44b80cd72fb

4 years agoUse std::string in dwarf2read.c
Tom Tromey [Thu, 31 Oct 2019 16:46:18 +0000 (10:46 -0600)] 
Use std::string in dwarf2read.c

This replaces two instances of manual string management in
dwarf2read.c with std::string.

gdb/ChangeLog
2020-01-08  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c (parse_macro_definition): Use std::string.
(parse_macro_definition): Likewise.

Change-Id: Iec437100105484aa4a116fb5d651d7ed52ee9d81

4 years agoUse std::vector in abbrev_table_read_table
Tom Tromey [Thu, 31 Oct 2019 16:37:35 +0000 (10:37 -0600)] 
Use std::vector in abbrev_table_read_table

This removes some manual memory management from
abbrev_table_read_table, replacing it with a std::vector.

gdb/ChangeLog
2020-01-08  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c (abbrev_table_read_table): Use std::vector.
(ATTR_ALLOC_CHUNK): Remove.

Change-Id: I0b0e70ac2281d89a78f4d6a642700c9f0506871d

4 years agoUse unique_xmalloc_ptr in fixup_go_packaging
Tom Tromey [Thu, 31 Oct 2019 16:34:40 +0000 (10:34 -0600)] 
Use unique_xmalloc_ptr in fixup_go_packaging

This changes fixup_go_packaging to use unique_xmalloc_ptr.  I kept
this patch separate as it is slightly more complicated than the
previous changes.

gdb/ChangeLog
2020-01-08  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c (fixup_go_packaging): Use unique_xmalloc_ptr.

Change-Id: I0c553d0c6579db478c27bc40fc21133a61e1a4d9

4 years agoRemove some explicit memory management from dwarf2read.c
Tom Tromey [Thu, 31 Oct 2019 16:31:28 +0000 (10:31 -0600)] 
Remove some explicit memory management from dwarf2read.c

I noticed a few spots in dwarf2read.c that could be improved by moving
to unique_xmalloc_ptr or, in one case, std::vector.

gdb/ChangeLog
2020-01-08  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c (add_partial_symbol): Use unique_xmalloc_ptr.
(dwarf2_compute_name, open_dwo_file): Likewise.
(process_enumeration_scope): Use std::vector.
(guess_partial_die_structure_name): Use unique_xmalloc_ptr.
(partial_die_info::fixup, dwarf2_start_subfile)
(guess_full_die_structure_name, dwarf2_name): Likewise.
(determine_prefix): Update.
(guess_full_die_structure_name): Make return type const.
(partial_die_full_name): Return unique_xmalloc_ptr.
(DW_FIELD_ALLOC_CHUNK): Remove.

Change-Id: I1cb278c608041ef36ef1f77c7e7565c921038d08

4 years agoDocument the fact that the assembler's alignment pseudo-ops can be issued without...
Nick Clifton [Wed, 8 Jan 2020 17:00:54 +0000 (17:00 +0000)] 
Document the fact that the assembler's alignment pseudo-ops can be issued without any argumemtns.

PR 25284
* doc/as.texi (Align): Document the fact that all arguments can be
omitted.
(Balign): Likewise.
(P2align): Likewise.

4 years agoMake the assembler generate an error if there is an attempt to define a section with...
Nick Clifton [Wed, 8 Jan 2020 16:30:20 +0000 (16:30 +0000)] 
Make the assembler generate an error if there is an attempt to define a section with the same name as an already defined symbol.

PR 14891
* config/obj-elf.c (obj_elf_section): Fail if the section name is
already defined as a different symbol type.
* testsuite/gas/elf/pr14891.s: New test source file.
* testsuite/gas/elf/pr14891.d: New test driver.
* testsuite/gas/elf/pr14891.s: New test expected error output.
* testsuite/gas/elf/elf.exp: Run the new test.

4 years agoubsan: z8k: index 10 out of bounds for type 'unsigned int const[10]'
Alan Modra [Wed, 8 Jan 2020 01:12:36 +0000 (11:42 +1030)] 
ubsan: z8k: index 10 out of bounds for type 'unsigned int const[10]'

The fix is the additional ARRAY_SIZE test, the rest just tidies
variable types rather than adding a cast to avoid warnings.

opcodes/
* z8k-dis.c: Include libiberty.h
(instr_data_s): Make max_fetched unsigned.
(z8k_lookup_instr): Make nibl_index and tabl_index unsigned.
Don't exceed byte_info bounds.
(output_instr): Make num_bytes unsigned.
(unpack_instr): Likewise for nibl_count and loop.
* z8kgen.c (gas <opcode_entry_type>): Make noperands, length and
idx unsigned.
* z8k-opc.h: Regenerate.
gas/
* config/tc-z8k.c (md_begin): Make idx unsigned.
(get_specific): Likewise for this_index.

4 years agoPR25351 .ARM.attributes not found for symbol
Alan Modra [Wed, 8 Jan 2020 01:06:01 +0000 (11:36 +1030)] 
PR25351 .ARM.attributes not found for symbol

PR 25351
* elflink.c (bfd_elf_final_link): Call _bfd_fix_excluded_sec_syms
after removing sections.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 8 Jan 2020 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAdd constructor to stap_static_probe_ops
Tom Tromey [Thu, 19 Dec 2019 18:35:22 +0000 (11:35 -0700)] 
Add constructor to stap_static_probe_ops

PR build/24937 concerns an error given by the clang provided by a
particular version of macOS.  In particular, it reports

    error: default initialization of an object of const type 'const
    stap_static_probe_ops' without a user-provided default constructor

Although (at least according to sources I found online) this was
resolved as a bug in the standard, it seemed simple enough to work
around this.

Given that this is a trivial build fix, I think it should go on the
gdb 9 branch as well.

gdb/ChangeLog
2020-01-07  Tom Tromey  <tromey@adacore.com>

PR build/24937:
* stap-probe.c (class stap_static_probe_ops): Add constructor.

Change-Id: I18f180c17850f420e9b66afc67f9cb3d8dceb0b3

4 years agoEnable styling by default on Cygwin
Jon Turney [Sun, 29 Dec 2019 22:26:41 +0000 (22:26 +0000)] 
Enable styling by default on Cygwin

Cygwin meets the expectations of gdb for styling (if TERM is set and not
'DUMB', the terminal supports 'ANSI' (ECMA-48) escape sequences.

gdb/ChangeLog:

2020-01-02  Jon Turney  <jon.turney@dronecode.org.uk>

* cli/cli-style.c: Set cli_styling to 'true' in the Cygwin build.

4 years ago[ARC] Improve parsing instruction operands.
Claudiu Zissulescu [Tue, 7 Jan 2020 13:29:16 +0000 (15:29 +0200)] 
[ARC] Improve parsing instruction operands.

We use gas' expression function to parse the operands of an
instruction in a generic way. There are situations when we have labels
and registers having the same name as well as the substraction sign
doesn't always stands for the arithmetical operation but for the
register range (e.g. enter instruction). This patch improves parsing
symbols found in a instruction operand, cleans up code and avoids
using default or undefined variables.

gas/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (parse_reloc_symbol): New function.
(tokenize_arguments): Clean up, use parse_reloc_symbol function.
(md_operand): Set X_md to absent.
(arc_parse_name): Check for X_md.

4 years ago[ARC] Add finer details for LLOCK and SCOND
Shahab Vahedi [Tue, 7 Jan 2020 13:25:15 +0000 (15:25 +0200)] 
[ARC] Add finer details for LLOCK and SCOND

This patch changes the "class" of LLOCK/SCOND from "MEMORY" to
"LLOCK/SCOND" respectively. Moreover, it corrects the "data_size_mode".

These changes are necessary for GDB's atmoic sequence handler.

Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 7 Jan 2020 00:00:19 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoRISC-V: Fix weak function call reloc overflow on llvm build.
Jim Wilson [Mon, 6 Jan 2020 23:34:50 +0000 (15:34 -0800)] 
RISC-V: Fix weak function call reloc overflow on llvm build.

bfd/
PR 25205
* elfnn-riscv.c (riscv_elf_relocate_section) <R_RISCV_CALL>: Add
check for !bfd_link_pic (info).
<R_RISCV_CALL_PLT>: Move next to R_RISCV_CALL.
<R_RISCV_JAL>: Add comment.
(_bfd_riscv_relax_section): For plt.offset check, add check for
bfd_link_pic (info).  Add comment.

Change-Id: Ie769bc3d5adf096a51df5cc12efe3d50e80acb8f

4 years agoRe: Prefer object over notype symbols when disassembling
Alan Modra [Mon, 6 Jan 2020 22:59:54 +0000 (09:29 +1030)] 
Re: Prefer object over notype symbols when disassembling

Reverts unnecessary mips testsuite changes made by commit 660df28acf.

* testsuite/ld-mips-elf/eh-frame5.s,
* testsuite/ld-mips-elf/ehdr_start-new.s,
* testsuite/ld-mips-elf/ehdr_start-o32.s,
* testsuite/ld-mips-elf/mips16-call-global-1.s,
* testsuite/ld-mips-elf/mips16-intermix-1.s,
* testsuite/ld-mips-elf/mips16-pic-1b.s,
* testsuite/ld-mips-elf/mips16-pic-4c.s,
* testsuite/ld-mips-elf/no-shared-1-n64.s,
* testsuite/ld-mips-elf/no-shared-1-o32.s,
* testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s,
* testsuite/ld-mips-elf/pic-and-nonpic-1b.s,
* testsuite/ld-mips-elf/pic-and-nonpic-2a.s,
* testsuite/ld-mips-elf/pic-and-nonpic-3b.s,
* testsuite/ld-mips-elf/pic-and-nonpic-4b.s,
* testsuite/ld-mips-elf/pic-and-nonpic-5a.s,
* testsuite/ld-mips-elf/pic-and-nonpic-6-n32c.s,
* testsuite/ld-mips-elf/pic-and-nonpic-6-n64c.s,
* testsuite/ld-mips-elf/pic-and-nonpic-6-o32c.s,
* testsuite/ld-mips-elf/pie.s,
* testsuite/ld-mips-elf/relax-jalr.s: Revert 2019-12-17 change.

4 years agogdb: Fix backtrace with disassemble-next-line on
Andrew Burgess [Thu, 26 Dec 2019 20:56:01 +0000 (20:56 +0000)] 
gdb: Fix backtrace with disassemble-next-line on

In this commit:

  commit ec8e2b6d3051f0b4b2a8eee9917898e95046c62f
  Date:   Fri Jun 14 23:43:00 2019 +0100

      gdb: Don't allow annotations to influence what else GDB prints

A change was accidentally made that moved a call to do_gdb_disassembly
out of an if block guarded by 'if (source_print && sal.symtab)'.  The
result was that if a user has 'set disassemble-next-line on' then the
backtrace would now include some disassembly of a few instructions in
each frame.

This change was not intentional, but was not spotted by any tests.

This commit restores the old behaviour and adds a test to ensure this
doesn't break again in the future.

gdb/ChangeLog:

* stack.c (print_frame_info): Move disassemble_next_line code
inside source_print block.

gdb/testsuite/ChangeLog:

* gdb.base/backtrace.c: New file.
* gdb.base/backtrace.exp: New file.

Change-Id: I47c52a202fa74be138382646b695827940178689

4 years agoFix MinGW native compilation of gdb/gdbsupport/gdb_wait.c
Eli Zaretskii [Mon, 6 Jan 2020 19:54:21 +0000 (21:54 +0200)] 
Fix MinGW native compilation of gdb/gdbsupport/gdb_wait.c

gdb/ChangeLog
2020-01-06  Eli Zaretskii  <eliz@gnu.org>

* gdbsupport/gdb_wait.c: Include <signal.h> instead of
gdb/signals.h, as we are now using native signal symbols.

4 years agoGDB: Fix the overflow in addr/line_is_displayed()
Shahab Vahedi [Mon, 6 Jan 2020 14:27:32 +0000 (15:27 +0100)] 
GDB: Fix the overflow in addr/line_is_displayed()

In tui_disasm_window::addr_is_displayed(), there can be situations
where "content" is empty. For instance, it can happen when the
"content" was not filled in tui_disasm_window::set_contents(),
because tui_disassemble() threw an exception. Usually this exception
is the result of fetching invalid PC addresses like the ones beyond
the end of the program.

Having "content.size ()" zero leads to an overflow in this condition
check inside tui_disasm_window::addr_is_displayed():

  int i = 0;
  while (i < content.size () - threshold ...) {
    ... content[i] ...
  }

"threshold" is 2 and there are times that "content.size ()" is 0.
This results into an overflow and the loop is entered whereas it
should have been skipped. Finally, "content[i]" access leads to
a segmentation fault.

Same problem applies to tui_source_window::line_is_displayed().

The issue has been discussed at length in bug 25345:
  https://sourceware.org/bugzilla/show_bug.cgi?id=25345

This commit avoids the segmentation faults with an early check:

  if (content.size () < SCROLL_THRESHOLD)
    return false;

Moreover, those functions have been overhauled to a leaner code.

gdb/ChangeLog:
2020-01-06  Shahab Vahedi  <shahab@synopsys.com>

* tui/tui-disasm.c (tui_disasm_window::addr_is_displayed): Avoid
overflow by an early check of content vs threshold.
        * tui/tui-source.c (tui_source_window::line_is_displayed):
Likewise.

4 years agoMention the recent fix of $_exitsignal on MS-Windows in gdb/NEWS
Eli Zaretskii [Mon, 6 Jan 2020 19:25:23 +0000 (21:25 +0200)] 
Mention the recent fix of $_exitsignal on MS-Windows in gdb/NEWS

gdb/ChangeLog
2020-01-06  Eli Zaretskii  <eliz@gnu.org>

* NEWS: Mention the recent fix of $_exitsignal on MS-Windows.

4 years agoFix a crash with a malformed PE header
Jon Turney [Thu, 2 Jan 2020 00:25:56 +0000 (00:25 +0000)] 
Fix a crash with a malformed PE header

Don't try to read the PE export table when no section contains the RVA
for it.

(I have a PE executable [1] packed with UPX, where the export table data
directory entry contains a RVA which doesn't correspond to any section.
Mistakenly trying to debug this with gdb makes it crash.)

[1] https://cygwin.com/setup/setup-2.898.x86_64.exe

gdb/ChangeLog:

2020-01-02  Jon Turney  <jon.turney@dronecode.org.uk>

* coff-pe-read.c (read_pe_exported_syms): Don't try to read the
export table if no section contains it's RVA.

4 years agoFix a typo in gdb/windows-tdep.c
Eli Zaretskii [Mon, 6 Jan 2020 18:22:15 +0000 (20:22 +0200)] 
Fix a typo in gdb/windows-tdep.c

gdb/ChangeLog
2020-01-06  Eli Zaretskii  <eliz@gnu.org>

    * windows-tdep.c: Fix a typo in WINDOWS_SIGABRT.

4 years agoAdd -fcommon compiler command line option to linker tests that need common symbols.
Nick Clifton [Mon, 6 Jan 2020 16:24:23 +0000 (16:24 +0000)] 
Add -fcommon compiler command line option to linker tests that need common symbols.

PR 25327
* testsuite/ld-elf/shared.exp: Add -fcommon option to compiler
command line when building libcomm1.o and pr13250 tests.
* testsuite/ld-plugin/lto.exp: Likewise for pr20267 tests.

4 years agoFix search in TUI
Hannes Domani [Sun, 22 Dec 2019 13:58:22 +0000 (14:58 +0100)] 
Fix search in TUI

The variable last_line_listed is never set when print_source_lines_base is
called in TUI mode, so the search always started from the last line printed
outside of TUI mode.

gdb/ChangeLog:

2020-01-06  Hannes Domani  <ssbssa@yahoo.de>

* source.c (print_source_lines_base): Set last_line_listed.

4 years agoFix test of the fix for PR19579 when compiling with gcc-10.
Nick Clifton [Mon, 6 Jan 2020 14:00:34 +0000 (14:00 +0000)] 
Fix test of the fix for PR19579 when compiling with gcc-10.

PR 25326
* testsuite/ld-elf/shared.exp: Add -fcommon option to compiler
command line when building pr19579 binaries.

4 years agoGDB: Remove trailing spaces in tui-disasm.c
Shahab Vahedi [Mon, 6 Jan 2020 12:54:18 +0000 (13:54 +0100)] 
GDB: Remove trailing spaces in tui-disasm.c

A few trailing spaces are removed.

gdb/ChangeLog:
2020-01-06  Shahab Vahedi  <shahab@synopsys.com>

* tui/tui-disasm.c: Remove trailing spaces.

4 years agoImprove process exit status macros on MinGW
Eli Zaretskii [Mon, 6 Jan 2020 11:51:54 +0000 (11:51 +0000)] 
Improve process exit status macros on MinGW

When a Windows program is terminated by a fatal exception, its exit
code is the value of that exception, as defined by the various
EXCEPTION_* symbols in the Windows API headers.  This commit emulates
WTERMSIG etc. by translating the fatal exception codes to more-or-less
equivalent Posix signals.

gdb/ChangeLog:
2020-01-06  Eli Zaretskii  <eliz@gnu.org>
    Pedro Alves  <palves@redhat.com>

* Makefile.in (COMMON_SFILES): Add gdbsupport/gdb_wait.c.
* windows-tdep.c: New enumeration of WINDOWS_SIG* signals.
(windows_gdb_signal_to_target): New function, uses the above
enumeration to convert GDB internal signal codes to equivalent
Windows codes.
(windows_init_abi): Call set_gdbarch_gdb_signal_to_target.
* windows-nat.c: Include "gdb_wait.h".
(get_windows_debug_event): Extract the fatal exception from the
exit status and convert to the equivalent Posix signal number.
* cli/cli-cmds.c (exit_status_set_internal_vars): Account for the
possibility that WTERMSIG returns GDB_SIGNAL_UNKNOWN.
* gdbsupport/gdb_wait.c: New file, implements
windows_status_to_termsig.
* gdbsupport/gdb_wait.h (WIFEXITED, WIFSIGNALED, WEXITSTATUS)
(WTERMSIG) [__MINGW32__]: Separate definitions for MinGW.

gdb/gdbserver/ChangeLog:
2020-01-06  Eli Zaretskii  <eliz@gnu.org>
    Pedro Alves  <palves@redhat.com>

* win32-low.c (get_child_debug_event): Extract the fatal exception
from the exit status and convert to the equivalent Posix signal
number.
(win32_wait): Allow TARGET_WAITKIND_SIGNALLED status as well.
* Makefile.in (OBS, SFILES): Add gdb_wait.[co].

4 years agobfd_check_format: ignore errors from coff_real_object_p
Alan Modra [Mon, 6 Jan 2020 09:21:22 +0000 (19:51 +1030)] 
bfd_check_format: ignore errors from coff_real_object_p

Since 1993-11-05 git commit c188b0bec3b, bfd_check_format has failed
if any of the target object_p functions returns false with any error
but bfd_error_wrong_format.  That's just weird.  There is really no
reason why coff_real_object_p should be fixed to only return that
error instead of numerous other possible errors.  Even an out of
memory condition for one target doesn't necessarily mean other targets
can't match, assuming the failing target nicely returns all memory it
might have used.

* format.c (bfd_check_format_matches): Ignore bfd_error on target
match failures.  Don't init to bfd_error_wrong_format before
calling _bfd_check_format.

4 years agoalpha-vms: don't exit on stack underflow/overflow
Alan Modra [Mon, 6 Jan 2020 07:59:14 +0000 (18:29 +1030)] 
alpha-vms: don't exit on stack underflow/overflow

BFD is not supposed to exit or abort on anything the user can do.

* vms-alpha.c (_bfd_vms_push, _bfd_vms_pop): Return pass/fail
status rather than exiting on stack overflow or underflow.
(_bfd_vms_slurp_etir): Adjust to suit.

4 years agoubsan: m32c: left shift of negative value
Alan Modra [Sat, 4 Jan 2020 09:23:19 +0000 (19:53 +1030)] 
ubsan: m32c: left shift of negative value

There are probably a lot more of these still here.

cpu/
* m32c.cpu (f-dsp-8-u16, f-dsp-8-s16): Rearrange to mask any sign
bits before shifting rather than masking after shifting.
(f-dsp-16-u16, f-dsp-16-s16, f-dsp-32-u16, f-dsp-32-s16): Likewise.
(f-dsp-40-u16, f-dsp-40-s16, f-dsp-48-u16, f-dsp-48-s16): Likewise.
(f-dsp-64-u16, f-dsp-8-s24): Likewise.
(f-bitbase32-16-s19-unprefixed): Avoid signed left shift.
opcodes/
* m32c-ibld.c: Regenerate.

4 years agosom_bfd_fill_in_ar_symbols buffer overflow
Alan Modra [Mon, 6 Jan 2020 06:42:51 +0000 (17:12 +1030)] 
som_bfd_fill_in_ar_symbols buffer overflow

* som.c (som_bfd_fill_in_ar_symbols): Bounds check som_dict index.

4 years agoBasic error checking for mach-o
Alan Modra [Sun, 5 Jan 2020 23:31:55 +0000 (10:01 +1030)] 
Basic error checking for mach-o

Fixes lots of places the fuzzers are going to find, and the one they
already hit.

* mach-o.c (bfd_mach_o_read_dylinker): Don't read past end of
command.  Check name offset is within command.
(bfd_mach_o_read_dylib, bfd_mach_o_read_prebound_dylib),
(bfd_mach_o_read_prebind_cksum, bfd_mach_o_read_twolevel_hints),
(bfd_mach_o_read_fvmlib, bfd_mach_o_read_dysymtab),
(bfd_mach_o_read_symtab, bfd_mach_o_read_uuid),
(bfd_mach_o_read_linkedit, bfd_mach_o_read_str),
(bfd_mach_o_read_dyld_info, bfd_mach_o_read_version_min),
(bfd_mach_o_read_encryption_info, bfd_mach_o_read_source_version),
(bfd_mach_o_read_encryption_info_64, bfd_mach_o_read_main),
(bfd_mach_o_read_note, bfd_mach_o_read_build_version),
(bfd_mach_o_read_segment): Similarly.
(bfd_mach_o_read_thread): Properly bound check thread struct.
Don't repeat checks on second loop.
(bfd_mach_o_read_command): Fail on invalid command length.

4 years agoPR25344, z80 disassembler recursion
Alan Modra [Sun, 5 Jan 2020 22:22:39 +0000 (08:52 +1030)] 
PR25344, z80 disassembler recursion

PR 25344
* z80-dis.c (suffix): Don't use a local struct buffer copy.
Peek at next byte to prevent recursion on repeated prefix bytes.
Ensure uninitialised "mybuf" is not accessed.
(print_insn_z80): Don't zero n_fetch and n_used here,..
(print_insn_z80_buf): ..do it here instead.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 6 Jan 2020 00:00:21 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogdb: use tui_set_layout not show_layout to fix window focus
Andrew Burgess [Sun, 22 Dec 2019 23:45:31 +0000 (23:45 +0000)] 
gdb: use tui_set_layout not show_layout to fix window focus

When calling tui_add_win_to_layout, use tui_set_layout not show_layout
so that window focus is correctly updated.  If the focus is not
correctly maintained then GDB can be crashed like this:

  start
  tui enable
  layout asm
  list SOME_FUNCTION

At this point GDB will have "popped up" the source window to
display SOME_FUNCTION.  Previously no window would have focus at this
point, and so if the user now does 'focus next' or 'focus prev', then
GDB would crash.

Calling tui_set_layout ensures that focus is correctly calculated as
the source window is "popped up", and this fixes the issue.

gdb/ChangeLog:

* tui/tui-layout.c (tui_add_win_to_layout): Use tui_set_layout not
show_layout.

gdb/testsuite/ChangeLog:

* gdb.tui/list.exp: Test 'focus next' after 'list main'.

Change-Id: Id0b13f99b0e889261efedfd0adabe82020202f44

4 years ago[AArch64] Fix erroneous use of spu architecture bfd
Luis Machado [Fri, 3 Jan 2020 19:08:16 +0000 (16:08 -0300)] 
[AArch64] Fix erroneous use of spu architecture bfd

While investigating some SVE code, i noticed the use of two spu bfd variables.

This looks like an oversight, as the "id" field is available for non-spu
architectures as well, even though its primary use was the Cell BE
architecture.

gdb/ChangeLog:

2020-01-05  Luis Machado  <luis.machado@linaro.org>

* aarch64-linux-nat.c
(aarch64_linux_nat_target::thread_architecture): Use bfd_arch_aarch64
and bfd_mach_aarch64.

4 years agoFix libctf ChangeLog date in most recent entry.
Joel Brobecker [Sun, 5 Jan 2020 05:53:14 +0000 (09:53 +0400)] 
Fix libctf ChangeLog date in most recent entry.

4 years agolibctf: Add configure check for asprintf (for MinGW)
Eli Zaretskii [Sun, 5 Jan 2020 05:50:27 +0000 (09:50 +0400)] 
libctf: Add configure check for asprintf (for MinGW)

This commit fixes a compilation warning when compiling libctf
on MinGW:

    libctf/ctf-dump.c:118:8: warning: implicit declaration of function
    'asprintf'; did you mean 'vasprintf'? [-Wimplicit-function-declaration]

 if (asprintf (&bit, " %lx: [slice 0x%x:0x%x]",
     ^~~~~~~~
     vasprintf

MinGW doesn't provide that function, so we depend on the one provided
by libiberty. However, the declaration is guarded by HAVE_DECL_ASPRINTF,
which we do not have in libctf's config.h.

libctf/ChangeLog:

PR binutils/25155:
* configure.ac: Add AC_CHECK_DECLS([asprintf]).
* configure, config.h.in: Regenerate.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 5 Jan 2020 00:01:08 +0000 (00:01 +0000)] 
Automatic date update in version.in

4 years agoRelease bfd_alloc memory in bfd_check_format_matches
Alan Modra [Thu, 2 Jan 2020 07:09:32 +0000 (17:39 +1030)] 
Release bfd_alloc memory in bfd_check_format_matches

It's a little tricky.  We can release any memory back when we have a
match failure, but after a match success which we might want to
preserve for later use the high water mark must change to that of the
matched bfd.

* format.c (bfd_check_format_matches): Add preserve_match.
Save initial bfd state in "preserve", matched bfd state in
"preserve_match".  Save just the first match.  Release
bfd_alloc memory.  Restore and finish preserved state as
appropriate on all function exit paths.

4 years agommo tdata leak
Alan Modra [Mon, 30 Dec 2019 22:25:08 +0000 (08:55 +1030)] 
mmo tdata leak

malloc'd tdata isn't freed.

* mmo.c (mmo_mkobject): Allocate tdata with bfd_zalloc.

4 years agoubsan: m32r: left shift of negative value
Alan Modra [Fri, 3 Jan 2020 21:41:43 +0000 (08:11 +1030)] 
ubsan: m32r: left shift of negative value

cpu/
* m32r.cpu (f-disp8): Avoid left shift of negative values.
(f-disp16, f-disp24): Likewise.
opcodes/
* m32r-ibld.c: Regenerate.

4 years agoubsan: cr16: left shift cannot be represented in type 'int'
Alan Modra [Thu, 2 Jan 2020 21:42:00 +0000 (08:12 +1030)] 
ubsan: cr16: left shift cannot be represented in type 'int'

* cr16-dis.c (cr16_match_opcode): Avoid shift left of signed value.

4 years agoubsan: crx: left shift cannot be represented in type 'int'
Alan Modra [Thu, 2 Jan 2020 20:37:17 +0000 (07:07 +1030)] 
ubsan: crx: left shift cannot be represented in type 'int'

* crx-dis.c (match_opcode): Avoid shift left of signed value.

4 years agoubsan: d30v: left shift cannot be represented in type 'int'
Alan Modra [Wed, 1 Jan 2020 08:16:43 +0000 (18:46 +1030)] 
ubsan: d30v: left shift cannot be represented in type 'int'

* d30v-dis.c (print_insn): Avoid signed overflow in left shift.

4 years agocoff: free malloc'd memory on successful target match too
Alan Modra [Tue, 31 Dec 2019 23:58:42 +0000 (10:28 +1030)] 
coff: free malloc'd memory on successful target match too

object_p functions cannot allocate memory by malloc and not free it
before returning.  Even a successful target match may not be the best
match.  If a match isn't used then those malloc'd blocks won't be
freed.

* coffgen.c (coff_real_object_p): Free malloc'd memory on target
match too.

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Jan 2020 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoEnsure GDB warnings are styled.
Philippe Waroquiers [Sun, 15 Dec 2019 16:58:16 +0000 (17:58 +0100)] 
Ensure GDB warnings are styled.

While handling the comments of Tom related to
  [RFC] Have an option to tell GDB to detect and possibly handle mismatched exec-files.
  https://sourceware.org/ml/gdb-patches/2019-12/msg00621.html
I saw that GDB warnings are produced ignoring the given styles.

This patch:
  * ensures that style markups are properly handled by "warning".
  * changes 'set/show data-directory' so that file style is used
    in warnings and in 'show message'
  * changes all other messages in top.c to use file style when appropriate.
  * Uses the above data-directory changes in gdb.base/style.exp

2020-01-03  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* ui-file.c (stdio_file::can_emit_style_escape)
(tee_file::can_emit_style_escape): Ensure style is used also on
gdb_stderr when gdb_stderr is a tty supporting styling, similarly
to gdb_stdout.
* main.c (set_gdb_data_directory): Use file style to output the
warning that the given pathname is not a directory.
* top.c (show_history_filename, gdb_safe_append_history)
(show_gdb_datadir): Use file style.

2020-01-03  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.base/style.exp: Test that warnings are styled.

4 years agosolib_target_free_so memory leak
Hannes Domani [Fri, 27 Dec 2019 12:41:58 +0000 (13:41 +0100)] 
solib_target_free_so memory leak

gdb/ChangeLog:

2020-01-03  Hannes Domani  <ssbssa@yahoo.de>

* solib-target.c (struct lm_info_target):
Change offsets to be a unique_xmalloc_ptr.
(solib_target_relocate_section_addresses): Update.

4 years agowindows_clear_solib memory leak
Hannes Domani [Tue, 24 Dec 2019 12:14:01 +0000 (13:14 +0100)] 
windows_clear_solib memory leak

gdb/ChangeLog:

2020-01-03  Hannes Domani  <ssbssa@yahoo.de>

* windows-nat.c (windows_clear_solib): Free so_list linked list.

4 years agoAllow individual targets to decide if string escapes should be allowed. Disable...
Sergey Belyashov [Fri, 3 Jan 2020 16:23:19 +0000 (16:23 +0000)] 
Allow individual targets to decide if string escapes should be allowed.  Disable for PPC and Z80.

PR 25311
* as.h (TC_STRING_ESCAPES): Provide a default definition.
* app.c (do_scrub_chars): Use TC_STRING_ESCAPES instead of
NO_STRING_ESCAPES.
* read.c (next_char_of_string): Likewise.
* config/tc-ppc.h (TC_STRING_ESCAPES): Define.
* config/tc-z80.h (TC_STRING_ESCAPES): Define.

4 years agoFix potential illegal memory access when parsing a corrupt PEF format file.
Nick Clifton [Fri, 3 Jan 2020 16:17:53 +0000 (16:17 +0000)] 
Fix potential illegal memory access when parsing a corrupt PEF format file.

PR 25307
(bfd_pef_parse_function_stubs): Correct the test that ensures that
there is enough data remaining in the code buffer before
attempting to read a function stub.

4 years agoFix potential illegal memory access failures in the BFD library by ensuring that...
Nick Clifton [Fri, 3 Jan 2020 14:41:02 +0000 (14:41 +0000)] 
Fix potential illegal memory access failures in the BFD library by ensuring that the return value from bfd_malloc() is checked before it is used.

PR 25308
* elf-properties.c (_bfd_elf_convert_gnu_properties): Check the
return value from bfd_malloc.
* elf32-arm.c (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
(bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Likewise.
(elf32_arm_filter_cmse_symbols): Likewise.
(elf32_arm_write_section): Likewise.
* mach-o.c (bfd_mach_o_core_fetch_environment): Likewise.
(bfd_mach_o_follow_dsym): Likewise.
* pef.c (bfd_pef_print_loader_section): Likewise.
(bfd_pef_scan_start_address): Likewise.
(bfd_pef_parse_function_stubs): Likewise.
(bfd_pef_parse_symbols): Likewise.

4 years agoUpdated Swedish translation for the GAS subdirectory.
Nick Clifton [Fri, 3 Jan 2020 12:59:54 +0000 (12:59 +0000)] 
Updated Swedish translation for the GAS subdirectory.

4 years agoFor PE format files, the base relocation table is necessary if the image is loaded...
Hannes Domani [Fri, 3 Jan 2020 12:55:12 +0000 (12:55 +0000)] 
For PE format files, the base relocation table is necessary if the image is loaded at a different image base than specified in the PE header.  This patch provides a new option --enable-reloc-section to force the generation of this section.

* emultempl/pe.em: Add new option --enable-reloc-section.
* emultempl/pep.em: Likewise.
* ld.texi: Document --enable-reloc-section.
* pe-dll.c (pe_dll_build_sections): Use pe_dll_enable_reloc_section.
(pe_dll_fill_sections): Simplify by calling pe_exe_fill_sections.
* pe-dll.h: Add extern declaration of option flag.
* pep-dll.c (pe_dll_enable_reloc_section):
Add alias define for pep_dll_enable_reloc_section.
* pep-dll.h: Add extern declaration of option flag.

4 years agoFix ld/PR25316 for the ia64 target by refusing to support binary merging.
Sergei Trofimovich [Fri, 3 Jan 2020 11:21:00 +0000 (11:21 +0000)] 
Fix ld/PR25316 for the ia64 target by refusing to support binary merging.

ld/PR25316
* elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): don't fail
        on binary inputs ld/PR25316.
        (is_ia64_elf): new helper to filter on ia64 objects.

4 years agoArm64: correct address index operands for LD1RO{H,W,D}
Jan Beulich [Fri, 3 Jan 2020 09:16:44 +0000 (10:16 +0100)] 
Arm64: correct address index operands for LD1RO{H,W,D}

Just like their LD1RQ{H,W,D} counterparts, as per the specification the
index registers get scaled by element size.

4 years agoArm64: correct {su,us}dot SIMD encodings
Jan Beulich [Fri, 3 Jan 2020 09:14:16 +0000 (10:14 +0100)] 
Arm64: correct {su,us}dot SIMD encodings

According to the specification these permit the Q bit to control the
vector length operated on, and hence this bit should not already be set
in the opcode table entries (it rather needs setting dynamically). Note
how the test case output did also not match its input. Besides
correcting the test case also extend it to cover both forms.

4 years agoArm64: correct uzp{1,2} mnemonics
Jan Beulich [Fri, 3 Jan 2020 09:13:31 +0000 (10:13 +0100)] 
Arm64: correct uzp{1,2} mnemonics

According to the specification, and in line with the pre-existing
predicate forms, the mnemonics do not include an 'i'.

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