deliverable/binutils-gdb.git
7 years agoRename _doprnt -> _bfd_doprnt to fix DJGPP bfd build (and likely others)
Pedro Alves [Wed, 11 Oct 2017 11:47:25 +0000 (12:47 +0100)] 
Rename _doprnt -> _bfd_doprnt to fix DJGPP bfd build (and likely others)

Building bfd/ for DJGPP, I see:

 ../../src/bfd/bfd.c:642:1: error: conflicting types for '_doprnt'
  _doprnt (FILE *stream, const char *format, va_list ap)
  ^~~~~~~
 In file included from ../../src/bfd/sysdep.h:37:0,
  from ../../src/bfd/bfd.c:367:
 /usr/lib64/gcc/i586-pc-msdosdjgpp/6.1.0/include-fixed/stdio.h:171:5: note: previous declaration of '_doprnt' was here
  int _doprnt(const char *_fmt, va_list _args, FILE *_f);
      ^~~~~~~

Possible fixes the build on other systems too -- _doprnt was/is an
exported symbol on old Unix/BSD systems too.

bfd/ChangeLog:
2017-10-11  Pedro Alves  <palves@redhat.com>

* bfd.c (_doprnt): Rename to ...
(_bfd_doprnt): ... this.
(error_handler_internal): Adjust.

7 years agoDisplay more information when decoding DW_AT_endianity, DW_AT_decimal_sign, DW_AT_def...
Nick Clifton [Wed, 11 Oct 2017 11:02:51 +0000 (12:02 +0100)] 
Display more information when decoding DW_AT_endianity, DW_AT_decimal_sign, DW_AT_defaulted and DW_AT_discr_list DWARF attributes.

* dwarf.c (read_and_display_attr_value): Handle DW_AT_endianity,
DW_END_default, DW_END_big, DW_END_little, DW_ATE_UCS,
DW_ATE_ASCII, DW_CC_pass_by_reference, DW_CC_pass_by_value,
DW_CC_GNU_renesas_sh, DW_CC_GNU_borland_fastcall_i386,
DW_AT_decimal_sign, DW_AT_defaulted, DW_AT_discr_list.
(get_TAG_name): Report user generated tag values.
* testsuite/binutils-all/dwarf-attributes.S: New test.
* testsuite/binutils-all/dwarf-attributes.W. Expected output from
readelf.
* testsuite/binutils-all/readelf.exp: Run the new test.

7 years agoRemove unnecessary parentheses in declarations
Egeyar Bagcioglu [Wed, 11 Oct 2017 10:00:48 +0000 (11:00 +0100)] 
Remove unnecessary parentheses in declarations

GCC commit a94975e57 ("C++ warning on vexing parse") introduces new
warnings "unnecessary parentheses in the declaration of ...".  These
cause the build of binutils and gdb to fail.  This patch removes those
parentheses for a successful build.

gdb/ChangeLog:
2017-10-11  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

* macrotab.h (macro_lookup_inclusion): Remove unnecessary
parentheses in the declaration.
(macro_lookup_inclusion): Likewise.
(macro_lookup_definition): Likewise.
* p-lang.h (pascal_builtin_types): Likewise.
* tui/tui-data.c (tui_win_list): Likewise.
* tui/tui-data.h (tui_win_list): Likewise.
* utils.h (make_cleanup_free_section_addr_info): Likewise.

7 years agoFlash memory size not aligned to address
Kevin Buettner [Wed, 11 Oct 2017 05:47:01 +0000 (22:47 -0700)] 
Flash memory size not aligned to address

(This patch is from Mark Rages <markrages@gmail.com>.)

The Nordic nRF52 memory map, reported from black magic probe:

Num Enb Low Addr High Addr Attrs
0 y 0x00000000 0x00080000 flash blocksize 0x1000 nocache
1 y 0x10001000 0x10001210 flash blocksize 0x210 nocache
2 y 0x20000000 0x20010000 rw nocache

The region at 0x10001000 is "UICR" and it is a section of flash that is
erased all at once.

Notice the odd size: 0x210 is the size of the region defined in the
datasheet.

But because the block size was listed as 0x210, gdb was insisting on
issuing two erase commands divisible by 0x210, starting below 0x10001000.

This patch fixes it by doing the alignment computation from the start of
the region, not from address 0.

gdb/ChangeLog:

* target-memory.c (block_boundaries): Fix for block address not
aligned on block size.

7 years agold internationalization fixes
Alan Modra [Wed, 11 Oct 2017 04:18:45 +0000 (14:48 +1030)] 
ld internationalization fixes

* emultempl/aarch64elf.em: Wrap einfo strings in _().  Formatting.
* emultempl/aix.em: Likewise.
* emultempl/armcoff.em: Likewise.
* emultempl/armelf.em: Likewise.
* emultempl/avrelf.em: Likewise.
* emultempl/beos.em: Likewise.
* emultempl/cr16elf.em: Likewise.
* emultempl/elf-generic.em: Likewise.
* emultempl/elf32.em: Likewise.
* emultempl/genelf.em: Likewise.
* emultempl/hppaelf.em: Likewise.
* emultempl/linux.em: Likewise.
* emultempl/lnk960.em: Likewise.
* emultempl/m68hc1xelf.em: Likewise.
* emultempl/m68kcoff.em: Likewise.
* emultempl/m68kelf.em: Likewise.
* emultempl/metagelf.em: Likewise.
* emultempl/mipself.em: Likewise.
* emultempl/mmix-elfnmmo.em: Likewise.
* emultempl/mmo.em: Likewise.
* emultempl/msp430.em: Likewise.
* emultempl/nds32elf.em: Likewise.
* emultempl/nios2elf.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc32elf.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/riscvelf.em: Likewise.
* emultempl/s390.em: Likewise.
* emultempl/scoreelf.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/sunos.em: Likewise.
* emultempl/tic6xdsbt.em: Likewise.
* emultempl/v850elf.em: Likewise.
* emultempl/vms.em: Likewise.
* emultempl/vxworks.em: Likewise.
* ldcref.c: Likewise.
* ldlang.c: Likewise.
* ldlex.l: Likewise.
* ldmain.c: Likewise.
* pe-dll.c: Likewise.
* plugin.c: Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Oct 2017 00:00:22 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agox86: Set GOT refcount to 1
H.J. Lu [Tue, 10 Oct 2017 22:52:39 +0000 (15:52 -0700)] 
x86: Set GOT refcount to 1

