Commit Graph

95820 Commits

Author SHA1 Message Date
Alan Modra e4c2619ad1 PR23800, .eqv doesn't always defer expression evaluation
.eqv (and ==) ought not simplify expressions involving dot or other
symbols set by .eqv.  If such simplification occurs, the value of dot
will be that at the assignment rather than at the place where the
symbol is used.

	PR 23800
	* expr.c (expr): Don't simplify expressions involving forward_ref
	symbols when mode is expr_defer.
	* config/tc-spu.c (spu_cons): Parse expression using normal
	expression evaluation if @ppu is not detected.
	* testsuite/gas/all/eqv-dot.d,
	* testsuite/gas/all/eqv-dot.s: New test.
	* testsuite/gas/all/gas.exp: Run it.
2018-10-20 19:46:43 +10:30
Alan Modra ac85e67c05 PR23788, objcopy: failed to find link section
Symbol tables can change when a number of objcopy options are used.
I figure string tables are similarly changeable.

	PR 23788
	* elf.c (section_match): Don't require a size match for SHT_SYMTAB
	or SHT_STRTAB.
2018-10-20 19:46:43 +10:30
Alan Modra 91ae256e33 Relax a -r --gc-sections requirement
A symbol root is not needed if --gc-keep-exported is also given.

	* ldlang.c (lang_end): Don't error if no --entry or --undefined
	is given with -r -gc-sections if --gc-keep-exported.
2018-10-20 19:46:43 +10:30
GDB Administrator fe19e45ff3 Automatic date update in version.in 2018-10-20 00:00:40 +00:00
Tom Tromey 7806cea723 Deprecate and replace the "tabset" command
The "tabset" command sets the tab width as used by the TUI for source
and disassembly display.

This command has long seemed to be misnamed to me.  It is more in
keeping with gdb design to call it "set tui tab-width".  Also, making
this change allows for the corresponding "show" command to work.

gdb/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	PR tui/18388:
	* NEWS: Mention tabset deprecation.
	* tui/tui-win.c (tui_tab_width, internal_tab_width): New globals.
	(update_tab_width): New function.
	(tui_set_tab_width, tui_show_tab_width): New functions.
	(tui_set_tab_width_command): Use update_tab_width.
	(_initialize_tui_win): Move to end of file.  Deprecate "tabset".
	Add new "set tui tab-width" command.
	* tui/tui-source.c (tui_set_source_content): Update.
	* tui/tui-disasm.c (tui_set_disassem_content): Update.
	* tui/tui-data.h (tui_default_tab_len, tui_set_default_tab_len):
	Don't declare.
	(tui_tab_width): Declare.
	* tui/tui-data.c (default_tab_len, tui_default_tab_len)
	(tui_set_default_tab_len): Remove.

gdb/doc/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	PR tui/18388:
	* gdb.texinfo (TUI Commands): Remove tabset documentation.
	(TUI Configuration): Document "set tui tab-width".
2018-10-19 17:22:27 -06:00
Tom Tromey 84371624ad Minor cleanups in tui-io.c
I noticed that a couple of functions in tui-io.c could be static, and
that a couple more were unused and could be removed.

gdb/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	* tui/tui-io.h (key_is_start_sequence, key_is_end_sequence)
	(key_is_backspace, tui_getc): Don't declare.
	* tui/tui-io.c (key_is_start_sequence): Now static.
	(key_is_end_sequence, key_is_backspace): Remove.
	(tui_getc): Now static.
2018-10-19 17:22:27 -06:00
Tom Tromey 22ad8107d3 Clear static_links in reread_symbols
-fsanitize=address pointed out a use-after free in
objfile_register_static_link.  The bug turned out to be that
reread_symbols does not clear the static_links field; this leaves a
hash table that is filled with freed pointers.

Jan's (now quite old) idea of replacing reread_symbols with a simple
delete/new still seems good to me, and it's worth noting that it would
have avoided this bug.

Tested by the buildbot and by observing the change with
-fsanitize=address.

gdb/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	* symfile.c (reread_symbols): Clear "static_links".
2018-10-19 10:28:33 -06:00
Tamar Christina bacb77d018 Arm: Skip new binary decode tests on pe targets
The two new test I added require the use of the ".inst" directive which the PE
targets don't support.  Because of that I excluded *-unknown-pe but the mask needs
to be wider.  I am now excluding *-*-pe.

