]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
3 years agogdb: Convert language la_value_print_inner field to a method
Andrew Burgess [Mon, 1 Jun 2020 14:36:30 +0000 (15:36 +0100)] 
gdb: Convert language la_value_print_inner field to a method

This commit changes the language_data::la_value_print_inner function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data): Delete la_value_print_inner
initializer.
(ada_language::value_print_inner): New member function.
* c-lang.c (c_language_data): Delete la_value_print_inner
initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
(d_language::value_print_inner): New member function.
* f-lang.c (f_language_data): Delete la_value_print_inner
initializer.
(f_language::value_print_inner): New member function.
* f-lang.h (f_value_print_innner): Rename to...
(f_value_print_inner): ...this (note spelling of 'inner').
* f-valprint.c (f_value_print_innner): Rename to...
(f_value_print_inner): ...this (note spelling of 'inner').
* go-lang.c (go_language_data): Delete la_value_print_inner
initializer.
(go_language::value_print_inner): New member function.
* language.c (language_defn::value_print_inner): Define new member
function.
(unk_lang_value_print_inner): Delete.
(unknown_language_data): Delete la_value_print_inner initializer.
(unknown_language::value_print_inner): New member function.
(auto_language_data): Delete la_value_print_inner initializer.
(auto_language::value_print_inner): New member function.
* language.h (language_data): Delete la_value_print_inner field.
(language_defn::value_print_inner): Delcare new member function.
* m2-lang.c (m2_language_data): Delete la_value_print_inner
initializer.
(m2_language::value_print_inner): New member function.
* objc-lang.c (objc_language_data): Delete la_value_print_inner
initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
(pascal_language::value_print_inner): New member function.
* rust-lang.c (rust_language_data): Delete la_value_print_inner
initializer.
(rust_language::value_print_inner): New member function.
* valprint.c (do_val_print): Update call to value_print_inner.

3 years agogdb: Convert language la_value_print field to a method
Andrew Burgess [Mon, 1 Jun 2020 14:21:33 +0000 (15:21 +0100)] 
gdb: Convert language la_value_print field to a method

This commit changes the language_data::la_value_print function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data): Delete la_value_print
initializer.
(ada_language::value_print): New member function.
* c-lang.c (c_language_data): Delete la_value_print initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_language_data): Likewise.
* go-lang.c (go_language_data): Likewise.
* language.c (unk_lang_value_print): Delete.
(language_defn::value_print): Define new member function.
(unknown_language_data): Delete la_value_print initializer.
(unknown_language::value_print): New member function.
(auto_language_data): Delete la_value_print initializer.
(auto_language::value_print): New member function.
* language.h (language_data): Delete la_value_print field.
(language_defn::value_print): Declare new member function.
(LA_VALUE_PRINT): Update call to value_print.
* m2-lang.c (m2_language_data): Delete la_value_print initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
(pascal_language::value_print): New member function.
* rust-lang.c (rust_language_data): Delete la_value_print
initializer.

3 years agogdb: Convert language la_watch_location_expression field to a method
Andrew Burgess [Mon, 1 Jun 2020 14:06:43 +0000 (15:06 +0100)] 
gdb: Convert language la_watch_location_expression field to a method

This commit changes the language_data::la_watch_location_expression
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_watch_location_expression): Rename to
ada_language::watch_location_expression.
(ada_language_data): Delete la_watch_location_expression
initializer.
(ada_language::watch_location_expression): New member function,
implementation from ada_watch_location_expression.
* breakpoint.c (watch_command_1): Update call to
watch_location_expression.
* c-lang.c (c_watch_location_expression): Rename to
language_defn::watch_location_expression.
(c_language_data): Delete la_watch_location_expression
initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* c-lang.h (c_watch_location_expression): Delete declaration.
* d-lang.c (d_language_data): Delete la_watch_location_expression
initializer.
* f-lang.c (f_language_data): Likewise.
* go-lang.c (go_language_data): Likewise.
* language.c (language_defn::watch_location_expression): Member
function implementation from c_watch_location_expression.
(unknown_language_data): Delete la_watch_location_expression
initializer.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_watch_location_expression
field.
(language_defn::watch_location_expression): Declare new member
function.
* m2-lang.c (m2_language_data): Delete
la_watch_location_expression initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_watch_location_expression): Rename to
rust_language::watch_location_expression.
(rust_language_data): Delete la_watch_location_expression
initializer.
(rust_language::watch_location_expression): New member function,
implementation from rust_watch_location_expression.

3 years agogdb: Convert language la_collect_symbol_completion_matches field to a method
Andrew Burgess [Mon, 1 Jun 2020 13:53:55 +0000 (14:53 +0100)] 
gdb: Convert language la_collect_symbol_completion_matches field to a method

This commit changes the
language_data::la_collect_symbol_completion_matches function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_collect_symbol_completion_matches): Rename to
ada_language::collect_symbol_completion_matches.
(ada_language_data): Delete la_collect_symbol_completion_matches
initializer.
(ada_language::collect_symbol_completion_matches): New member
function, implementation from
ada_collect_symbol_completion_matches.
* c-lang.c (c_language_data): Delete
la_collect_symbol_completion_matches initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* f-lang.c (f_collect_symbol_completion_matches): Rename to
f_language::collect_symbol_completion_matches.
(f_language_data): Delete la_collect_symbol_completion_matches
initializer.
(f_language::collect_symbol_completion_matches) New member
function, implementation from f_collect_symbol_completion_matches.
* go-lang.c (go_language_data): Delete
la_collect_symbol_completion_matches initializer.
* language.c (unknown_language_data): Likewise.
(auto_language_data): Likewise.
* language.h (language_data): Delete
la_collect_symbol_completion_matches field.
(language_defn::collect_symbol_completion_matches): New member
function.
* m2-lang.c (m2_language_data): Delete
la_collect_symbol_completion_matches initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.
* symtab.c (default_collect_symbol_completion_matches): Delete.
(collect_symbol_completion_matches): Update call to
collect_symbol_completion_matches.
(collect_symbol_completion_matches_type): Likewise.
* symtab.h (default_collect_symbol_completion_matches): Delete
declaration.

3 years agogdb: Convert language la_word_break_characters field to a method
Andrew Burgess [Mon, 1 Jun 2020 13:40:22 +0000 (14:40 +0100)] 
gdb: Convert language la_word_break_characters field to a method

This commit changes the language_data::la_word_break_characters
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_get_gdb_completer_word_break_characters): Delete.
(ada_language_data): Delete la_word_break_characters initializer.
(ada_language::word_break_characters): New member function.
* c-lang.c (c_language_data): Delete la_word_break_characters
initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* completer.c: Update global comment.
(advance_to_expression_complete_word_point): Update call to
word_break_characters.
(complete_files_symbols): Likewise.
(complete_line_internal_1): Likewise.
(default_completer_handle_brkchars): Likewise.
(skip_quoted_chars): Likewise.
* d-lang.c (d_language_data): Delete la_word_break_characters
initializer.
* f-lang.c (f_word_break_characters): Delete.
(f_language_data): Delete la_word_break_characters initializer.
(f_language::word_break_characters): New member function.
* go-lang.c (go_language_data): Delete la_word_break_characters
initializer.
* language.c (unknown_language_data): Likewise.
(auto_language_data): Likewise.
* language.h (default_word_break_characters): Move declaration to
earlier in the file.
(language_data): Delete la_word_break_characters field.
(language_defn::word_break_characters): New member function.
* m2-lang.c (m2_language_data): Delete la_word_break_characters
initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.

3 years agogdb: Convert language la_get_symbol_name_matcher field to a method
Andrew Burgess [Mon, 1 Jun 2020 10:46:54 +0000 (11:46 +0100)] 
gdb: Convert language la_get_symbol_name_matcher field to a method

This commit changes the language_data::la_get_symbol_name_matcher
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

Before this commit access to the la_get_symbol_name_matcher function
pointer was through the get_symbol_name_matcher function, which looked
something like this (is pseudo-code):

  <return-type>
  get_symbol_name_matcher (language_defn *lang, <other args>)
  {
    if (current_language == ada)
      current_language->la_get_symbol_name_matcher (<other args>);
    else
      lang->la_get_symbol_name_matcher (<other args>);
  }

In this commit I moved the get_symbol_name_matcher as a non-virtual
function in the language_defn base class, I then add a new virtual
method that is only used from within get_symbol_name_matcher, this can
then be overridden by specific languages as needed.  So we now have:

  class language_defn
  {
    <return-type> get_symbol_name_matcher (<args>)
    {
      if (current_language == ada)
        return current_language->get_symbol_name_matcher_inner (<args>);
      else
        return this->get_symbol_name_matcher_inner (<args>);
    }

    virtual <return-type> get_symbol_name_matcher_inner (<args>)
    {
        ....
    }
  }

gdb/ChangeLog:

* ada-lang.c (ada_get_symbol_name_matcher): Update header comment.
(ada_language_data): Delete la_get_symbol_name_matcher
initializer.
(language_defn::get_symbol_name_matcher_inner): New member
function.
* c-lang.c (c_language_data): Delete la_get_symbol_name_matcher
initializer.
(cplus_language_data): Likewise.
(cplus_language::get_symbol_name_matcher_inner): New member
function.
(asm_language_data): Delete la_get_symbol_name_matcher initializer.
(minimal_language_data): Likewise.
* cp-support.h (cp_get_symbol_name_matcher): Update header comment.
* d-lang.c (d_language_data): Delete la_get_symbol_name_matcher
initializer.
* dictionary.c (iter_match_first_hashed): Update call to
get_symbol_name_matcher.
(iter_match_next_hashed): Likewise.
(iter_match_next_linear): Likewise.
* dwarf2/read.c (dw2_expand_symtabs_matching_symbol): Likewise.
* f-lang.c (f_language_data): Delete la_get_symbol_name_matcher
initializer.
(f_language::get_symbol_name_matcher_inner): New member function.
* go-lang.c (go_language_data): Delete la_get_symbol_name_matcher
initializer.
* language.c (default_symbol_name_matcher): Update header comment,
make static.
(language_defn::get_symbol_name_matcher): New definition.
(language_defn::get_symbol_name_matcher_inner): Likewise.
(get_symbol_name_matcher): Delete.
(unknown_language_data): Delete la_get_symbol_name_matcher
initializer.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_get_symbol_name_matcher
field.
(language_defn::get_symbol_name_matcher): New member function.
(language_defn::get_symbol_name_matcher_inner): Likewise.
(default_symbol_name_matcher): Delete declaration.
* linespec.c (find_methods): Update call to
get_symbol_name_matcher.
* m2-lang.c (m2_language_data): Delete la_get_symbol_name_matcher
initializer.
* minsyms.c (lookup_minimal_symbol): Update call to
get_symbol_name_matcher.
(iterate_over_minimal_symbols): Likewise.
* objc-lang.c (objc_language_data): Delete
la_get_symbol_name_matcher initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* psymtab.c (psymbol_name_matches): Update call to
get_symbol_name_matcher.
* rust-lang.c (rust_language_data): Delete
la_get_symbol_name_matcher initializer.
* symtab.c (symbol_matches_search_name): Update call to
get_symbol_name_matcher.
(compare_symbol_name): Likewise.

