Jan Beulich [Wed, 11 Jul 2018 08:28:56 +0000 (10:28 +0200)]
x86: drop {,reg16_}inoutportreg variables
The checking against reg16_inoutportreg can be had with a simple test of
a bit, and the value setting from inoutportreg can be replaced by using
the actual register's reg_type field.
Note that the so far redundant 2nd instance of OPERAND_TYPE_INOUTPORTREG
is left in place, for its use in type_names[].
Jan Beulich [Wed, 11 Jul 2018 08:28:16 +0000 (10:28 +0200)]
x86: simplify legacy prefix emission
The check_prefix label was bogus from the beginning: The special
checking is supposed to happen for PadLock insns only; no
3-opcode-byte insn should go this path.
Jan Beulich [Wed, 11 Jul 2018 08:25:40 +0000 (10:25 +0200)]
x86/Intel: accept memory operand size specifiers for CET insns
Jan Beulich [Wed, 11 Jul 2018 08:24:44 +0000 (10:24 +0200)]
x86: replace off-by-one OTMax
With its name it should equal to the largest prior enumerator, which is
not very helpful as that will change every once in a while. Rename it to
OTNum instead to make name and value match, and correct use sites to no
longer use one too large a value.
Jan Beulich [Wed, 11 Jul 2018 08:23:48 +0000 (10:23 +0200)]
x86: fix "REP RET" with -madd-bnd-prefix
Just like any other branches, RET should gain a BND prefix also when
already prefixed in source by REP.
Alan Modra [Wed, 11 Jul 2018 04:23:20 +0000 (13:53 +0930)]
Revise "ld testsuite use of notarget"
git commit
624940689a wrongly changed fill.d and fill16.d notarget
entries to xfail, so revert that change and instead replace notarget
with skip. The two tests are complementary.
This patch also modifies the pr20022 test to use .data, avoiding
xfails on targets that complain about dynamic relocations in .text.
This shows a bug in metag which discards section _foo in pr2022.so.
* testsuite/ld-elf/hash.d: Comment on mips xfail.
* testsuite/ld-gc/pr20022b.s: Use .data not .text.
* testsuite/ld-gc/pr20022.d: Remove xfails.
* testsuite/ld-scripts/fill.d: Revert most of last patch, but use
skip rather than notarget.
* testsuite/ld-scripts/fill16.d: Likewise.
Tom Tromey [Tue, 5 Jun 2018 16:35:38 +0000 (10:35 -0600)]
Use std::vector for moribund_locations
This changes moribund_locations to use a std::vector rather than VEC.
I also noticed that moribund_locations is only used in breakpoint.c,
so now it is static as well.
It might be possible to make this code a bit simpler by using a
ref_ptr in moribund_locations; however, I have not done this.
Tested by the buildbot.
gdb/ChangeLog
2018-07-10 Tom Tromey <tom@tromey.com>
* breakpoint.c (moribund_locations): Now static and a
std::vector.
(breakpoint_init_inferior, moribund_breakpoint_here_p)
(build_bpstat_chain, update_global_location_list)
(breakpoint_retire_moribund): Update.
* breakpoint.h (bp_location_p): Remove typedef. Don't declare
VEC.
GDB Administrator [Wed, 11 Jul 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Tue, 10 Jul 2018 23:56:46 +0000 (16:56 -0700)]
MIPS/ld/testsuite: Limit export class call reloc tests to DSO targets
Only run MIPS/LD export class call relocation tests with shared library
targets, avoiding:
.../ld/ld-new: -shared not supported
linker errors and removing:
FAIL: MIPS export class call relocation test (o32)
regressions with `mipsel-ps2-elf' and `mips64el-ps2-elf' targets.
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Limit export class call
relocation tests to shared library targets.
Maciej W. Rozycki [Tue, 10 Jul 2018 23:42:43 +0000 (00:42 +0100)]
BFD/ELF: Correct a `remove' global shadowing error for pre-4.8 GCC
Remove `-Wshadow' compilation errors:
cc1: warnings being treated as errors
.../bfd/elflink.c: In function 'bfd_elf_final_link':
.../bfd/elflink.c:11722: error: declaration of 'remove' shadows a global declaration
/usr/include/stdio.h:154: error: shadowed declaration is here
which for versions of GCC before 4.8 prevent support for ELF targets
from being built. See also GCC PR c/53066.
bfd/
* elflink.c (bfd_elf_final_link): Rename `remove' local variable
to `remove_section'.
Alan Modra [Tue, 10 Jul 2018 02:39:28 +0000 (12:09 +0930)]
xgate testsuite fixes
binutils/
* testsuite/lib/binutils-common.exp (supports_gnu_unique): Return
zero for xgate.
ld/
* testsuite/lib/ld-lib.exp (check_gc_sections_available): Return 0
for xgate.
* testsuite/ld-elf/elf.exp: Add xgate to pr21703 xfails.
* testsuite/ld-elf/shared.exp: Add xgate to pr21703 xfails.
* testsuite/ld-discard/extern.d: xfail xgate.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
* testsuite/ld-elf/attributes.d: Likewise.
* testsuite/ld-elf/compressed1d.d: Likewise.
* testsuite/ld-elf/group1.d: Likewise.
* testsuite/ld-elf/group3b.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/group8b.d: Likewise.
* testsuite/ld-elf/group9a.d: Likewise.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/merge.d: Likewise.
* testsuite/ld-elf/merge2.d: Likewise.
* testsuite/ld-elf/merge3.d: Likewise.
* testsuite/ld-elf/orphan-10.d: Likewise.
* testsuite/ld-elf/orphan-9.d: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/orphan.d: Likewise.
* testsuite/ld-elf/orphan3.d: Likewise.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr14156b.d: Likewise.
* testsuite/ld-elf/pr17550c.d: Likewise.
* testsuite/ld-elf/pr17550d.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr20528a.d: Likewise.
* testsuite/ld-elf/pr20528b.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr22677.d: Likewise.
* testsuite/ld-elf/pr22836-1a.d: Likewise.
* testsuite/ld-elf/pr22836-1b.d: Likewise.
* testsuite/ld-elf/pr349.d: Likewise.
* testsuite/ld-elf/warn1.d: Likewise.
* testsuite/ld-elf/warn2.d: Likewise.
* testsuite/ld-elf/warn3.d: Likewise.
Alan Modra [Sat, 7 Jul 2018 11:53:53 +0000 (21:23 +0930)]
xgate cleanup
elf32-xgate.c contains many functions that are only stubs and
elf32-xgate.h contains unused declarations. While this might be
reasonable for the initial commit of a port with subsequent work
fleshing out the stubs, xgate has only had two minor target specific
patches since the initial commit over six years ago. The rest of the
changes have been general maintenance work applied to all ELF targets,
and some of this work could have been avoided if the stubs hadn't been
there. So this patch removes all the stubs.
I've kept the functionality of the old elf32_xgate_add_symbol_hook,
implemented in elf32_xgate_backend_symbol_processing. Presumably,
that's to set the symbol st_target_internal flag for use in
elf32-m68hc1x.c:elf32_m68hc11_relocate_section.
The empty elf32_xgate_relocate_section meant that xgate had no linker.
Or at least, no linker relocation processing. Deleting the
elf_backend_relocate_section define means the target will now use the
generic linker reloc processing. How good that is will depend on the
accuracy of the reloc howtos..
I haven't updated the ld testsuite to xfail tests expected to fail
for generic elf targets.
bfd/
* elf32-xgate.h: Delete.
* elf32-xgate.c: Delete unnecessary forward declarations, add two
that are now needed.
(xgate_elf_bfd_link_hash_table_create)
(xgate_elf_bfd_link_hash_table_free)
(xgate_elf_set_mach_from_flags, struct xgate_scan_param)
(stub_hash_newfunc, elf32_xgate_add_symbol_hook)
(elf32_xgate_setup_section_lists, elf32_xgate_size_stubs)
(elf32_xgate_build_stubs, elf32_xgate_check_relocs)
(elf32_xgate_relocate_section, _bfd_xgate_elf_set_private_flags)
(elf32_xgate_post_process_headers): Delete.
(elf32_xgate_backend_symbol_processing): New function.
(xgate_elf_ignore_reloc, xgate_elf_special_reloc)
(_bfd_xgate_elf_print_private_bfd_data): Make static.
(ELF_TARGET_ID, elf_info_to_howto, elf_backend_check_relocs)
(elf_backend_relocate_section, elf_backend_object_p)
(elf_backend_final_write_processing, elf_backend_can_gc_sections)
(elf_backend_post_process_headers, elf_backend_add_symbol_hook)
(bfd_elf32_bfd_link_hash_table_create)
(bfd_elf32_bfd_set_private_flags)
(xgate_stub_hash_lookup): Don't define.
(elf_backend_symbol_processing): Define.
* elf-bfd.h (elf_target_id): Delete XGATE_ELF_DATA.
ld/
* emulparams/xgateelf.sh (TEMPLATE_NAME) Set to generic.
(EXTRA_EM_FILE): Set to genelf.
Alan Modra [Tue, 10 Jul 2018 13:43:10 +0000 (23:13 +0930)]
ld testsuite use of notarget
Much of the time it is better to use xfail rather than notarget to
hide a testsuite failure no one is planning on fixing.
1) When a target is fixed, an inappropriate xfail results in XPASS
whereas notarget is silent. Leaving in an inappropriate notarget
entry risks the bug reappearing later, silently.
2) Tests might be used as a template for a new test, carrying over
notarget and/or xfail. Inappropriate notarget entries are silent.
3) An xfailed test that mysteriously XPASSes might actually indicate a
bug.
* testsuite/ld-elf/attributes.d: Use xfail rather than notarget.
* testsuite/ld-elf/hash.d: Likewise.
* testsuite/ld-elf/orphan-10.d: Likewise.
* testsuite/ld-elf/overlay.d: Likewise.
* testsuite/ld-elf/pr14926.d: Likewise.
* testsuite/ld-elf/pr17550d.d: Likewise.
* testsuite/ld-elf/pr19539.d: Likewise.
* testsuite/ld-elf/pr22319.d: Likewise.
* testsuite/ld-misc/defsym1.d: Likewise.
* testsuite/ld-pe/pr19803.d: Likewise.
* testsuite/ld-scripts/assign-loc.d: Likewise.
* testsuite/ld-scripts/defined4.d: Likewise.
* testsuite/ld-scripts/empty-address-1.d: Likewise.
* testsuite/ld-scripts/empty-address-2a.d: Likewise.
* testsuite/ld-scripts/empty-address-2b.d: Likewise.
* testsuite/ld-scripts/fill.d: Likewise.
* testsuite/ld-scripts/fill16.d: Likewise.
* testsuite/ld-scripts/pr14962.d: Likewise.
* testsuite/ld-scripts/pr14962-2.d: Likewise.
* testsuite/ld-unique/pr21529.d: Likewise.
* testsuite/ld-elf/compress1a.d: Likewise, and adjust targets.
* testsuite/ld-elf/compressed1a.d: Likewise.
* testsuite/ld-elf/compressed1d.d: Likewise.
* testsuite/ld-elf/compressed1e.d: Likewise.
* testsuite/ld-elf/eh5.d: Likewise.
* testsuite/ld-elf/group8a.d: Likewise.
* testsuite/ld-elf/linkonce2.d: Likewise.
* testsuite/ld-elf/orphan-9.d: Likewise.
* testsuite/ld-elf/pr17550a.d: Likewise.
* testsuite/ld-elf/pr17550b.d: Likewise.
* testsuite/ld-elf/pr17550c.d: Likewise.
* testsuite/ld-elf/pr19162.d: Likewise.
* testsuite/ld-elf/pr21884.d: Likewise.
* testsuite/ld-gc/pr19167.d: Likewise.
* testsuite/ld-gc/pr20022.d: Likewise.
* testsuite/ld-gc/start.d: Likewise.
* testsuite/ld-elf/orphan-11.d: Delete notarget.
* testsuite/ld-elf/orphan-12.d: Likewise.
* testsuite/ld-gc/stop.d: Likewise.
* testsuite/ld-scripts/empty-address-3a.d: Likewise.
* testsuite/ld-scripts/empty-address-3b.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Delete duplicate notarget.
* testsuite/ld-scripts/section-match-1.d: Comment fix.
Andrew Burgess [Tue, 10 Apr 2018 19:21:58 +0000 (20:21 +0100)]
gdb/testsuite: Run test with software and hardware watchpoints
Expand the gdb.base/watchpoint-reuse-slot.exp test to be run twice,
once with hardware watchpoints disabled (this is new) and then with
hardware watchpoints enabled (the old way).
Running with hardware watchpoints enabled is skipped if the board file
says that hardware watchpoints are not supported on this target.
gdb/testsuite/ChangeLog:
* gdb.base/watchpoint-reuse-slot.exp: Test with hardware
watchpoints enabled and disabled.
Andrew Burgess [Sun, 8 Apr 2018 10:08:32 +0000 (11:08 +0100)]
gdb/riscv: Fix assertion in inferior call code
An assertion when setting up arguments for an inferior call checks the
size of the argument against xlen. However, if xlen and flen are
different sizes, and the argument is being placed into a floating
pointer register then we should be comparing against flen not xlen.
This issue shows up as an assertion failure when running on an rv32g
target with a binary compiled using the rv32f abi and making an
inferior call involving large floating point arguments, for example
the test gdb.base/infcall-nested-structs.exp.
gdb/ChangeLog:
* riscv-tdep.c (riscv_is_fp_regno_p): New function.
(riscv_register_reggroup_p): Use new function, remove unneeded
parenthesis.
(riscv_push_dummy_call): Extend assert to compare against xlen or
flen based on register type.
Andrew Burgess [Sun, 8 Apr 2018 10:07:56 +0000 (11:07 +0100)]
gdb/riscv: Use TYPE_SAFE_NAME
In debug printing, use TYPE_SAFE_NAME instead of replicating the
functionality using TYPE_NAME and a null check.
gdb/ChangeLog:
* riscv-tdep.c (riscv_print_arg_location): Use TYPE_SAFE_NAME.
Maciej W. Rozycki [Tue, 10 Jul 2018 00:28:46 +0000 (01:28 +0100)]
MIPS/LD/testsuite: Make Linux dumps for n64 GOT relocation tests the default
The current default dumps for n64 GOT relocation tests only work for
IRIX targets really, while the Linux dumps are suitable for non-Linux
targets as well. Make the Linux dumps the default then and handle the
IRIX ones as a special case.
Define an `irix' variable as a shorthand for `[istarget *-*-irix*]' and
use it for these n64 GOT relocation tests as well as export class call
relocation tests.
ld/
* testsuite/ld-mips-elf/elf-rel-got-n64.d: Rename to...
* testsuite/ld-mips-elf/elf-rel-got-n64-irix.d: ... this.
* testsuite/ld-mips-elf/elf-rel-got-n64-linux.d: Rename to...
* testsuite/ld-mips-elf/elf-rel-got-n64.d: ... this.
* testsuite/ld-mips-elf/elf-rel-xgot-n64.d: Rename to...
* testsuite/ld-mips-elf/elf-rel-xgot-n64-irix.d: ... this.
* testsuite/ld-mips-elf/elf-rel-xgot-n64-linux.dd: Rename to...
* testsuite/ld-mips-elf/elf-rel-xgot-n64.d: ... this.
* testsuite/ld-mips-elf/mips-elf.exp: Update accordingly.
Define `irix' as a shorthand for `[istarget *-*-irix*]' and use
it throughout.
GDB Administrator [Tue, 10 Jul 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Cary Coutant [Mon, 9 Jul 2018 23:12:27 +0000 (16:12 -0700)]
Fix test for availability of emplace_back.
Testing for the GCC version 5 or later isn't right, since C++ 11 support
wasn't enabled by default until later. This patch tests the C++ standard
support directly instead of inferring it from the GCC version.
gold/
* incremental.cc (Sized_incremental_binary::setup_readers): Use
emplace_back for C++ 11 or later.
Maciej W. Rozycki [Mon, 9 Jul 2018 22:43:27 +0000 (23:43 +0100)]
MIPS/LD/testsuite: Fix IRIX dumps for n64 GOT relocation tests
Factor in the presence of a `.gnu.attributes' section at the end of the
respective dumps:
Disassembly of section .gnu.attributes:
0000000000000000 <.gnu.attributes>:
0:
41000000 bc0f 4 <__dso_displacement+0x4>
4:
0f676e75 jal
d9db9d4 <__dso_displacement+0xd9db9d4>
8:
00010000 sll zero,at,0x0
c:
00070401 0x70401
and also ignore any trailing output with the IRIX variant of n64 GOT
relocation tests, like already done with the Linux and the embedded
ones, removing:
FAIL: MIPS ELF got reloc n64
FAIL: MIPS ELF xgot reloc n64
LD testsuite regressions with the `mips-sgi-irix6' target.
ld/
* testsuite/ld-mips-elf/elf-rel-got-n64.d: Add `#pass' at the
end.
* testsuite/ld-mips-elf/elf-rel-xgot-n64.d: Likewise.
Maciej W. Rozycki [Mon, 9 Jul 2018 20:30:44 +0000 (21:30 +0100)]
MIPS/BFD: Do not redirect to discarded lazy binding stubs
Correct a MIPS/BFD linker issue with dynamic symbol and corresponding
GOT entry values being redirected to lazy binding stubs where the stubs
section has been discarded by assigning to the `/DISCARD/' output
section in the linker script used. The issue manifests itself by the
values entered being relative to the absolute section, which is what any
discarded sections are internally assigned in the linker.
For the `stub-dynsym-2.s' piece of code included as a test case with
this change this issue results in the dynamic symbol table and the GOT
looking like:
Symbol table '.dynsym' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
00000000 0 NOTYPE LOCAL DEFAULT UND
1:
00000010 0 FUNC GLOBAL DEFAULT UND bar
2:
00000000 0 FUNC GLOBAL DEFAULT UND foo
Primary GOT:
Canonical gp value:
00097ff0
Reserved entries:
Address Access Initial Purpose
00090000 -32752(gp)
00000000 Lazy resolver
00090004 -32748(gp)
80000000 Module pointer (GNU extension)
Global entries:
Address Access Initial Sym.Val. Type Ndx Name
00090008 -32744(gp)
00000010 00000010 FUNC UND bar
0009000c -32740(gp)
00000000 00000000 FUNC UND foo
if assembled to regular MIPS code, or:
Symbol table '.dynsym' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
00000000 0 NOTYPE LOCAL DEFAULT UND
1:
0000000d 0 FUNC GLOBAL DEFAULT UND bar
2:
00000001 0 FUNC GLOBAL DEFAULT UND foo
Primary GOT:
Canonical gp value:
00097ff0
Reserved entries:
Address Access Initial Purpose
00090000 -32752(gp)
00000000 Lazy resolver
00090004 -32748(gp)
80000000 Module pointer (GNU extension)
Global entries:
Address Access Initial Sym.Val. Type Ndx Name
00090008 -32744(gp)
0000000d 0000000d FUNC UND bar
0009000c -32740(gp)
00000001 00000001 FUNC UND foo
if assembled to microMIPS code. Symbol values and GOT entries record
the offset into the inexistent stubs section and the ISA bit rather than
zero, which would be the case if a lazy binding stub was not used for
other reasons, such as the value of the symbol being taken for a purpose
other than making a function call (e.g. an R_MIPS_GOT16 relocation).
Correct the issue by refraining from redirecting symbols to lazy binding
stubs if the stubs section is going to be discarded.
bfd/
* elfxx-mips.c (_bfd_mips_elf_adjust_dynamic_symbol): Don't set
`->needs_lazy_stub' if the stubs output section is the absolute
section.
ld/
* testsuite/ld-mips-elf/stub-dynsym-2.dd: New test.
* testsuite/ld-mips-elf/stub-dynsym-2.gd: New test.
* testsuite/ld-mips-elf/stub-dynsym-2.sd: New test.
* testsuite/ld-mips-elf/stub-dynsym-discard-2.gd: New test.
* testsuite/ld-mips-elf/stub-dynsym-discard-2.sd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-2.dd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-2.gd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-2.sd: New test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.dd: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.gd: New
test.
* testsuite/ld-mips-elf/stub-dynsym-micromips-insn32-2.sd: New
test.
* testsuite/ld-mips-elf/stub-dynsym-2.ld: New test linker
script.
* testsuite/ld-mips-elf/stub-dynsym-discard-2.ld: New test
linker script.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Andrew Burgess [Mon, 2 Jul 2018 21:28:22 +0000 (22:28 +0100)]
gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c
Switch to use add_setshow_zuinteger_unlimited_cmd for some of the
control variables in remote.c. The variables
hardware-watchpoint-limit, hardware-breakpoint-limit, and
hardware-watchpoint-length-limit are all changed. For example, a user
will now see this:
(gdb) show remote hardware-breakpoint-limit
The maximum number of target hardware breakpoints is unlimited.
Instead of this:
(gdb) show remote hardware-breakpoint-limit
The maximum number of target hardware breakpoints is -1.
And can do this:
(gdb) set remote hardware-breakpoint-limit unlimited
However, previously any negative value implied "unlimited", now only
-1, or the text "unlimited" can be used for unlimited. Any other
negative value will give an error about invalid input. This is a
small change in the user interface, but, hopefully, this will not
cause too many problems.
I've also added show functions for these three variables to allow for
internationalisation.
gdb/ChangeLog:
* remote.c (show_hardware_watchpoint_limit): New function.
(show_hardware_watchpoint_length_limit): New function.
(show_hardware_breakpoint_limit): New function.
(_initialize_remote): Use add_setshow_zuinteger_unlimited_cmd
where appropriate, update help text.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote Configuration): Update descriptions for
set/show of hardware-watchpoint-limit, hardware-breakpoint-limit,
and hardware-watchpoint-length-limit variables.
Jeff Law [Mon, 9 Jul 2018 16:35:12 +0000 (10:35 -0600)]
* testsuite/nds32/ji-jr.d: Fix name tag.
Maciej W. Rozycki [Mon, 9 Jul 2018 14:50:57 +0000 (15:50 +0100)]
LD/testsuite: run_dump_test: Report UNSUPPORTED for excluded targets
Bring the LD implementation of `run_dump_test' in line with its binutils
and GAS counterparts and report the UNSUPPORTED status for tests the run
of which has been prevented by means of one or more of `target',
`alltargets' and `notarget' tags. Define `skip', `anyskip' and `noskip'
tags, which do not report anything for tests that are not run.
The rationale behind this is that we want to have unsupported tests
reported to ensure that they have actually been attempted and have not
been accidentally suppressed. Then tests which have target-specific
variants that cannot be expressed with a single .d file can make use of
the newly added tags to silently suppress the uninteresting variants.
ld/
* testsuite/lib/ld-lib.exp (run_dump_test): Call `unsupported'
if the target being tested has been excluded by means of one or
more of `target', `alltargets' and `notarget' tags. Add support
for `skip', `anyskip' and `noskip' tags.
Maciej W. Rozycki [Mon, 9 Jul 2018 14:50:57 +0000 (15:50 +0100)]
LD/testsuite: run_dump_test: Use the intended test name ASAP
Bring the LD implementation of `run_dump_test' in line with its binutils
and GAS counterparts and use the intended test name, from the `name' tag
if set, for test status reporting as soon as it is available.
ld/
* testsuite/lib/ld-lib.exp (run_dump_test): Move the setting of
`testname' earlier on and use it for test status reporting.
Maciej W. Rozycki [Mon, 9 Jul 2018 14:50:57 +0000 (15:50 +0100)]
S12Z/opcodes: Correct a `reg' global shadowing error for pre-4.8 GCC
Remove `-Wshadow' compilation errors:
cc1: warnings being treated as errors
.../opcodes/s12z-dis.c: In function 'lea_reg_xys_opr':
.../opcodes/s12z-dis.c:814: error: declaration of 'reg' shadows a global declaration
.../opcodes/s12z-dis.c:783: error: shadowed declaration is here
.../opcodes/s12z-dis.c: In function 'lea_reg_xys':
.../opcodes/s12z-dis.c:843: error: declaration of 'reg' shadows a global declaration
.../opcodes/s12z-dis.c:783: error: shadowed declaration is here
.../opcodes/s12z-dis.c: In function 'print_insn_loop_primitive':
.../opcodes/s12z-dis.c:2206: error: declaration of 'reg' shadows a global declaration
.../opcodes/s12z-dis.c:783: error: shadowed declaration is here
which for versions of GCC before 4.8 prevent support for S12Z targets
from being built. See also GCC PR c/53066.
opcodes/
* s12z-dis.c (lea_reg_xys_opr): Rename `reg' local variable to
`reg_xys'.
(lea_reg_xys): Likewise.
(print_insn_loop_primitive): Rename `reg' local variable to
`reg_dxy'.
Andrew Burgess [Fri, 2 Feb 2018 15:51:31 +0000 (15:51 +0000)]
gdb/testsuite: Allow for failure to read some memory addresses
In the gdb.base/examine-backward.exp test script, we check to see if
address zero is readable, and then read memory first forward from
address zero, and then backward from address zero.
The problem is, being able to read address zero does not guarantee
that you'll be able to read from the other end of the address space,
and the test probably shouldn't assume that is the case.
This patch updates the test script so that even if address zero is
known non-readable, we still run the tests, the tests in question are
mostly about, can GDB calculate the correct address to read from, we
can confirm this even if the final read ultimately fails. We also no
longer assume that if address zero is readable, then the other end of
the address space will be readable.
One further change is that, when we examined the memory at address
zero, the regexp used to match the address expected that the zero
address would have two '0' digits as the least significant digits. As
GDB strips leading zeros from addresses this was causing the test to
fail. I've reduced the zero address to a single 0 digit.
gdb/testsuite/ChangeLog:
* gdb.base/examine-backward.exp: Still run tests around address
0x0, even if address 0x0 is not readable. Update the pattern for
matching address 0x0 in expected output.
Tom Tromey [Mon, 2 Jul 2018 13:36:04 +0000 (07:36 -0600)]
Don't mention XM_CDEPS or NAT_CLIBS
Neither XM_CDEPS nor NAT_CLIBS are defined anywhere, so remove the
uses.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (CDEPS): Don't mention XM_CDEPS.
(CLIBS): Don't mention NAT_CLIBS.
Tom Tromey [Mon, 2 Jul 2018 13:32:10 +0000 (07:32 -0600)]
Remove ADD_FILES and ADD_DEPS from Makefile.in
Nothing defines XM_ADD_FILES, TM_ADD_FILES, or NAT_ADD_FILES any more,
so consequently ADD_FILES and ADD_DEPS are no longer needed. So, this
removes them.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (ADD_FILES, ADD_DEPS): Remove.
(LIBGDB_OBS, clean mostlyclean): Update.
(gdb$(EXEEXT), insight$(EXEEXT)): Update.
Tom Tromey [Mon, 2 Jul 2018 13:29:03 +0000 (07:29 -0600)]
Minimize yacc and lex output
This minimizes the "make" output from the yacc and lex rules,
following the same technique as the rest of the Makefile.
The lex rule had a special case to deal with the situation where flex
is not available. I don't think this is needed, so I removed it. If
flex is truly unavailable, the person building gdb can simply "touch"
the output file.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (%.c: %.y): Use ECHO_YACC.
(%.c: %.l): Use ECHO_LEX. Just fail if flex not available.
* silent-rules.mk (ECHO_YACC, ECHO_LEX): New variables.
Tom Tromey [Mon, 2 Jul 2018 13:09:37 +0000 (07:09 -0600)]
Fix exec.c handling in Makefile
exec.c ws handled specially in COMMON_OBS, but there doesn't seem to
be a reason for this. This changes the Makefile to treat exec.c as an
ordinary source file.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (ALLDEPFILES): Remove exec.c.
(COMMON_OBS): Remove exec.o.
(COMMON_SFILES): Add exec.c.
Tom Tromey [Mon, 2 Jul 2018 13:07:35 +0000 (07:07 -0600)]
Remove lint support
I don't think anyone uses lint any more, so this removes the support
for it from the Makefile.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (LINT, LINTFLAGS, LINTFILES, lint): Remove.
Tom Tromey [Mon, 2 Jul 2018 13:06:27 +0000 (07:06 -0600)]
Use a stamp file for version.c
This introduces a stamp file for version.c, preventing unnecessary
version.o rebuilds.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (clean mostlyclean): Remove stamp-version.
(version.c): Depend on stamp-version.
(stamp-version): New rule, from version.c rule.
Tom Tromey [Mon, 2 Jul 2018 13:03:13 +0000 (07:03 -0600)]
Use a stamp file for init.c
This introduces a stamp file for init.c. This prevents constant
rebuilds of init.o, by arranging for init.c to only be modified when
its contents change. (FWIW this is a standard idiom in use by
Automake and by gdb itself for many years.)
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (init.c): Depend on stamp-init.
(stamp-init): New rule, from init.c rule.
(clean mostlyclean): Remove stamp-init.
Tom Tromey [Mon, 2 Jul 2018 00:31:08 +0000 (18:31 -0600)]
Simplify INIT_FILES
This simplifies the INIT_FILES variable. COMMON_OBS includes
CONFIG_OBS and SUBDIR_GCC_COMPILE_OBS, so there's no need to reference
CONFIG_OBS or SUBDIR_GCC_COMPILE_SRCS there. Once this is done, it it
clear that duplicates can't occur, so remove the duplicate-removing
code as well.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (INIT_FILES): Remove CONFIG_SRCS,
SUBDIR_GCC_COMPILE_SRCS.
Tom Tromey [Mon, 2 Jul 2018 00:29:42 +0000 (18:29 -0600)]
Remove some unused code from init.c build rule
The init.c build rule has a few sed expressions that aren't necessary
any more. This removes them.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (init.c): Remove some unused sed rules.
Tom Tromey [Sun, 1 Jul 2018 23:34:51 +0000 (17:34 -0600)]
Remove TSOBS from gdb/Makefile.in
The TSOBS variable doesn't seem to serve a useful purpose in
gdb/Makefile.in, so remove it.
gdb/ChangeLog
2018-07-09 Tom Tromey <tom@tromey.com>
* Makefile.in (TSOBS): Remove.
(INIT_FILES): Update.
(LIBGDB_OBS): Update.
(COMMON_SFILES): Add inflow.c.
(SFILES): Remove inflow.c.
H.J. Lu [Mon, 9 Jul 2018 13:51:17 +0000 (06:51 -0700)]
bfd: Use changequote for "i[3-7]86-*-linux-*"
Use changequote to match "i[3-7]86-*-linux-*", instead of
"i3-786-*-linux-*".
PR ld/23388
* configure.ac: Use changequote for "i[3-7]86-*-linux-*".
* configure: Regenerated.
Alan Modra [Mon, 9 Jul 2018 02:39:59 +0000 (12:09 +0930)]
m68hc1* fixes
With config.sub now properly returning m68hc12-unknown-elf rather than
m68hc12-unknown-none, more ELF tests run. This patch enables
STB_GNU_UNIQUE processing fixing some testsuite failures that probably
no m68hc12 user cares about, and removes some XPASSes.
bfd/
* elf32-m68hc1x.c (elf32_m68hc11_post_process_headers): Call
_bfd_elf_post_process_headers.
ld/
* testsuite/ld-discard/extern.d: Remove m68hc12 xfail.
* testsuite/ld-discard/start.d: Likewise.
* testsuite/ld-discard/static.d: Likewise.
Christophe Lyon [Mon, 9 Jul 2018 07:45:46 +0000 (07:45 +0000)]
[ARM] Fix warning cannot find thumb start symbol
In case params.thumb_entry_symbol has its default NULL value, using it
to print a warning in gld${EMULATION_NAME}_finish results in a crash.
Use h->root.string instead which either points to
params.thumb_entry_symbol name or to entry_symbol name.
2018-07-09 Christophe Lyon <christophe.lyon@linaro.org>
* emultempl/armelf.em (gld${EMULATION_NAME}_finish): Use the right
symbol name in case of warning.
Change-Id: Iec61a833c0ad538b1440bf326ba67834c314dd63
GDB Administrator [Mon, 9 Jul 2018 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 8 Jul 2018 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
Jan Kratochvil [Sat, 7 Jul 2018 21:02:36 +0000 (23:02 +0200)]
contrib/gdb-add-index.sh -dwarf-5
------------------------------------------------------------------------------
(gdb) help save gdb-index
Save a gdb-index file.
Usage: save gdb-index [-dwarf-5] DIRECTORY
No options create one file with .gdb-index extension for pre-DWARF-5
compatible .gdb_index section. With -dwarf-5 creates two files with
extension .debug_names and .debug_str for DWARF-5 .debug_names section.
------------------------------------------------------------------------------
But gdb-add-index command provided no way how to pass the -dwarf-5 option.
gdb/ChangeLog
2018-07-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* contrib/gdb-add-index.sh ($dwarf5): New, use it.
Simon Marchi [Sat, 7 Jul 2018 15:13:14 +0000 (11:13 -0400)]
ia64-tdep.c: Fix -Wwrite-strings errors
Simply add const where necessary to get rid of errors like:
/home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:1: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
^~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/gdb/common/preprocessor.h:28:25: note: in definition of macro ‘STRINGIFY_1’
#define STRINGIFY_1(x) #x
^
/home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:29: note: in expansion of macro ‘STRINGIFY’
static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
^~~~~~~~~
gdb/ChangeLog:
* ia64-tdep.c (get_reg_name, get_fpreg_name, get_saveloc_name,
is_signal_frame_name, step_name, init_remote_name,
create_addr_space_name, destroy_addr_space_name,
search_unwind_table_name, find_dyn_list_name): Constify.
GDB Administrator [Sat, 7 Jul 2018 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
Max Filippov [Mon, 2 Jul 2018 18:12:44 +0000 (11:12 -0700)]
xtensa: don't emit dynamic relocation for weak undefined symbol
Resolved reference to a weak undefined symbol in PIE must not have
a dynamic relative relocation against itself, otherwise the value of a
reference will be changed from 0 to the base of executable, breaking
code like the following:
void weak_function (void);
if (weak_function)
weak_function ();
This fixes tests for PR ld/22269 and a number of PIE tests in xtensa gcc
testsuite.
bfd/
2018-07-06 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (elf_xtensa_allocate_dynrelocs): Don't allocate
space for dynamic relocation for undefined weak symbol.
(elf_xtensa_relocate_section): Don't emit R_XTENSA_RELATIVE
relocation for undefined weak symbols.
(shrink_dynamic_reloc_sections): Don't shrink dynamic relocation
section for relocations against undefined weak symbols.
Alan Hayward [Fri, 6 Jul 2018 15:25:21 +0000 (16:25 +0100)]
Add checks for the NT_ARM_SVE section in a core file.
The NT_ARM_SVE section is documented here:
https://github.com/torvalds/linux/blob/master/Documentation/arm64/sve.txt
* A NT_ARM_SVE note will be added to each coredump for each thread of the
dumped process. The contents will be equivalent to the data that would have
been read if a PTRACE_GETREGSET of NT_ARM_SVE were executed for each thread
when the coredump was generated.
* elf.c (elfcore_grok_aarch_sve): New function.
(elfcore_grok_note): Check for Aarch64 SVE.
(elfcore_write_aarch_sve): New function.
(elfcore_write_register_note): Check for Aarch64 SVE.
* elf-bfd.h(elfcore_grok_aarch_sve): New declaration.
Tamar Christina [Fri, 6 Jul 2018 15:18:19 +0000 (16:18 +0100)]
Fix SBO bit in disassembly mask for ldrah on AArch64.
The disassembly mask for ldarh incorrectly didn't mask out bit 20 which
is part of the SBO part of the instruction and shouldn't be considered input.
This fixes the wrong bit fixing the disassembly of instructions to
ldarh and makes the behavior consistent.
opcodes/
PR binutils/23242
* aarch64-tbl.h (ldarh): Fix disassembly mask.
Tamar Christina [Fri, 6 Jul 2018 15:15:41 +0000 (16:15 +0100)]
Fix the read/write flag for these registers on AArch64
The previous constraints were based on information already in opcodes and it
seems that a few of them were wrong. I have now hand verified the ones changed
by the previous patch and corrected where needed.
This prevents a warning to be issued when one shouldn't be.
opcodes/
PR binutils/23369
* aarch64-opc.c (aarch64_sys_regs): Make read/write csselr_el1,
vsesr_el2, osdtrrx_el1, osdtrtx_el1, pmsidr_el1.
gas/testsuite/
PR binutils/23369
* gas/aarch64/msr.d (csselr_el1,
vsesr_el2, osdtrrx_el1, osdtrtx_el1, pmsidr_el1): New.
* gas/aarch64/msr.s: Likewise.
Andrew Burgess [Tue, 10 Apr 2018 19:18:53 +0000 (20:18 +0100)]
gdb/testsuite: Ensure test links in malloc and free
The test associated with the source file
gdb.base/share-env-with-gdbserver.c relies on calling malloc and free
within the inferior from GDB. However, as the test source itself
makes no use of these functions, there's no requirement that they be
linked into the test executable.
This commit adds a dummy call to malloc and free to ensure they are
linked into the test executable.
gdb/testsuite/ChangeLog:
* gdb.base/share-env-with-gdbserver.c (main): Add call to
malloc/free.
Nick Clifton [Fri, 6 Jul 2018 12:52:59 +0000 (13:52 +0100)]
Stop readelf from reporting gaps in the gnu build notes if the gap crosses a section boundary.
* readelf.c (same_section): New function.
(print_gnu_build_attribute_description): Do not complain about
gaps that cross a section boundary.
Nick Clifton [Fri, 6 Jul 2018 10:46:14 +0000 (11:46 +0100)]
Fix the relocs created to adjust notes created by the assembler.
* write.c (maybe_generate_build_notes): Bias reloc offsets by the
number of notes already generated.
Sebastian Huber [Fri, 6 Jul 2018 06:23:40 +0000 (08:23 +0200)]
Update config.sub
* config.sub: Sync with upstream version 2018-07-03.
Alan Modra [Fri, 6 Jul 2018 05:37:08 +0000 (15:07 +0930)]
Fix diagnostic errors
Fixes a number of build errors like the following
.../elf32-arm.c: In function 'elf32_arm_nabi_write_core_note':
.../elf32-arm.c:2177: error: #pragma GCC diagnostic not allowed inside functions
.../elf32-arm.c:2186: error: #pragma GCC diagnostic not allowed inside functions
See the comment in diagnostics.h.
include/
* diagnostics.h: Comment on macro usage.
bfd/
* elf32-arm.c (elf32_arm_nabi_write_core_note): Don't use
DIAGNOTIC_PUSH and DIAGNOSTIC_POP unconditionally.
* elf32-ppc.c (ppc_elf_write_core_note): Likewise.
* elf32-s390.c (elf_s390_write_core_note): Likewise.
* elf64-ppc.c (ppc64_elf_write_core_note): Likewise.
* elf64-s390.c (elf_s390_write_core_note): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise.
Alan Modra [Thu, 5 Jul 2018 15:38:16 +0000 (01:08 +0930)]
[GOLD] PowerPC .gnu.attributes support
elfcpp/
* powerpc.h (Tag_GNU_Power_ABI_FP): Define.
(Tag_GNU_Power_ABI_Vector, Tag_GNU_Power_ABI_Struct_Return): Define.
gold/
* powerpc.cc: Include attributes.h.
(Powerpc_relobj::attributes_section_data_): New variable, with
accessor and associated constructor and destructor support.
(Powerpc_dynobj::attributes_section_data_): Likewise.
(Powerpc_relobj::do_read_symbols): Stash SHT_GNU_ATTRIBUTES section
contents in attributes_section_data_.
(Powerpc_dynobj::do_read_symbols): Likewise.
(Target_powerpc): Add attributes_section_data_, last_fp_, last_ld_,
last_vec_, and last_struct_ vars.
(Target_powerpc::merge_object_attributes): New function.
(Target_powerpc::do_finalize_sections): Iterate over input objects
merging attributes. Create output attributes section.
Simon Marchi [Fri, 6 Jul 2018 01:50:12 +0000 (21:50 -0400)]
darwin: Silence syscall deprecated declaration warning
This patch silences this warning:
/Users/simark/src/binutils-gdb/gdb/darwin-nat.c:839:10: error: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Werror,-Wdeprecated-declarations]
res = syscall (SYS___pthread_kill, thread->gdb_port, nsignal);
^
/usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
^
The comment of the new pthread_kill function explains why we use the
syscall function directly.
include/ChangeLog:
* diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS):
Define for clang.
gdb/ChangeLog:
* darwin-nat.c (darwin_pthread_kill): New function.
(darwin_resume_thread): Use darwin_pthread_kill.
Jim Wilson [Fri, 6 Jul 2018 00:49:11 +0000 (17:49 -0700)]
RISC-V: Add riscv-*-* configure support, and minor cleanup.
bfd/
* config.bfd (riscv32*-*-*): Renamed from riscv32-*-*.
(riscv64*-*-*): Likewise.
(riscv-*-*): Add as an alias for riscv32*-*-*.
ld/
* configure.tgt (riscv-*-*): Add as an alias for riscv32*-*-*.
GDB Administrator [Fri, 6 Jul 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Thu, 5 Jul 2018 18:44:02 +0000 (19:44 +0100)]
MIPS/LD/testsuite: Use $linux_gnu consistently across `mips-elf.exp'
Replace two remaining spelled-out calls to `[istarget mips*-*-linux*]'
in `mips-elf.exp' with $linux_gnu, which is equivalent.
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Replace remaining calls to
`[istarget mips*-*-linux*]' with $linux_gnu.
H.J. Lu [Thu, 5 Jul 2018 16:24:07 +0000 (09:24 -0700)]
x86: Remove x86 ISA properties with empty bits
There is no need to generate x86 ISA properties with empty bits in
linker output.
bfd/
PR ld/23372
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove x86
ISA properties with empty bits.
ld/
PR ld/23372
* testsuite/ld-i386/i386.exp: Run pr23372a and pr23372b.
* testsuite/ld-i386/pr23372a.d: New file.
* testsuite/ld-i386/pr23372a.s: Likewise.
* testsuite/ld-i386/pr23372b.d: Likewise.
* testsuite/ld-i386/pr23372b.s: Likewise.
* testsuite/ld-i386/pr23372c.s: Likewise.
* testsuite/ld-x86-64/pr23372a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372a.d: Likewise.
* testsuite/ld-x86-64/pr23372a.s: Likewise.
* testsuite/ld-x86-64/pr23372b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372b.d: Likewise.
* testsuite/ld-x86-64/pr23372b.s: Likewise.
* testsuite/ld-x86-64/pr23372c.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr23372a, pr23372a-x32,
pr23372b and pr23372b-x32.
Sebastian Huber [Fri, 29 Jun 2018 11:06:40 +0000 (13:06 +0200)]
Update config.guess and config.sub
* config.guess: Sync with upstream version 2018-06-26.
* config.sub: Sync with upstream version 2018-07-02.
Nick Clifton [Thu, 5 Jul 2018 11:16:56 +0000 (12:16 +0100)]
Updated Russian, Bulgarian, and Brazilian Portuguese translations for various components of the binutuls.
ld * po/bg.po: Updated Bulgarian translation.
* po/pt_BR.po: Updated Brazilian Portuguese translation.
binutils* po/bg.po: Updated Bulgarian translation.
bfd,gas * po/ru.po: Updated Russian translation.
Tom de Vries [Sat, 16 Jun 2018 16:39:30 +0000 (18:39 +0200)]
[gdb] Fix build error in macroexp.c
When doing a combined build with the gcc and binutils-gdb repos, I run into
this build error in gdb:
...
gdb/macroexp.c: \
In function ‘void get_next_token_for_substitution(macro_buffer*, \
macro_buffer*, char**, macro_buffer*, char**, int*, bool*)’:
gdb/macroexp.c:925:17: error: \
implicitly-declared ‘constexpr macro_buffer& \
macro_buffer::operator=(const macro_buffer&)’ is deprecated \
[-Werror=deprecated-copy]
*token = *lookahead;
...
Wdeprecated-copy is a new gcc warning added after gcc 8.
This patch fixes the build error by adding an explicit copy operator to the
macro_buffer class. I've added asserts to ensure that both the dest and src
of the copy are shared, in other words, neither is owner of the text pointer.
I've run the gdb testsuite on x86_64-linux and the asserts did not trigger.
2018-07-05 Tom de Vries <tdevries@suse.de>
* macroexp.c (macro_buffer) <operator=>: New member function.
Alan Modra [Wed, 4 Jul 2018 01:11:31 +0000 (10:41 +0930)]
Error for mismatched powerpc ABI tags
And report the two input files that are incompatible rather than
reporting that an input file is incompatible with the output.
bfd/
* elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Update prototype.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Return error
on mismatch. Remove "warning: " from messages. Track last bfd
used to set tags.
(ppc_elf_merge_obj_attributes): Likewise. Handle status from
_bfd_elf_ppc_merge_fp_attributes.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Handle status
from _bfd_elf_ppc_merge_fp_attributes.
ld/
* testsuite/ld-powerpc/attr-gnu-4-12.d: Update expected output.
* testsuite/ld-powerpc/attr-gnu-4-13.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-21.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-31.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-4-32.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise.
* testsuite/ld-powerpc/attr-gnu-12-21.d: Likewise.
GDB Administrator [Thu, 5 Jul 2018 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 4 Jul 2018 17:32:50 +0000 (11:32 -0600)]
Use exit_inferior in darwin_attach_pid
Commit
a50c11c666 was intended to use exit_inferior in
darwin_attach_pid, but I accidentally pushed the wrong version of the
patch. This fixes the problem.
gdb/ChangeLog
2018-07-04 Tom Tromey <tom@tromey.com>
* darwin-nat.c (darwin_attach_pid): Use exit_inferior.
Simon Marchi [Wed, 4 Jul 2018 16:40:25 +0000 (12:40 -0400)]
darwin: Don't use sbrk
This patch gets rid of this warning on macOS:
CXX main.o
/Users/simark/src/binutils-gdb/gdb/main.c:492:27: error: 'sbrk' is deprecated [-Werror,-Wdeprecated-declarations]
lim_at_start = (char *) sbrk (0);
^
/usr/include/unistd.h:585:1: note: 'sbrk' has been explicitly marked deprecated here
__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
^
/usr/include/sys/cdefs.h:176:37: note: expanded from macro '__deprecated'
#define __deprecated __attribute__((deprecated))
^
sbrk on macOS is not useful for our purposes, since sbrk(0) always
returns the same value. From what I read, brk/sbrk on macOS is just an
emulation, it always returns a pointer in a 4MB section reserved for
that.
So instead of letting users use "maint set per-command space on" and
print silly results, I think we should just disable that feature for
this platform (as we do for platforms that don't have sbrk).
I defined a HAVE_USEFUL_SBRK macro and used that instead of HAVE_SBRK.
gdb/ChangeLog:
* common/common-defs.h (HAVE_USEFUL_SBRK): Define.
* main.c: Use HAVE_USEFUL_SBRK instead of HAVE_SBRK.
* maint.c: Likewise.
* top.c: Likewise.
Joel Brobecker [Wed, 4 Jul 2018 15:48:05 +0000 (08:48 -0700)]
Update NEWS post GDB 8.2 branch creation.
gdb/ChangeLog:
* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.
Joel Brobecker [Wed, 4 Jul 2018 15:42:44 +0000 (08:42 -0700)]
Bump version to 8.2.50.DATE-git.
Now that the GDB 8.2 branch has been created, we can
bump the version number.
gdb/ChangeLog:
GDB 8.2 branch created (
1b919490e8ba30bf1d6941df0ed112b0e557017e):
* version.in: Bump version to 8.2.50.DATE-git.
Vyacheslav Barinov [Wed, 4 Jul 2018 15:13:29 +0000 (16:13 +0100)]
Warn if /proc is not accessible
There's a buildroot where I want to debug a binary, and I tried to
connect to it from outside, but got very weird errors like
architecture mismatch or protocol errors. At last, after switching on
'--debug' for gdbserver I found a message 'Can't open /proc/pid/'
message and suddenly found that I forgot to mount procfs in my
buildroot.
Make discovering the problem easier by making GDB / GDBserver warn
(even without --debug) if /proc can not be accessed.
Native debugging:
(gdb) start
Temporary breakpoint 1 at 0x400835: file test.c, line 10.
Starting program: /tmp/test
warning: /proc is not accessible.
GDBserver/remote debugging:
$ ./gdbserver :9999 ./gdbserver
gdbserver: /proc is not accessible.
gdb/ChangeLog:
2018-07-04 Vyacheslav Barinov <v.barinov@samsung.com>
Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_init_ptrace): Rename to ...
(linux_init_ptrace_procfs): ... this. Call
linux_proc_init_warnings.
(linux_nat_target::post_attach)
(linux_nat_target::post_startup_inferior): Adjust.
* nat/linux-procfs.c (linux_proc_init_warnings): Define function.
* nat/linux-procfs.h (linux_proc_init_warnings): Declare function.
gdb/gdbserver/ChangeLog:
2018-07-04 Vyacheslav Barinov <v.barinov@samsung.com>
Pedro Alves <palves@redhat.com>
* linux-low.c (initialize_low): Call linux_proc_init_warnings.
H.J. Lu [Wed, 4 Jul 2018 13:27:58 +0000 (06:27 -0700)]
ld: Set non_ir_ref_regular for --undefined SYMBOL
Set non_ir_ref_regular to TRUE for symbols forced into the output file
so that they won't be removed by garbage collection with LTO.
PR ld/23309
* ldlang.c (insert_undefined): Set non_ir_ref_regular to TRUE.
* plugin.c (is_visible_from_outside): Don't scan entry_symbol.
* testsuite/ld-plugin/pr23309.c: New file.
* testsuite/ld-plugin/pr23309.d: Likewise.
H.J. Lu [Wed, 4 Jul 2018 13:22:40 +0000 (06:22 -0700)]
ld: Properly display default for -z separate-code
Check DEFAULT_LD_Z_SEPARATE_CODE to display default for -z separate-code.
PR ld/23358
* lexsup.c (elf_shlib_list_options): Properly display default
for -z separate-code.
H.J. Lu [Wed, 4 Jul 2018 13:18:22 +0000 (06:18 -0700)]
Also install diagnostics.h
Since bfd.h is an installed header, also install diagnostics.h.
* Makefile.am (bfdinclude_HEADERS): Add $(INCDIR)/diagnostics.h.
* Makefile.in: Regenerated.
Tom de Vries [Tue, 3 Jul 2018 22:07:30 +0000 (00:07 +0200)]
[gdb/symtab] Fix version check in dwarf compilation unit header
The version check of the dwarf compilation unit header in
error_check_comp_unit_head is done too late, and consequently dwarf code with
an unsupported version in the compilation unit header is interpreted as dwarf5
code in read_comp_unit_head.
Fixed by moving the check earlier.
Build and reg-tested on x86_64-linux.
2018-07-04 Tom de Vries <tdevries@suse.de>
* dwarf2read.c (error_check_comp_unit_head): Move dwarf version
check ...
(read_comp_unit_head): ... here.
* gdb.dwarf2/dw2-error.exp: Update expected error message.
Tom Tromey [Tue, 5 Jun 2018 16:22:01 +0000 (10:22 -0600)]
Remove VEC from breakpoint
This removes a use of VEC from breakpoint.h, also removing the
now-unnecessary breakpoint_p typedef.
This patch fixes a latent memory leak in
find_matching_tracepoint_location, which neglected to free the vector
returned by all_tracepoints.
Tested by the buildbot.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* tracepoint.c (process_tracepoint_on_disconnect, start_tracing)
(stop_tracing, tstatus_command)
(find_matching_tracepoint_location, merge_uploaded_tracepoints)
(print_one_static_tracepoint_marker): Update.
* breakpoint.c (static_tracepoints_here, all_tracepoints): Return
std::vector.
* breakpoint.h (breakpoint_p): Remove typedef. Don't declare
VEC.
(all_tracepoints, static_tracepoints_here): Return std::vector.
GDB Administrator [Wed, 4 Jul 2018 00:01:24 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 11 Jun 2018 20:45:22 +0000 (14:45 -0600)]
Remove ptid_equal
Remove ptid_equal in favor of using "==".
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_equal): Remove.
* common/ptid.h (ptid_equal): Don't declare.
* ada-tasks.c: Update.
* breakpoint.c: Update.
* common/agent.c: Update.
* corelow.c: Update.
* darwin-nat-info.c: Update.
* darwin-nat.c: Update.
* dcache.c: Update.
* dtrace-probe.c: Update.
* dummy-frame.c: Update.
* fbsd-nat.c: Update.
* frame.c: Update.
* gdbthread.h: Update.
* gnu-nat.c: Update.
* go32-nat.c: Update.
* inf-loop.c: Update.
* inf-ptrace.c: Update.
* infcall.c: Update.
* infcmd.c: Update.
* inflow.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-thread-db.c: Update.
* mi/mi-cmd-var.c: Update.
* mi/mi-interp.c: Update.
* mi/mi-main.c: Update.
* nto-procfs.c: Update.
* ppc-linux-tdep.c: Update.
* procfs.c: Update.
* python/py-inferior.c: Update.
* python/py-record-btrace.c: Update.
* python/py-record.c: Update.
* ravenscar-thread.c: Update.
* regcache.c: Update.
* remote-sim.c: Update.
* remote.c: Update.
* sol-thread.c: Update.
* solib.c: Update.
* target.c: Update.
* tui/tui-stack.c: Update.
* varobj.c: Update.
* windows-nat.c: Update.
* windows-tdep.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* lynx-low.c: Update.
* mem-break.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* server.c: Update.
* spu-low.c: Update.
* target.c: Update.
* win32-low.c: Update.
Tom Tromey [Mon, 11 Jun 2018 20:35:00 +0000 (14:35 -0600)]
Remove ptid_match
This removes ptid_match in favor of the ptid_t::matches method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_match): Remove.
* common/ptid.h (ptid_match): Don't declare.
* fbsd-nat.c: Update.
* infcmd.c: Update.
* infrun.c: Update.
* linux-nat.c: Update.
* record-btrace.c: Update.
* regcache.c: Update.
* remote.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* server.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:22:04 +0000 (12:22 -0600)]
Remove ptid_tid_p
This removes ptid_tid_p in favor of the ptid_t::tid_p method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_tid_p): Remove.
* common/ptid.h (ptid_tid_p): Don't declare.
* sol-thread.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:20:11 +0000 (12:20 -0600)]
Remove ptid_lwp_p
This removes ptid_lwp_p in favor of the ptid_t::lwp_p method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_lwp_p): Remove.
* common/ptid.h (ptid_lwp_p): Don't declare.
* fbsd-nat.c: Update.
* linux-nat.c: Update.
* nat/linux-procfs.c: Update.
* nat/x86-linux-dregs.c: Update.
* sol-thread.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:18:15 +0000 (12:18 -0600)]
Remove ptid_is_pid
This removes ptid_is_pid in favor of the ptid_t::is_pid method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_is_pid): Remove.
* common/ptid.h (ptid_is_pid): Don't declare.
* infrun.c: Update.
* linux-nat.c: Update.
* mi/mi-interp.c: Update.
* remote.c: Update.
* thread.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:14:34 +0000 (12:14 -0600)]
Remove ptid_get_tid
This removes ptid_get_tid in favor of calling the ptid_t::tid method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_tid): Remove.
* common/ptid.h (ptid_get_tid): Don't declare.
* ada-tasks.c: Update.
* aix-thread.c: Update.
* bsd-uthread.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* i386-darwin-nat.c: Update.
* infrun.c: Update.
* linux-tdep.c: Update.
* nto-procfs.c: Update.
* ppc-ravenscar-thread.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* sol-thread.c: Update.
* sparc-ravenscar-thread.c: Update.
* windows-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* target.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:10:09 +0000 (12:10 -0600)]
Remove ptid_get_lwp
This removes ptid_get_lwp in favor of calling the ptid_t::lwp method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_lwp): Remove.
* common/ptid.h (ptid_get_lwp): Don't declare.
* aarch64-linux-nat.c: Update.
* ada-tasks.c: Update.
* aix-thread.c: Update.
* amd64-linux-nat.c: Update.
* arm-linux-nat.c: Update.
* corelow.c: Update.
* fbsd-nat.c: Update.
* fbsd-tdep.c: Update.
* gnu-nat.c: Update.
* i386-cygwin-tdep.c: Update.
* i386-gnu-nat.c: Update.
* i386-linux-nat.c: Update.
* ia64-linux-nat.c: Update.
* inf-ptrace.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* mips-linux-nat.c: Update.
* nat/aarch64-linux-hw-point.c: Update.
* nat/aarch64-linux.c: Update.
* nat/linux-btrace.c: Update.
* nat/linux-osdata.c: Update.
* nat/linux-procfs.c: Update.
* nat/x86-linux-dregs.c: Update.
* obsd-nat.c: Update.
* ppc-fbsd-nat.c: Update.
* ppc-linux-nat.c: Update.
* procfs.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* remote.c: Update.
* s390-linux-nat.c: Update.
* sol-thread.c: Update.
* sol2-tdep.c: Update.
* spu-linux-nat.c: Update.
* x86-linux-nat.c: Update.
* xtensa-linux-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* linux-mips-low.c: Update.
* lynx-low.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* server.c: Update.
* spu-low.c: Update.
* target.c: Update.
* thread-db.c: Update.
Tom Tromey [Mon, 11 Jun 2018 18:05:27 +0000 (12:05 -0600)]
Remove ptid_get_pid
This removes ptid_get_pid in favor of calling the ptid_t::pid method.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (ptid_get_pid): Remove.
* common/ptid.h (ptid_get_pid): Don't declare.
* aarch64-linux-nat.c: Update.
* ada-lang.c: Update.
* aix-thread.c: Update.
* alpha-bsd-nat.c: Update.
* amd64-fbsd-nat.c: Update.
* amd64-linux-nat.c: Update.
* arm-linux-nat.c: Update.
* arm-nbsd-nat.c: Update.
* auxv.c: Update.
* break-catch-syscall.c: Update.
* breakpoint.c: Update.
* bsd-uthread.c: Update.
* corelow.c: Update.
* ctf.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* fbsd-tdep.c: Update.
* gcore.c: Update.
* gnu-nat.c: Update.
* hppa-nbsd-nat.c: Update.
* hppa-obsd-nat.c: Update.
* i386-fbsd-nat.c: Update.
* ia64-linux-nat.c: Update.
* inf-ptrace.c: Update.
* infcmd.c: Update.
* inferior.c: Update.
* inferior.h: Update.
* inflow.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-tdep.c: Update.
* linux-thread-db.c: Update.
* m68k-bsd-nat.c: Update.
* mi/mi-interp.c: Update.
* mi/mi-main.c: Update.
* mips-linux-nat.c: Update.
* mips-nbsd-nat.c: Update.
* mips64-obsd-nat.c: Update.
* nat/aarch64-linux-hw-point.c: Update.
* nat/aarch64-linux.c: Update.
* nat/linux-btrace.c: Update.
* nat/linux-osdata.c: Update.
* nat/linux-procfs.c: Update.
* nat/x86-linux-dregs.c: Update.
* nto-procfs.c: Update.
* obsd-nat.c: Update.
* ppc-linux-nat.c: Update.
* ppc-nbsd-nat.c: Update.
* ppc-obsd-nat.c: Update.
* proc-service.c: Update.
* procfs.c: Update.
* python/py-inferior.c: Update.
* python/py-infthread.c: Update.
* ravenscar-thread.c: Update.
* record.c: Update.
* remote-sim.c: Update.
* remote.c: Update.
* rs6000-nat.c: Update.
* s390-linux-nat.c: Update.
* sh-nbsd-nat.c: Update.
* sol-thread.c: Update.
* sparc-nat.c: Update.
* sparc64-tdep.c: Update.
* spu-linux-nat.c: Update.
* spu-tdep.c: Update.
* target-debug.h: Update.
* target.c: Update.
* thread.c: Update.
* tid-parse.c: Update.
* tracefile-tfile.c: Update.
* vax-bsd-nat.c: Update.
* windows-nat.c: Update.
* x86-linux-nat.c: Update.
* x86-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* linux-mips-low.c: Update.
* lynx-low.c: Update.
* mem-break.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* server.c: Update.
* spu-low.c: Update.
* target.c: Update.
* tracepoint.c: Update.
Tom Tromey [Mon, 11 Jun 2018 17:25:49 +0000 (11:25 -0600)]
Remove pid_to_ptid
This removes pid_to_ptid in favor of calling the ptid_t constructor
directly.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.c (pid_to_ptid): Remove.
* common/ptid.h (pid_to_ptid): Don't declare.
* aix-thread.c: Update.
* arm-linux-nat.c: Update.
* common/ptid.c: Update.
* common/ptid.h: Update.
* corelow.c: Update.
* ctf.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* fork-child.c: Update.
* gnu-nat.c: Update.
* go32-nat.c: Update.
* inf-ptrace.c: Update.
* infcmd.c: Update.
* inferior.c: Update.
* infrun.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* nat/aarch64-linux-hw-point.c: Update.
* nat/fork-inferior.c: Update.
* nat/x86-linux-dregs.c: Update.
* nto-procfs.c: Update.
* obsd-nat.c: Update.
* procfs.c: Update.
* progspace.c: Update.
* remote.c: Update.
* rs6000-nat.c: Update.
* s390-linux-nat.c: Update.
* sol-thread.c: Update.
* spu-linux-nat.c: Update.
* target.c: Update.
* top.c: Update.
* tracefile-tfile.c: Update.
* windows-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* linux-ppc-low.c: Update.
* linux-x86-low.c: Update.
* proc-service.c: Update.
* server.c: Update.
* spu-low.c: Update.
* thread-db.c: Update.
* win32-low.c: Update.
Tom Tromey [Mon, 11 Jun 2018 17:18:51 +0000 (11:18 -0600)]
Remove ptid_build
This removes ptid_build in favor of simply calling the ptid_t
constructor directly.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* common/ptid.h (ptid_build): Don't declare.
* common/ptid.c (ptid_build): Remove.
* aix-thread.c: Update.
* bsd-kvm.c: Update.
* bsd-uthread.c: Update.
* common/agent.c: Update.
* common/ptid.c: Update.
* common/ptid.h: Update.
* corelow.c: Update.
* darwin-nat.c: Update.
* fbsd-nat.c: Update.
* gnu-nat.c: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* linux-thread-db.c: Update.
* nat/linux-osdata.c: Update.
* nat/linux-procfs.c: Update.
* nto-procfs.c: Update.
* obsd-nat.c: Update.
* proc-service.c: Update.
* procfs.c: Update.
* ravenscar-thread.c: Update.
* remote-sim.c: Update.
* remote.c: Update.
* sol-thread.c: Update.
* target.c: Update.
* windows-nat.c: Update.
gdb/gdbserver/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* linux-low.c: Update.
* lynx-low.c: Update.
* nto-low.c: Update.
* remote-utils.c: Update.
* spu-low.c: Update.
* thread-db.c: Update.
* win32-low.c: Update.
Tom Tromey [Mon, 2 Jul 2018 15:20:40 +0000 (09:20 -0600)]
Remove exit_inferior_num_silent
The sole caller of exit_inferior_num_silent was getting the inferior's
number to then use the number to look up the inferior again. I think
it's better to simply not have exit_inferior_num_silent; any potential
callers that only have the inferior's number should probably be
converted to pass the inferior itself around instead.
Tested by the buildbot.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
* infrun.c (follow_exec): Use exit_inferior_silent.
* inferior.c (exit_inferior_num_silent): Remove.
* inferior.h (exit_inferior_num_silent): Don't declare.
Tom Tromey [Thu, 28 Jun 2018 17:57:39 +0000 (11:57 -0600)]
Fix crash in "run" on macOS when gdb is not signed
On macOS, when gdb is not code-signed, it will throw an exception from
darwin_attach_pid. However, gdb also then crashes:
thread.c:93: internal-error: struct thread_info *inferior_thread(): Assertion `tp' failed.
I think the problem here is that darwin_attach_pid does not clean up
inferior_ptid and inf->pid on failure. This leads to a situation
where gdb tries to find a thread, but cannot.
In other cases, gdb would mourn the inferior at this point; but here
this is not possible because the target has not been pushed. Instead
this patch works by simply updating the inferior and inferior_ptid on
failure.
Tested by building an unsigned gdb on macOS and trying to run an
inferior.
gdb/ChangeLog
2018-07-03 Tom Tromey <tom@tromey.com>
PR cli/23340:
* darwin-nat.c (darwin_attach_pid): Reset inferior and
inferior_ptid on error.
Alan Modra [Tue, 3 Jul 2018 08:27:36 +0000 (17:57 +0930)]
Correct removal of .gnu.attributes
Setting SEC_EXCLUDE for empty .gnu.attributes is too late in the link
process for the linker to remove the section. That must be done in
bfd_elf_final_link, as we do for removed group sections.
* elflink.c (bfd_elf_final_link): Remove zero size .gnu.attributes
sections.
Alan Modra [Tue, 3 Jul 2018 05:20:38 +0000 (14:50 +0930)]
GNU attribute output on errors
.gnu.attributes entries from linker input files are merged to the
output file, the output having the union of compatible input
attributes. Incompatible attributes generally cause a linker error
and no output. However in some cases only a warning is emitted, and
one of the incompatible input attributes is passed on to the output.
PowerPC tends to emit warnings rather than errors, and the output
takes the first input attribute. For example, if we have two input
files with Tag_GNU_Power_ABI_FP, the first with a value signifying
"double-precision hard float, IBM long double", the second with a
value signifying "double-precision hard float, IEEE long double",
we'll get a warning about incompatible long double types and the
output will say "double-precision hard float, IBM long double".
The output attribute of course isn't correct. It would be correct to
specify "IBM and IEEE long double", but we don't have a way to
represent that currently. While it would be possible to extend the
encoding, there isn't much gain in doing so. A shared library
providing support for both long double types should link against
objects using either long double type without warning or error. That
is what you'd get if such a shared library had no Tag_GNU_Power_ABI_FP
attribute.
So this patch provides a way for the backend to omit .gnu.attributes
tags from the output.
* elf-bfd.h (ATTR_TYPE_FLAG_ERROR, ATTR_TYPE_HAS_ERROR): Define.
* elf-attrs.c (is_default_attr): Handle ATTR_TYPE_HAS_ERROR.
* elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Use
ATTR_TYPE_FLAG_INT_VAL. Set ATTR_TYPE_HAS_ERROR on finding
incompatible attribute.
(ppc_elf_merge_obj_attributes): Likewise. Return
_bfd_elf_merge_object_attributes result.
* elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Return
_bfd_elf_merge_object_attributes result.
Alan Modra [Tue, 3 Jul 2018 02:48:10 +0000 (12:18 +0930)]
Hide dynamic symbols in discarded sections
This is a followup to git commit
97196564c7 "Strip global symbol
defined in discarded section". If a symbol defined in a discarded
section was dynamic, that patch left .dynsym with holes (ie. all zero
entries). For example, the following from libstdc++.so:
Symbol table '.dynsym' contains 6090 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1:
00000000000a74e0 0 SECTION LOCAL DEFAULT 10
2:
0000000000264180 0 SECTION LOCAL DEFAULT 17
3:
0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_addUserCommitAction
4:
0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_memcpyRtWn
5:
0000000000000000 0 NOTYPE LOCAL DEFAULT UND
readelf: Warning: local symbol 5 found at index >= .dynsym's sh_info value of 3
6:
0000000000000000 0 NOTYPE LOCAL DEFAULT UND
readelf: Warning: local symbol 6 found at index >= .dynsym's sh_info value of 3
[snip]
This patch removes the symbols from .dynsym too.
PR 17550
* elflink.c (_bfd_elf_fix_symbol_flags): Hide dynamic symbols
in discarded sections.
GDB Administrator [Tue, 3 Jul 2018 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:22 +0000 (23:57 +0100)]
MIPS/BFD: Make section GC work with `ict_irix5' targets
Prevent runtime procedure table symbols, produced with `ict_irix5' MIPS
targets, from being swept in section GC, fixing linker errors like:
./ld-new: tmpdir/dump: protected symbol `_procedure_table_size' isn't defined
./ld-new: final link failed: bad value
triggered whenever section GC is enabled with those targets and
consequently removing the following test suite failures:
FAIL: Build pr22649-2a.so
FAIL: Build pr22649-2c.so
FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned shared library)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned)
FAIL: --gc-sections with .text._init
FAIL: pr20022
observed with `mips-elf', `tx39-elf', `mipsisa32-elf', `mipsisa64-elf',
`mipsel-elf', `mipsisa32el-elf', `mipsisa64el-elf', `mips64vr-elf',
`mips64vrel-elf', `mips64vr4300-elf', `mips64vr4300el-elf',
`mips-sgi-irix5' and `mips-rtems' targets, among others. This fix makes
section GC usable with the affected targets.
bfd/
* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Set
`mark' for symbols created from `mips_elf_dynsym_rtproc_names'
list.
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:22 +0000 (23:57 +0100)]
microMIPS/GAS: Handle several percent-ops with macros
In the microMIPS mode also accept %half, %got, %call, %got_hi, %got_lo,
%call_hi, %call_lo, %neg, %got_page, %highest, %got_disp, %tlsgd,
%tlsldm, %dtprel_hi, %dtprel_lo, %gottprel, %tprel_hi and %tprel_lo
percent-ops with macros, so that they can be used with instructions that
expand into sequences if relocation is required due to their limited
offset span, such as LL, LWL, etc., fixing GAS assertions:
.../gas/testsuite/gas/mips/elf-rel28.s: Assembler messages:
.../gas/testsuite/gas/mips/elf-rel28.s:17: Internal error in macro_build at .../gas/config/tc-mips.c:8854.
Please report this bug.
observed if an attempt is made to assemble the `elf-rel28.s' test case
modified to use one of the affected instructions to microMIPS code.
gas/
* config/tc-mips.c (macro_build) <'i', 'j'>: Also accept
BFD_RELOC_16, BFD_RELOC_MIPS_GOT16, BFD_RELOC_MIPS_CALL16,
BFD_RELOC_MIPS_GOT_HI16, BFD_RELOC_MIPS_GOT_LO16,
BFD_RELOC_MIPS_CALL_HI16, BFD_RELOC_MIPS_CALL_LO16,
BFD_RELOC_MIPS_SUB, BFD_RELOC_MIPS_GOT_PAGE,
BFD_RELOC_MIPS_HIGHEST, BFD_RELOC_MIPS_GOT_DISP,
BFD_RELOC_MIPS_TLS_GD, BFD_RELOC_MIPS_TLS_LDM,
BFD_RELOC_MIPS_TLS_DTPREL_HI16, BFD_RELOC_MIPS_TLS_DTPREL_LO16,
BFD_RELOC_MIPS_TLS_GOTTPREL, BFD_RELOC_MIPS_TLS_TPREL_HI16 and
BFD_RELOC_MIPS_TLS_TPREL_LO16 relocations if in the microMIPS
mode.
* testsuite/gas/mips/elf-rel28-lldscd-n32.d: New test.
* testsuite/gas/mips/elf-rel28-lldscd-micromips-n32.d: New test.
* testsuite/gas/mips/elf-rel28-lldscd-n64.d: New test.
* testsuite/gas/mips/elf-rel28-lldscd-micromips-n64.d: New test.
* testsuite/gas/mips/elf-rel28.s: Add instruction selection.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:22 +0000 (23:57 +0100)]
microMIPS/BFD: Add missing NewABI TLS and miscellaneous relocations
Complement commit
df58fc944dbc ("MIPS: microMIPS ASE support"),
<https://sourceware.org/ml/binutils/2011-07/msg00198.html>, and add TLS
and a few miscellaneous relocations to NewABI microMIPS support, fixing
GAS assertion failures:
.../gas/testsuite/gas/mips/elf-rel28.s: Assembler messages:
.../gas/testsuite/gas/mips/elf-rel28.s:19: Internal error in append_insn at .../gas/config/tc-mips.c:7660.
Please report this bug.
observed if an attempt is made to assemble the `elf-rel28.s' test case
to microMIPS code. The relocations are the same as with o32 support,
except for `partial_inplace' and `src_mask' updates for the respective
RELA variants.
bfd/
* elf64-mips.c (micromips_elf64_howto_table_rel): Add
R_MICROMIPS_HI0_LO16, R_MICROMIPS_TLS_GD, R_MICROMIPS_TLS_LDM,
R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_DTPREL_LO16,
R_MICROMIPS_TLS_GOTTPREL, R_MICROMIPS_TLS_TPREL_HI16,
R_MICROMIPS_TLS_TPREL_LO16, R_MICROMIPS_GPREL7_S2 and
R_MICROMIPS_PC23_S2 relocation entries.
(micromips_elf64_howto_table_rela): Likewise.
(micromips_reloc_map): Likewise.
* elfn32-mips.c (elf_micromips_howto_table_rel): Likewise.
(elf_micromips_howto_table_rela): Likewise.
(micromips_reloc_map): Likewise.
gas/
* testsuite/gas/mips/elf-rel28-micromips-n32.d: New test.
* testsuite/gas/mips/elf-rel28-micromips-n64.d: New test.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:21 +0000 (23:57 +0100)]
MIPS/LD/testsuite: Fix a typo in PR ld/21334 test name
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Fix a typo in PR ld/21334
test name.
Maciej W. Rozycki [Mon, 2 Jul 2018 22:57:21 +0000 (23:57 +0100)]
GDB PR tdep/8282: MIPS: Wire in `set disassembler-options'
Implement MIPS target support for passing options to the disassembler,
complementing commit
65b48a81404c ("GDB: Add support for the new
set/show disassembler-options commands.").
This includes options that expect an argument, so adjust the generic
code and data structures used so as to handle such options. So as to
give backends syntax flexibility no specific delimiter has been defined
to separate options from their respective arguments, so it has to be
included as the last character of the option name. Completion code
however has not been adjusted and consequently option arguments cannot
be completed at this time.
Also the MIPS target has non-empty defaults for the options, so that ABI
names for the general-purpose registers respect our `set mips abi ...'
setting rather than always being determined from the ELF headers of the
binary file selected. Handle these defaults as implicit options, never
shown to the user and always prepended to the user-specified options, so
that the latters can override the defaults.
The resulting output for the MIPS target is as follows:
(gdb) show disassembler-options
The current disassembler options are ''
The following disassembler options are supported for use with the
'set disassembler-options <option>[,<option>...]' command:
no-aliases Use canonical instruction forms.
msa Recognize MSA instructions.
virt Recognize the virtualization ASE instructions.
xpa Recognize the eXtended Physical Address (XPA) ASE
instructions.
ginv Recognize the Global INValidate (GINV) ASE instructions.
gpr-names=ABI Print GPR names according to specified ABI.
Default: based on binary being disassembled.
fpr-names=ABI Print FPR names according to specified ABI.
Default: numeric.
cp0-names=ARCH Print CP0 register names according to specified architecture.
Default: based on binary being disassembled.
hwr-names=ARCH Print HWR names according to specified architecture.
Default: based on binary being disassembled.
reg-names=ABI Print GPR and FPR names according to specified ABI.
reg-names=ARCH Print CP0 register and HWR names according to specified
architecture.
For the options above, the following values are supported for "ABI":
numeric 32 n32 64
For the options above, the following values are supported for "ARCH":
numeric r3000 r3900 r4000 r4010 vr4100 vr4111 vr4120 r4300 r4400 r4600
r4650 r5000 vr5400 vr5500 r5900 r6000 rm7000 rm9000 r8000 r10000 r12000
r14000 r16000 mips5 mips32 mips32r2 mips32r3 mips32r5 mips32r6 mips64
mips64r2 mips64r3 mips64r5 mips64r6 interaptiv-mr2 sb1 loongson2e
loongson2f loongson3a octeon octeon+ octeon2 octeon3 xlr xlp
(gdb)
which corresponds to what `objdump --help' used to print for the MIPS
target, with minor formatting changes, most notably option argument
lists being wrapped, but also the amount of white space separating
options from the respective descriptions. The relevant part the new
code is now also used by `objdump --help', which means these formatting
changes apply to both outputs, except for argument list wrapping, which
is GDB-specific.
This also adds a separating new line between the heading and option
lists where descriptions are provided, hence:
(gdb) set architecture s390:31-bit
(gdb) show disassembler-options
The current disassembler options are ''
The following disassembler options are supported for use with the
'set disassembler-options <option>[,<option>...]' command:
esa Disassemble in ESA architecture mode
zarch Disassemble in z/Architecture mode
insnlength Print unknown instructions according to length from first two bits
(gdb)
but:
(gdb) set architecture powerpc:common
(gdb) show disassembler-options
The current disassembler options are ''
The following disassembler options are supported for use with the
'set disassembler-options <option>[,<option>...]' command:
403, 405, 440, 464, 476, 601, 603, 604, 620, 7400, 7410, 7450, 7455, 750cl,
821, 850, 860, a2, altivec, any, booke, booke32, cell, com, e200z4, e300,
e500, e500mc, e500mc64, e5500, e6500, e500x2, efs, efs2, power4, power5,
power6, power7, power8, power9, ppc, ppc32, 32, ppc64, 64, ppc64bridge,
ppcps, pwr, pwr2, pwr4, pwr5, pwr5x, pwr6, pwr7, pwr8, pwr9, pwrx, raw, spe,
spe2, titan, vle, vsx
(gdb)
Existing affected target backends have been adjusted accordingly.
This has been verified manually with:
(gdb) set architecture arm
(gdb) set architecture powerpc:common
(gdb) set architecture s390:31-bit
to cause no issues with the `show disassembler-options' and `set
disassembler-options' commands. A test case for the MIPS target has
also been provided, covering the default settings with ABI overrides as
well as disassembler option overrides.
2018-07-02 Maciej W. Rozycki <macro@mips.com>
Simon Marchi <simon.marchi@polymtl.ca>
include/
PR tdep/8282
* dis-asm.h (disasm_option_arg_t): New typedef.
(disasm_options_and_args_t): Likewise.
(disasm_options_t): Add `arg' member, document members.
(disassembler_options_mips): New prototype.
(disassembler_options_arm, disassembler_options_powerpc)
(disassembler_options_s390): Update prototypes.
opcodes/
PR tdep/8282
* mips-dis.c (mips_option_arg_t): New enumeration.
(mips_options): New variable.
(disassembler_options_mips): New function.
(print_mips_disassembler_options): Reimplement in terms of
`disassembler_options_mips'.
* arm-dis.c (disassembler_options_arm): Adapt to using the
`disasm_options_and_args_t' structure.
* ppc-dis.c (disassembler_options_powerpc): Likewise.
* s390-dis.c (disassembler_options_s390): Likewise.
gdb/
PR tdep/8282
* disasm.h (gdb_disassembler): Add
`m_disassembler_options_holder'. member
* disasm.c (get_all_disassembler_options): New function.
(gdb_disassembler::gdb_disassembler): Use it.
(gdb_buffered_insn_length_init_dis): Likewise.
(gdb_buffered_insn_length): Adjust accordingly.
(set_disassembler_options): Handle options with arguments.
(show_disassembler_options_sfunc): Likewise. Add a leading new
line if showing options with descriptions.
(disassembler_options_completer): Adapt to using the
`disasm_options_and_args_t' structure.
* mips-tdep.c (mips_disassembler_options): New variable.
(mips_disassembler_options_o32): Likewise.
(mips_disassembler_options_n32): Likewise.
(mips_disassembler_options_n64): Likewise.
(gdb_print_insn_mips): Don't set `disassembler_options'.
(gdb_print_insn_mips_n32, gdb_print_insn_mips_n64): Remove
functions.
(mips_gdbarch_init): Always set `gdbarch_print_insn' to
`gdb_print_insn_mips'. Set `gdbarch_disassembler_options',
`gdbarch_disassembler_options_implicit' and
`gdbarch_valid_disassembler_options'.
* arm-tdep.c (_initialize_arm_tdep): Adapt to using the
`disasm_options_and_args_t' structure.
* gdbarch.sh (disassembler_options_implicit): New `gdbarch'
method.
(valid_disassembler_options): Switch from `disasm_options_t' to
the `disasm_options_and_args_t' structure.
* NEWS: Document `set disassembler-options' support for the MIPS
target.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
gdb/doc/
PR tdep/8282
* gdb.texinfo (Source and Machine Code): Document `set
disassembler-options' support for the MIPS target.
gdb/testsuite/
PR tdep/8282
* gdb.arch/mips-disassembler-options.exp: New test.
* gdb.arch/mips-disassembler-options.s: New test source.
H.J. Lu [Mon, 2 Jul 2018 20:08:09 +0000 (13:08 -0700)]
x86-64: Clear the R_X86_64_converted_reloc_bit bit
We need to clear the R_X86_64_converted_reloc_bit bit after setting it
to avoid leaking it out by --emit-relocs.
bfd/
PR ld/23324
* elf64-x86-64.c (elf_x86_64_relocate_section): Clear the
R_X86_64_converted_reloc_bit bit.
ld/
PR ld/23324
* testsuite/ld-x86-64/pr23324.s: New file.
* testsuite/ld-x86-64/pr23324a.d: Likewise.
* testsuite/ld-x86-64/pr23324b.d: Likewise.
Tom Tromey [Thu, 28 Jun 2018 14:02:42 +0000 (08:02 -0600)]
Allow BFD to recognize macOS universal libraries
Bug #13157 is about a gdb regression, where previously it could handle
universal libraries, but now cannot.
gdb isn't working for me on macOS for other reasons, so I wrote this
small test program to show the problem:
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <bfd.h>
void
die (const char *what)
{
fprintf (stderr, "die: %s\n", what);
exit (1);
}
int
main (int argc, char **argv)
{
bfd *file = bfd_openr (argv[1], NULL);
if (file == NULL)
die ("couldn't open");
if (!bfd_check_format (file, bfd_archive))
die ("not an archive");
printf ("yay\n");
bfd_close (file);
return 0;
}
Then I built a simple universal binary. With git master BFD, I get:
$ ./doit ./universal-exe
die: not an archive
Jeff Muizelaar tracked this down to the BFD change for PR binutils/21787.
This patch changed bfd_generic_archive_p to sometimes reset the BFD's
"format" field.
However, simply changing bfd_generic_archive_p regressed the test case
in that bug.
Debugging PR binutils/21787 again, what I saw is that the mach-o
universal binary support acts like a bfd_archive but does not provide
a _close_and_cleanup function. However, if a BFD appears as an
archive member, it must always remove its own entry from its parent's
map. Otherwise, when the parent is destroyed, the already-destroyed
child BFD will be referenced. mach-o does not use the usual archive
member support, so simply using _bfd_archive_close_and_cleanup (as
other targets do) will not work.
This patch fixes the problem by introducing a new
_bfd_unlink_from_archive_parent function, then arranging for it to be
called in the mach-o case.
Ok?
bfd/ChangeLog
2018-07-02 Jeff Muizelaar <jrmuizel@gmail.com>
Tom Tromey <tom@tromey.com>
PR 13157
PR 21787
* mach-o.c (bfd_mach_o_fat_close_and_cleanup): New function.
(bfd_mach_o_close_and_cleanup): Redefine.
* archive.c (_bfd_unlink_from_archive_parent): New function,
extracted from..
(_bfd_archive_close_and_cleanup): ..here.
(bfd_generic_archive_p): Do not clear archive's format.
* libbfd-in.h (_bfd_unlink_from_archive_parent): Declare.
* libbfd.h: Regenerate.
Sebastian Huber [Fri, 29 Jun 2018 08:50:11 +0000 (10:50 +0200)]
gdb: Prefer RISC-V register name "s0" over "fp"
The "fp" register name is an alias for "s0" which is an alias for "x8".
The "fp" name is only understood by very recent Binutils and thus not
used by GCC. GCC does not emit a frame pointer with common optimization
options such as -Og or -O2.
It is still possible to use the "fp" register name, e.g.
(gdb) p/x $fp
$1 = 0x800367c8
works.
However, in the register dump you see now:
(gdb) info registers
...
t2 0xffffffffffffffff
18446744073709551615
s0 0x800367c8 0x800367c8
s1 0x80033280
2147693184
...
gdb/
* riscv-tdep.c (riscv_register_aliases): Swap "fp" and "s0"
entries.