gas/ChangeLog:

	* testsuite/gas/arm/undefined-insn-arm.d: Widen pe skip.
	* testsuite/gas/arm/undefined-insn-thumb.d: Likewise.
2018-10-19 16:19:07 +01:00
Alan Hayward 74b3c71318 Aarch64: Better termination checks for sigcontext reading
When reading the reserved section in the sigcontext ensure the
address is updated on an unknown section. Also add additional
checks to prevent reading past the end of the array.

Fixes gdb.base/savedregs.exp

	* aarch64-linux-tdep.c (AARCH64_SIGCONTEXT_RESERVED_SIZE): New
	define.
	(aarch64_linux_sigframe_init): Extra boundary checks.
2018-10-19 13:51:00 +01:00
Andreas Arnez 0667c50682 S390: Fix crash when remote tdesc doesn't define vec128
I've encountered a GDB crash when trying to read registers from a remote
stub that provided a target.xml with vector registers, but without the
'vec128' data type.  The crash is caused by NULL register type entries for
the "concatenated" pseudo-registers v0-v15.  These NULL entries are
introduced by the logic in s390_pseudo_register_type(), where the tdesc
type 'vec128' is returned unconditionally -- even if it doesn't exist (is
NULL).

The fixed logic for determining a "concatenated" vector register's type
now returns the type of the raw register v16 instead.  This also makes
sure that all vector register have the same type.

gdb/ChangeLog:

	* s390-tdep.c (s390_pseudo_register_type): For v0-v15 don't yield
	the possibly non-existent tdesc type 'vec128', but the type of raw
	register v16 instead.
2018-10-19 14:05:08 +02:00
Gary Benson ba543ca5af Fix cli_interp::cli_uiout resource leak found by Coverity
This commit fixes a resource leak found by Coverity, where cli_interp's
constructor creates a new cli_ui_out, but there was no corresponding
destructor to free it.

gdb/ChangeLog:

	* cli/cli-interp.c (cli_interp::~cli_interp): New function.
2018-10-19 11:52:33 +01:00
Alan Hayward b04480b119 Testsuite: Fix racy conditions in py-cmd.exp
The test loop in test_python_inline_or_multiline was not checking for the
gdb prompt. readline_is_used then reads in the prompt causing it to fail
and the final chunk of tests to be skipped.

Spotted this error because sometimes the gdb prompt does get processed
correctly and the final tests are run, causing it to show up in the
racy tests script output.

Fix by ensuring the prompt is always checked for. To do this the list
style needs reformatting so that variables get expanded.

2018-10-19  Alan Hayward  <alan.hayward@arm.com>

	* gdb.python/py-cmd.exp: Check for gdb_prompt.
2018-10-19 11:29:42 +01:00
Alan Hayward 2c6ac8d7ce Testsuite: vla-optimized-out.exp is too pessimistic
On aarch64 (and possibly other ports), for O3 the sizeof "a" can still be shown.

2018-10-19  Alan Hayward  <alan.hayward@arm.com>

	* gdb.base/vla-optimized-out.exp: Allow either optimized out or 6.
2018-10-19 11:21:12 +01:00
Alan Hayward 2bc69f2588 testsuite: ovldbreak.exp: fix regexp
Fix the layout used in the regexp for breakpoints.

Gets rid of two FAILS.

2018-10-18  Alan Hayward  <alan.hayward@arm.com>

	* gdb.cp/ovldbreak.exp: Fix regexps.
2018-10-19 11:13:40 +01:00
Alan Hayward 1f1ae3a34f Testsuite: compile-cplus-print.exp: Start inferior before compiling
skip_compile_feature_tests is only valid if the inferior has already
been started (see proc comments). Move the runto_main earlier.

2018-10-18  Alan Hayward  <alan.hayward@arm.com>

	* gdb.compile/compile-cplus-print.exp: Start inferior earlier.
2018-10-19 11:03:38 +01:00
Tamar Christina 0b347048e7 Arm: Fix disassembler crashing on -b binary when thumb file and thumb not forced.
The disassembler for Arm has some aborts in it in places it assumes can never
be reached.  Under normal circumstances they indeed cannot be reached because
the right options are selected from the ARM attributes in the ELF file.

However when disassembling with -b binary then if you do not get the options
right the disassembler just aborts.  This changes it so it just prints how it
was trying to interpret the instruction and prints UNKNOWN instructions next to it.

This way the user has an idea of what's going.