Since x86 check_relocs is called after opening all inputs and garbage
collection, they never see the removed sections.  There is no need
for incrementing GOT refcount.  But since PLT refcount is also used in

  /* Don't create the PLT entry if there are only function pointer
     relocations which can be resolved at run-time.  */
  else if (htab->elf.dynamic_sections_created
           && (h->plt.refcount > eh->func_pointer_refcount
               || eh->plt_got.refcount > 0))
    {

we must increment it.

* elf32-i386.c (elf_i386_check_relocs): Set GOT refcount to 1
instead of incrementing it.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.

7 years agoget_integer_valueof: Don't output value in test name
Simon Marchi [Tue, 10 Oct 2017 19:10:25 +0000 (15:10 -0400)] 
get_integer_valueof: Don't output value in test name

The get_integer_valueof outputs the value it has read as part of the
test name.  This causes test names to vary from run to run, and adds
some noise when diffing test results.  e.g.:

-PASS: gdb.threads/process-dies-while-detaching.exp: multi-process: continue: killed outside: get integer valueof "mypid" (28770)
+PASS: gdb.threads/process-dies-while-detaching.exp: multi-process: continue: killed outside: get integer valueof "mypid" (32238)

This patch removes that, since it's probably not very useful.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (get_integer_valueof): Don't output read value in test name.

7 years agoBump dwarf-mode version number
Tom Tromey [Fri, 6 Oct 2017 20:38:36 +0000 (14:38 -0600)] 
Bump dwarf-mode version number

Bump the dwarf-mode version number, so it can be installed by package.el
users who installed an earlier verision.

2017-10-10  Tom Tromey  <tom@tromey.com>

* dwarf-mode.el: Bump to version 1.4.

7 years agoAsynchronous insertion for dwarf-mode.el
Tom Tromey [Fri, 6 Oct 2017 20:36:44 +0000 (14:36 -0600)] 
Asynchronous insertion for dwarf-mode.el

I was recently examining a very large .debug file.  I tried to use
dwarf-mode, but it blocked Emacs for a very long time while reading
output.

This patch changes dwarf-mode to run the objdump process asynchronously.
This way, I can still do other things in Emacs while waiting for the
dumping to finish.

2017-10-10  Tom Tromey  <tom@tromey.com>

* dwarf-mode.el (dwarf--process, dwarf--deletion-region): New
defvar.
(dwarf--check-running, dwarf--sentinel, dwarf--invoke)
(dwarf--filter): New functions.
(dwarf-do-insert-substructure, dwarf-do-refresh): Call
dwarf--check-running, dwarf--invoke.
(dwarf-browse): Initialize new variables.

7 years agoSet lexical-binding in dwarf-mode
Tom Tromey [Fri, 6 Oct 2017 19:42:49 +0000 (13:42 -0600)] 
Set lexical-binding in dwarf-mode

Emacs has had lexical binding for a while, and it's a good practice to
use it; so enable it in dwarf-mode.el.

2017-10-10  Tom Tromey  <tom@tromey.com>

* dwarf-mode.el: Set lexical-binding.

7 years agoBind keys in dwarf-mode-map definition
Tom Tromey [Fri, 6 Oct 2017 19:18:31 +0000 (13:18 -0600)] 
Bind keys in dwarf-mode-map definition

It's bad Emacs style to define keys from a top-level form.  Instead, one
should define a mode map separately and binding keys in the definition.
This lets users completely override the map by defining it before
loading the mode.

2017-10-10  Tom Tromey  <tom@tromey.com>

* dwarf-mode.el (dwarf-mode-map): New defvar.

7 years agoEliminate catch_exceptions/catch_exceptions_with_msg
Pedro Alves [Tue, 10 Oct 2017 15:45:51 +0000 (16:45 +0100)] 
Eliminate catch_exceptions/catch_exceptions_with_msg

This patch gets rid of catch_exceptions / catch_exceptions_with_msg.
The latter is done mostly by getting rid of the three remaining
vestigial libgdb wrapper functions, which are really pointless
nowadays.  This results in a good number of simplifications.

(I checked that Insight doesn't use those functions.)

The gdb.mi/mi-pthreads.exp change is necessary because this actually
fixes a bug, IMO -- the patch stops MI's -thread-select causing output
on the CLI stream.

I.e., before:
 -thread-select 123456789
 &"Thread ID 123456789 not known.\n"
 ^error,msg="Thread ID 123456789 not known."
 (gdb)

After:
 -thread-select 123456789
 ^error,msg="Thread ID 123456789 not known."
 (gdb)

gdb/ChangeLog
2017-10-10  Pedro Alves <palves@redhat.com>
    Tom Tromey  <tom@tromey.com>

* breakpoint.c (struct captured_breakpoint_query_args)
(do_captured_breakpoint_query, gdb_breakpoint_query): Delete.
(print_breakpoint): New.
* breakpoint.h (print_breakpoint): Declare.
* common/common-exceptions.h (enum return_reason): Remove
references to catch_exceptions.
* exceptions.c (catch_exceptions, catch_exceptions_with_msg):
Delete.
* exceptions.h (catch_exceptions_ftype, catch_exceptions)
(catch_exception_ftype, catch_exceptions_with_msg): Delete.
* gdb.h: Delete.
* gdbthread.h (thread_select): Declare.
* mi/mi-cmd-break.c: Don't include gdb.h.
(breakpoint_notify): Use print_breakpoint.
* mi/mi-cmd-catch.c: Don't include gdb.h.
* mi/mi-interp.c: Don't include gdb.h.
(mi_print_breakpoint_for_event): New.
(mi_breakpoint_created, mi_breakpoint_modified): Use
mi_print_breakpoint_for_event.
* mi/mi-main.c: Don't include gdb.h.
(mi_cmd_thread_select): Parse the global thread ID here.  Use
thread_select instead of gdb_thread_select.
(mi_cmd_thread_list_ids): Output "thread-ids" tuple here instead
of using gdb_list_thread_ids.
* remote-fileio.c (do_remote_fileio_request): Change type.  Reply
FILEIO_ENOSYS here.
(remote_fileio_request): Use TRY/CATCH instead of
catch_exceptions.
* symfile-mem.c (struct symbol_file_add_from_memory_args)
(symbol_file_add_from_memory_wrapper): Delete.
(add_vsyscall_page): Use TRY/CATCH instead of catch_exceptions.
* thread.c: Don't include gdb.h.
(do_captured_list_thread_ids, gdb_list_thread_ids): Delete.
(thread_alive): Use thread_select.
(do_captured_thread_select): Delete, parts salvaged as ...
(thread_select): ... this new function.
(gdb_thread_select): Delete.

gdb/testsuite/ChangeLog
2017-10-10  Pedro Alves <palves@redhat.com>

* gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Don't
expect CLI output.

7 years agoEliminate catch_errors
Pedro Alves [Tue, 10 Oct 2017 15:45:50 +0000 (16:45 +0100)] 
Eliminate catch_errors

If you want to use catch_errors with a function with parameters, then
currently you have to manually write a "capture" struct wrapping the
arguments and marshall/unmarshall that.

https://sourceware.org/ml/gdb-patches/2017-09/msg00834.html proposed
adjusting catch_errors to use gdb::function_view, which would allow
passing lambdas with automatic captures.  However, it seems like using
TRY/CATCH directly instead ends up producing clearer and easier to
debug code.  This is what this commit does.

Note that removing catch_errors exposes further cleanup opportunities
around no longer having to follow catch_errors callback type, and also
removes a few cleanups.

I didn't do anything to save/restore current_uiout because I think
that should be the responsibility of the code that changes
current_uiout in the first place.

(Another approach could be to make catch_errors a variadic template
like:

  template<typename Function, typename... Args>
  int catch_errors (const char *errstring, return_mask mask,
    Function &&func, Args... args);

and then with:

  extern void function_with_args (int, int);
  extern void function_with_no_args ();

calls to the above functions would be wrapped like this:

  catch_errors ("some error happened", RETURN_MASK_ERROR,
                function_with_args, arg1, arg2);

  catch_errors ("some error happened", RETURN_MASK_ERROR,
                function_with_no_args);

but I'm thinking that that doesn't improve much if at all either.)

gdb/ChangeLog
2017-10-10  Pedro Alves  <palves@redhat.com>
    Tom Tromey  <tom@tromey.com>

* breakpoint.c (breakpoint_cond_eval): Change return type to bool
and reverse logic.
(WP_DELETED, WP_VALUE_CHANGED, WP_VALUE_NOT_CHANGED, WP_IGNORE):
No longer macros.  Instead ...
(enum wp_check_result): They're now values of this new
enumeration.
(watchpoint_check): Change return type to wp_check_result and
parameter type to bpstat.
(bpstat_check_watchpoint): Use TRY/CATCH instead of catch_errors.
(bpstat_check_breakpoint_conditions): Use TRY/CATCH instead of
catch_errors.  Reverse logic of watchpoint_check call.
(breakpoint_re_set_one): Now returns void and takes a breakpoint
pointer as parameter.
(breakpoint_re_set): Use TRY/CATCH instead of catch_errors.
* common/common-exceptions.c (throw_exception_sjlj): Update
comments to avoid mentioning catch_errors.
* exceptions.c (catch_errors): Delete.
* exceptions.h: Update comments to avoid mentioning catch_errors.
(catch_errors_ftype, catch_errors): Delete.
* infrun.c (normal_stop): Use TRY/CATCH instead of catch_errors.
(hook_stop_stub): Delete.
(restore_selected_frame): Change return type to void, and
parameter type to const frame_id &.
(restore_infcall_control_state): Use TRY/CATCH instead of
catch_errors.
* main.c (captured_command_loop): Return void and remove
parameter.  Remove references to catch_errors.
(captured_main): Use TRY/CATCH instead of catch_errors.
* objc-lang.c (objc_submethod_helper_data)
(find_objc_msgcall_submethod_helper): Delete.
(find_objc_msgcall_submethod): Use TRY/CATCH instead of
catch_errors.
* record-full.c (record_full_message): Return void.
(record_full_message_args, record_full_message_wrapper): Delete.
(record_full_message_wrapper_safe): Return bool and use TRY/CATCH
instead of catch_errors.
* solib-aix.c (solib_aix_open_symbol_file_object): Change
parameter type to int.
* solib-darwin.c (open_symbol_file_object): Ditto.
* solib-dsbt.c (open_symbol_file_object): Ditto.
* solib-frv.c (open_symbol_file_object): Ditto.
* solib-svr4.c (open_symbol_file_object): Ditto.
* solib-target.c (solib_target_open_symbol_file_object): Ditto.
* solib.c (update_solib_list): Use TRY/CATCH instead of
catch_errors.
* solist.h (struct target_so_ops) <open_symbol_file_object>:
Change type.
* symmisc.c (struct print_symbol_args): Remove.
(dump_symtab_1): Use TRY/CATCH instead of catch_errors.
(print_symbol): Change type.
* windows-nat.c (handle_load_dll, handle_unload_dll): Return void
and remove parameters.
(catch_errors): New.
(get_windows_debug_event): Adjust.

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

* lib/selftest-support.exp (selftest_setup): Update for
captured_command_loop's prototype change.

7 years ago[ARM] PR ld/21402, only override the symbol dynamic decision on undefined weak symbol.
Renlin Li [Mon, 25 Sep 2017 10:41:54 +0000 (11:41 +0100)] 
[ARM] PR ld/21402, only override the symbol dynamic decision on undefined weak symbol.

Similar as aarch64 backend, arm backend only overrides the decision on undefined
weak symbols. arm backend part already emits necessary relative relocation for
this case.

bfd/

PR ld/21402
* elf32-arm.c (allocate_dynrelocs_for_symbol): Only make undefined weak
symbols into dynamic.

ld/

PR ld/21402
* testsuite/ld-arm/tls-app.d: Update address.
* testsuite/ld-arm/tls-app.r: Remove relocations.
* testsuite/ld-arm/unresolved-1-dyn.d: Update.

7 years agoImprove the speed of the --dwarf-start option by skipping processing of any comp...
Nick Clifton [Tue, 10 Oct 2017 12:37:58 +0000 (13:37 +0100)] 
Improve the speed of the --dwarf-start option by skipping processing of any comp unit that ends before the specified start address.

PR 22249
* dwarf.c (process_debug_info): Skip any comp unit that ends
before dwarf_start_die.

7 years agoriscv: Cache the max alignment of output sections
H.J. Lu [Tue, 10 Oct 2017 05:03:42 +0000 (22:03 -0700)] 
riscv: Cache the max alignment of output sections

Cache the max alignment of output sections instead of scanning all
output sections for each input section, which can take a very long
time if there are millions of input/output sections.

PR ld/22274
* elfnn-riscv.c (riscv_elf_link_hash_table): Add max_alignment.
(riscv_elf_link_hash_table_create): Initialize max_alignment to
(bfd_vma) -1.
(_bfd_riscv_relax_section): Cache the max alignment of output
sections if possible.

7 years agoPrepare powerpc64 for late check_relocs
Alan Modra [Tue, 10 Oct 2017 01:22:06 +0000 (11:52 +1030)] 
Prepare powerpc64 for late check_relocs

check_relocs was setting up some data used by the --gc-sections
gc_mark_hook.  If we change ld to run check_relocs after gc_sections
that data needs to be set up elsewhere.  Done by this patch in the
backend check_directives function (ppc64_elf_before_check_relocs).

* elf64-ppc.c (ppc64_elf_before_check_relocs): Set sec_type for
.opd whenever .opd is present and non-zero size.  Move code
setting abiversion to/from output file earlier.  Only set
u.opd.func_sec when --gc-sections.  Read relocs and set up
u.opd.func_sec values here..
(ppc64_elf_check_relocs): ..rather than here.  Simplify opd
section tests.
(ppc64_elf_edit_opd): Don't set sec_type for .opd here.

7 years agoCorrect ld/Makefile earmelfb_fuchsia dependencies
Alan Modra [Tue, 10 Oct 2017 01:11:10 +0000 (11:41 +1030)] 
Correct ld/Makefile earmelfb_fuchsia dependencies

There were two copies of earmelf_fuchsia.c dependencies.

* Makefile.am (earmelfb_fuchsia.c): Rename rule from earmelf_fuchsia.c.
* Makefile.in: Regenerate.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Oct 2017 00:00:24 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoRemove free_splay_tree cleanup
Tom Tromey [Sun, 8 Oct 2017 22:37:46 +0000 (16:37 -0600)] 
Remove free_splay_tree cleanup

One spot in gdb uses a cleanup to free a splay tree.  This patch
introduces a unique_ptr specialization for this case.

ChangeLog
2017-10-09  Tom Tromey  <tom@tromey.com>

* mi/mi-main.c (free_splay_tree): Remove.
(list_available_thread_groups): Use splay_tree_up.
* common/gdb_splay_tree.h: New file.

7 years agoRemove "do_nothing"
Tom Tromey [Sun, 8 Oct 2017 22:19:48 +0000 (16:19 -0600)] 
Remove "do_nothing"

The do_nothing function in mi-main.c is used as a splay tree
key-deleting function; but NULL serves the same purpose and is used
elsewhere in gdb.  This patch removes the unneeded function.

ChangeLog
2017-10-09  Tom Tromey  <tom@tromey.com>

* mi/mi-main.c (do_nothing): Remove.
(list_available_thread_groups): Update.

7 years agomn10300: Don't free cached internal symbol table
H.J. Lu [Mon, 9 Oct 2017 22:05:03 +0000 (15:05 -0700)] 
mn10300: Don't free cached internal symbol table

Since ELF linker may cache internal symbol table in init_reloc_cookie,
we should check if it is cached, before free it.

* elf-m10300.c (mn10300_elf_check_relocs): Don't free cached
isymbuf.

7 years agobfin: Don't create .interp section for info->nointerp
H.J. Lu [Mon, 9 Oct 2017 19:45:57 +0000 (12:45 -0700)] 
bfin: Don't create .interp section for info->nointerp

Don't create the .interp section with "ld --no-dynamic-linker".  This
fixed:

FAIL: PR ld/20828 forcibly exported symbol version without section GC
FAIL: PR ld/20828 forcibly exported symbol version with section GC
FAIL: readelf version information

* elf32-bfin.c (bfin_size_dynamic_sections): Don't create the
.interp section with "ld --no-dynamic-linker".

7 years agogdb.multi/multi-arch-exec.exp: Also test -m32 => -m64
Pedro Alves [Mon, 9 Oct 2017 17:11:02 +0000 (18:11 +0100)] 
gdb.multi/multi-arch-exec.exp: Also test -m32 => -m64

The gdb.multi/multi-arch-exec.exp testcase currently tests execing
from -m64 to -m32, but does not test the other direction.  For
thoroughness, this commit fixes that.  Without the fix in the previous
commit for example ("Multi-arch exec, more register reading
avoidance"), on x86_64 we would get different symptoms depending on
"execing direction".  Vis:

  Continuing.
  Truncated register 50 in remote 'g' packet
  Truncated register 50 in remote 'g' packet
  (gdb) FAIL: gdb.multi/multi-arch-exec.exp: first_arch=1: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture

Vs:

  Continuing.
  Remote 'g' packet reply is too long (expected 440 bytes, got 816 bytes): daffffffffffffff0000[snip]
  Remote 'g' packet reply is too long (expected 440 bytes, got 816 bytes): daffffffffffffff0000[snip]
  (gdb) FAIL: gdb.multi/multi-arch-exec.exp: first_arch=2: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture

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

Test both arch1=>arch2 and arch2=>arch1.

* gdb.multi/multi-arch-exec.exp (exec1, srcfile1, binfile1, exec2)
(srcfile2, binfile2, march1, march2): Remove globals.  Largely
factored out to...
(append_arch1_options, append_arch2_options, append_arch_options)
(build_executables): New procedures.
(do_test): New 'first_arch' parameter.  Use it to define 'from_exec'
local.
(top level): Add new 'first_arch' testing axis.

7 years agoMulti-arch exec, more register reading avoidance
Pedro Alves [Mon, 9 Oct 2017 17:11:01 +0000 (18:11 +0100)] 
Multi-arch exec, more register reading avoidance

As mentioned in commit bf93d7ba9931 ("Add thread after updating
gdbarch when exec'ing"), we should avoid doing register reads after a
process does an exec and before we've updated that inferior's gdbarch.
Otherwise, we may interpret the registers using the wrong
architecture.

There's still (at least) one case where we still read registers
post-exec with the pre-exec architecture.  That's when infrun decides
it needs to switch context to the exec'ing thread.  I.e., if the exec
event is processed at a time when the current thread is not already
the exec'ing thread, then we get (with the test added by this commit):

  continue
  Continuing.
  Truncated register 50 in remote 'g' packet
  Truncated register 50 in remote 'g' packet
  (gdb) FAIL: gdb.multi/multi-arch-exec.exp: selected_thread=2: follow_exec_mode=same: continue across exec that changes architecture

The fix is to avoid reading registers when switching context in this
case.

(I'd be nice to get rid of the constant stop_pc reading when switching
threads, but that'd be a deeper change.)

gdb/ChangeLog:
2017-10-09  Pedro Alves  <palves@redhat.com>

* infrun.c (handle_inferior_event_1) <TARGET_WAITKIND_EXECD>: Skip
reading registers when switching context.

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

* gdb.multi/multi-arch-exec.c: Include <pthread.h> and <assert.h>.
(barrier): New.
(thread_start, all_started): New functions.
(main): Spawn new thread and wait until it is scheduled.
* gdb.multi/multi-arch-exec.exp: Build $srcfile1 with the pthreads
option.
(do_test): Add 'selected_thread' parameter.  Run to all_started
instead of main.  Explicitly set the breakpoint at main.  Switch
to the SELECTED_THREAD thread.
(top level): Test handling the exec event with either the main
thread or the second thread selected.

7 years agoUse gdbarch_long_bit to determine layout of FreeBSD siginfo_t.
John Baldwin [Mon, 9 Oct 2017 16:54:42 +0000 (09:54 -0700)] 
Use gdbarch_long_bit to determine layout of FreeBSD siginfo_t.

FreeBSD architectures are either ILP32 or LP64 resulting in two
different layouts for siginfo_t.  Previously, the 'bits_per_word'
member of bfd_arch_info was used to determine the layout to use for a
given FreeBSD architecture.  However, mipsn32 architectures inherit
from a 64-bit mips architecture where bits_per_word is 64.  As a
result, $_siginfo was not properly extracted from FreeBSD/mipsn32 core
dumps.  Fix this by using gdbarch_long_bit instead of 'bits_per_word'
to determine if a FreeBSD architecture is ILP32 or LP64.

gdb/ChangeLog:

* fbsd-nat.c (fbsd_siginfo_size): Use gdbarch_long_bit.
(fbsd_convert_siginfo): Likewise.
* fbsd-tdep.c (fbsd_core_xfer_siginfo): Likewise.

7 years agoDon't try building gdb against guile-2.2
Simon Marchi [Mon, 9 Oct 2017 16:50:58 +0000 (12:50 -0400)] 
Don't try building gdb against guile-2.2

GDB currently doesn't build with Guile 2.2 (see PR 21104).  If one has
both Guile 2.2 and 2.0 installed, GDB will pick up Guile 2.2 first and
fail building.  Until somebody does the work of adapting the GDB code to
Guile 2.2, we should not try using it.  This patch therefore removes it
from configure.

gdb/ChangeLog:

* configure.ac (try_guile_versions): Remove guile-2.2.
* configure: Regenerate.

7 years agoS/390: Sync with latest POP - 3 new instructions
Andreas Krebbel [Mon, 9 Oct 2017 16:37:53 +0000 (18:37 +0200)] 
S/390: Sync with latest POP - 3 new instructions

prno, tpei, and irbm are missing in the optable.

gas/ChangeLog:

2017-10-09  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* testsuite/gas/s390/zarch-arch12.d (prno, tpei, irbm): New
instructions added.
* testsuite/gas/s390/zarch-arch12.s: Likewise.
* testsuite/gas/s390/zarch-z13.d: Rename ppno to prno.

opcodes/ChangeLog:

2017-10-09  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-opc.txt (prno, tpei, irbm): New instructions added.

7 years agoS/390: Sync with IBM z14 POP - SI_RD format
Andreas Krebbel [Mon, 9 Oct 2017 16:37:53 +0000 (18:37 +0200)] 
S/390: Sync with IBM z14 POP - SI_RD format

The recent POP adjusted a few of the instruction formats.  This patch
adjusts our optable accordingly.  No user visible change - hopefully.

opcodes/ChangeLog:

2017-10-09  Heiko Carstens  <heiko.carstens@de.ibm.com>

* s390-opc.c (INSTR_SI_RD): New macro.
(INSTR_S_RD): Adjust example instruction.
* s390-opc.txt (lpsw, ssm, ts): Change S_RD instruction format to
SI_RD.

7 years agoFix automatic dependency tracking
Tom Tromey [Sun, 8 Oct 2017 23:12:19 +0000 (17:12 -0600)] 
Fix automatic dependency tracking

Commit f38307f5 changed COMPILE.post and POSTCOMPILE to remove
$(basename) from the dependency file name computation.  However, it
did not update the `-include' at the end of the Makefile.in; this in
effect disabled automatic dependency tracking.

This patch restores the $(basename) wrapper so that the dependency
files are named "file.Po" rather than "file.o.Po".

I also tested the non-gcc3 dependency mode, which pointed out that
this case hadn't been working since the switch to C++.  This is also
fixed in this patch.

Tested by rebuilding.

ChangeLog
2017-10-09  Tom Tromey  <tom@tromey.com>

* Makefile.in (COMPILE.post, POSTCOMPILE): Restore $(basename).
(COMPILE.pre): Use $(CXX).

7 years agoMake cp_remove_params return a gdb::unique_xmalloc_ptr
Pedro Alves [Mon, 9 Oct 2017 14:57:36 +0000 (15:57 +0100)] 
Make cp_remove_params return a gdb::unique_xmalloc_ptr

Use the type system instead of callers needing to know how the
returned string's memory is supposed to be managed.

gdb/ChangeLog:
2017-10-09  Pedro Alves  <palves@redhat.com>

* cp-support.c (cp_remove_params): Return a gdb::unique_xmalloc_ptr.
Use bool.
(overload_list_add_symbol): Adjust to use gdb::unique_xmalloc_ptr.
* cp-support.h (cp_remove_params): Now returns a
gdb::unique_xmalloc_ptr.
* dwarf2read.c (find_slot_in_mapped_hash): Now returns bool.
Adjust to cp_remove_params returning a gdb::unique_xmalloc_ptr.
* psymtab.c (psymtab_search_name): Adjust to cp_remove_params
returning a gdb::unique_xmalloc_ptr.
(lookup_partial_symbol): Adjust to use gdb::unique_xmalloc_ptr.
* stack.c (find_frame_funname): Adjust to cp_remove_params
returning a gdb::unique_xmalloc_ptr.

7 years agoFix link time warning message when running the srec linker tests.
Nick Clifton [Mon, 9 Oct 2017 14:32:09 +0000 (15:32 +0100)] 
Fix link time warning message when running the srec linker tests.

* testsuite/ld-srec/srec.exp (run_srec_test): Set start address.

7 years agoFix compile time warning message when running the PR19874 linker test.
Nick Clifton [Mon, 9 Oct 2017 14:00:31 +0000 (15:00 +0100)] 
Fix compile time warning message when running the PR19874 linker test.

PR ld/19874
* testsuite/ld-x86-64/pr19784c.c (bar): Change return type to void.

7 years agoAdd missing changelog entries
Andreas Krebbel [Mon, 9 Oct 2017 13:40:15 +0000 (15:40 +0200)] 
Add missing changelog entries

7 years agoFix gdb.base/print-file-var-main.c value check logic
Pedro Alves [Mon, 9 Oct 2017 11:33:31 +0000 (12:33 +0100)] 
Fix gdb.base/print-file-var-main.c value check logic

Fix a typo introduced in commit c56e7c4390ed ("Make ctxobj.exp and
print-file-var.exp work on all platforms.").

This doesn't really affect the outcome of the testcase.  I only
noticed the typo because I stepped through the program manually.

To avoid such problems if the test is extended, this moves the STOP
marker until after the program self-validates the values.  With the
typo in place, this alone would have resulted in a test FAIL.  I.e.,
it'd have caught the typo.

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

* gdb.base/print-file-var-main.c: Fix get_version_2 value check
logic.  Move STOP marker after the value checks.
* gdb.base/print-file-var.exp (continue to STOP marker): Tighten
regexp.

7 years agold: Don't allow '~' as the first char in symbol name
H.J. Lu [Mon, 9 Oct 2017 11:17:10 +0000 (04:17 -0700)] 
ld: Don't allow '~' as the first char in symbol name

Don't allow '~' as the first character in symbol name in linker script.

PR ld/22267
* ldlex.l (SYMBOLNAMECHAR1) New.
(DEFSYMEXP): Replace FILENAMECHAR1 with SYMBOLNAMECHAR1.
(EXPRESSION): Likewise.
* testsuite/ld-scripts/expr.exp: Run pr22267.
* testsuite/ld-scripts/pr22267.d: New file.
* testsuite/ld-scripts/pr22267.s: Likewise.
* testsuite/ld-scripts/pr22267.t: Likewise.

7 years agoReplace nop in fill-1.s testcase.
Andreas Krebbel [Mon, 9 Oct 2017 10:24:11 +0000 (12:24 +0200)] 
Replace nop in fill-1.s testcase.

gas/ChangeLog:

2017-10-09  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* testsuite/gas/all/fill-1.s: Replace nop with .word 42

7 years agoEnable .fill forward labels
Andreas Krebbel [Fri, 6 Oct 2017 11:12:32 +0000 (13:12 +0200)] 
Enable .fill forward labels

gas/ChangeLog:

2017-10-09  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* read.c (s_fill): Invoke expression instead of
get_known_segmented_expression.
* testsuite/gas/all/fill-1.s: New testcase.
* testsuite/gas/all/gas.exp: Run fill-1 testcase

7 years agoRemove some cleanups from dwarf2read.c
Tom Tromey [Sun, 8 Oct 2017 19:29:18 +0000 (13:29 -0600)] 
Remove some cleanups from dwarf2read.c

This removes a number of cleanups from dwarf2read.c in a
straightforward way.

Note that some places in dwarf2read create dangling cleanups.  I don't
believe any of the changes in this patch interact with those spots.

Regression tested by the buildbot.

gdb/ChangeLog
2017-10-08  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (dwarf2_get_dwz_file): Use
gdb::unique_xmalloc_ptr.
(find_slot_in_mapped_hash): Likewise.
(dwarf2_physname): Likewise.
(create_dwo_unit_in_dwp_v1): Use std::string.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_cutu): Likewise.
(inherit_abstract_dies): Use std::vector.
(read_array_type): Likewise.
(dwarf_decode_macros): Remove unused declaration.
(unsigned_int_compar): Remove.
(dwarf2_build_psymtabs_hard): Use scoped_restore.
(psymtabs_addrmap_cleanup): Remove.

7 years agoRemove cleanup from frame_prepare_for_sniffer
Tom Tromey [Sun, 8 Oct 2017 18:40:07 +0000 (12:40 -0600)] 
Remove cleanup from frame_prepare_for_sniffer

Currently frame_prepare_for_sniffer returns a cleanup.  This patch
changes it to return void, and exposes frame_cleanup_after_sniffer to
the caller.

Normally I would write an RAII class for this sort of thing; but
because there was just a single caller of frame_prepare_for_sniffer,
and because this caller is already using try/catch, I thought it
seemed ok to require explicit calls in this instance.

Regression tested by the buildbot.

gdb/ChangeLog
2017-10-08  Tom Tromey  <tom@tromey.com>

* frame-unwind.c (frame_unwind_try_unwinder): Update.
* frame.h (frame_cleanup_after_sniffer): Declare.
(frame_prepare_for_sniffer): Return void.
* frame.c (frame_cleanup_after_sniffer): No longer static.  Change
type of argument.
(frame_prepare_for_sniffer): Return void.

7 years agoRemove make_cleanup_value_free
Tom Tromey [Sun, 8 Oct 2017 18:20:49 +0000 (12:20 -0600)] 
Remove make_cleanup_value_free

This removes make_cleanup_value_free, in favor of a unique_ptr
specialization.

Regression tested by the buildbot.

gdb/ChangeLog
2017-10-08  Tom Tromey  <tom@tromey.com>

* utils.h (make_cleanup_value_free): Remove.
* utils.c (do_value_free, struct cleanup): Remove.
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full) <DWARF_VALUE_STACK>:
Use gdb_value_up.
* value.h (struct value_deleter): New.
(gdb_value_up): New typedef.

7 years agoChange search_symbols to return std::vector
Tom Tromey [Sun, 8 Oct 2017 18:11:18 +0000 (12:11 -0600)] 
Change search_symbols to return std::vector

This changes search_symbols to return a std::vector, replacing the
previous linked list approach.  This allows the removal of some
cleanups, as well as the use of std::sort and std::unique, saving some
code and extra allocations in sort_search_symbols_remove_dups.

Regression tested by the buildbot.

gdb/ChangeLog
2017-10-08  Tom Tromey  <tom@tromey.com>

* symtab.c (free_search_symbols, do_free_search_symbols_cleanup)
(make_cleanup_free_search_symbols): Remove.
(search_symbols): Return std::vector.
(symbol_search::compare_search_syms): Now member of
symbol_search.  Change arguments.
(sort_search_symbols_remove_dups): Change arguments.  Rewrite.
(symtab_symbol_info, rbreak_command): Update.
* symtab.h (struct symbol_search) <next>: Remove.
Add constructors.
(symbol_search::operator<): New function.
(symbol_search::operator==): New function.
(search_symbols): Remove std::vector.
(free_search_symbols, make_cleanup_free_search_symbols): Remove.
(symbol_search::compare_search_syms): Declare.

7 years agoPR22212, memory leak in nm
Alan Modra [Mon, 9 Oct 2017 02:51:44 +0000 (13:21 +1030)] 
PR22212, memory leak in nm

PR 22212
* dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free
funcinfo_hash_table and varinfo_hash_table.

7 years agosh: Dump dynamic relocation info to the map file
H.J. Lu [Mon, 9 Oct 2017 00:17:29 +0000 (17:17 -0700)] 
sh: Dump dynamic relocation info to the map file

Dump dynamic relocation info to the map file when generating dynamic
relocation in read-only section relocations if -Map is used.

* elf32-sh.c (readonly_dynrelocs): Dump dynamic relocation
in read-only section with minfo.
(sh_elf_size_dynamic_sections): Likewise.

7 years agosparc: Remove a strayed comment
H.J. Lu [Mon, 9 Oct 2017 00:09:26 +0000 (17:09 -0700)] 
sparc: Remove a strayed comment

* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Remove
a strayed comment.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 Oct 2017 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agotilegx: Set this_hdr.sh_entsize only if section size > 0
H.J. Lu [Sun, 8 Oct 2017 21:29:52 +0000 (14:29 -0700)] 
tilegx: Set this_hdr.sh_entsize only if section size > 0

This fixes:

/export/build/gnu/binutils-cross/build-tilegx-linux/ld/ld-new   -o tmpdir/comm-data -z norelro -L/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf  -T comm-data2.ld -Ltmpdir -lcomm-data tmpdir/comm-data2.o
sh: line 1:  9208 Segmentation fault      (core dumped) /export/build/gnu/binutils-cross/build-tilegx-linux/ld/ld-new -o tmpdir/comm-data -z norelro -L/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf -T comm-data2.ld -Ltmpdir -lcomm-data tmpdir/comm-data2.o 2>&1
FAIL: Common symbol override test

* elfxx-tilegx.c (tilegx_elf_finish_dynamic_sections): Set
this_hdr.sh_entsize only if section size > 0.

7 years agoReformat elf_x86_allocate_dynrelocs
H.J. Lu [Sun, 8 Oct 2017 20:20:17 +0000 (13:20 -0700)] 
Reformat elf_x86_allocate_dynrelocs

* elfxx-x86.c (elf_x86_allocate_dynrelocs): Reformat.

7 years agosparc: Dump dynamic relocation info to the map file
H.J. Lu [Sun, 8 Oct 2017 00:30:12 +0000 (17:30 -0700)] 
sparc: Dump dynamic relocation info to the map file

Dump dynamic relocation info to the map file when generating dynamic
relocation in read-only section relocations if -Map is used.

* elfxx-sparc.c (readonly_dynrelocs): Dump dynamic relocation
in read-only section with minfo.
(_bfd_sparc_elf_size_dynamic_sections): Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 Oct 2017 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agold-elf/merge.d: Don't expect to fail for sparc
H.J. Lu [Sat, 7 Oct 2017 23:10:56 +0000 (16:10 -0700)] 
ld-elf/merge.d: Don't expect to fail for sparc

It passed with cross binutils to sparc-linux and sparc64-linux.

* testsuite/ld-elf/merge.d: Don't expect to fail for sparc.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 Oct 2017 00:00:17 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agox86: Update UNDEFINED_WEAK_RESOLVED_TO_ZERO comments
H.J. Lu [Fri, 6 Oct 2017 23:45:37 +0000 (16:45 -0700)] 
x86: Update UNDEFINED_WEAK_RESOLVED_TO_ZERO comments

* elfxx-x86.h (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Update
comments.

7 years agox86: Use zero_undefweak in elf_x86_link_hash_entry
H.J. Lu [Fri, 6 Oct 2017 22:25:07 +0000 (15:25 -0700)] 
x86: Use zero_undefweak in elf_x86_link_hash_entry

Replace has_got_reloc and has_non_got_reloc in elf_x86_link_hash_entry
with zero_undefweak:

Bit 0: Symbol has no GOT nor PLT relocations.
Bit 1: Symbol has non-GOT/non-PLT relocations in text sections.

zero_undefweak is initialized to 1 and undefined weak symbol should be
resolved to 0 if zero_undefweak > 0.

* elf32-i386.c (elf_i386_check_relocs): Replace has_got_reloc
and has_non_got_reloc with zero_undefweak.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_hash_newfunc): Initialize
zero_undefweak to 1.
(_bfd_x86_elf_copy_indirect_symbol): Replace has_got_reloc and
has_non_got_reloc with zero_undefweak.
* elfxx-x86.h (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace
has_got_reloc and has_non_got_reloc with zero_undefweak.
(elf_x86_link_hash_entry): Likewise.

7 years agoSkip gdb.mi/mi-threads-interrupt.exp if nointerrupts.
Sandra Loosemore [Fri, 6 Oct 2017 22:24:01 +0000 (15:24 -0700)] 
Skip gdb.mi/mi-threads-interrupt.exp if nointerrupts.

2017-10-06  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.mi/mi-threads-interrupt.exp: Skip test if nointerrupts.

7 years agoAccount for padding in FreeBSD/mipsn32 NT_PRSTATUS notes.
John Baldwin [Fri, 6 Oct 2017 18:41:45 +0000 (11:41 -0700)] 
Account for padding in FreeBSD/mipsn32 NT_PRSTATUS notes.

Add a new ELF backend method to grok FreeBSD NT_PRSTATUS core dump
notes.  Define a method for MIPS N32 to override the default
elfcore_grok_freebsd_prstatus that accounts for additional padding
between pr_pid and pr_reg that is not present in other 32-bit FreeBSD
platforms.

* elf-bfd.h (struct elf_backend_data): Add
`elf_backend_grok_freebsd_prstatus'.
* elf.c (elfcore_grok_freebsd_note): Call
`elf_backend_grok_freebsd_prstatus' to handle NT_PRSTATUS if
present.
* elfn32-mips.c (elf_n32_mips_grok_freebsd_prstatus): New
function.
(elf_backend_grok_freebsd_prstatus): Define.
* elfxx-target.h (elf_backend_grok_freebsd_prstatus): Define.
(elfNN_bed): Initialize `elf_backend_grok_freebsd_prstatus'.

7 years agoMove aarch64-insn.o to arch/aarch64-insn.o and Remove a rule for arch/*.c
Yao Qi [Fri, 6 Oct 2017 13:53:39 +0000 (14:53 +0100)] 
Move aarch64-insn.o to arch/aarch64-insn.o and Remove a rule for arch/*.c

This patch moves aarch64-insn.o to arch/aarch64-insn.o.  Then, all
arch/*.c are built to arch/*.o, so we don't need a Makefile rule to build
*.o from arch/*.c.  This patch removes it too.

gdb:

2017-10-06  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (ALL_64_TARGET_OBS): Replace aarch64-insn.o with
arch/aarch64-insn.o.
Remove one rule.
* configure.tgt: Replace aarch64-insn.o with arch/aarch64-insn.o.

7 years agoMove arm.o arm-get-next-pcs.o arm-linux.o to arch/
Yao Qi [Fri, 6 Oct 2017 13:36:04 +0000 (14:36 +0100)] 
Move arm.o arm-get-next-pcs.o arm-linux.o to arch/

It is tested by building GDB for some targets, arm-elf, arm-netbsd,
arm-linux, and aarch64-linux.

gdb:

2017-10-06  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (ALL_TARGET_OBS): Replace arm.o, arm-get-next-pcs.o,
and arm-linux.o with arch/arm.o, arch/arm-get-next-pcs.o and
arch/arm-linux.o respectively.
* configure.tgt: Likewise.

7 years agoMove i386.o to arch/i386.o
Yao Qi [Fri, 6 Oct 2017 13:07:29 +0000 (14:07 +0100)] 
Move i386.o to arch/i386.o

This patch changes the build that arch/i386.c is built to arch/i386.o,
instead of i386.o.

gdb:

2017-10-06  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (ALL_TARGET_OBS): Rename i386.o to arch/i386.o.
* configure.tgt (i386_tobjs): Replace i386.o with arch/i386.o.

7 years agoAdd "do/while(0);" to COPY_INPUT_RELOC_P/VERIFY_COPY_RELOC
H.J. Lu [Fri, 6 Oct 2017 12:49:48 +0000 (05:49 -0700)] 
Add "do/while(0);" to COPY_INPUT_RELOC_P/VERIFY_COPY_RELOC

Add "do/while(0);" to COPY_INPUT_RELOC_P/VERIFY_COPY_RELOC to avoid
potential dangling else problems.

* elfxx-x86.h (COPY_INPUT_RELOC_P): Add "do/while(0);".
(VERIFY_COPY_RELOC): Likewise.

7 years agoFix more GDB build breakage on mingw32
Pedro Alves [Fri, 6 Oct 2017 10:58:56 +0000 (11:58 +0100)] 
Fix more GDB build breakage on mingw32

With F23's mingw gcc 5.3.0, I'm seeing:

 i686-w64-mingw32-g++ -x c++ -std=gnu++11 -g3 -O0   -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../../src/gdb/../zlib -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber  -I../../src/gdb/gnulib/import -Ibuild-gnulib/import   -I/home/pedro/src/expat/install-win32//include   -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wno-format -Werror -c -o windows-nat.o -MT windows-nat.o -MMD -MP -MF ./.deps/windows-nat.o.Tpo ../../src/gdb/windows-nat.c
 ../../src/gdb/windows-nat.c: In function 'void windows_create_inferior(target_ops*, const char*, const string&, char**, int)':
 ../../src/gdb/windows-nat.c:2476:7: error: 'replace' is not a member of 'std'
std::replace (expanded_infcwd.begin (), expanded_infcwd.end (),
^

gdb/Changelog:
2017-10-06  Pedro Alves  <palves@redhat.com>

* windows-nat.c: Include <algorithm>.

7 years agoFix GDB build under msys+mingw gcc 32bit
Yuanhui Zhang [Fri, 6 Oct 2017 10:44:54 +0000 (11:44 +0100)] 
Fix GDB build under msys+mingw gcc 32bit

I see a build error when building GDB under msys+mingw gcc 32bit:

 g++ -x c++ -std=gnu++11 -g -O2    -I. -I../../../binutils-gdb/gdb/gdbserver -I../../../binutils-gdb/gdb/gdbserver/../common -I../../../binutils-gdb/gdb/gdbserver/../regformats -I../../../binutils-gdb/gdb/gdbserver/.. -I../../../binutils-gdb/gdb/gdbserver/../../include -I../../../binutils-gdb/gdb/gdbserver/../gnulib/import -Ibuild-gnulib-gdbserver/import  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized -Wno-format -Werror -DGDBSERVER -c -o win32-low.o -MT win32-low.o -MMD -MP -MF .deps/win32-low.Tpo ../../../binutils-gdb/gdb/gdbserver/win32-low.c
 ../../../binutils-gdb/gdb/gdbserver/win32-low.c: In function 'BOOL create_process(const char*, char*, DWORD, PROCESS_INFORMATION*)':
 ../../../binutils-gdb/gdb/gdbserver/win32-low.c:566:48: error: 'get_inferior_cwd' was not declared in this scope
    const char *inferior_cwd = get_inferior_cwd ();
 ^
 make[4]: *** [win32-low.o] Error 1

It can be fixed by simply including the right header file.

gdb/gdbserver/ChangeLog:
2017-10-06  Yuanhui Zhang  <asmwarrior@gmail.com>

* win32-low.c: Include "common-inferior.h".

7 years agoShare code updating gdb_target_obs
Yao Qi [Fri, 6 Oct 2017 10:18:48 +0000 (11:18 +0100)] 
Share code updating gdb_target_obs

Nowadays, there are much duplications in configure.tgt to update
gdb_target_obs, some cpu specific object files are added to gdb_target_obs
to some different target triplets of the same cpu.  The same problem
exists for os specific object files too.  It is fragile to update them,
and build with all targets enabled doesn't find the problem.

This patch splits the gdb_target_obs update to three steps, cpu steps, os
steps, and the rest.

I tested this patch by build gdb for each different target triplets
respectively,

aarch64-elf aarch64-rtems aarch64-freebsd aarch64-linux alpha-elf
alpha-linux alpha-netbsd alpha-openbsd arm-elf arm-wince-pe arm-linux
arm-netbsd arm-symbianelf avr cris-elf frv-elf h8300-elf i386-elf
i386-darwin i386-dicos i386-freebsd i386-netbsdelf i386-openbsd
i386-nto i386-solaris i386-linux i386-gnu i386-cygwin i386-mingw32
i386-go32 ia64-linux-gnu ia64-vms lm32-elf m32c-elf m32r-elf m32r-linux
m68hc11-elf m68k-elf m68k-linux m68k-netbsd m68k-openbsd m88k-openbsd
mep-elf microblaze-xilinx-elf microblaze-linux-gnu mips-elf moxie-elf
ms1-elf nios2-elf nios2-linux-gnu hppa-elf hppa-linux hppa-netbsd
hppa-openbsd powerpc-eabi powerpc-freebsd powerpc-netbsd powerpc-openbsd
powerpc-linux powerpc-lynx178 rl78-elf rx-elf s390-linux-gnu score-elf
sh-elf sh-linux sh-openbsd sh64-elf sh64-linux sh64-openbsd sparc64-linux
sparc-linux sparc-freebsd sparc64-freebsd sparc-netbsd sparc64-netbsd
sparc-openbsd sparc64-openbsd spu-elf tic6x-elf tic6x-uclinux v850-elf
vax-netbsd vax-openbsd x86_64-linux-gnu x86_64-darwin x86_64-dicos
x86_64-elf x86_64-freebsd x86_64-mingw32 x86_64-netbsd x86_64-openbsd
x86_64-rtems xstormy16-elf xtensa-elf xtensa-linux

gdb:

2017-10-06  Yao Qi  <yao.qi@linaro.org>

* configure.tgt (i386_tobjs): New variable.
(amd64_tobjs): New variable.
Set $cpu_obs and $os_obs.

7 years ago[RFC] Replicate src dir in build dir
Yao Qi [Fri, 6 Oct 2017 10:13:30 +0000 (11:13 +0100)] 
[RFC] Replicate src dir in build dir

Nowadays, GDB build tree is almost flat, but source tree isn't.  We
have arch/ nat/ target/ common/ cli/ mi/ tui/ python/ guile/ directories.
We need to some rules in Makefile for source files in different source
directories, like,

 # Rules for compiling .c files in the various source subdirectories.
%.o: ${srcdir}/arch/%.c
$(COMPILE) $<
$(POSTCOMPILE)

%.o: ${srcdir}/nat/%.c
$(COMPILE) $<
$(POSTCOMPILE)

so we should take care of some special case that files' base name is the
same, like,

 # Specify an explicit rule for gdb/common/agent.c, to avoid a clash with the
 # object file generate by gdb/agent.c.
common-agent.o: $(srcdir)/common/agent.c
$(COMPILE) $(srcdir)/common/agent.c
$(POSTCOMPILE)

As we add more and more files in different directories, it becomes tricky
to name files, because we need take this into account.

This patch takes the first step toward "Replicate src dir in build dir",
that is, we create arch/ directory in buildtree, and put amd64.o there
as an example.  Dependency tracking is updated for files with directory
name.  Currently, when we build amd64.o,

  "-c -o amd64.o -MT amd64.o -MMD -MP -MF .deps/amd64.Tpo"

with this patch applied, it becomes,

  "-c -o arch/amd64.o -MT arch/amd64.o -MMD -MP -MF arch/.deps/amd64.o.Tpo"

"make clean" removes the object files, and "make distclean" removes .deps
additionally.  configure file create .deps directory in each of
CONFIG_SRC_SUBDIR, and pass it to Makefile.in, so that "make clean" and
"make distclean" can remove stuffs there.

If people agree with this change, I'll add more directories to
CONFIG_SRC_SUBDIR.

gdb:

2017-10-06  Yao Qi  <yao.qi@linaro.org>

* Makefile.in (CONFIG_SRC_SUBDIR): New.
(ALL_64_TARGET_OBS): Replace amd64.o with arch/amd64.o.
(clean): Remove object files and dependency files.
(distclean): Remove the directory.
* configure.ac: Invoke AC_CONFIG_COMMANDS.
* configure: Re-generated.
* configure.tgt: Replace amd64.o with arch/amd64.o.

7 years agogdb: Fix decoding of ARM neon memory hint insns.
Jose E. Marchesi [Fri, 6 Oct 2017 09:49:39 +0000 (11:49 +0200)] 
gdb: Fix decoding of ARM neon memory hint insns.

gdb/ChangeLog:

2017-10-05  Jose E. Marchesi  <jose.marchesi@oracle.com>

PR build/22188
* arm-tdep.c (arm_decode_misc_memhint_neon): Fix decoding of CPS
and SETEND.

7 years agox86: Add VERIFY_COPY_RELOC
H.J. Lu [Fri, 6 Oct 2017 07:50:12 +0000 (00:50 -0700)] 
x86: Add VERIFY_COPY_RELOC

Add VERIFY_COPY_RELOC to verify that symbol supports copy relocation.

* elfxx-x86.h (VERIFY_COPY_RELOC): New.
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.

7 years agox86: Add VERIFY_PLT_ENTRY
H.J. Lu [Fri, 6 Oct 2017 07:46:56 +0000 (00:46 -0700)] 
x86: Add VERIFY_PLT_ENTRY

Add VERIFY_PLT_ENTRY to verify that symbol has an entry in the procedure
linkage table.

* elfxx-x86.h (VERIFY_PLT_ENTRY): New.
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.

7 years agox86: Add COPY_INPUT_RELOC_P
H.J. Lu [Fri, 6 Oct 2017 07:43:31 +0000 (00:43 -0700)] 
x86: Add COPY_INPUT_RELOC_P

Add COPY_INPUT_RELOC_P which returns TRUE if input relocation should
be copied to output.

* elfxx-x86.h (COPY_INPUT_RELOC_P): New.
* elf32-i386.c (elf_i386_relocate_section): Use it.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

7 years agox86: Add GENERATE_DYNAMIC_RELOCATION_P
H.J. Lu [Fri, 6 Oct 2017 07:40:56 +0000 (00:40 -0700)] 
x86: Add GENERATE_DYNAMIC_RELOCATION_P

Add GENERATE_DYNAMIC_RELOCATION_P which returns TRUE if dynamic
relocation should be generated.

* elf32-i386.c (X86_SIZE_TYPE_P): New.
(elf_i386_relocate_section): Use GENERATE_DYNAMIC_RELOCATION_P.
* elf64-x86-64.c (X86_SIZE_TYPE_P): New.
(elf_x86_64_relocate_section): Use GENERATE_DYNAMIC_RELOCATION_P.
* elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): New.

7 years agox86: Add POINTER_LOCAL_IFUNC_P/PLT_LOCAL_IFUNC_P
H.J. Lu [Fri, 6 Oct 2017 07:35:13 +0000 (00:35 -0700)] 
x86: Add POINTER_LOCAL_IFUNC_P/PLT_LOCAL_IFUNC_P

Add POINTER_LOCAL_IFUNC_P which returns TRUE for pointer reference to
local IFUNC symbol.  Add PLT_LOCAL_IFUNC_P which returns TRUE for PLT
reference to local IFUNC symbol.

* elfxx-x86.h (POINTER_LOCAL_IFUNC_P): New.
(PLT_LOCAL_IFUNC_P): Likewise.
* elf32-i386.c (elf_i386_relocate_section): Use them.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

7 years agox86: Add GENERATE_RELATIVE_RELOC_P
H.J. Lu [Fri, 6 Oct 2017 07:29:16 +0000 (00:29 -0700)] 
x86: Add GENERATE_RELATIVE_RELOC_P

Add GENERATE_RELATIVE_RELOC_P which returns TRUE if dynamic relative
relocation should be generated.

* elfxx-x86.h (GENERATE_RELATIVE_RELOC_P): New.
* elf32-i386.c (elf_i386_relocate_section): Use it.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

7 years agox86: Add RESOLVED_LOCALLY_P
H.J. Lu [Fri, 6 Oct 2017 07:26:17 +0000 (00:26 -0700)] 
x86: Add RESOLVED_LOCALLY_P

Add RESOLVED_LOCALLY_P which returns TRUE if symbol is resolved to
local definition at link-time.

* elfxx-x86.h (RESOLVED_LOCALLY_P): New.
* elf32-i386.c (elf_i386_relocate_section): Use it.
* elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.

7 years agoAdd RESOLVED_LOCALLY_P
H.J. Lu [Thu, 5 Oct 2017 21:36:58 +0000 (14:36 -0700)] 
Add RESOLVED_LOCALLY_P

7 years agox86: Add NEED_DYNAMIC_RELOCATION_P
H.J. Lu [Fri, 6 Oct 2017 07:21:48 +0000 (00:21 -0700)] 
x86: Add NEED_DYNAMIC_RELOCATION_P

Add NEED_DYNAMIC_RELOCATION_P which returns TRUE if dynamic relocation
is needed.

* elf32-i386.c (X86_PCREL_TYPE_P): New.
(elf_i386_check_relocs): Use NEED_DYNAMIC_RELOCATION_P.
* elf64-x86-64.c (IS_X86_64_PCREL_TYPE): Renamed to ...
(X86_PCREL_TYPE_P): This.
(elf_x86_64_check_relocs): Use NEED_DYNAMIC_RELOCATION_P.
Replace IS_X86_64_PCREL_TYPE with X86_PCREL_TYPE_P.
(elf_x86_64_relocate_section): Replace IS_X86_64_PCREL_TYPE with
X86_PCREL_TYPE_P.
* elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): New.

7 years agox86: Add TLS_TRANSITION_IE_TO_LE_P
H.J. Lu [Fri, 6 Oct 2017 07:11:41 +0000 (00:11 -0700)] 
x86: Add TLS_TRANSITION_IE_TO_LE_P

Add TLS_TRANSITION_IE_TO_LE_P which returns TRUE if TLS IE->LE transition
is OK.

* elfxx-x86.h (TLS_TRANSITION_IE_TO_LE_P): New.
* elf32-i386.c (elf_i386_tls_transition): Use it.
* elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.

7 years agoDWARF header checks
Alan Modra [Fri, 6 Oct 2017 03:44:21 +0000 (14:14 +1030)] 
DWARF header checks

This patch tidies DWARF header checks, consolidating the "negative"
checks (which are really overflow checks) with the section size
check.  In a number of cases this also ensures that small negative
lengths are caught.  For instance

      hdrptr = start + arange.ar_length + initial_length_size;
      if (hdrptr < start || hdrptr > end)

does not detect ar_length in the range [-initial_length_size,-1].

* dwarf.c (process_debug_info): Consolidate header length checks.
(display_debug_pubnames_worker): Use "start" to read header.
Properly check header length and report errors earlier.
Simplify loop printing pubnames.
(get_line_filename_and_dirname): Catch small negative "length"
values.
(display_debug_aranges): Likewise.  Report header errors
earlier using standardized message.
(display_debug_names): Likewise.

7 years agopowerpc: Dump dynamic relocation info to the map file
H.J. Lu [Fri, 6 Oct 2017 01:09:07 +0000 (18:09 -0700)] 
powerpc: Dump dynamic relocation info to the map file

Dump dynamic relocation info to the map file when generating dynamic
relocation in read-only section relocations if -Map is used.

* elf32-ppc.c (readonly_dynrelocs): Add a link_info argument.
Dump dynamic relocation in read-only section with minfo if
needed.
(ppc_elf_adjust_dynamic_symbol): Pass NULL to readonly_dynrelocs.
(maybe_set_textrel): Likewise.
(ppc_elf_size_dynamic_sections): Dump dynamic relocation in
read-only section with minfo.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 6 Oct 2017 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoFix fork-related regressions on GNU/Linux
Pedro Alves [Thu, 5 Oct 2017 17:33:22 +0000 (18:33 +0100)] 
Fix fork-related regressions on GNU/Linux

Commit 5cd63fda035d ("Fix "Remote 'g' packet reply is too long"
problems with multiple inferiors") caused a number of regressions on
native GNU/Linux, all related to follow-fork support.  E.g.:

  src/gdb/target.c:3141: internal-error: gdbarch* default_thread_architecture(target_ops*, ptid_t): Assertion `inf != NULL' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n)
  Resyncing due to internal error.
  FAIL: gdb.base/catch-signal-fork.exp: got SIGHUP after fork (GDB internal error)

This commit fixes it.

gdb/ChangeLog:
2017-10-05  Pedro Alves  <palves@redhat.com>

* linux-nat.c (linux_child_follow_fork): When following the parent
and detaching the child, consult the parent thread's architecture
instead of the child's.

7 years agoRemove unused "union agent_val" from ax.h
Ulrich Weigand [Thu, 5 Oct 2017 17:15:11 +0000 (19:15 +0200)] 
Remove unused "union agent_val" from ax.h

The ax.h header file contains a use of DOUBLEST in the type "union agent_val".

However, that type is never used anywhere, so it can be simply removed.

gdb/ChangeLog:
2017-10-05  Ulrich Weigand  <uweigand@de.ibm.com>

* ax.h: Do not include "doublest.h".
(union agent_val): Remove.

7 years agoClean up some DFP interfaces
Ulrich Weigand [Thu, 5 Oct 2017 17:14:08 +0000 (19:14 +0200)] 
Clean up some DFP interfaces

This cleans up a number of interfaces in dfp.c / dfp.h.  Specifically:

- The decimal_from_string / decimal_to_string routines are C++-ified
  to operate on std::string instead of character buffers.  In the
  decimal_from_string, the boolean return value now actually is bool
  instead of an int.

- The decimal_from_integral and decimal_from_doublest routines take
  an struct value as input.  This is not really appropriate at the low
  level the DFP routines sit, so this replaced them with new routines
  decimal_from_longest / decimal_from_ulongest / decimal_from_doublest
  that operate on contents instead.

- To mirror the decimal_from_[u]longest, a new decimal_to_longest
  routine is added as well, which can be used in unpack_long to
  avoid an unnecessary conversion via DOUBLEST.

Note that the decimal_from_longest / decimal_from_ulongest routines
are actually more powerful than decimal_from_integral: the old routine
would only accept integer *types* of at most four bytes size, while
the new routines accept all integer *values* that fit in an [u]int32_t,
no matter which type they came from.  The DFP tests are updated to
allow for this larger range of integers that can be converted.

gdb/ChangeLog:
2017-10-05  Ulrich Weigand  <uweigand@de.ibm.com>

* dfp.h (MAX_DECIMAL_STRING): Move to dfp.c.
(decimal_to_string): Return std::string object.
(decimal_from_string): Accept std::string object.  Return bool.
(decimal_from_integral, decimal_from_doublest): Remove.
(decimal_from_longest): Add prototype.
(decimal_from_ulongest): Likewise.
(decimal_to_longest): Likewise.
(decimal_from_doublest): Likewise.
* dfp.c: Do not include "gdbtypes.h" or "value.h".
(MAX_DECIMAL_STRING): Move here.
(decimal_to_string): Return std::string object.
(decimal_from_string): Accept std::string object.  Return bool.
(decimal_from_integral): Remove, replace by ...
(decimal_from_longest, decimal_from_ulongest): ... these new functions.
(decimal_to_longest): New function.
(decimal_from_floating): Remove, replace by ...
(decimal_from_doublest): ... this new function.
(decimal_to_doublest): Update to new decimal_to_string interface.

* value.c (unpack_long): Use decimal_to_longest.
* valops.c (value_cast): Use decimal_from_doublest instead of
decimal_from_floating.  Use decimal_from_[u]longest isntead of
decimal_from_integral.
* valarith.c (value_args_as_decimal): Likewise.
* valprint.c (print_decimal_floating): Update to new
decimal_to_string interface.
* printcmd.c (printf_decfloat): Likewise.
* c-exp.y (parse_number): Update to new decimal_from_string interface.

gdb/testsuite/ChangeLog:
2017-10-05  Ulrich Weigand  <uweigand@de.ibm.com>

* gdb.base/dfp-exprs.exp: Update tests to larger range of supported
integer-to-dfp conversion.
* gdb.base/dfp-test.exp: Likewise.

7 years agoClean up includes of doublest.h and floatformat.h
Ulrich Weigand [Thu, 5 Oct 2017 17:12:45 +0000 (19:12 +0200)] 
Clean up includes of doublest.h and floatformat.h

As a first small step to getting rid of doublest.h, this patch removes the
include of "floatformat.h" in "doublest.h".  This is actually not needed
for the file itself.  A few source files now need to include "floatformat.h"
directly, since they got it indirectly via "doublest.h" and still need it.

In reviewing which files need it, I found a number of files that include
"floatformat.h" directly without actually needing it at all.  Similarly,
a number of files include "doublest.h" without needing it.  I've also
removed those unnecessary include statements.

gdb/ChangeLog:
2017-10-05  Ulrich Weigand  <uweigand@de.ibm.com>

* doublest.h: Do not include "floatformat.h".  Remove stale comments.
* gdbtypes.c: Include "floatformat.h".
* value.c: Likewise.
* m68k-tdep.c: Likewise.

* findvar.c: Do not include "floatformat.h".
* amd64-darwin-tdep.c: Likewise.
* arm-linux-tdep.c: Likewise.
* i386-darwin-tdep.c: Likewise.
* i387-tdep.c: Likewise.
* m68k-linux-tdep.c: Likewise.
* mep-tdep.c: Likewise.
* mips-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* s390-linux-tdep.c: Likewise.
* sparc-obsd-tdep.c: Likewise.
* sparc-tdep.c: Likewise.
* sparc64-tdep.c: Likewise.
* spu-tdep.c: Likewise.
* tic6x-tdep.c: Likewise.
* tilegx-tdep.c: Likewise.
* vax-tdep.c: Likewise.
* xstormy16-tdep.c: Likewise.
* xtensa-tdep.c: Likewise.

* top.c: Do not include "doublest.h".
* aarch64-tdep.c: Likewise.
* alpha-tdep.c: Likewise.
* arm-linux-tdep.c: Likewise.
* m68k-linux-tdep.c: Likewise.
* tilegx-tdep.c: Likewise.
* xstormy16-tdep.c: Likewise.

7 years agoAdd a signal frame unwinder for FreeBSD/mipsn32.
John Baldwin [Thu, 5 Oct 2017 16:50:01 +0000 (09:50 -0700)] 
Add a signal frame unwinder for FreeBSD/mipsn32.

The N32 signal frame uses an identical layout to N64, so reuse the N64
handler.  The N32 signal trampoline does use one different instruction
relative to N64, so a separate tramp_frame is required.

gdb/ChangeLog:

* mips-fbsd-tdep.c (MIPS_INST_ADDIU_A0_SP_N32): Define.
(mipsn32_fbsd_sigframe): Define.
(mips_fbsd_init_abi): Install mipsn32_fbsd_sigframe unwinder
for FreeBSD/mipsn32.

7 years agoHandle the NT_ARM_VFP core dump note on FreeBSD.
John Baldwin [Thu, 5 Oct 2017 16:50:01 +0000 (09:50 -0700)] 
Handle the NT_ARM_VFP core dump note on FreeBSD.

bfd/ChangeLog:

* elf.c (elfcore_grok_freebsd_note): Handle NT_ARM_VFP.

7 years agoHandle FreeBSD-specific AT_EHDRFLAGS and AT_HWCAP auxiliary vector types.
John Baldwin [Thu, 5 Oct 2017 16:50:01 +0000 (09:50 -0700)] 
Handle FreeBSD-specific AT_EHDRFLAGS and AT_HWCAP auxiliary vector types.

FreeBSD recently added two additional ELF auxiliary vectors.  FreeBSD's
AT_HWCAP uses a different number compared to AT_HWCAP on Linux as the
numerical value was already in use for a different vector on FreeBSD.

include/ChangeLog:

* elf/common.h (AT_FREEBSD_EHDRFLAGS, AT_FREEBSD_HWCAP): Define.

gdb/ChangeLog:

* fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_EHDRFLAGS and
AT_HWCAP.

7 years agoFix the MSP430 assembler so that it detects and reports extraneous text at the end...
Nick Clifton [Thu, 5 Oct 2017 15:17:22 +0000 (16:17 +0100)] 
Fix the MSP430 assembler so that it detects and reports extraneous text at the end of operands.

PR 22133
* config/tc-msp430.c (parse_exp): Skip an 'h' suffix to constant
expressions.
(msp430_srcoperand): Check that the entire text was parsed by
parse_exp.
(msp430_operands): Likewise.
* testsuite/gas/msp430/pr22133.s: New test file.
* testsuite/gas/msp430/pr22133.d: New test driver.
* testsuite/gas/msp430/pr22133.s: Expected error output.
* testsuite/gas/msp430/msp430.exp: Run the new test.

7 years agoAvoid spurious readelf error status from decode_arm_unwind.
Joseph Myers [Thu, 5 Oct 2017 14:19:39 +0000 (14:19 +0000)] 
Avoid spurious readelf error status from decode_arm_unwind.

readelf.c:decode_arm_unwind has a variable res that is used as a
return value, with FALSE meaning unsuccessful and TRUE meaning
successful.  This is initialized to FALSE (and then various code in
the function sets it to FALSE again on error), meaning that when the
function is successful, if it reaches returning res is still returns
FALSE, resulting eventually in exit status 1 from readelf without any
error message to indicate an error.

This patch fixes the initialization to use TRUE, so avoiding those
spurious errors.  I don't have a self-contained test for this issue;
it was observed as many prelink tests failing without the patch and
passing with it.

* readelf.c (decode_arm_unwind): Initialize res to TRUE.

7 years agoUpdate the Hungarian translation in the gprof directory.
Nick Clifton [Thu, 5 Oct 2017 13:10:27 +0000 (14:10 +0100)] 
Update the Hungarian translation in the gprof directory.

* po/hu.po: Updated Hungarian translation.

7 years agoUpdated Turkish translation for the ld sub-directory.
Nick Clifton [Thu, 5 Oct 2017 13:02:10 +0000 (14:02 +0100)] 
Updated Turkish translation for the ld sub-directory.

* po/tr.po: Updated Turkish translation.

7 years agotile: Dump dynamic relocation info to the map file
H.J. Lu [Thu, 5 Oct 2017 13:01:18 +0000 (06:01 -0700)] 
tile: Dump dynamic relocation info to the map file

Dump dynamic relocation info to the map file when generating dynamic
relocation in read-only section relocations if -Map is used.

* elf32-tilepro.c (readonly_dynrelocs): Dump dynamic relocation
in read-only section with minfo.
(tilepro_elf_size_dynamic_sections): Likewise.
* elfxx-tilegx.c (readonly_dynrelocs): Likewise.
(tilegx_elf_size_dynamic_sections): Likewise.

7 years agoFix strip so that is accepts -M as an abbreviation for --merge-notes.
Nick Clifton [Thu, 5 Oct 2017 12:48:32 +0000 (13:48 +0100)] 
Fix strip so that is accepts -M as an abbreviation for --merge-notes.

PR 22260
* objcopy.c (strip_main): Add 'M' character to short options list
when calling getopt_long.

7 years agoChange readelf so that when --wide is active a relocation's full name is displayed.
Nick Clifton [Thu, 5 Oct 2017 12:25:44 +0000 (13:25 +0100)] 
Change readelf so that when --wide is active a relocation's full name is displayed.

PR 22262
binutils* readelf.c (dump_relocations): Do not truncate reloc names when
displaying output in wide mode.

ld * testsuite/ld-powerpc/relocsort.d: Update expected output (for
longer reloc names).

7 years agoUpdate README-how-to-make-a-release with the correct sequence for creating the source...
Nick Clifton [Thu, 5 Oct 2017 09:52:04 +0000 (10:52 +0100)] 
Update README-how-to-make-a-release with the correct sequence for creating the source tarball.

* README-how-to-make-a-release: Merge steps 3, 4 and 5, and insert
the git tag operation at the correct location.

7 years agoPR22239 - invalid memory read in display_debug_frames
Alan Modra [Thu, 5 Oct 2017 07:02:18 +0000 (17:32 +1030)] 
PR22239 - invalid memory read in display_debug_frames

Pointer comparisons have traps for the unwary.  After adding a large
unknown value to "start", the test "start < end" depends on where
"start" is originally in memory.

PR 22239
* dwarf.c (read_cie): Don't compare "start" and "end" pointers
after adding a possibly wild length to "start", compare the length
to the difference of the pointers instead.  Remove now redundant
"negative" length test.

7 years agoUpdate my email address.
Tristan Gingold [Thu, 5 Oct 2017 04:34:06 +0000 (06:34 +0200)] 
Update my email address.

Also refer to global maintainers for branch release approval.

7 years agobfd_set_input_error
Pedro Alves [Wed, 4 Oct 2017 13:20:51 +0000 (14:20 +0100)] 
bfd_set_input_error

A downside to the 2017-10-04 PR22245 fix is that bfd_set_error can now
silently accept invalid errors if/when someone passes the a value of
the wrong enumeration type, which previously would be caught by the
-Wenum-conversion warning.

PR 22245
* bfd.c (bfd_set_error): Revert 2017-10-04 change.  Remove
ellipsis parameter.  Split out bfd_error_on_input code to..
(bfd_set_input_error): .. New function.
* archive.c (_bfd_write_archive_contents): Use bfd_set_input_error.
* vms-lib.c (_bfd_vms_lib_write_archive_contents): Likewise.
* bfd-in2.h: Regenerate.

7 years agoAdd an assembler test for PR gas/21167
H.J. Lu [Thu, 5 Oct 2017 01:01:47 +0000 (18:01 -0700)] 
Add an assembler test for PR gas/21167

PR gas/21167
* testsuite/gas/elf/elf.exp: Run group3.
* testsuite/gas/elf/group3.d: New file.
* testsuite/gas/elf/group3.s: Likewise.

7 years agobfd_error_on_input is for archives
Alan Modra [Thu, 5 Oct 2017 00:36:44 +0000 (11:06 +1030)] 
bfd_error_on_input is for archives

* elflink.c (elf_link_input_bfd): Correct ctor/dtor in init_array/
fini_array error value.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 5 Oct 2017 00:00:13 +0000 (00:00 +0000)] 
Automatic date update in version.in

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