3 years agogdb: Convert language la_compute_program field to a method
Andrew Burgess [Mon, 1 Jun 2020 10:07:52 +0000 (11:07 +0100)] 
gdb: Convert language la_compute_program field to a method

This commit changes the language_data::la_compute_program function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data): Delete la_compute_program
initializer.
* c-lang.c (c_language_data): Likewise.
(c_language::compute_program): New member function.
(cplus_language_data): Delete la_compute_program initializer.
(cplus_language::compute_program): New member function.
(asm_language_data): Delete la_compute_program initializer.
(minimal_language_data): Likewise.
* c-lang.h (c_compute_program): Update comment.
(cplus_compute_program): Likewise.
* compile/compile-c-support.c (c_compute_program): Likewise.
(cplus_compute_program): Likewise.
* compile/compile.c (compile_to_object): Update call to
la_compute_program.
* d-lang.c (d_language_data): Delete la_compute_program
initializer.
* f-lang.c (f_language_data): Likewise.
* go-lang.c (go_language_data): Likewise.
* language.c (unknown_language_data): Likewise.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_compute_program field.
(language_defn::compute_program): New member function.
* m2-lang.c (m2_language_data): Delete la_compute_program
initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.

3 years agogdb: Convert language la_class_name_from_physname field to a method
Andrew Burgess [Mon, 1 Jun 2020 09:53:05 +0000 (10:53 +0100)] 
gdb: Convert language la_class_name_from_physname field to a method

This commit changes the language_data::la_class_name_from_physname function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data) Delete
la_class_name_from_physname initializer.
* c-lang.c (c_language_data): Likewise.
(cplus_language_data): Likewise.
(cplus_language::class_name_from_physname): New member function.
(asm_language_data): Delete la_class_name_from_physname
initializer.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* dwarf2/read.c (guess_partial_die_structure_name): Update to call
method on language_defn class.
(guess_full_die_structure_name): Likewise.
* f-lang.c (f_language_data): Delete la_class_name_from_physname
initializer.
* go-lang.c (go_language_data): Likewise.
* language.c (language_class_name_from_physname): Delete.
(unk_lang_class_name): Delete.
(unknown_language_data): Delete la_class_name_from_physname
initializer.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_class_name_from_physname
field.
(language_defn::class_name_from_physname): New function.
(language_class_name_from_physname): Delete declaration.
* m2-lang.c (m2_language_data): Delete la_class_name_from_physname
initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.

3 years agoUse macros for TUI window names
Tom Tromey [Tue, 16 Jun 2020 23:55:57 +0000 (17:55 -0600)] 
Use macros for TUI window names

Christian pointed out that tui-layout.c hard-codes various window
names.  This patch changes the code to use the macros from tui-data.h
instead.  For each window, I searched for uses of the name; but I only
found any in tui-layout.c.  This also adds a new macro to account for
the "status" window.

gdb/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (STATUS_NAME): New macro.
* tui/tui-layout.c (tui_remove_some_windows)
(initialize_known_windows, tui_register_window)
(tui_layout_split::remove_windows, initialize_layouts)
(tui_new_layout_command): Don't use hard-coded window names.

3 years agoFix crash when exiting TUI with gdb -tui
Tom Tromey [Tue, 16 Jun 2020 23:55:57 +0000 (17:55 -0600)] 
Fix crash when exiting TUI with gdb -tui

PR tui/25348 points out that, when "gdb -tui" is used, then exiting
the TUI will cause a crash.

This happens because tui_setup_io stashes some readline variables --
but because this happens before readline is initialized, some of these
are NULL.  Then, when exiting the TUI, the NULL values are "restored",
causing a crash in readline.