gas/ChangeLog:

	* testsuite/gas/arm/undefined-insn-arm.d: New test.
	* testsuite/gas/arm/undefined-insn-thumb.d: New test.
	* testsuite/gas/arm/undefined-insn.s: New test.

opcodes/ChangeLog:

	* arm-dis.c (UNKNOWN_INSTRUCTION_32BIT): Format specifier for arm mode.
	(UNKNOWN_INSTRUCTION_16BIT): Format specifier for thumb mode.
	(print_insn_arm, print_insn_thumb16, print_insn_thumb32): Use them.
2018-10-19 10:33:11 +01:00
Fredrik Noring 33d64ca5db This set of changes clarifies the conditions for the R5900 short loop fix and extends its test with the border cases of six and seven instructions.
* testsuite/gas/mips/r5900.s: Extend the R5900 short loop fix
	test with border cases.
	* testsuite/gas/mips/r5900.d: Add extra expected disassembly.
	* config/tc-mips.c (can_swap_branch_p): Clarify the R5900 short
	loop hardware bug conditions.  Correct note on the R5900
	instruction count short loop fix.
2018-10-19 09:47:55 +01:00
GDB Administrator 08acaf5caf Automatic date update in version.in 2018-10-19 00:00:36 +00:00
Sergio Durigan Junior 94c18618a8 Fix PR cli/23785: Check if file exists when invoking "restore FILE binary"
This simple patch fixes the segfault reported on PR cli/23785, which
happens when using the "restore FILE binary" command with a
non-existent file.  We just have to check if the file handler returned
by "gdb_fopen_cloexec" is not NULL, and error out if it is.

A test has also been added to gdb.base/restore.exp in order to
exercise this scenario.

No regressions introduced.

gdb/ChangeLog:
2018-10-18  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR cli/23785
	* cli/cli-dump.c (restore_binary_file): Check if "file" is
	NULL.

gdb/testsuite/ChangeLog:
2018-10-18  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR cli/23785
	* gdb.base/restore.exp: New test to check if "restore" with an
	invalid file doesn't segfault.
2018-10-18 17:39:09 -04:00
Nick Clifton f63085d15f Update documentation of readelf's --unwind option.
* doc/binutils.texi (readelf): Document alternatives to the
	--unwind option if it is not supported for the target
	architecture.
2018-10-18 16:58:16 +01:00
Tom de Vries 812cd6eb05 [gdb/testsuite] Fix capitalized test names
At https://sourceware.org/gdb/wiki/GDBTestcaseCookbook\
  #Follow_the_test_name_convention we find:
..
Test names should start with a lower case and don't need to end with a period
(they are not sentences).
...

Fix some capitalized test names.

Tested on x86_64-linux.

2018-10-18  Tom de Vries  <tdevries@suse.de>

	* gdb.ada/bp_inlined_func.exp: Fix capitalized test name.
	* gdb.ada/excep_handle.exp: Same.
	* gdb.ada/mi_string_access.exp: Same.
	* gdb.ada/mi_var_union.exp: Same.
	* gdb.arch/arc-analyze-prologue.exp: Same.
	* gdb.arch/arc-decode-insn.exp: Same.
	* gdb.base/readnever.exp: Same.
	* gdb.fortran/printing-types.exp: Same.
	* gdb.guile/scm-lazy-string.exp: Same.
2018-10-18 15:06:38 +02:00
GDB Administrator 841ef605ee Automatic date update in version.in 2018-10-18 00:00:35 +00:00
Paul Koning 89eb3c5470 gdb/ChangeLog:
* charset.c (convert_between_encodings): Fix unsigned overflow.

    gdb/charset.c (convert_between_encodings): Fix unsigned overflow.
2018-10-17 19:26:55 -04:00
John Baldwin 6f3b1098e8 Share the code to format "info proc mappings" entries for FreeBSD.
gdb/ChangeLog:

	* fbsd-nat.c (fbsd_nat_target::info_proc) Use
	fbsd_info_proc_mappings_header and fbsd_info_proc_mappings_entry.
	* fbsd-tdep.c (fbsd_vm_map_entry_flags): Mark static.
	(fbsd_info_proc_mappings_header, fbsd_info_proc_mappings_entry):
	New functions.
	(fbsd_core_info_proc_mappings): Use fbsd_info_proc_mappings_header
	and fbsd_info_proc_mappings_header.
	* fbsd-tdep.h (fbsd_vm_map_entry_flags): Remove.
	(fbsd_info_proc_mappings_header, fbsd_info_proc_mappings_entry):
	New.
2018-10-17 11:42:00 -07:00
Joel Brobecker d500b4f23f gdb/MAINTAINERS: Add Rainer Orth as Solaris maintainer for GDB
gdb/ChangeLog:

	* MAINTAINERS (Responsible Maintainers): Add Rainer Orth as
	Solaris Maintainer.
2018-10-17 11:04:14 -07:00
Alan Modra 4de5434b69 PR23653, ld SIGSEGVs when attempts to link sparc object with x86_64 library
This patch improves dynobj selection.  This allows the testcase in the
PR to proceed further before segfaulting due to other bugs in the
sparc backend.

../ld/ld-new --eh-frame-hdr -m elf_x86_64 -shared -o bug.so.5 bug.o ./libc.so.6 ./crtendS.o
../ld/ld-new: sparc architecture of input file `bug.o' is incompatible with i386:x86-64 output
../ld/ld-new: bug.o: in function `a':
bug.c:(.text+0x4): undefined reference to `_GLOBAL_OFFSET_TABLE_'
../ld/ld-new: bug.c:(.text+0x8): undefined reference to `_GLOBAL_OFFSET_TABLE_'
Segmentation fault

	PR 23653
	* elflink.c (_bfd_elf_link_create_dynstrtab): Match elf_object_id
	too when choosing dynobj.
2018-10-17 14:36:18 +10:30
GDB Administrator c69f6b8096 Automatic date update in version.in 2018-10-17 00:01:28 +00:00
Tom de Vries c4b9078851 [gdb/testsuite] Rewrite catch-follow-exec.exp
There are two problems with the current catch-follow-exec.exp:
- INTERNAL_GDBFLAGS (containing the datadir setting) is not used
- remote host testing doesn't work

Fix the former by using gdb_spawn_with_cmdline_opts.  Fix the latter by
requiring gdb-native.

Build on x86_64-linux with and without ubsan, and tested.

2018-10-16  Tom de Vries  <tdevries@suse.de>

	PR gdb/23730
	* gdb.base/catch-follow-exec.c: Add copyright notice.
	* gdb.base/catch-follow-exec.exp: Rewrite to use
	gdb_spawn_with_cmdline_opts.  Require gdb-native.
2018-10-16 22:40:41 +02:00
Matthew Malcomson 66e6f0b760 AArch64: Fix error checking for SIMD udot (by element)
Committed on behalf of Matthew Malcomson:

The SIMD UDOT instruction assembly has an unusual operand that selects a single
32 bit element with the mnemonic 4B.
This unusual mnemonic is handled by a special operand qualifier and associated
qualifier data in `aarch64_opnd_qualifiers`.

The current qualifier data describes 4 1-byte elements with the structure
{1, 4, 0x0, "4b", OQK_OPD_VARIANT}
This makes sense, as the instruction does work on 4 1-byte elements, however
some logic in the `operand_general_constraint_met_p` makes assumptions about
the range of index allowed when selecting a SIMD_ELEMENT depending on element
size.
That function reasons that e.g. in order to select a byte-sized element in a 16
byte V register an index must allow selection of one of the 16 elements and
hence its range will be in [0,15].

This reasoning breaks with the above description of a 4 part selection of 1
byte elements and allows an index outside the valid [0,3] range, triggering an
assert later on in the program in `aarch64_ins_reglane`.

vshcmd: > echo 'udot v0.2s, v1.8b, v2.4b[4]' | ../src/binutils-build/gas/as-new -march=armv8.4-a
as-new: ../../binutils-gdb/opcodes/aarch64-asm.c:134: aarch64_ins_reglane: Assertion `reglane_index < 4' failed.
{standard input}: Assembler messages:
{standard input}:1: Internal error (Aborted).
Please report this bug.

This patch changes the operand qualifier data so that it describes a single
32 bit element.
{4, 1, 0x0, "4b", OQK_OPD_VARIANT}
Hence the calculation in `operand_general_constraint_met_p` provides the
correct answer and the usual error checking machinery is used.

vshcmd: > echo 'udot v0.2s, v1.8b, v2.4b[4]' | ../src/binutils-build/gas/as-new -march=armv8.4-a
{standard input}: Assembler messages:
{standard input}:1: Error: register element index out of range 0 to 3 at operand 3 -- `udot v0.2s,v1.8b,v2.4b[4]'
2018-10-16 18:50:42 +01:00
Alan Modra 48dcd4ea06 Simplify PR23110 PE_DEBUG_DATA size checks
The negative size check can be rolled into the "exceeds space left in
section" check if that is done using an unsigned comparison.  We know
that "addr - section->vma" is never larger than section->size since
the section is found by find_section_by_vma.

	* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Simplify
	PE_DEBUG_DATA size checks.