This patch fixes the problem by ensuring that readline is initialized
first.  Back in commit 11061048d ("Give a name to the TUI SingleKey
keymap"), a call to rl_initialize was removed from
tui_initialize_readline; this patch resurrects the call, but moves it
to the end of the function, so as not to remove the ability to modify
the SingleKey map from .inputrc.

gdb/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

PR tui/25348:
* tui/tui.c (tui_ensure_readline_initialized): Rename from
tui_initialize_readline.  Only run once.  Call rl_initialize.
* tui/tui.h (tui_ensure_readline_initialized): Rename from
tui_initialize_readline.
* tui/tui-io.c (tui_setup_io): Call
tui_ensure_readline_initialized.
* tui/tui-interp.c (tui_interp::init): Update.

3 years agoFix C-x 1 from gdb prompt
Tom Tromey [Tue, 16 Jun 2020 23:55:57 +0000 (17:55 -0600)] 
Fix C-x 1 from gdb prompt

Pedro pointed out on irc that C-x 1 from the gdb prompt will cause a
crash.  This happened because of a bug in remove_windows -- it would
always remove all the windows from the layout.  This patch fixes this
bug, and also arranges to have C-x 1 preserve the status window.

gdb/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

* tui/tui-layout.c (tui_layout_split::remove_windows): Fix logic.
Also preserve the status window.

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 17 Jun 2020 00:00:15 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoFix crash when TUI window creation fails
Tom Tromey [Tue, 16 Jun 2020 23:48:38 +0000 (17:48 -0600)] 
Fix crash when TUI window creation fails

If a TUI window is written in Python, and if the window construction
function fails, then gdb will crash.  This patch fixes the crash.

gdb/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

* python/py-tui.c (tui_py_window::~tui_py_window): Handle case
where m_window==nullptr.

gdb/testsuite/ChangeLog
2020-06-16  Tom Tromey  <tom@tromey.com>

* gdb.python/tui-window.py (failwin): New function.  Register it
as a TUI window type.
* gdb.python/tui-window.exp: Create new "fail" layout.  Test it.

3 years agox86: Correct noavx512_vp2intersect
Cui,Lili [Tue, 16 Jun 2020 17:07:15 +0000 (10:07 -0700)] 
x86: Correct noavx512_vp2intersect

* config/tc-i386.c (cpu_arch): Correct noavx512_vp2intersect
cpu_arch to CPU_ANY_VP2INTERSECT_FLAGS.
* doc/c-i386.texi: Add avx512_vp2intersect.

3 years agoRe: Use __asm__ rather than asm in ld testsuite
Alan Modra [Tue, 16 Jun 2020 13:09:44 +0000 (22:39 +0930)] 
Re: Use __asm__ rather than asm in ld testsuite

* testsuite/ld-elf/pr19553c.c: Replace asm with __asm__.
* testsuite/ld-elfvers/vers27b.c: Likewise.

3 years agoUse __asm__ rather than asm in ld testsuite
Alan Modra [Tue, 16 Jun 2020 12:16:00 +0000 (21:46 +0930)] 
Use __asm__ rather than asm in ld testsuite

* testsuite/ld-elf/pr23428.c: Define _DEFAULT_SOURCE.
* testsuite/ld-elf/indirect1b.c: Replace asm with __asm__.
* testsuite/ld-elf/indirect2.c: Likewise.
* testsuite/ld-elf/indirect3b.c: Likewise.
* testsuite/ld-elf/indirect4b.c: Likewise.
* testsuite/ld-elf/pr14323-2.c: Likewise.
* testsuite/ld-elf/pr18720b.c: Likewise.
* testsuite/ld-elf/pr23428.c: Likewise.
* testsuite/ld-elfvsb/common.c: Likewise.
* testsuite/ld-elfvsb/main.c: Likewise.
* testsuite/ld-elfvsb/sh1.c: Likewise.
* testsuite/ld-elfvsb/test.c: Likewise.
* testsuite/ld-pe/aligncomm-1.c: Likewise.
* testsuite/ld-pe/aligncomm-2.c: Likewise.
* testsuite/ld-pe/aligncomm-3.c: Likewise.
* testsuite/ld-pe/aligncomm-4.c: Likewise.
* testsuite/ld-plugin/pr23958.c: Likewise.
* testsuite/ld-size/size-1b.c: Likewise.
* testsuite/ld-size/size-2b.c: Likewise.
* testsuite/ld-size/size-3a.c: Likewise.
* testsuite/ld-size/size-3b.c: Likewise.
* testsuite/ld-size/size-3c.c: Likewise.
* testsuite/ld-size/size-4b.c: Likewise.
* testsuite/ld-size/size-5b.c: Likewise.
* testsuite/ld-size/size-6a.c: Likewise.
* testsuite/ld-size/size-7a.c: Likewise.
* testsuite/ld-size/size-8a.c: Likewise.
* testsuite/ld-size/size-9b.c: Likewise.
* testsuite/ld-size/size-10b.c: Likewise.

3 years agoUse __asm__ rather than asm in gold testsuite
Alan Modra [Tue, 16 Jun 2020 11:55:18 +0000 (21:25 +0930)] 
Use __asm__ rather than asm in gold testsuite

discard_locals_test.c:28:6: error: expected declaration specifiers or
‘...’ before string constant
 asm (".Lshould_be_discarded:");
      ^

* testsuite/discard_locals_test.c: Replace uses of asm with __asm__.
* testsuite/discard_locals_relocatable_test.c: Likewise.

3 years agoAdd two missing return values in gdb.python/py-nested-maps.c users/luisgpm/test
Gary Benson [Tue, 16 Jun 2020 11:41:28 +0000 (12:41 +0100)] 
Add two missing return values in gdb.python/py-nested-maps.c

Two functions in gdb.python/py-nested-maps.c are missing return
values.  This causes clang to fail to compile the file with the
following error:
  warning: control reaches end of non-void function [-Wreturn-type]

This commit fixes, by causing the two functions to return pointers
to the objects they've just allocated and initialized.  I didn't
investigate how this test had been passing with other compilers;
I'm assuming serendipity, that in each function the value to be
returned was already in the register it would need to be in to be
the function's return value.

gdb/testsuite/ChangeLog:

* gdb.python/py-nested-maps.c (create_map): Add missing return
value.
(create_map_map): Likewise.

3 years agoUse CXXCOMPILE in gold/testsuite/Makefile for c++ testcases
Alan Modra [Tue, 16 Jun 2020 08:39:33 +0000 (18:09 +0930)] 
Use CXXCOMPILE in gold/testsuite/Makefile for c++ testcases

I was playing with passing -std=c99 to an older version of gcc by
using CC="gcc-4 -std=c99", and ran into
cc1plus: error: command line option ‘-std=c99’ is valid for C/ObjC but
not for C++ [-Werror]
This obvious fix uses the correct compiler for a number of gold
testcases.

* testsuite/Makefile.am (export_dynamic_plugin.o): Use CXXCOMPILE.
(plugin_test_wrap_symbols_1.o): Likewise.
(plugin_test_wrap_symbols_2.o): Likewise.
* testsuite/Makefile.in: Regenerate.

3 years agox86: drop SSE4a from SSE check again
Jan Beulich [Tue, 16 Jun 2020 08:34:55 +0000 (10:34 +0200)] 
x86: drop SSE4a from SSE check again

Upon re-consideration in commit 569d50f1c611 ("x86: further refine SSE
check (SSE4a, SHA, GFNI)") I went too far: Mixing of SSE and AVX insns
doesn't suffer as bad a penalty on AMD CPUs as on Intel ones. SSE4a
being an AMD-only extension, it shouldn't be part of the ISA extensions
set for which the diagnostic may get issued. Undo that part.

3 years agoReally remove tic30-aout support
Alan Modra [Tue, 16 Jun 2020 02:43:05 +0000 (12:13 +0930)] 
Really remove tic30-aout support

bfd/
* aout-tic30.c: Delete file.
* Makefile.am (BFD32_BACKENDS): Remove aout-tic30.lo.
(BFD32_BACKENDS_CFILES): Remove aout-tic30.c.
* config.bfd (c30-*-*aout*, tic30-*-*aout*): Remove entry.
(xc16x-*-elf): Sort properly.
* configure.ac: Remove tic30_aout_vec.
* targets.c: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
gas/
* config/tc-tic30.h: Remove OBJ_AOUT support.
* configure.tgt: Delete tic30-*-*aout* entry.
ld/
* emulparams/tic30aout.sh: Delete file.
* scripttempl/tic30aout.sc: Delete file.
* Makefile.am: Remove etic30aout.c from ALL_EMULATION_SOURCES and
delete dependency.
* configure.tgt: Delete tic30-*-*aout* entry.
* testsuite/ld-scripts/sane1.d: Delete tic30-*-aout mention.
* testsuite/ld-scripts/segment-start.d: Likewise.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 16 Jun 2020 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoxtensa: allow runtime ABI selection
Max Filippov [Sun, 10 May 2020 15:03:08 +0000 (08:03 -0700)] 
xtensa: allow runtime ABI selection

2020-06-15  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
* elf32-xtensa.c (XSHAL_ABI, XTHAL_ABI_UNDEFINED)
(XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New macros.
(elf32xtensa_abi): New global variable.
(xtensa_abi_choice): New function.
(elf_xtensa_create_plt_entry): Use xtensa_abi_choice instead of
XSHAL_ABI to select PLT code.

gas/
* config/tc-xtensa.c (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New
macros.
(elf32xtensa_abi): New declaration.
(option_abi_windowed, option_abi_call0): New enum constants.
(md_longopts): Add entries for --abi-windowed and --abi-call0.
(md_parse_option): Add handlers for --abi-windowed and
--abi-call0.
(xtensa_add_config_info): Use xtensa_abi_choice instead of
XSHAL_ABI to format ABI tag.
* doc/as.texi (Target Xtensa options): Add --abi-windowed and
--abi-call0 to the list of options.
* doc/c-xtensa.texi: Add description for options --abi-windowed
and --abi-call0.
* testsuite/gas/xtensa/abi-call0.d: New test definition.
* testsuite/gas/xtensa/abi-windowed.d: New test definition.
* testsuite/gas/xtensa/abi.s: New test source.

include/
* elf/xtensa.h (xtensa_abi_choice): New declaration.

ld/
* emultempl/xtensaelf.em (XSHAL_ABI): Remove macro definition.
(XTHAL_ABI_UNDEFINED, XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): New
macros.
(elf32xtensa_abi): New declaration.
(xt_config_info_unpack_and_check): Set elf32xtensa_abi if it is
undefined.  Use xtensa_abi_choice instead of XSHAL_ABI to test
ABI tag consistency.
(xtensa_add_config_info): Use xtensa_abi_choice instead of
XSHAL_ABI to format ABI tag.
(PARSE_AND_LIST_PROLOGUE): Define OPTION_ABI_WINDOWED,
OPTION_ABI_CALL0 and declare elf32xtensa_abi.
(PARSE_AND_LIST_LONGOPTS): Add entries for --abi-windowed and
--abi-call0.
(PARSE_AND_LIST_OPTIONS): Add help text for --abi-windowed and
--abi-call0.
(PARSE_AND_LIST_ARGS_CASES): Add handlers for --abi-windowed and
--abi-call0.
* ld.texi: Add description for options --abi-windowed and
--abi-call0.

3 years agogold, ld: Implement -z start-stop-visibility=... option.
Roland McGrath [Mon, 15 Jun 2020 18:45:02 +0000 (11:45 -0700)] 
gold, ld: Implement -z start-stop-visibility=... option.

gold/
Implement -z start-stop-visibility=... option.
* options.h (class General_options): Handle -z start-stop-visibility=.
(General_options::start_stop_visibility_enum): New public method.
(General_options::set_start_stop_visibility_enum): New private method.
(General_options::start_stop_visibility_enum_): New private member.
* options.cc (General_options::General_options): Add initializer.
(General_options::finalize): Set this->start_stop_visibility_enum_
from string value.
* layout.cc (Layout::define_section_symbols): Use option setting.

bfd/
* elflink.c (bfd_elf_define_start_stop): Use start_stop_visibility
field of bfd_link_info.

include/
* bfdlink.h (struct bfd_link_info): New field start_stop_visibility.

ld/
* NEWS: Mention -z start-stop-visibility=... option for ELF.
* ld.texi (Options): Document -z start-stop-visibility=... option.
* ldmain.c (main): Initialize link_info.start_stop_visibility.
* emultempl/elf.em (gld${EMULATION_NAME}_handle_option):
Parse -z start-stop-visibility=... option.

3 years agoChange target_read_string API
Tom Tromey [Mon, 15 Jun 2020 12:28:09 +0000 (06:28 -0600)] 
Change target_read_string API

This simplifies the target_read_string API a bit.

Note that some code was using safe_strerror on the error codes
returned by target_read_string.  It seems to me that this is incorrect
(if it was ever correct, it must have been quite a long time ago).

gdb/ChangeLog
2020-06-15  Tom Tromey  <tromey@adacore.com>

* windows-nat.c (windows_nat::handle_output_debug_string):
Update.
(windows_nat::handle_ms_vc_exception): Update.
* target.h (target_read_string): Change API.
* target.c (target_read_string): Change API.
* solib-svr4.c (open_symbol_file_object, svr4_read_so_list):
Update.
* solib-frv.c (frv_current_sos): Update.
* solib-dsbt.c (dsbt_current_sos): Update.
* solib-darwin.c (darwin_current_sos): Update.
* linux-thread-db.c (inferior_has_bug): Update.
* expprint.c (print_subexp_standard): Update.
* ada-lang.c (ada_main_name, ada_tag_name_from_tsd)
(ada_exception_message_1): Update.

3 years agoRemove a use of target_read_string
Tom Tromey [Mon, 15 Jun 2020 12:28:09 +0000 (06:28 -0600)] 
Remove a use of target_read_string

linux-tdep.c:dump_mapping_p uses target_read_string, but in a way that
does not really make sense.  It's better to use target_read_memory
here.

gdb/ChangeLog
2020-06-15  Tom Tromey  <tromey@adacore.com>

* linux-tdep.c (dump_mapping_p): Use target_read_memory.

3 years agoRewrite target_read_string
Tom Tromey [Mon, 15 Jun 2020 12:28:09 +0000 (06:28 -0600)] 
Rewrite target_read_string

This rewrites target_read_string in terms of read_string.

gdb/ChangeLog
2020-06-15  Tom Tromey  <tromey@adacore.com>

* valprint.c (read_string): Update comment.
* target.c (MIN): Remove.
(target_read_string): Rewrite.

3 years agoRemove read_memory_string
Tom Tromey [Mon, 15 Jun 2020 12:28:09 +0000 (06:28 -0600)] 
Remove read_memory_string

read_memory_string is redundant and only called in a couple of spots.
This patch removes it in favor of target_read_string.

gdb/ChangeLog
2020-06-15  Tom Tromey  <tromey@adacore.com>

* corefile.c (read_memory_string): Remove.
* ada-valprint.c (ada_value_print_ptr): Update.
* ada-lang.h (ada_tag_name): Change return type.
* ada-lang.c (type_from_tag): Update.
(ada_tag_name_from_tsd): Change return type.  Use
target_read_string.
(ada_tag_name): Likewise.
* gdbcore.h (read_memory_string): Don't declare.

3 years agogdb/testsuite: fix minor things in jit tests
Tankut Baris Aktemur [Mon, 15 Jun 2020 07:07:07 +0000 (09:07 +0200)] 
gdb/testsuite: fix minor things in jit tests

gdb/testsuite/ChangeLog:
2020-06-15  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* gdb.base/jit-elf-so.exp: Refer to the global main_loader_basename
variable.
* gdb.base/jit-reader-simple.exp: Fix typo ("Built" -> "Build"),
and use the already-defined 'options' variable.

3 years agoObsolete PowerPC PE, winnt and cygwin targets
Alan Modra [Mon, 15 Jun 2020 05:16:01 +0000 (14:46 +0930)] 
Obsolete PowerPC PE, winnt and cygwin targets

The PowerPC PE support is so old and bitrotted that it ought to be
removed.  Test results for a cross from x86_64 with no C cross
compiler currently shows 109 fails.  I don't think anyone cares about
the target.

This FIXME in bfd/peXXigen.c has been around since 1999, git commit
277d1b5e453:

/* FIXME: This file has various tests of POWERPC_LE_PE.  Those tests
   worked when the code was in peicode.h, but no longer work now that
   the code is in peigen.c.  PowerPC NT is said to be dead.  If
   anybody wants to revive the code, you will have to figure out how
   to handle those issues.  */

and this one in gas/config/tc-ppc.c since 1995, git commit
cd557d83d61:

 * FIXME: I just noticed this. This doesn't work at all really. It it
 *        setting bits that bfd probably neither understands or uses. The
 *        correct approach (?) will have to incorporate extra fields attached
 *        to the section to hold the system specific stuff. (krk)

* config.bfd: Obsolete powerpcle-*-pe targets.

3 years agoUnnecessary load_lib in ld testsuite
Alan Modra [Mon, 15 Jun 2020 03:28:26 +0000 (12:58 +0930)] 
Unnecessary load_lib in ld testsuite

ld-lib.exp is loaded in config/defaults.exp

* testsuite/ld-scripts/include.exp: Don't load ld-lib.exp.
* testsuite/ld-scripts/phdrs3.exp: Likewise.
* testsuite/ld-scripts/rgn-at.exp: Likewise.
* testsuite/ld-scripts/rgn-over.exp: Likewise.
* testsuite/ld-scripts/sort.exp: Likewise.
* testsuite/ld-discard/discard.exp: Likewise.  Use is_elf_format.

3 years agoPR26103 testcase
Alan Modra [Mon, 15 Jun 2020 02:41:27 +0000 (12:11 +0930)] 
PR26103 testcase

PR 26103
* testsuite/ld-linkonce/ref1.s,
* testsuite/ld-linkonce/ref2.s,
* testsuite/ld-linkonce/sym1.s,
* testsuite/ld-linkonce/sym2.s,
* testsuite/ld-linkonce/sym3.s: New test files.
* testsuite/ld-linkonce/linkonce.exp: Run tests for PE too.
Add pr26103 test.  Remove unnecessary load_lib.

3 years agoPR26103, Assertion failure with symbols defined in link-once sections
Alan Modra [Mon, 15 Jun 2020 02:40:06 +0000 (12:10 +0930)] 
PR26103, Assertion failure with symbols defined in link-once sections

PR 26103
* elflink.c (elf_link_add_archive_symbols): Exclude undefined
symbols that were defined in discarded sections.
* cofflink.c (coff_link_check_archive_element): Likewise.
(coff_link_add_symbols): Set indx to -3 for symbols defined in
discarded sections.
(_bfd_coff_write_global_sym): Don't emit such symbols.
libcoff-in.h (struct coff_link_hash_entry): Update indx comment.
libcoff.h: Regenerate.

3 years agold-linkonce test
Alan Modra [Mon, 15 Jun 2020 02:38:33 +0000 (12:08 +0930)] 
ld-linkonce test

* testsuite/ld-linkonce/zeroeh_x.s: Rename from x.s.
* testsuite/ld-linkonce/zeroeh_y.s: Rename from y.s.
* testsuite/ld-linkonce/zeroehl32.d: Adjust for renaming.  Support
big-endian output.  Run for powerpc.

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 15 Jun 2020 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoHandle Windows drives in rbreak paths
Hannes Domani [Wed, 13 May 2020 10:38:54 +0000 (12:38 +0200)] 
Handle Windows drives in rbreak paths

Fixes this testsuite fail on Windows:
FAIL: gdb.base/fullpath-expand.exp: rbreak XXX/fullpath-expand-func.c:func

If the found colon is actually part of a Windows drive, look for another.

gdb/ChangeLog:

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

* symtab.c (rbreak_command): Ignore Windows drive colon.

3 years agox86: Correct xsusldtrk mnemonic
H.J. Lu [Sun, 14 Jun 2020 12:18:35 +0000 (05:18 -0700)] 
x86: Correct xsusldtrk mnemonic

The correct mnemonic is xsusldtrk, not xsuspldtrk.

gas/

PR gas/26115
* testsuite/gas/i386/tsxldtrk.d: Replace xsuspldtrk with
xsusldtrk.
* testsuite/gas/i386/tsxldtrk.s: Likewise.
* testsuite/gas/i386/x86-64-tsxldtrk.d: Likewise.
* testsuite/gas/i386/x86-64-tsxldtrk.s: Likewise.

opcodes/

PR gas/26115
* i386-dis.c (prefix_table): Replace xsuspldtrk with xsusldtrk.
* i386-opc.tbl: Likewise.
* i386-tbl.h: Regenerated.

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 14 Jun 2020 00:00:13 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 13 Jun 2020 00:00:15 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: mention removed GDBserver host support in NEWS
Simon Marchi [Fri, 12 Jun 2020 20:06:46 +0000 (16:06 -0400)] 
gdb: mention removed GDBserver host support in NEWS

gdb/ChangeLog:

* NEWS: Mention removed GDBserver host support.

Change-Id: Ib9e212e525d12ac7f3f9b5c056adc5bf9c4d52cd

3 years agogdbserver: remove support for ARM/WinCE
Simon Marchi [Fri, 12 Jun 2020 20:06:45 +0000 (16:06 -0400)] 
gdbserver: remove support for ARM/WinCE

This port has been unmaintained for years, remove it.

gdbserver/ChangeLog:

* Makefile.in (SFILES): Remove win32-arm-low.cc, wincecompat.cc.
* configure.srv: Remove mingw32ce cases.
* server.h, win32-low.cc: Remove __MINGW32CE__-guarded code.
* win32-low.h (to_back_slashes): Remove.
* win32-arm-low.cc, wincecompat.cc, wincecompat.h: Remove.

Change-Id: Ib75c0b55b0ab7caca38bbeff5f2fa9397a8e7e8d

3 years agogdbserver: remove support for Tile
Simon Marchi [Fri, 12 Jun 2020 20:06:44 +0000 (16:06 -0400)] 
gdbserver: remove support for Tile

This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

* Makefile.in (SFILES): linux-tile-low.cc.
* configure.srv: Remove tilegx case.
* linux-tile-low.cc: Remove.

Change-Id: I1c2910d04ddbd6013e5d228047106b41d80f9477

3 years agogdbserver: remove support for M32R
Simon Marchi [Fri, 12 Jun 2020 20:06:44 +0000 (16:06 -0400)] 
gdbserver: remove support for M32R

This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

* Makefile.in (SFILES): Remove linux-m32r-low.cc.
* configure.srv: Remove m32r case.
* linux-m32r-low.cc: Remove.

Change-Id: I5617b2b1fd92aeec19b38e0e3c0b78adaafdb35b

3 years agogdbserver: remove support for CRIS
Simon Marchi [Fri, 12 Jun 2020 20:06:43 +0000 (16:06 -0400)] 
gdbserver: remove support for CRIS

This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

* Makefile.in (SFILES): Remove linux-cris-low.c.
* configure.srv: Remove cris cases.
* linux-cris-low.cc, linux-crisv32-low.cc: Remove.

Change-Id: Ib3ff436b03373548215f15540a47f39cbec5f512

3 years agogdbserver: remove support for Blackfin
Simon Marchi [Fri, 12 Jun 2020 20:06:42 +0000 (16:06 -0400)] 
gdbserver: remove support for Blackfin

This port has been unmaintained for years and the upstream Linux kernel
does not support this architecture anymore, remove it.

gdbserver/ChangeLog:

* Makefile.in (SFILES): Remove linux-bfin-low.c.
* configure.srv: Remove bfin case.
* linux-bfin-low.cc: Remove.
* linux-low.cc: Remove BFIN-conditional code.

Change-Id: I846310d15e6386118ec7eabb1b87e647174560fb

3 years agogdbserver: remove support for Neutrino
Simon Marchi [Fri, 12 Jun 2020 20:06:41 +0000 (16:06 -0400)] 
gdbserver: remove support for Neutrino

This port has been unmaintained for years, remove it.

gdbserver/ChangeLog:

* configure: Re-generate.
* configure.ac: Remove srv_qnx test.
* configure.srv: Remove nto case.
* nto-low.cc, nto-low.h, nto-x86-low.cc: Remove.
* remote-utils.c: Remove __QNX__-guarded code.

Change-Id: I8a1ad9c740a69352da1f6993778dbf951eebb22f

3 years agogdbserver: remove support for LynxOS
Simon Marchi [Fri, 12 Jun 2020 20:06:41 +0000 (16:06 -0400)] 
gdbserver: remove support for LynxOS

This port has been unmaintained for years, remove it.

gdbserver/ChangeLog:

* configure: Re-generate.
* configure.ac: Remove srv_lynxos test.
* configure.srv: Remove lynxos cases.
* lynx-i386-low.cc, lynx-low.cc, lynx-low.h, lynx-ppc-low.c:
Remove.

Change-Id: I239d1cf1fc7b4c7a174251bc7981707eaba7d972

3 years agogdbserver: small cleanup of README file
Simon Marchi [Fri, 12 Jun 2020 20:01:26 +0000 (16:01 -0400)] 
gdbserver: small cleanup of README file

Fix a few outdated or incoherent things in the README:

- Don't mention remote.c nor *-stub.c files as references for the remote
  protocol.  remote.c is in GDB, not GDBserver, and *-stub.c files don't
  exist today.  Add a link to the documentation instead.

- In the "server (target) side" section, use `:2345` instead of
  `host:2345`.  It currently says that using `host:2345` means we would
  expect a connection from `host`.  That's not what I would expect by
  passing a host part here.  If I passed `11.22.33.44:2345` as the listen
  address, I would expect it to instruct gdbserver to listen only on that
  (11.22.33.44) network interface, not to expect a connection from host
  `11.22.33.44`.  So, remove that part of the sentence.

- Remove the list of supported target, refer to configure.srv instead.
  Keeping a list here is bound to lose sync with reality.

- In the cross-compile instructions, I don't think it's necessary to mention
  "In a Bourne shell".

- In the cross-compile instructions, I don't know what passing
  `your-target-name` to configure does, I don't think it's valid.  Use
  `make all-gdbserver` as in the instructions just above.

gdbserver/ChangeLog:

* README: Fix a few outdated or incoherent things.

Change-Id: I79349e25bc1bc53447855e0dea6cc7b9630f4553

3 years ago[gdbserver] Fix Wlto-type-mismatch for debug_agent
Tom de Vries [Fri, 12 Jun 2020 16:36:56 +0000 (18:36 +0200)] 
[gdbserver] Fix Wlto-type-mismatch for debug_agent

When building gdb including gdbserver with CFLAGS/CXXFLAGS -O2 -g -flto=auto,
I run into:
...
src/gdbserver/../gdbsupport/agent.h:47:13: error: type of 'debug_agent' \
  does not match original declaration [-Werror=lto-type-mismatch]
 extern bool debug_agent;
             ^
src/gdbserver/ax.cc:28:5: note: type 'int' should match type 'bool'
 int debug_agent = 0;
     ^
src/gdbserver/ax.cc:28:5: note: 'debug_agent' was previously declared here
src/gdbserver/ax.cc:28:5: note: code may be misoptimized unless \
  -fno-strict-aliasing is used
...

Fix this by changing the type of debug_agent in ax.cc from int to bool.

Tested on x86_64-linux.

3 years agogdb/testsuite: Prevent globals leaking between test scripts
Andrew Burgess [Fri, 12 Jun 2020 13:09:33 +0000 (15:09 +0200)] 
gdb/testsuite: Prevent globals leaking between test scripts

Many of the test scripts create variables in the global namespace,
these variables will then be present for the following test scripts.
In most cases this is harmless, but in some cases this can cause
problems.

For example, if a variable is created as an array in one script, but
then assigned as a scalar in a different script, this will cause a TCL
error.

The solution proposed in this patch is to have the GDB test harness
record a list of all known global variables at the point just before
we source the test script.  Then, after the test script has run, we
again iterate over all global variables.  Any variable that was not in
the original list is deleted, unless it was marked as a persistent global
variable using gdb_persistent_global.

The assumption here is that no test script should need to create a
global variable that will outlive the lifetime of the test script
itself.  With this patch in place all tests currently seem to pass, so
the assumption seems to hold.

gdb/testsuite/ChangeLog:

2020-06-12  Andrew Burgess  <andrew.burgess@embecosm.com>
    Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (gdb_known_globals, gdb_persistent_globals): New global.
(gdb_persistent_global, gdb_persistent_global_no_decl): New proc.
(gdb_setup_known_globals): New proc.
(gdb_cleanup_globals): New proc.
* lib/gdb.exp (load_lib): New override proc.
(gdb_stdin_log_init): Set var in_file as persistent global.
* lib/pascal.exp (gdb_stdin_log_init): Set vars
pascal_compiler_is_gpc, pascal_compiler_is_fpc, gpc_compiler and
fpc_compiler as persistent global.

3 years ago[gdb/testsuite] Don't leak tuiterm.exp spawn override
Tom de Vries [Fri, 12 Jun 2020 11:29:43 +0000 (13:29 +0200)] 
[gdb/testsuite] Don't leak tuiterm.exp spawn override

In lib/tuiterm.exp the builtin spawn is overridden by a tui-specific version.

After running the first test-case that imports tuiterm.exp, the override
remains active, so it can cause trouble in subsequent test-cases, even if they
do not import tuiterm.exp.  See f.i. commit c8d4f6dfd9 "[gdb/testsuite] Fix
spawn in tuiterm.exp".

Fix this by:
- adding a variable gdb_finish_hooks which is a list of procs to run during
  gdb_finish
- adding a proc tuiterm_env that is used in test-cases instead of
  "load_lib tuiterm.exp".
- letting tuiterm_env:
  - install the tui-specific spawn version, and
  - use the gdb_finish_hooks to schedule restoring the builtin spawn
    version.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-12  Tom de Vries  <tdevries@suse.de>

* lib/tuiterm.exp (spawn): Rename to ...
(tui_spawn): ... this.
(toplevel): Move rename of spawn ...
(gdb_init_tuiterm): ... here.  New proc.
(gdb_finish_tuiterm): New proc.
* lib/gdb.exp (gdb_finish_hooks): New global var.
(gdb_finish): Handle gdb_finish_hooks.
(tuiterm_env): New proc.
* gdb.python/tui-window.exp: Replace load_lib tuiterm.exp with
tuiterm_env.
* gdb.tui/basic.exp: Same.
* gdb.tui/corefile-run.exp: Same.
* gdb.tui/empty.exp: Same.
* gdb.tui/list-before.exp: Same.
* gdb.tui/list.exp: Same.
* gdb.tui/main.exp: Same.
* gdb.tui/new-layout.exp: Same.
* gdb.tui/regs.exp: Same.
* gdb.tui/resize.exp: Same.
* gdb.tui/tui-layout-asm-short-prog.exp: Same.
* gdb.tui/tui-layout-asm.exp: Same.
* gdb.tui/tui-missing-src.exp: Same.
* gdb.tui/winheight.exp: Same.

3 years ago[gdb/testsuite] Don't abort testrun for invalid command in test-case
Tom de Vries [Fri, 12 Jun 2020 07:13:17 +0000 (09:13 +0200)] 
[gdb/testsuite] Don't abort testrun for invalid command in test-case

Say we add a call to foobar at the end of a test-case, and run the
test-suite.  We'll run into a dejagnu error:
...
ERROR: (DejaGnu) proc "foobar" does not exist.
...
and the test-suite run is aborted.

It's reasonable that the test-case is aborted, but it's not reasonable that
the testsuite run is aborted.

Problems in one test-case should not leak into other test-cases, and they
generally don't.  The exception is the "invalid command name" problem due to
an override of ::unknown in dejagnu's framework.exp.

Fix this by reverting dejagnu's ::unknown override for the duration of each
test-case, using the gdb_init/gdb_finish hooks.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-12  Tom de Vries  <tdevries@suse.de>

PR testsuite/26110
* lib/gdb.exp (gdb_init): Revert dejagnu's override of ::unknown.
(gdb_finish): Reinstall dejagnu's override of ::unknown.

3 years agoRISC-V: Update the rebuild-csr-xml.sh.
Nelson Chu [Thu, 11 Jun 2020 01:42:40 +0000 (18:42 -0700)] 
RISC-V: Update the rebuild-csr-xml.sh.

We add new arguments defined and aborted verisons for DECLARE_CSR to
support privileged versions controling in binutils.  Therefore, the
rebuild-csr-xml.sh should be updated, too.

gdb/
* features/riscv/rebuild-csr-xml.sh: Updated.

3 years agoRISC-V: Drop the privileged spec v1.9 support.
Nelson Chu [Wed, 10 Jun 2020 06:07:54 +0000 (14:07 +0800)] 
RISC-V: Drop the privileged spec v1.9 support.

There is a conflict between v1.9 and v1.9.1 - CSR MISA address.  MISA is
0xf10 in v1.9, but change to 0x301 in v1.9.1.  The change made MISA writable,
but may also cause risk of compatibility.  Binutils already support the
-mpriv-spec options and ELF priv attributes, which can used to choose what
privileged spec you want, and then give a correponding CSR name and address
to use.  But Gdb and other tools don't have the simialr mechanism for now.
However, there are two things can be confirmed,

1. If we don't have a way to control the priv specs, then the changes, like
MISA, will cause risk and hard to maintain.

2. We get the guarantee that the CSR address won't be reused in the future
specs, even if it is dropped.

I'm not sure if Gdb needs to care about the priv spec versions, it is still
discussing.  But drop the priv spec v1.9, and make sure that we won't reuse
the CSR address is a useful solution for now.  Also, we might drop the v1.9.1
in a year or two.  After that, specs above v1.10 should be compatible anyway.

gas/
* testsuite/gas/riscv/priv-reg-fail-version-1p9.d: Removed.
* testsuite/gas/riscv/priv-reg-fail-version-1p9.l: Likewise.
* testsuite/gas/riscv/priv-reg-version-1p9.d: Likewise.

include/
* opcode/riscv-opc.h: Update the defined versions of CSR from
PRIV_SPEC_CLASS_1P9 to PRIV_SPEC_CLASS_1P9P1.  Also, drop the
MISA DECLARE_CSR_ALIAS since it's aborted version is v1.9.
* opcode/riscv.h (enum riscv_priv_spec_class): Remove
PRIV_SPEC_CLASS_1P9.

opcodes/
* riscv-opc.c (priv_specs): Remove v1.9 and PRIV_SPEC_CLASS_1P9.

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 12 Jun 2020 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoUpdate documentation for Ada .gdb_index
Tom Tromey [Thu, 11 Jun 2020 15:45:51 +0000 (09:45 -0600)] 
Update documentation for Ada .gdb_index

.gdb_index now supports Ada, so update the documentation to reflect
this.

gdb/doc/ChangeLog
2020-06-11  Tom Tromey  <tromey@adacore.com>

* gdb.texinfo (Index Files): Reword.  Remove Ada limitation.

3 years agoFix hex floating point lexing
Tom Tromey [Thu, 11 Jun 2020 16:34:31 +0000 (10:34 -0600)] 
Fix hex floating point lexing

PR gdb/18318 notes that gdb will sometimes incorrectly handle hex
floating point input.  This turns out to be a bug in the C lexer; the
'p' was not being correctly recognized, and so the exponent was not
always passed to the floating point "from_string" method.

Tested by the buildbot "Fedora-x86_64-m64" builder.

gdb/ChangeLog
2020-06-11  Tom Tromey  <tom@tromey.com>

PR gdb/18318:
* c-exp.y (lex_one_token): Handle 'p' like 'e'.

gdb/testsuite/ChangeLog
2020-06-11  Tom Tromey  <tom@tromey.com>

PR gdb/18318:
* gdb.base/printcmds.exp (test_float_accepted): Add more hex
floating point tests.

3 years agogdb: add mailing list and IRC information to --help
Jonny Grant [Thu, 11 Jun 2020 14:30:03 +0000 (10:30 -0400)] 
gdb: add mailing list and IRC information to --help

A few user-vibisble changes to the --help output:

 * Remove unnecessary quotes around bug url.
 * Mention the mailing list and IRC channel as places where users can
   ask GDB-related questions.
 * Add empty lines between items in the footer, to improve readability.
 * Remove unnecessary new line at the end of output.

2020-06-09  Jonny Grant  <jg@jguk.org>
2020-06-09  Simon Marchi  <simon.marchi@polymtl.ca>

* main.c (captured_main_1): Don't print new line after help.
(print_gdb_help): add mailing list and IRC channel information
to --help.  Add new lines between items in the footer.  Remove
quotes around bug url.

Signed-off-by: Jonathan Grant <jg@jguk.org>
Change-Id: Ibd0746a348d558fb35b5cd7e366f107742806565

3 years agoCompute proper length for dynamic types of TYPE_CODE_TYPEDEF
Keith Seitz [Thu, 11 Jun 2020 12:34:44 +0000 (14:34 +0200)] 
Compute proper length for dynamic types of TYPE_CODE_TYPEDEF

This patch fixes gdb/21356 in which we hit an assertion in
value_contents_bits_eq:

(gdb) p container_object2
(gdb) p container_object2
$1 = {_container_member2 = 15, _vla_struct_object2 = {_some_member = 0,
    _vla_field = {
../../src/gdb/value.c:829: internal-error: \
  int value_contents_bits_eq(const value*, int, const value*, int, int): \
  Assertion `offset1 + length \
             <= TYPE_LENGTH (val1->enclosing_type) * TARGET_CHAR_BIT' failed.

This is happening because TYPE_LENGTH (val1->enclosing_type) is erroneously
based on enclosing_type, which is a typedef, instead of the actual underlying
type.

This can be traced back to resolve_dynamic_struct, where the size of the
type is computed:
...
        TYPE_FIELD_TYPE (resolved_type, i)
          = resolve_dynamic_type_internal (TYPE_FIELD_TYPE (resolved_type, i),
                                           &pinfo, 0);
        gdb_assert (TYPE_FIELD_LOC_KIND (resolved_type, i)
                    == FIELD_LOC_KIND_BITPOS);

        new_bit_length = TYPE_FIELD_BITPOS (resolved_type, i);
        if (TYPE_FIELD_BITSIZE (resolved_type, i) != 0)
          new_bit_length += TYPE_FIELD_BITSIZE (resolved_type, i);
        else
          new_bit_length += (TYPE_LENGTH (TYPE_FIELD_TYPE (resolved_type, i))
                             * TARGET_CHAR_BIT);
...

In this function, resolved_type is TYPE_CODE_TYPEDEF which is not what we
want to use to calculate the size of the actual field.

This patch fixes this and the similar problem in resolve_dynamic_union.

gdb/ChangeLog:
2020-06-11  Keith Seitz  <keiths@redhat.com>

PR gdb/21356
* gdbtypes.c (resolve_dynamic_union, resolve_dynamic_struct):
Resolve typedefs for type length calculations.

gdb/testsuite/ChangeLog:
2020-06-11  Keith Seitz  <keiths@redhat.com>

PR gdb/21356
* gdb.base/vla-datatypes.c (vla_factory): Add typedef for struct
vla_struct.
Add new struct vla_typedef and union vla_typedef_union and
corresponding instantiation objects.
Initialize new objects.
* gdb.base/vla-datatypes.exp: Add tests for vla_typedef_struct_object
and vla_typedef_union_object.
Fixup type for vla_struct_object.

3 years ago[gdb/testsuite] Make gdb.base/dbx.exp more robust
Tom de Vries [Thu, 11 Jun 2020 12:10:05 +0000 (14:10 +0200)] 
[gdb/testsuite] Make gdb.base/dbx.exp more robust

Test-case gdb.base/dbx.exp overrides:
- the GDBFLAGS variable
- the gdb_file_cmd proc

There's code at the end of the test-case to restore both, but that's not
guaranteed to be executed.

Fix this by:
- using save_vars to restore GDBFLAGS
- using a new proc with_override to restore gdb_file_cmd

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-11  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (with_override): New proc, factored out of ...
* gdb.base/dbx.exp: ... here.  Use with_override and save_vars.

3 years ago[PATCH]: aarch64: Refactor representation of system registers
Alex Coplan [Thu, 11 Jun 2020 11:34:37 +0000 (12:34 +0100)] 
[PATCH]: aarch64: Refactor representation of system registers

Prior to this patch, the information describing the AArch64 system
registers was separate from the information describing which system
registers are available depending on the CPU feature set. Indeed, the
latter was implemented as a separate function from the main table with
the system register information.

This patch remedies this situation and puts the feature information into
the system register table itself.

This has several advantages:

 * Having all the information described in one place is easier to
   maintain.
 * The logic to check whether a system register is supported now becomes
   trivial (and much more efficient).

Since this patch ended up touching every line of the system register
table, I took the opportunity to make the formatting more consistent and
remove some redundant comments.

Note that there is still more refactoring that could be done along the
same lines here (e.g. with the TLB instructions) but this seemed like a
reasonable first pass.

Testing:

 * Regression tested an x64 -> aarch64-none-elf cross binutils.
 * Built aarch64-none-elf cross toolchain, checked newlib startup
   code still works.
 * Bootstrapped binutils on aarch64-linux-gnu, regression tested.
 * Built aarch64 kernel using new binutils with allyesconfig.

OK for master? If so, I'll need a maintainer to commit on my behalf
since I don't have write access.

Thanks,
Alex

---

include/ChangeLog:

2020-06-11  Alex Coplan  <alex.coplan@arm.com>

* opcode/aarch64.h (aarch64_sys_reg): Add required features to struct
describing system registers.

opcodes/ChangeLog:

2020-06-11  Alex Coplan  <alex.coplan@arm.com>

* aarch64-opc.c (SYSREG): New macro for describing system registers.
(SR_CORE): Likewise.
(SR_FEAT): Likewise.
(SR_RNG): Likewise.
(SR_V8_1): Likewise.
(SR_V8_2): Likewise.
(SR_V8_3): Likewise.
(SR_V8_4): Likewise.
(SR_PAN): Likewise.
(SR_RAS): Likewise.
(SR_SSBS): Likewise.
(SR_SVE): Likewise.
(SR_ID_PFR2): Likewise.
(SR_PROFILE): Likewise.
(SR_MEMTAG): Likewise.
(SR_SCXTNUM): Likewise.
(aarch64_sys_regs): Refactor to store feature information in the table.
(aarch64_sys_reg_supported_p): Collapse logic for system registers
that now describe their own features.
(aarch64_pstatefield_supported_p): Likewise.

3 years agoRun certain ld-plugun lto tests only for ELF
Alan Modra [Thu, 11 Jun 2020 08:23:30 +0000 (17:53 +0930)] 
Run certain ld-plugun lto tests only for ELF

lto-6.c refers to _etext, pr12760b.c has a .gnu.warning section,
the pr23818 test uses readelf, and pr23958.c has a .symver directive.

* testsuite/ld-plugin/lto.exp (lto_link_tests): Move lto-6,
pr12760, pr23818 and pr23958 tests to..
(lto_link_elf_tests): ..here.

3 years agoFix a compile time warning in the linker testsuite when compiling using clang.
Nick Clifton [Thu, 11 Jun 2020 08:27:41 +0000 (09:27 +0100)] 
Fix a compile time warning in the linker testsuite when compiling using clang.

* testsuite/ld-elf/pr26094-1b.c (main): Change return type to
int.

3 years agoPR26107, Compilation failure in pdp11.c
Alan Modra [Thu, 11 Jun 2020 06:18:12 +0000 (15:48 +0930)] 
PR26107, Compilation failure in pdp11.c

PR 26107
* pdp11.c (is_stab): Replace legacy "index" function with "strchr".

3 years agoRe: asan: readelf: process_mips_specific buffer overflow
Alan Modra [Thu, 11 Jun 2020 05:08:26 +0000 (14:38 +0930)] 
Re: asan: readelf: process_mips_specific buffer overflow

Let's do without that unnecessary internal option buffer.  This also
fixes another bug in that the REGINFO data was being taken from the
calloc'd internal option buffer, so was all zeros.

* readelf.c (process_mips_specific): Don't alloc memory for
Elf_Internal_Options.

3 years agoasan: readelf: process_mips_specific buffer overflow
Alan Modra [Thu, 11 Jun 2020 03:57:50 +0000 (13:27 +0930)] 
asan: readelf: process_mips_specific buffer overflow

DT_MIPS_OPTIONS is not a regular array as assumed by readelf.  This
patch corrects that assumption, and to do so easily, makes various
internal (host byte order) structs the same size as external (target
byte order) structs.

include/
* elf/mips.h (Elf32_RegInfo): Use fixed width integer types.
(Elf64_Internal_RegInfo, Elf_Internal_Options): Likewise.
binutils/
* readelf.c (process_mips_specific): Assert size of internal
types match size of external types, and simplify allocation of
internal buffer.  Catch possible integer overflow when sanity
checking option size.  Don't assume options are a regular array.
Sanity check reginfo option against option size.  Use PRI macros
when printing.

3 years agogdb: fix whitespaces in ChangeLog
Simon Marchi [Thu, 11 Jun 2020 03:00:20 +0000 (23:00 -0400)] 
gdb: fix whitespaces in ChangeLog

Replace 8 spaces with tabs.

Change-Id: I60f2df3a2866f75f0307077bf6cb1fa3918f8180

3 years agogdb/doc: remove broken links Previous and Up from contents
Jonny Grant [Thu, 11 Jun 2020 02:56:31 +0000 (22:56 -0400)] 
gdb/doc: remove broken links Previous and Up from contents

gdb/doc/ChangeLog:

* gdb.texinfo: Remove broken links Previous and Up from
contents.

Signed-off-by: Jonny Grant <jg@jguk.org>
Change-Id: Iad7323580a3c0c7f00eab1264d66f39e8d156e38

3 years agoia64: Set DF_TEXTREL instead of reltext
H.J. Lu [Thu, 11 Jun 2020 01:15:13 +0000 (18:15 -0700)] 
ia64: Set DF_TEXTREL instead of reltext

Update ia64 ELF backend to set DF_TEXTREL for dynamic relocs against
readonly sections like other backends.

* elfnn-ia64.c (elfNN_ia64_link_hash_table): Remove reltext.
(allocate_dynrel_entries): Set DF_TEXTREL instead of reltext.
(elfNN_ia64_size_dynamic_sections): Check DF_TEXTREL instead
of reltext.

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 11 Jun 2020 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoFix x86 ld testsuite fails with glibc < 2.28
Alan Modra [Wed, 10 Jun 2020 03:38:15 +0000 (13:08 +0930)] 
Fix x86 ld testsuite fails with glibc < 2.28

* testsuite/ld-elf/linux-x86.exp: Build tests when non-native.
(check_pr25749b): Add optional args.  Set expected pass file
from args.  Run -1b and -2a tests with passall.out.
* testsuite/ld-elf/passall.out: New file.
* testsuite/ld-elf/pr25749-1.c: Adjust to pass with older glibc.
* testsuite/ld-elf/pr25749-2.c: Likewise.
* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Use
regexp_diff to compare expected output from running binary.

3 years ago[gdb/symtab] Enable ada .gdb_index
Tom de Vries [Wed, 10 Jun 2020 12:46:53 +0000 (14:46 +0200)] 
[gdb/symtab] Enable ada .gdb_index

Currently the .gdb_index is not enabled for ada executables (PR24713).

Fix this by adding the required support in write_psymbols, similar to how that
is done for .debug_names in debug_names::insert.

Tested on x86_64-linux, with native and target board cc-with-gdb-index.

gdb/ChangeLog:

2020-06-10  Tom de Vries  <tdevries@suse.de>

PR ada/24713
* dwarf2/index-write.c (struct mapped_symtab): Add m_string_obstack.
(write_psymbols): Enable .gdb_index for ada.
* dwarf2/read.c: Remove comment stating .gdb_index is unsupported for
ada.

gdb/testsuite/ChangeLog:

2020-06-10  Tom de Vries  <tdevries@suse.de>

* gdb.ada/ptype_union.exp: Remove PR24713 workaround.

3 years ago[gdb/symtab] Fix name lookup in dw2_map_matching_symbols
Tom de Vries [Wed, 10 Jun 2020 12:46:53 +0000 (14:46 +0200)] 
[gdb/symtab] Fix name lookup in dw2_map_matching_symbols

In commit 9a0bacfb08 "[gdb/symtab] Handle .gdb_index in ada language mode", a
missing part of dw2_map_matching_symbols was added, containing a call to
dw2_expand_symtabs_matching_symbol.

However, the callback passed to that call has one problem: the callback has an
argument "offset_type namei", which is ignored.  Instead, match_name is passed
as argument to dw2_symtab_iter_init, where a name lookup is done, which may or
may not yield the same value as namei.

Fix this by creating a new version of dw2_symtab_iter_init that takes a
"offset_type namei" argument instead of "const char *name", and passing namei.

Tested on x86_64-linux, with native and target board cc-with-gdb-index.

gdb/ChangeLog:

2020-06-10  Tom de Vries  <tdevries@suse.de>

* dwarf2/read.c (dw2_symtab_iter_init_common): Factor out of ...
(dw2_symtab_iter_init): ... here.  Add variant with "offset_type
namei" instead of "const char *name" argument.
(dw2_map_matching_symbols): Use "offset_type namei" variant of
dw2_symtab_iter_init.

3 years agoELF: Properly handle section symbols
H.J. Lu [Wed, 10 Jun 2020 12:31:19 +0000 (05:31 -0700)] 
ELF: Properly handle section symbols

When defining the section symbol, __start_FOO, for the section FOO:

1. Treat the common symbol, __start_FOO, in input object file as
definition.
2. Clear verinfo.verdef.

bfd/

PR ld/26094
* elflink.c (bfd_elf_define_start_stop): Handle common symbols.
Clear verinfo.verdef.

ld/

PR ld/26094
* testsuite/ld-elf/pr26094-1.ver: New fike.
* testsuite/ld-elf/pr26094-1a.c: Likewise.
* testsuite/ld-elf/pr26094-1a.rd: Likewise.
* testsuite/ld-elf/pr26094-1b.c: Likewise.
* testsuite/ld-elf/pr26094-1b.rd: Likewise.
* testsuite/ld-elf/pr26094-1c.c: Likewise.
* testsuite/ld-elf/shared.exp: Run ld/26094 tests.

3 years agoFix the windmc program to conform to the behaviour of mc.exe by rejecting lines that...
Ralf Habacker [Wed, 10 Jun 2020 09:07:26 +0000 (10:07 +0100)] 
Fix the windmc program to conform to the behaviour of mc.exe by rejecting lines that reach end-of-file without a terminating newline character.

PR 26082
* mclex.c (yylex): Reject lines that reach end-of-file without a
terminating newline character.

3 years agogdb/testsuite: fix duplicate test names in gdb.base/index-cache.exp
Simon Marchi [Wed, 10 Jun 2020 03:14:46 +0000 (23:14 -0400)] 
gdb/testsuite: fix duplicate test names in gdb.base/index-cache.exp

Fix:

    DUPLICATE: gdb.base/index-cache.exp: test_cache_disabled: no files were created
    DUPLICATE: gdb.base/index-cache.exp: test_cache_disabled: check index-cache stats

We use `proc_with_prefix` for test_cache_disabled, but we call it twice.  So we
need an additional prefix to identify the specific call.  This patch adds that.

gdb/testsuite/ChangeLog:

* gdb.base/index-cache.exp (test_cache_disabled): Add test_prefix
parameter, update callers.

Change-Id: Idf382fd380c77a654e8a7aa236af50b65c96b1d2

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 10 Jun 2020 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoIFUNC: Update IFUNC resolver check with DT_TEXTREL
H.J. Lu [Tue, 9 Jun 2020 13:56:55 +0000 (06:56 -0700)] 
IFUNC: Update IFUNC resolver check with DT_TEXTREL

Add ifunc_resolvers to elf_link_hash_table and use it for both x86 and
ppc64.  Before glibc commit b5c45e837, DT_TEXTREL is incompatible with
IFUNC resolvers.  Set ifunc_resolvers if there are IFUNC resolvers and
issue a warning for IFUNC resolvers with DT_TEXTREL.

bfd/

PR ld/18801
* elf-bfd.h (elf_link_hash_table): Add ifunc_resolvers.
(_bfd_elf_allocate_ifunc_dyn_relocs): Remove the
bfd_boolean * argument.  Set ifunc_resolvers if there are IFUNC
resolvers.
* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Updated.
Set ifunc_resolvers if there are FUNC resolvers.
* elf64-ppc.c (ppc_link_hash_table): Remove local_ifunc_resolver.
(build_global_entry_stubs_and_plt): Replace local_ifunc_resolver
with elf.ifunc_resolvers.
(write_plt_relocs_for_local_syms): Likewise.
(ppc64_elf_relocate_section): Likewise.
(ppc64_elf_finish_dynamic_sections): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_allocate_ifunc_dynrelocs):
Updated.
* elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
(_bfd_x86_elf_size_dynamic_sections): Check elf.ifunc_resolvers
instead of readonly_dynrelocs_against_ifunc.
* elfxx-x86.h (elf_x86_link_hash_table): Remove
readonly_dynrelocs_against_ifunc.

ld/

PR ld/18801
* testsuite/ld-i386/i386.exp: Run ifunc-textrel-1a,
ifunc-textrel-1b, ifunc-textrel-2a and ifunc-textrel-2b.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/ifunc-textrel-1a.d: Likewise.
* testsuite/ld-i386/ifunc-textrel-1b.d: Likewise.
* testsuite/ld-i386/ifunc-textrel-2a.d: Likewise.
* testsuite/ld-i386/ifunc-textrel-2b.d: Likewise.
* testsuite/ld-x86-64/ifunc-textrel-1.s: Likewise.
* testsuite/ld-x86-64/ifunc-textrel-1a.d: Likewise.
* testsuite/ld-x86-64/ifunc-textrel-1b.d: Likewise.
* testsuite/ld-x86-64/ifunc-textrel-2.s: Likewise.
* testsuite/ld-x86-64/ifunc-textrel-2a.d: Likewise.
* testsuite/ld-x86-64/ifunc-textrel-2b.d: Likewise.
* testsuite/ld-i386/pr18801a.d: Expect warning for IFUNC
resolvers.
* testsuite/ld-i386/pr18801b.d: Likewise.
* estsuite/ld-x86-64/pr18801a.d: Likewise.
* estsuite/ld-x86-64/pr18801b.d: Likewise.

3 years agoi386-dis.c: Fix a typo in comments
H.J. Lu [Tue, 9 Jun 2020 13:29:33 +0000 (06:29 -0700)] 
i386-dis.c: Fix a typo in comments

* i386-dis.c (prefix_table): Fix a typo in comments.

3 years ago[PATCH] gas/doc: improve AVR modifiers wording.
Seth Girvan [Tue, 9 Jun 2020 10:13:39 +0000 (11:13 +0100)] 
[PATCH] gas/doc: improve AVR modifiers wording.

* doc/c-avr.texi: Improve wording.

3 years agox86: add missing 64-bit tests for "don't ignore mandatory pseudo prefixes"
Jan Beulich [Tue, 9 Jun 2020 09:28:15 +0000 (11:28 +0200)] 
x86: add missing 64-bit tests for "don't ignore mandatory pseudo prefixes"

Commit da4977e00b73 added the 32-bit test files, but failed to add the
64-bit ones.

3 years agoPR26065, ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail
Alan Modra [Tue, 9 Jun 2020 07:32:12 +0000 (17:02 +0930)] 
PR26065, ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail

PR 26065
* testsuite/ld-elf/shared.exp: Compile dl4main.c -fPIC.
(dl4e, dl4f): Expect dl4a.out.
* testsuite/ld-elf/dl4e.out: Delete.

3 years agox86: consistently print prefixes explicitly which are invalid with VEX etc
Jan Beulich [Tue, 9 Jun 2020 06:59:04 +0000 (08:59 +0200)] 
x86: consistently print prefixes explicitly which are invalid with VEX etc

All of data size, rep, lock, and rex prefixes are invalid with VEX- and
alike encoded insns. Make sure they get printed explicitly in all cases,
to signal the anomaly. With this, do away with "rex_ignored" - if there
is a rex prefix, we want to print it anyway for VEX etc (and there's
nothing "ignored" about it in the first place - such an instruction will
raise #UD).

3 years agox86: fix {,V}MOV{L,H}PD disassembly
Jan Beulich [Tue, 9 Jun 2020 06:57:55 +0000 (08:57 +0200)] 
x86: fix {,V}MOV{L,H}PD disassembly

Neither the legacy nor the VEX-encoded forms are permitted with register
operands, just like is already the case for their store forms as well as
{,V}MOV{L,H}PS.

At the same time, besides folding respective vex_len_table[] entries,
adjust adjacent related legacy mod_table[] entries:
- when the prefix was already decoded, PREFIX_OPCODE is pointless,
- limit the amount of string literals by using X consistently on all
  {,V}MOV{L,H}P{S,D} forms.

3 years agox86: utilize X macro in EVEX decoding
Jan Beulich [Tue, 9 Jun 2020 06:57:22 +0000 (08:57 +0200)] 
x86: utilize X macro in EVEX decoding

For major opcodes allowing only packed FP kinds of operands, i.e. the
ones where legacy and AVX decoding uses the X macro, we can do so for
AVX512 as well, by attaching to the checking logic the "EVEX.W must
match presence of embedded 66 prefix" rule. (Encodings not following
this general pattern simply may not gain the PREFIX_OPCODE attribute.)

Note that testing of the thus altered decoding has already been put in
place by "x86: correct decoding of packed-FP-only AVX encodings".

This can also be at least partly applied to scalar-FP-only insns (i.e.
V{,U}COMIS{S,D}) as well as the vector-FP forms of insns also allowing
scalar encodings (e.g. VADDP{S,D}).

Take the opportunity and also fix EVEX-encoded VMOVNTP{S,D} as well as
to-memory forms of VMOV{L,H}PS and both forms of VMOV{L,H}PD to wrongly
disassemble with only register operands.

3 years agox86: correct decoding of packed-FP-only AVX encodings
Jan Beulich [Tue, 9 Jun 2020 06:56:39 +0000 (08:56 +0200)] 
x86: correct decoding of packed-FP-only AVX encodings

Various AVX insns utilizing the X macro fail to reject F3/F2 embedded
prefix encodings. As the PREFIX_OPCODE attribute wasn't used by any
non-legacy-encoded insns so far, re-use it to achieve the intended
effect.

3 years agox86: correct mis-named MOD_0F51 enumerator
Jan Beulich [Tue, 9 Jun 2020 06:55:50 +0000 (08:55 +0200)] 
x86: correct mis-named MOD_0F51 enumerator

This is for extension major opcode 50, so name it accordingly.

3 years agox86-64: adjust far indirect branch handling
Jan Beulich [Tue, 9 Jun 2020 06:47:31 +0000 (08:47 +0200)] 
x86-64: adjust far indirect branch handling

An unwanted side effect of 5990e377e5a3 ("x86-64: Intel64 adjustments
for insns dealing with far pointers") was that with -mintel64 LCALL and
LJMP would now default to 64-bit operand size. Since 64-bit far branches
aren't portable, the default operand size should still be 32-bit.
However, since the 64-bit variant is permitted, an ambiguous operand
warning should be issued.

As to the actual code change, please note that the conditional
surrounding the switch() that gets adjusted covers several cases which
are of no interest to or benign in 64-bit mode, hence the new
conditional added can be quite a bit less involved.

3 years agox86: don't ignore mandatory pseudo prefixes
Jan Beulich [Tue, 9 Jun 2020 06:46:22 +0000 (08:46 +0200)] 
x86: don't ignore mandatory pseudo prefixes

{vex}, {vex3}, and {evex} are mandatory prefixes, and hence should not
be randomly ignored. Fix this for insns without operands as well as for
insns referencing the high 16 [XYZ]MM registers. To achieve the former,
re-purpose VEX_check_operands(), renaming it to VEX_check_encoding() and
moving its only operand check to check_VecOperands().

This involves fixing a testcase relying on {vex2} to get ignored.

3 years agoPowerPC64: Downgrade ifunc with textrel error to a warning
Alan Modra [Tue, 9 Jun 2020 00:02:10 +0000 (09:32 +0930)] 
PowerPC64: Downgrade ifunc with textrel error to a warning

For ppc64 I set flags when recording the dynamic relocation rather
than when allocating space.  That allows you to distinguish three
cases:
1) The dynamic ifunc relocation is in an executable and will always be
   to an ifunc resolver in the executable.
2) The dynamic ifunc relocation is in a shared library which provides
   an ifunc resolver, but that may be overridden at runtime to use a
   resolver in another binary.
3) The dynamic ifunc relocation is not to a locally defined ifunc
   resolver.

Case (3) won't cause a segfault trying to run resolver code that is
non-exec on older glibc.

I made case (1) an error for ppc64, but since newer glibc ld.so does
allow running ifunc resolvers when segments are writable I suppose I
should downgrade that to a warning like case (2).

* elf64-ppc.c (struct ppc_link_hash_table): Delete
maybe_local_ifunc_resolver field.
(build_global_entry_stubs_and_plt): Set local_ifunc_resolver in
cases where maybe_local_ifunc_resolver was set.
(ppc64_elf_relocate_section): Likewise.
(ppc64_elf_finish_dynamic_sections): Downgrade ifunc with textrel
error to a warning.

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 9 Jun 2020 00:00:34 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agogdb: remove TYPE_FIELD_TYPE macro
Simon Marchi [Mon, 8 Jun 2020 19:26:20 +0000 (15:26 -0400)] 
gdb: remove TYPE_FIELD_TYPE macro

Remove the `TYPE_FIELD_TYPE` macro, changing all the call sites to use
`type::field` and `field::type` directly.

gdb/ChangeLog:

* gdbtypes.h (TYPE_FIELD_TYPE): Remove.  Change all call sites
to use type::field and field::type instead.

Change-Id: Ifda6226a25c811cfd334a756a9fbc5c0afdddff3

3 years agogdb: remove FIELD_TYPE macro
Simon Marchi [Mon, 8 Jun 2020 19:26:06 +0000 (15:26 -0400)] 
gdb: remove FIELD_TYPE macro

Remove the `FIELD_TYPE` macro, changing all the call sites to use
`field::type` directly.

gdb/ChangeLog:

* gdbtypes.h (FIELD_TYPE): Remove.  Change all call sites
to use field::type instead.

Change-Id: I7673fedaa276e485189c87991a9043495da22ef5

3 years agogdb: add field::type / field::set_type
Simon Marchi [Mon, 8 Jun 2020 19:26:04 +0000 (15:26 -0400)] 
gdb: add field::type / field::set_type

Add the `type` and `set_type` methods on `struct field`, in order to
remoremove the `FIELD_TYPE` macro.  In this patch, the `FIELD_TYPE`
macro is changed to use `field::type`, so all the call sites that are
useused to set the field's type are changed to use `field::set_type`.
The next patch will remove `FIELD_TYPE` completely.

Note that because of the name clash between the existing field named
`type` and the new method, I renamed the field `m_type`.  It is not
private per-se, because we can't make `struct field` a non-POD yet, but
it should be considered private anyway (not accessed outside `struct
field`).

gdb/ChangeLog:

* gdbtypes.h (struct field) <type, set_type>: New methods.
Rename `type` field to...
<m_type>: ... this.  Change references throughout to use type or
set_type methods.
(FIELD_TYPE): Use field::type.  Change call sites that modify
the field's type to use field::set_type instead.

Change-Id: Ie21f866e3b7f8a51ea49b722d07d272a724459a0

3 years agogdb: remove TYPE_INDEX_TYPE macro
Simon Marchi [Mon, 8 Jun 2020 19:25:53 +0000 (15:25 -0400)] 
gdb: remove TYPE_INDEX_TYPE macro

Remove `TYPE_INDEX_TYPE` macro, changing all the call sites to use
`type::index_type` directly.

gdb/ChangeLog:

* gdbtypes.h (TYPE_INDEX_TYPE): Remove.  Change all call sites
to use type::index_type instead.

Change-Id: I56715df0bdec89463cda6bd341dac0e01b2faf84

3 years agogdb: add type::index_type / type::set_index_type
Simon Marchi [Mon, 8 Jun 2020 19:25:50 +0000 (15:25 -0400)] 
gdb: add type::index_type / type::set_index_type

Add the `index_type` and `set_index_type` methods on `struct type`, in
order to remove the `TYPE_INDEX_TYPE` macro.  In this patch, the
`TYPE_INDEX_TYPE` macro is changed to use `type::index_type`, so all the
call sites that are used to set the type's index type are changed to use
`type::set_index_type`.  The next patch will remove `TYPE_INDEX_TYPE`
completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <index_type, set_index_type>: New
methods.
(TYPE_INDEX_TYPE): Use type::index_type.
* gdbtypes.c (create_array_type_with_stride): Likewise.

Change-Id: I93bdca9de9f3e143d2ccea59310c63745315e18d

3 years ago[PATCH] arm: Add DFB instruction for ARMv8-R
Alex Coplan [Mon, 8 Jun 2020 14:16:29 +0000 (15:16 +0100)] 
[PATCH] arm: Add DFB instruction for ARMv8-R

gas/ChangeLog:
2020-06-08  Alex Coplan  <alex.coplan@arm.com>

* config/tc-arm.c (insns): Add dfb.
* testsuite/gas/arm/dfb.d: New test.
* testsuite/gas/arm/dfb.s: Input for test.

opcodes/ChangeLog:
2020-06-08  Alex Coplan  <alex.coplan@arm.com>

* arm-dis.c (arm_opcodes): Add dfb.
(thumb32_opcodes): Add dfb.

3 years agoELF: Move tlsdesc_plt/tlsdesc_got to elf_link_hash_table
H.J. Lu [Mon, 8 Jun 2020 11:24:04 +0000 (04:24 -0700)] 
ELF: Move tlsdesc_plt/tlsdesc_got to elf_link_hash_table

All ELF backends with TLS descriptor support have

  /* The offset into splt of the PLT entry for the TLS descriptor
     resolver.  Special values are 0, if not necessary (or not found
     to be necessary yet), and -1 if needed but not determined
     yet.  */
  bfd_vma tlsdesc_plt;

  /* The GOT offset for the lazy trampoline.  Communicated to the
     loader via DT_TLSDESC_GOT.  The magic value (bfd_vma) -1
     indicates an offset is not allocated.  */
  bfd_vma tlsdesc_got;

in symbol hash entry.  Move tlsdesc_plt/tlsdesc_got to elf_link_hash_entry
to reduce code duplication.

* elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt and
tlsdesc_got.
* elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt
and dt_tlsdesc_got.
(elf32_arm_size_dynamic_sections): Updated.  Clear
root.tlsdesc_plt for DF_BIND_NOW.
(elf32_arm_finish_dynamic_sections): Updated.
(elf32_arm_output_arch_local_syms): Likewise.
* elf32-nds32.c (nds32_elf_size_dynamic_sections): Updated.
Clear root.tlsdesc_plt for DF_BIND_NOW.
(nds32_elf_finish_dynamic_sections): Updated.
* elf32-nds32.h (elf_nds32_link_hash_table): Remove
dt_tlsdesc_plt and dt_tlsdesc_got.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated.
* elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
tlsdesc_plt and dt_tlsdesc_got.
(elfNN_aarch64_allocate_dynrelocs): Updated.
(elfNN_aarch64_finish_dynamic_sections): Likewise.
(elfNN_aarch64_size_dynamic_sections): Updated.  Clear
root.tlsdesc_plt for DF_BIND_NOW.  Don't check DF_BIND_NOW
twice.
* elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
(_bfd_x86_elf_size_dynamic_sections): Likewise.
(_bfd_x86_elf_finish_dynamic_sections): Likewise.
* elfxx-x86.h (elf_x86_link_hash_table): Remove tlsdesc_plt and
tlsdesc_got.

3 years agoFix a typo in the description of the strings program.
Nick Clifton [Mon, 8 Jun 2020 10:32:15 +0000 (11:32 +0100)] 
Fix a typo in the description of the strings program.

PR 26093
* doc/binutils.texi (strings): Fix typo.

3 years agoFix an illegal memory access when parsing corrupt DWARF debug information.
Nick Clifton [Mon, 8 Jun 2020 10:24:06 +0000 (11:24 +0100)] 
Fix an illegal memory access when parsing corrupt DWARF debug information.

PR 26086
* dwarf.c (process_debug_info): Check that there is space in the
debug_information array before filling in an entry.