2018-10-16 16:41:57 +10:30
Alan Modra 8df73d5cc3 PR23781, _bfd_pe_bfd_copy_private_bfd_data_common memory leak
PR 23781
	* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Free data
	before returning.
2018-10-16 16:41:57 +10:30
Alan Modra feceaa596e PR23780, assertion abort in function display_raw_attribute
PR 23780
	* readelf.c (display_raw_attribute): Correct assertion.
2018-10-16 16:41:57 +10:30
Cherry Zhang 08ea4a7805 PR23769, mixing split-stack and non-split-stack error message
Corrects which file is reported as being split-stack.

	PR 23769
	* gold.cc (queue_middle_tasks): Correct split-stack error message.
2018-10-16 16:41:57 +10:30
Tom Tromey 63a33118e0 Remove unnecessary casts from TUI
This removes a number of unnecessary casts from the TUI.  Some were
found with -Wuseless-cast (which, I think, can't easily be enabled for
gdb); and some were found by inspection.

Tested by rebuilding on x86-64 Fedora 28.
I'm checking this in.

gdb/ChangeLog
2018-10-15  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (strcat_to_buf): Remove casts.
	* tui/tui-winsource.c (tui_show_source_line)
	(tui_set_is_exec_point_at, tui_line_is_displayed): Remove casts.
	* tui/tui-wingeneral.c (tui_refresh_win, box_win): Remove casts.
	* tui/tui-windata.c (tui_first_data_item_displayed)
	(tui_delete_data_content_windows, tui_erase_data_content)
	(tui_display_all_data, tui_display_data_from)
	(tui_refresh_data_win, tui_vertical_data_scroll): Remove casts.
	* tui/tui-win.c (tui_set_win_height)
	(make_invisible_and_set_new_height, parse_scrolling_args): Remove
	casts.
	* tui/tui-win.c (tui_resize_all): Remove casts.
	(tui_scroll_backward_command, tui_set_focus)
	(tui_set_tab_width_command): Likewise.
	* tui/tui-source.c (tui_vertical_source_scroll): Remove cast.
	* tui/tui-regs.c (tui_show_register_group): Remove cast.
	* tui/tui-layout.c (tui_set_layout_by_name): Remove cast.
	* tui/tui-disasm.c (tui_vertical_disassem_scroll): Remove cast.
	* tui/tui-data.c (tui_partial_win_by_name, tui_free_win_content):
	Remove casts.
2018-10-15 23:01:32 -06:00
GDB Administrator d53eec4ef8 Automatic date update in version.in 2018-10-16 00:00:36 +00:00
Jim Wilson 640be958cd RISC-V: Adjust __global_pointer$ value to reduce code size.
ld/
	* emulparams/elf32lriscv-defs.sh (DATA_START_SYMBOLS): New.
	(SDATA_START_SYMBOLS): Define __SDATA_BEGIN__.  Don't define
	__global_pointer$.
	(OTHER_END_SYMBOLS): New.  Define __global_pointer$.
	* testsuite/ld-riscv-elf/pcrel-lo-addend-2.d (#ld): Add --no-relax.
2018-10-15 16:00:28 -07:00
Alan Modra 0e0dd7f1e8 Re: BFD_INIT_MAGIC
I should know better than to introduce the first use of size_t in
bfd.h.

	PR 23534
	* init.c (bfd_init): Return an unsigned int.
	bfd-in2.h: Regenerate.
2018-10-16 09:03:41 +10:30
Simon Marchi 933e62b1c1 Add Alan Hayward as AArch64/ARM GDB maintainer
gdb/ChangeLog:

	* MAINTAINERS (Responsible Maintainers): Add Alan Hayward as
	AArch64/ARM maintainer.
2018-10-15 15:52:03 -04:00
Alan Modra bf2dd8d7cf BFD_INIT_MAGIC
This patch performs a run-time test that a shared libbfd.so has been
compiled with the same size bfd_vma as that of apps using the library.
On a 32-bit host it is easily possible to have one libbfd.so compiled
to support 64-bit targets (or configured with --enable-64-bit-bfd)
while another only supports 32-bit targets.  The two libraries will
have differently sized bfd_vma types, and if the wrong one is loaded
all sorts of weird behaviour might be seen.

bfd/
	PR 23534
	* init.c (BFD_INIT_MAGIC): Define.
	(bfd_init): Return BFD_INIT_MAGIC.
	bfd-in2.h: Regenerate.
binutils/
	PR 23534
	* addr2line.c (main): Exit with fatal error if bfd_init
	returns an unexpected value.
	* ar.c (main): Likewise.
	* dlltool.c (identify_dll_for_implib): Likewise.
	* nm.c (main): Likewise.
	* objcopy.c (main): Likewise.
	* objdump.c (main): Likewise.
	* size.c (main): Likewise.
	* strings.c (main): Likewise.
	* windmc.c (main): Likewise.
	* windres.c (main): Likewise.
gas/
	PR 23534
	* as.c (main): Exit with fatal error if bfd_init returns an
	unexpected value.
ld/
	PR 23534
	* ldmain.c (main): Exit with fatal error if bfd_init returns
	an unexpected value.
2018-10-15 22:11:58 +10:30
GDB Administrator dc86962bf1 Automatic date update in version.in 2018-10-15 00:00:54 +00:00
GDB Administrator cf8d3709eb Automatic date update in version.in 2018-10-14 00:01:07 +00:00
Alan Modra 0930cb3021 _bfd_clear_contents bounds checking
This PR shows a fuzzed binary triggering a segfault via a bad
relocation in .debug_line.  It turns out that unlike normal
relocations applied to a section, the linker applies those with
symbols from discarded sections via _bfd_clear_contents without
checking that the relocation is within the section bounds.  The same
thing now happens when reading debug sections since commit
a4cd947aca, the PR23425 fix.

	PR 23770
	PR 23425
	* reloc.c (_bfd_clear_contents): Replace "location" param with
	"buf" and "off".  Bounds check "off".  Return status.
	* cofflink.c (_bfd_coff_generic_relocate_section): Update
	_bfd_clear_contents call.
	* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Likewise.
	* elf32-arc.c (elf_arc_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	* elf32-metag.c (metag_final_link_relocate): Likewise.
	* elf32-nds32.c (nds32_elf_get_relocated_section_contents): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-visium.c (visium_elf_relocate_section): Likewise.
	* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
	* elf64-x86-64.c *(elf_x86_64_relocate_section): Likewise.
	* libbfd-in.h (_bfd_clear_contents): Update prototype.
	* libbfd.h: Regenerate.
2018-10-13 23:54:33 +10:30
Alan Modra 2bf2bf23da ELF ld -r scripts
"ld -r" generally should not combine object file sections with
different names.  For example, "ld -r" should not combine ".text",
".text.hot" and ".text.cold" into an output ".text" section.  An
exception needs to be made for linker created sections, for example,
branch trampoline sections that might be created even for ld -r.

"ld -r" also should not define symbols in linker scripts.  Any
definitions are likely to conflict with those defined at final link.

A MEMORY spec is also not needed for ld -r.

	* Makefile.am (eelf32btsmip_fbsd.c, eelf32btsmipn32_fbsd.c),
	(eelf32epiphany.c, eelf32epiphany_4x4.c, eelf32ltsmip_fbsd.c),
	(eelf32ltsmipn32_fbsd.c, eelf32xc16x.c, eelf32xc16xl.c),
	(eelf32xc16xs.c, emcorepe.c, enios2elf.c, enios2linux.c),
	(eelf64btsmip_fbsd.c, eelf64ltsmip_fbsd.c): Correct dependencies.
	* Makefile.in: Regenerate.
	* emulparams/aarch64cloudabi.sh, * emulparams/aarch64fbsd.sh,
	* emulparams/aarch64linux.sh, * emulparams/aarch64linux32.sh,
	* emulparams/arc-nps.sh, * emulparams/elf32_spu.sh,
	* emulparams/elf32_tic6x_le.sh, * emulparams/elf32bmip.sh,
	* emulparams/elf32btsmipn32.sh, * emulparams/elf32lr5900n32.sh,
	* emulparams/elf32mep.sh, * emulparams/elf32metag.sh,
	* emulparams/elf64btsmip.sh, * emulparams/shelf_vxworks.sh,
	* emulparams/shlelf_fd.sh, * scripttempl/DWARF.sc,
	* scripttempl/alpha.sc, * scripttempl/alphavms.sc,
	* scripttempl/arclinux.sc, * scripttempl/armbpabi.sc,
	* scripttempl/avr.sc, * scripttempl/dlx.sc, * scripttempl/elf.sc,
	* scripttempl/elf32cr16.sc, * scripttempl/elf32cr16c.sc,
	* scripttempl/elf32crx.sc, * scripttempl/elf32msp430.sc,
	* scripttempl/elf32msp430_3.sc, * scripttempl/elf32xc16x.sc,
	* scripttempl/elf32xc16xl.sc, * scripttempl/elf32xc16xs.sc,
	* scripttempl/elf64hppa.sc, * scripttempl/elf_chaos.sc,
	* scripttempl/elfarc.sc, * scripttempl/elfarcv2.sc,
	* scripttempl/elfd10v.sc, * scripttempl/elfd30v.sc,
	* scripttempl/elfm68hc11.sc, * scripttempl/elfm68hc12.sc,
	* scripttempl/elfm9s12z.sc, * scripttempl/elfmicroblaze.sc,
	* scripttempl/elfxgate.sc, * scripttempl/elfxtensa.sc,
	* scripttempl/epiphany_4x4.sc, * scripttempl/ft32.sc,
	* scripttempl/hppaelf.sc, * scripttempl/ia64vms.sc,
	* scripttempl/ip2k.sc, * scripttempl/iq2000.sc,
	* scripttempl/mep.sc, * scripttempl/mmo.sc,
	* scripttempl/nds32elf.sc, * scripttempl/pru.sc,
	* scripttempl/sh.sc, * scripttempl/v850.sc,
	* scripttempl/v850_rh850.sc, * scripttempl/visium.sc,
	* scripttempl/xstormy16.sc: Condition various parts of scripts on
	${RELOCATABLE} in order to prevent ld -r merging sections or
	defining symbols.  Remove MEMORY and VERSION definitions from
	ld -r scripts too.
	* testsuite/ld-elf/group2.d, * testsuite/ld-elf/group4.d,
	* testsuite/ld-elf/group5.d, * testsuite/ld-elf/group6.d,
	* testsuite/ld-elf/group7.d, * testsuite/ld-elf/group8a.d,
	* testsuite/ld-elf/group8b.d, * testsuite/ld-elf/group9a.d,
	* testsuite/ld-elf/group9b.d, * testsuite/ld-elf/pr17550a.d,
	* testsuite/ld-elf/pr17550b.d,
	* testsuite/ld-elf/pr17550d.d: Don't xfail cr16 and crx.
	* testsuite/ld-elf/init-fini-arrays.d,
	* testsuite/ld-elf/pr22677.d: Likewise, and dont' xfail mep.
2018-10-13 20:33:23 +10:30
Sandra Loosemore 8bca297856 Clean up gdb.trace test results on targets not supporting this feature.
2018-10-12  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.trace/actions-changed.exp: Check for arch support.
	* gdb.trace/actions.exp: Likewise.
	* gdb.trace/ax.exp: Likewise.
	* gdb.trace/backtrace.exp: Likewise.
	* gdb.trace/change-loc.exp: Likewise.
	* gdb.trace/deltrace.exp: Likewise.
	* gdb.trace/ftrace-lock.exp: Check for shlib and arch support.
	* gdb.trace/ftrace.exp: Likewise.
	* gdb.trace/infotrace.exp: Check for arch support.
	* gdb.trace/mi-trace-frame-collected.exp: Likewise.
	* gdb.trace/mi-tracepoint-changed.exp: Likewise.
	* gdb.trace/mi-tsv-changed.exp: Likewise.
	* gdb.trace/packetlen.exp: Likewise.
	* gdb.trace/passc-dyn.exp: Likewise.
	* gdb.trace/passcount.exp: Likewise.
	* gdb.trace/pending.exp: Likewise.
	* gdb.trace/range-stepping.exp: Check for shlib support.
	* gdb.trace/report.exp: Check for arch support.
	* gdb.trace/save-trace.exp: Likewise.
	* gdb.trace/signal.exp: Check for signal support.
	* gdb.trace/tfind.exp: Check for arch support.
	* gdb.trace/trace-break.exp: Check for arch and shlib support.
	* gdb.trace/trace-common.h: Add comment.
	* gdb.trace/trace-condition.exp: Check for shlib and arch support.
	* gdb.trace/trace-enable-disable.exp: Likewise.
	* gdb.trace/trace-mt.exp: Likewise.  Remove redundant untested call.
	* gdb.trace/tracecmd.exp: Check for arch support.
	* gdb.trace/tspeed.exp: Check for shlib and target support.
	* gdb.trace/tstatus.exp: Check for arch support.
	* gdb.trace/tsv.exp: Likewise.
	* gdb.trace/while-dyn.exp: Likewise.
	* gdb.trace/while-stepping.exp: Likewise.
	* lib/trace-support.exp (gdb_trace_common_supports_arch): New.
2018-10-12 17:56:13 -07:00
GDB Administrator 032c98ec52 Automatic date update in version.in 2018-10-13 00:00:38 +00:00
Simon Marchi f9c49bffe6 Fix buglets in gdb.trace/tspeed.{exp,c}
When trying to run gdb.trace/tspeed.exp, I get:

ERROR: can't read "ipalib": no such variable
    while executing
"gdb_load_shlib $ipalib"
    (procedure "prepare_for_trace_test" line 5)

This problem seems to come from commit

    c708f4d256 ("gdb: Don't call gdb_load_shlib unless GDB is running")

which moved the gdb_load_shlib call in prepare_for_trace_test.  In order
to access the ipalib variable, we need to declare "global ipalib" first.

Then, this test uses nowarnings, for no good reason I could find.  We
can remove that and fix the two trivial warnings that appear:

/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/tspeed.c: In function 'main':
/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/tspeed.c:87:16: warning: too many arguments for format [-Wformat-extra-args]
        printf ("Negative times, giving up\n", max_iters);
                ^
/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/tspeed.c:99:7: warning: implicit declaration of function 'sleep' [-Wimplicit-function-declaration]
       sleep (1);  /* set post-run breakpoint here */
       ^

gdb/testsuite/ChangeLog:

	* gdb.trace/tspeed.exp: Remove nowarnings.
	(prepare_for_trace_test): Declare "global ipalib".
	* gdb.trace/tspeed.c: Include unistd.h.
	(main): Remove superfluous printf argument.
2018-10-12 16:27:29 -04:00
GDB Administrator fe4ba87324 Automatic date update in version.in 2018-10-12 00:00:39 +00:00
Sandra Loosemore d4330bde68 Fix pathname regexp in gdb.base/solib-vanish.exp.
2018-10-11  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/testsuite/
	* gdb.base/solib-vanish.exp: Fix regexp not to require a POSIX
	directory prefix on the filename.
2018-10-11 16:51:26 -07:00
Nick Clifton de564eb5cc Prevent the --keep-global-symbol and --globalize-symbol options from being used together.
This is the result of an email thread starting here:
  https://sourceware.org/ml/binutils/2018-09/msg00031.html

The main point of the thread is this observation:

  * Supposing we had an object file with two globals, SomeGlobal and
  SomeOtherGlobal, if one were to do "--globalize-symbol SomeGlobal
  --keep-global-symbol SomeOtherGlobal", you might expect that both
  SomeGlobal and SomeOtherGlobal are global in the output file... but it
  isn't. Because --keep-global-symbol is set and doesn't include
  SomeGlobal, SomeGlobal will be demoted to a local symbol. And because
  the check to see if we should apply the --globalize-symbol flag checks
  "flags" (the original flag set), and not "sym->flags", it decides not
  to do anything, so SomeGlobal remains a local symbol. Although this is
  a weird edge case, should this be changed so that --keep-global-symbol
  implicitly keeps anything also specified via --globalize-symbol? (The
  code seems technically correct with respect to the documentation, but
  IMO the behavior is counter-intuitive).

binutils* objcopy.c (copy_main): Issue a fata error if the
	--keep-global-symbol(s) and the --globalize-symbol(s) options are
	used together.
	* doc/binutils.texi: Document that the two options are
	incompatible.
	* testsuite/binutils-all/copy-5.d: New test.
	* testsuite/binutils-all/objcopy.exp: Run the new test.
2018-10-11 11:38:10 +01:00
Gary Benson fbe61a3661 Fix interp::m_name resource leak found by Coverity
This commit fixes a resource leak found by Coverity, where interp's
constructor allocated memory for m_name that interp's destructor did
not free.

gdb/ChangeLog:

	* interps.h (interp::m_name): Make private and mutable.
	* interps.c (interp::~interp): Free m_name.
2018-10-11 10:19:26 +01:00