binutils-gdb.git
4 years agoCRIS: fix PR ld/26589, a missing NULL check in fix for PR ld/22269
Hans-Peter Nilsson [Tue, 15 Sep 2020 00:57:39 +0000 (02:57 +0200)]
CRIS: fix PR ld/26589, a missing NULL check in fix for PR ld/22269

Not sure why there wasn't a NULL check in the ld/22269 patch
(e01c16a8) at the time, as there was one for the corresponding patch
to elf32-m68k.c (5056ba1d).

Incidentally, I had missed that in 2017, as a prerequisite for the
ld/22269 series, the check_relocs function finally were made "safe"!
(I.e. the number of references and symbol types are final, garbage
collection done, so port-specific accounting can be made sanely.)

Committed.

bfd:
PR ld/26589
* elf32-cris.c (cris_elf_check_relocs): Add missing NULL check
on argument before calling UNDEFWEAK_NO_DYNAMIC_RELOC.

ld:
PR ld/26589
* testsuite/ld-elf/pr26589.d, testsuite/ld-elf/locref3.s: New test.

4 years agogdb: fix compile break when HAVE_LIBEXPAT is not defined
Michael Mullin [Tue, 15 Sep 2020 00:39:54 +0000 (20:39 -0400)]
gdb: fix compile break when HAVE_LIBEXPAT is not defined

Fixes:

      CXX    xml-tdesc.o
    /home/smarchi/src/binutils-gdb/gdb/xml-tdesc.c: In function const target_desc* file_read_description_xml(const char*):
    /home/smarchi/src/binutils-gdb/gdb/xml-tdesc.c:681:60: error: too few arguments to function target_desc* tdesc_parse_xml(const char*, xml_fetch_another, void*)
      681 |   return tdesc_parse_xml (tdesc_str->data (), fetch_another);
          |                                                            ^
    /home/smarchi/src/binutils-gdb/gdb/xml-tdesc.c:44:1: note: declared here
       44 | tdesc_parse_xml (const char *document, xml_fetch_another fetcher,
          | ^~~~~~~~~~~~~~~

Commit 8400a90d19c5 ("gdb: change xml_fetch_another a function_view")
removed the `baton` parameter of `tdesc_parse_xml`, but didn't update
the version of the function used when GDB is built with no libexpat
support.  Remove the parameter in that definition too.

gdb/ChangeLog:

* xml-tdesc.c [!defined(HAVE_LIBEXPAT)] (tdesc_parse_xml):
Remove baton parameter.

Change-Id: I4ad29fbb7c3323f30ce5204c2976eaea16151a2e

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Sep 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoRewrite enum_flags, add unit tests, fix problems
Pedro Alves [Mon, 14 Sep 2020 20:16:59 +0000 (21:16 +0100)]
Rewrite enum_flags, add unit tests, fix problems

This patch started by adding comprehensive unit tests for enum_flags.

For the testing part, it adds:

 - tests of normal expected uses of the API.

 - checks that _invalid_ uses of the API would fail to compile.  I.e.,
   it validates that enum_flags really is a strong type, and that
   incorrect mixing of enum types would be caught at compile time.  It
   pulls that off making use of SFINEA and C++11's decltype/constexpr.

This revealed many holes in the enum_flags API.  For example, the f1
assignment below currently incorrectly fails to compile:

 enum_flags<flags> f1 = FLAG1;
 enum_flags<flags> f2 = FLAG2 | f1;

The unit tests also revealed that this useful use case doesn't work:

    enum flag { FLAG1 = 1, FLAG2 = 2 };
    enum_flags<flag> src = FLAG1;
    enum_flags<flag> f1 = condition ? src : FLAG2;

It fails to compile because enum_flags<flag> and flag are convertible
to each other.

Turns out that making enum_flags be implicitly convertible to the
backing raw enum type was not a good idea.

If we make it convertible to the underlying type instead, we fix that
ternary operator use case, and, we find cases throughout the codebase
that should be using the enum_flags but were using the raw backing
enum instead.  So it's a good change overall.

Also, several operators were missing.

These holes and more are plugged by this patch, by reworking how the
enum_flags operators are implemented, and making use of C++11's
feature of being able to delete methods/functions.

There are cases in gdb/compile/ where we need to call a function in a
C plugin API that expects the raw enum.  To address cases like that,
this adds a "raw()" method to enum_flags.  This way we can keep using
the safer enum_flags to construct the value, and then be explicit when
we need to get at the raw enum.

This makes most of the enum_flags operators constexpr.  Beyond
enabling more compiler optimizations and enabling the new unit tests,
this has other advantages, like making it possible to use operator|
with enum_flags values in switch cases, where only compile-time
constants are allowed:

    enum_flags<flags> f = FLAG1 | FLAG2;
    switch (f)
      {
      case FLAG1 | FLAG2:
break;
      }

Currently that fails to compile.

It also switches to a different mechanism of enabling the global
operators.  The current mechanism isn't namespace friendly, the new
one is.

It also switches to C++11-style SFINAE -- instead of wrapping the
return type in a SFINAE-friently structure, we use an unnamed template
parameter.  I.e., this:

  template <typename enum_type,
    typename = is_enum_flags_enum_type_t<enum_type>>
  enum_type
  operator& (enum_type e1, enum_type e2)

instead of:

  template <typename enum_type>
  typename enum_flags_type<enum_type>::type
  operator& (enum_type e1, enum_type e2)

Note that the static_assert inside operator~() was converted to a
couple overloads (signed vs unsigned), because static_assert is too
late for SFINAE-based tests, which is important for the CHECK_VALID
unit tests.

Tested with gcc {4.8, 7.1, 9.3} and clang {5.0.2, 10.0.0}.

gdb/ChangeLog:

* Makefile.in (SELFTESTS_SRCS): Add
unittests/enum-flags-selftests.c.
* btrace.c (ftrace_update_caller, ftrace_fixup_calle): Use
btrace_function_flags instead of enum btrace_function_flag.
* compile/compile-c-types.c (convert_qualified): Use
enum_flags::raw.
* compile/compile-cplus-symbols.c (convert_one_symbol)
(convert_symbol_bmsym):
* compile/compile-cplus-types.c (compile_cplus_convert_method)
(compile_cplus_convert_struct_or_union_methods)
(compile_cplus_instance::convert_qualified_base):
* go-exp.y (parse_string_or_char): Add cast to int.
* unittests/enum-flags-selftests.c: New file.
* record-btrace.c (btrace_thread_flag_to_str): Change parameter's
type to btrace_thread_flags from btrace_thread_flag.
(record_btrace_cancel_resume, record_btrace_step_thread): Change
local's type to btrace_thread_flags from btrace_thread_flag.  Add
cast in DEBUG call.

gdbsupport/ChangeLog:

* enum-flags.h: Include "traits.h".
(DEF_ENUM_FLAGS_TYPE): Declare a function instead of defining a
structure.
(enum_underlying_type): Update comment.
(namespace enum_flags_detail): New.  Move struct zero_type here.
(EnumIsUnsigned, EnumIsSigned): New.
(class enum_flags): Make most methods constexpr.
(operator&=, operator|=, operator^=): Take an enum_flags instead
of an enum_type.  Make rvalue ref versions deleted.
(operator enum_type()): Delete.
(operator&, operator|, operator^, operator~): Delete, moved out of
class.
(raw()): New method.
(is_enum_flags_enum_type_t): Declare.
(ENUM_FLAGS_GEN_BINOP, ENUM_FLAGS_GEN_COMPOUND_ASSIGN)
(ENUM_FLAGS_GEN_COMP): New.  Use them to reimplement global
operators.
(operator~): Now constexpr and reimplemented.
(operator<<, operator>>): New deleted functions.
* valid-expr.h (CHECK_VALID_EXPR_5, CHECK_VALID_EXPR_6): New.

4 years agoRewrite valid-expr.h's internals in terms of the detection idiom (C++17/N4502)
Pedro Alves [Mon, 14 Sep 2020 20:16:57 +0000 (21:16 +0100)]
Rewrite valid-expr.h's internals in terms of the detection idiom (C++17/N4502)

An earlier attempt at doing this had failed (wouldn't work in GCCs
around 4.8, IIRC), but now that I try again, it works.  I suspect that
my previous attempt did not use the pre C++14-safe void_t (in
traits.h).

I want to switch to this model because:

 - It's the standard detection idiom that folks will learn starting
   with C++17.

 - In the enum_flags unit tests, I have a static_assert that triggers
   a warning (resulting in build error), which GCC does not suppress
   because the warning is not being triggered in the SFINAE context.
   Switching to the detection idiom fixes that.  Alternatively,
   switching to the C++03-style expression-validity checking with a
   varargs overload would allow addressing that, but I think that
   would be going backwards idiomatically speaking.

 - While this patch shows a net increase of lines of code, the magic
   being added to traits.h can be removed in a few years when we start
   requiring C++17.

gdbsupport/ChangeLog:

* traits.h (struct nonesuch, struct detector, detected_or)
(detected_or_t, is_detected, detected_t, detected_or)
(detected_or_t, is_detected_exact, is_detected_convertible): New.
* valid-expr.h (CHECK_VALID_EXPR_INT): Use gdb::is_detected_exact.

4 years agoRename address_space_int_to_name/address_space_name_to_int
Pedro Alves [Mon, 14 Sep 2020 20:16:57 +0000 (21:16 +0100)]
Rename address_space_int_to_name/address_space_name_to_int

These methods now take/return a type_instance_flags instead of a raw
integer, so rename them accordingly.

gdb/ChangeLog:

* c-typeprint.c (c_type_print_modifier): Adjust to rename.
* gdbtypes.c (address_space_name_to_int): Rename to ...
(address_space_name_to_type_instance_flags): ... this.
(address_space_int_to_name): Rename to ...
(address_space_type_instance_flags_to_name): ... this.
* gdbtypes.h (address_space_name_to_int): Rename to ...
(address_space_name_to_type_instance_flags): ... this.
(address_space_int_to_name): Rename to ...
(address_space_type_instance_flags_to_name): ... this.
* type-stack.c (type_stack::insert): Adjust to rename.
* type-stack.h (type_stack::insert): Likewise.

4 years agoUse type_instance_flags more throughout
Pedro Alves [Mon, 14 Sep 2020 20:16:56 +0000 (21:16 +0100)]
Use type_instance_flags more throughout

A later patch in this series will rewrite enum_flags fixing some API
holes.  That would cause build failures around code using
type_instance_flags.  Or rather, that should be using it, but wasn't.

This patch fixes it by using type_instance_flags throughout instead of
plain integers.

Note that we can't make the seemingly obvious change to struct
type::instance_flags:

 -  unsigned instance_flags : 9;
 +  ENUM_BITFIELD (type_instance_flag_value) instance_flags : 9;

Because G++ complains then that 9 bits isn't sufficient for holding
all values of type_instance_flag_value.

So the patch adds an type::instance_flags() method, which takes care
of casting appropriately, and adds a separate type::set_instance_flags
method, following the pattern of the ongoing TYPE_XXX macro
elimination.  This converts uses of TYPE_INSTANCE_FLAGS to
type::instance_flags() in the places where the code was already being
touched, but there are still many references to the
TYPE_INSTANCE_FLAGS macro left behind.  Those could/should be fully
replaced at some point.

gdb/ChangeLog:

* avr-tdep.c (avr_address_class_type_flags): Return
type_instance_flags.
(avr_address_class_type_flags_to_name): Take a
type_instance_flags.
(avr_address_class_name_to_type_flags): Return bool and take a
type_instance_flags.
* d-lang.c (build_d_types): Use type::set_instance_flags.
* ft32-tdep.c (ft32_address_class_type_flags): Return
type_instance_flags.
(ft32_address_class_type_flags_to_name): Take a
type_instance_flags.
(ft32_address_class_name_to_type_flags): Return bool and take a
type_instance_flags.
(ft32_gdbarch_init): Use type::set_instance_flags.
* eval.c (fake_method::fake_method): Use type::set_instance_flags.
* gdbarch.h, gdbarch.c: Regenerate.
* gdbarch.sh (address_class_type_flags): Use type_instance_flags.
(address_class_name_to_type_flags): Use type_instance_flags and
bool.
* gdbtypes.c (address_space_name_to_int)
(address_space_int_to_name, make_qualified_type): Use
type_instance_flags.
(make_qualified_type): Use type_instance_flags and
type::set_instance_flags.
(make_type_with_address_space, make_cv_type, make_vector_type)
(check_typedef): Use type_instance_flags.
(recursive_dump_type): Cast type_instance_flags to unsigned for
printing.
(copy_type_recursive): Use type::set_instance_flags.
(gdbtypes_post_init): Use type::set_instance_flags.
* gdbtypes.h (struct type) <instance_flags>: Rename to ...
<m_instance_flags>: ... this.
<instance_flags, set_instance_flags>: New methods.
(TYPE_INSTANCE_FLAGS): Use the instance_flags method.
(SET_TYPE_INSTANCE_FLAGS): New.
(address_space_name_to_int, address_space_int_to_name)
(make_type_with_address_space): Pass flags using
type_instance_flags instead of int.
* stabsread.c (cleanup_undefined_types_noname): Use
type::set_instance_flags.
* s390-tdep.c (s390_address_class_type_flags): Return
type_instance_flags.
(s390_address_class_type_flags_to_name): Take a
type_instance_flags.
(s390_address_class_name_to_type_flags): Return bool and take a
type_instance_flags.
* type-stack.c (type_stack::follow_types): Use
type_instance_flags.
* dwarf2/read.c (read_tag_pointer_type): Use type_instance_flags.

4 years agoApply 'const' in more places
Tom Tromey [Mon, 14 Sep 2020 18:09:59 +0000 (12:09 -0600)]
Apply 'const' in more places

Many global arrays in gdb could be marked "const" but are not.  This
patch changes some of them.  (There may be other arrays that could
benefit from this treatment.  I only examined arrays of strings.)

This lets the linker move some symbols to the readonly data section.
For example, previously:

0000000000000000 d _ZL18can_use_agent_enum

is now:

0000000000000030 r _ZL18can_use_agent_enum

2020-09-14  Tom Tromey  <tromey@adacore.com>

* x86-tdep.h (x86_in_indirect_branch_thunk): Update.
* x86-tdep.c (x86_is_thunk_register_name)
(x86_in_indirect_branch_thunk): Update.
* sparc64-tdep.c (sparc64_fpu_register_names)
(sparc64_cp0_register_names, sparc64_register_names)
(sparc64_pseudo_register_names): Now const.
* sparc-tdep.h (struct gdbarch_tdep) <fpu_register_names,
cp0_registers_num>: Now const.
* sparc-tdep.c (sparc_core_register_names)
(sparc32_fpu_register_names, sparc32_cp0_register_names)
(sparc32_pseudo_register_names): Now const.
(validate_tdesc_registers): Update.
* rust-lang.c (rust_extensions): Now const.
* p-lang.c (p_extensions): Now const.
* objc-lang.c (objc_extensions): Now const.
* nto-tdep.c (nto_thread_state_str): Now const.
* moxie-tdep.c (moxie_register_names): Now const.
* mips-tdep.h (struct gdbarch_tdep) <mips_processor_reg_names>:
Now const.
* mips-tdep.c (mips_generic_reg_names, mips_tx39_reg_names)
(mips_linux_reg_names): Now const.
(mips_gdbarch_init): Update.
* microblaze-tdep.c (microblaze_register_names): Now const.
* m68k-tdep.c (m68k_register_names): Now const.
* m32r-tdep.c (m32r_register_names): Now const.
* ia64-tdep.c (ia64_register_names): Now const.
* i386-tdep.h (struct gdbarch_tdep) <register_names,
ymmh_register_names, ymm16h_regnum, mpx_register_names,
k_register_names, zmmh_register_names, xmm_avx512_register_names,
ymm_avx512_register_names, pkeys_register_names>: Now const.
* i386-tdep.c (i386_register_names, i386_zmm_names)
(i386_zmmh_names, i386_k_names, i386_ymm_names, i386_ymmh_names)
(i386_mpx_names, i386_pkeys_names, i386_bnd_names)
(i386_mmx_names, i386_byte_names, i386_word_names): Now const.
* f-lang.c (f_extensions): Now const.
* d-lang.c (d_extensions): Now const.
* csky-tdep.c (csky_register_names): Now const.
* charset.c (default_charset_names, charset_enum): Now const.
(_initialize_charset): Update.
* c-lang.c (c_extensions, cplus_extensions, asm_extensions): Now
const.
* bsd-uthread.c (bsd_uthread_solib_names): Now const.
(bsd_uthread_solib_loaded): Update.
(bsd_uthread_state): Now const.
* amd64-tdep.c (amd64_register_names, amd64_ymm_names)
(amd64_ymm_avx512_names, amd64_ymmh_names)
(amd64_ymmh_avx512_names, amd64_mpx_names, amd64_k_names)
(amd64_zmmh_names, amd64_zmm_names, amd64_xmm_avx512_names)
(amd64_pkeys_names, amd64_byte_names, amd64_word_names)
(amd64_dword_names): Now const.
* agent.c (can_use_agent_enum): Now const.
* ada-tasks.c (task_states, long_task_states): Now const.
* ada-lang.c (known_runtime_file_name_patterns)
(known_auxiliary_function_name_patterns, attribute_names)
(standard_exc, ada_extensions): Now const.

gdbserver/ChangeLog
2020-09-14  Tom Tromey  <tromey@adacore.com>

* tracepoint.cc (eval_result_names): Now const.
* ax.cc (gdb_agent_op_names): Now const.

4 years agogdb: turn gdb::bcache's function pointers into virtual methods
Simon Marchi [Mon, 14 Sep 2020 18:02:30 +0000 (14:02 -0400)]
gdb: turn gdb::bcache's function pointers into virtual methods

The two function pointers optionally passed to gdb::bcache are very good
candidates to be turned into virtual methods, this patch does that in
the most straightforward / unsurprising way.

gdb/ChangeLog:

* bcache.h (struct bcache) <bcache>: Remove constructor.
<m_hash_function, m_compare_function>: Remove.
<~bcache>: Make virtual.
<compare>: Remove static method, introduce virtual method.
<default_hash>: Remove.
<hash>: New virtual method.
* bcache.c (bcache::expand_hash_table): Update.
(bcache::insert): Update.
(bcache::hash): New.
(bcache::compare): Update comment and parameter names.
* gdbtypes.c (types_deeply_equal): Update.
* psymtab.h (struct psymbol_bcache): New struct.
(class psymtab_storage) <psymtab_storage>: Make default.
<psymbol_cache>: Change type to psymbol_bcache.
* psymtab.c (psymtab_storage::psymtab_storage): Remove.
(psymbol_hash): Change to...
(psymbol_bcache::hash): ... this.
(psymbol_compare): Change to...
(psymbol_bcache::compare): ... this.

Change-Id: I41d578e61de8ac1163461a28fbd220d1f855e372

4 years agoFix support for theassembler's new ".nop" directive on the IA64 target.
Nick Clifton [Mon, 14 Sep 2020 15:56:41 +0000 (16:56 +0100)]
Fix support for theassembler's new ".nop" directive on the IA64 target.

* config/tc-ia64.h (md_single_noop_insn): Define.

4 years agogdb: don't use inferior_ptid in linux_nat_wait_1
Simon Marchi [Mon, 14 Sep 2020 15:51:04 +0000 (11:51 -0400)]
gdb: don't use inferior_ptid in linux_nat_wait_1

target_ops::wait implementations should not rely on the value of
inferior_ptid on entry.  While looking at another wait-related patch, I
noticed that the code in linux_nat_wait_1, checking for a newly created
process, did just that.  This patch fixes it.  Note that I didn't see
any bug, this "fix" is simply to make the function respect the
target_ops::wait contract.

Instead of checking inferior_ptid, check for the passed in `ptid`
value.

During startup, linux_nat_wait_1 gets called a few times with the
pid-only ptid, while startup_inferior waits for the expected number of
exec events.  For this reason, I needed to add a `find_lwp_pid` call to
ensure that the actions of changing the main thread's ptid, and adding
the initial lwp, were done only once for a given process.

This was not needed before, since thread_change_ptid, through the
thread_ptid_changed observer, ends up changing inferior_ptid.  So the
second time around, inferior_ptid was not a pid-only ptid.

That find_lwp_pid won't add much overhead, as it will only be called
when the ptid is a pid-only ptid.  And AFAIK, that only happens during
inferior startup.

An alternative to that `find_lwp_pid` call might be to make
startup_inferior realize that the main thread has changed ptid, and make
it wait for the new ptid.  But that doesn't look easy to do.

Regtested on amd64/Linux.

gdb/ChangeLog:

* linux-nat.c (linux_nat_wait_1): Don't use inferior_ptid when
checking for initial lwp.

Change-Id: I8f1d5c766f5cb2a29c948bc75fa4582d7130c23f

4 years agoVarious m68k fixes for gdb
Tom Tromey [Mon, 14 Sep 2020 14:30:10 +0000 (08:30 -0600)]
Various m68k fixes for gdb

Recently I tried the m68k port of gdb.  It had some issues, which are
fixed in this patch.

* Various types of return values were not being handled properly.  In
  particular:

  * arrays are returned by following the same convention as
    structures.  This matters in languages like Ada, where an array
    can in fact be returned as a value.

  * "long double" was not being handled correctly in
    m68k_svr4_return_value.

  * GCC's m68k back end does not return vector types in registers, so
    change gdb to follow.

  * GCC's m68k back end doesn't faithfully implement the ABI, and so
    some objects with unusual size (not possible in C, but possible in
    Ada) are not returned correctly.

* gcc implements an m68k ABI variant that it simply describes as
  "embedded".  This ABI is similar to the SVR4 ABI, but rather than
  returning pointer-typed values in %a0, such values are returned in
  %d0.  To support this, an ELF osabi sniffer is added.

* Commit 85f7484a ("m68k: tag floating-point ABI used") adds an
  attribute that can be used to recognize when hard- or soft-float is
  in use.  gdb can now read this tag and choose the ABI accordingly.

I was unable to run the gdb test suite with this patch.  Instead, I
tested it using qemu and the internal AdaCore test suite.

gdb/ChangeLog
2020-09-14  Tom Tromey  <tromey@adacore.com>

* m68k-tdep.c (m68k_extract_return_value): Use
pointer_result_regnum.
(m68k_store_return_value): Likewise.
(m68k_reg_struct_return_p): Handle vectors and arrays.
(m68k_return_value): Handle arrays.
(m68k_svr4_return_value): Fix single-element aggregate handling.
Handle long double.  Adjust for embedded ABI.
(m68k_svr4_init_abi): Set pointer_result_regnum.
(m68k_embedded_init_abi): New function.
(m68k_gdbarch_init): Handle Tag_GNU_M68K_ABI_FP.
(m68k_osabi_sniffer): New function.
(_initialize_m68k_tdep): Register osabi sniffer.
* m68k-tdep.h (struct gdbarch_tdep) <pointer_result_regnum>: New
member.

4 years agogdb: remove xfree in xml-support.c
Simon Marchi [Mon, 14 Sep 2020 15:12:55 +0000 (11:12 -0400)]
gdb: remove xfree in xml-support.c

Replace an xfree with automatic memory management with a unique pointer.

gdb/ChangeLog:

* xml-support.c (xml_fetch_content_from_file): Replace xfree
with gdb::unique_xmalloc_ptr<char>.

Change-Id: Ia4d735b383e3b9eb660f445f2c7f2c5e27411b64

4 years agogdb: change xml_fetch_another a function_view
Simon Marchi [Mon, 14 Sep 2020 15:12:55 +0000 (11:12 -0400)]
gdb: change xml_fetch_another a function_view

The xml_fetch_another is currently a plain function pointer type, with a
`void *` baton parameter.  To improve type-safety, change this to a
function_view.  Any required data is captured by a lambda at the call
site.

gdb/ChangeLog:

* xml-support.h (xml_fetch_another): Change type to be a
function_view.
(xml_process_xincludes): Remove baton parameter.
(xml_fetch_content_from_file): Change baton parameter to
dirname.
* xml-support.c (struct xinclude_parsing_data)
<xinclude_parsing_data>: Remove baton parameter.
<fetcher_baton>: Remove.
(xinclude_start_include): Adjust.
(xml_process_xincludes): Adjust.
(xml_fetch_content_from_file): Replace baton parameter with
dirname.
* xml-syscall.c (syscall_parse_xml): Remove baton parameter.
(xml_init_syscalls_info): Use a lambda.
* xml-tdesc.c (tdesc_parse_xml): Remove baton parameter.
(file_read_description_xml): Use a lambda.
(fetch_available_features_from_target): Change baton parameter
to target_ops.
(target_read_description_xml): Use a lambda.
(target_fetch_description_xml): Use a lambda.
(string_read_description_xml): Update.

Change-Id: I7ba4b8f5e97fc6a952c6c20ccc3be92a06cc2bd2

4 years agoAdd a new ".nop" directive to the assembler to allow the creation of no-op instructio...
Nick Clifton [Mon, 14 Sep 2020 15:14:24 +0000 (16:14 +0100)]
Add a new ".nop" directive to the assembler to allow the creation of no-op instructions in an architeture neutral manner.

* read.c (s_nop): New function.  Handles the .nop directive.
(potable): Add entry for "nop".
(s_nops): Code tidy.
* read.h (s_nop): Add prototype.
* config/tc-bpf.h (md_single_noop_insn): Define.
* config/tc-mmix.h (md_single_noop_insn): Define.
* config/tc-or1k.h (md_single_noop_insn): Define.
* config/tc-s12z.c (md_assemble): Preserve the input line pointer,
rather than corrupting it.
* write.c (relax_segment): Update error message regarding
non-absolute values passed to .fill and .nops.
* NEWS: Mention the new directive.
* doc/as.texi: Document the new directive.
* doc/internals.texi: Document the new internal macros used to
implement the new directive.
* testsuite/gas/all/nop.s: New test.
* testsuite/gas/all/nop.d: New test control file.
* testsuite/gas/all/gas.exp: Run the new test.
* testsuite/gas/elf/dwarf-5-nop-for-line-table.s: New test.
* testsuite/gas/elf/dwarf-5-nop-for-line-table.d: New test
control file.
* testsuite/gas/elf/elf.exp: Run the new test.
* testsuite/gas/i386/space1.l: Adjust expected output.

4 years agogdb: remove TYPE_ENDIANITY_NOT_DEFAULT
Simon Marchi [Mon, 14 Sep 2020 15:08:08 +0000 (11:08 -0400)]
gdb: remove TYPE_ENDIANITY_NOT_DEFAULT

gdb/ChangeLog:

* gdbtypes.h (TYPE_ENDIANITY_NOT_DEFAULT): Remove, replace all
uses with type::endianity_is_not_default.

Change-Id: I61956093c8ce6703299e913746ba91313108a0f2

4 years agogdb: add type::endianity_is_not_default / type::set_endianity_is_not_default
Simon Marchi [Mon, 14 Sep 2020 15:08:07 +0000 (11:08 -0400)]
gdb: add type::endianity_is_not_default / type::set_endianity_is_not_default

Add the `endianity_is_not_default` and `set_endianity_is_not_default`
methods on `struct type`, in order to remove the
`TYPE_ENDIANITY_NOT_DEFAULT` macro.  In this patch, the macro is changed
to use the getter, so all the call sites of the macro that are used as a
setter are changed to use the setter method directly.  The next patch
will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <endianity_is_not_default,
set_endianity_is_not_default>: New methods.
(TYPE_ENDIANITY_NOT_DEFAULT): Use
type::endianity_is_not_default, change all write call sites to
use type::set_endianity_is_not_default.

Change-Id: I67acd68fcdae424d7e4a601afda78612ad5d92db

4 years agogdb: remove TYPE_FIXED_INSTANCE
Simon Marchi [Mon, 14 Sep 2020 15:08:07 +0000 (11:08 -0400)]
gdb: remove TYPE_FIXED_INSTANCE

gdb/ChangeLog:

* gdbtypes.h (TYPE_FIXED_INSTANCE): Remove, replace all
uses with type::is_fixed_instance.

Change-Id: I57731b5ab44aac7d8896a32b9c7481891baea51a

4 years agogdb: add type::is_fixed_instance / type::set_is_fixed_instance
Simon Marchi [Mon, 14 Sep 2020 15:08:06 +0000 (11:08 -0400)]
gdb: add type::is_fixed_instance / type::set_is_fixed_instance

Add the `is_fixed_instance` and `set_is_fixed_instance` methods on `struct
type`, in order to remove the `TYPE_FIXED_INSTANCE` macro.  In this patch, the
macro is changed to use the getter, so all the call sites of the macro that are
used as a setter are changed to use the setter method directly.  The next patch
will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <is_fixed_instance,
set_is_fixed_instance>: New methods.
(TYPE_FIXED_INSTANCE): Use type::is_fixed_instance, change all
write call sites to use type::set_is_fixed_instance.

Change-Id: I4401d81512fab9eab4232bbea48ce6c7d586b94c

4 years agogdb: remove TYPE_GNU_IFUNC
Simon Marchi [Mon, 14 Sep 2020 15:08:06 +0000 (11:08 -0400)]
gdb: remove TYPE_GNU_IFUNC

gdb/ChangeLog:

* gdbtypes.h (TYPE_GNU_IFUNC): Remove, replace all
uses with type::is_gnu_ifunc.

Change-Id: I72aae22599b5e582910c5d50588feaf159032bd8

4 years agogdb: add type::is_gnu_ifunc / type::set_is_gnu_ifunc
Simon Marchi [Mon, 14 Sep 2020 15:08:05 +0000 (11:08 -0400)]
gdb: add type::is_gnu_ifunc / type::set_is_gnu_ifunc

Add the `is_gnu_ifunc` and `set_is_gnu_ifunc` methods on `struct type`, in
order to remove the `TYPE_GNU_IFUNC` macro.  In this patch, the macro is
changed to use the getter, so all the call sites of the macro that are
used as a setter are changed to use the setter method directly.  The
next patch will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <is_gnu_ifunc, set_is_gnu_ifunc>: New methods.
(TYPE_GNU_IFUNC): Use type::is_gnu_ifunc, change all write call sites to
use type::set_is_gnu_ifunc.

Change-Id: Ic23ba8c5b8e589d9fc368385111aa16a94e014e2

4 years agogdb: remove TYPE_STUB_SUPPORTED
Simon Marchi [Mon, 14 Sep 2020 15:08:04 +0000 (11:08 -0400)]
gdb: remove TYPE_STUB_SUPPORTED

gdb/ChangeLog:

* gdbtypes.h (TYPE_STUB_SUPPORTED): Remove, replace all
uses with type::stub_is_supported.

Change-Id: I69dbc32a619455605b7f934a701bc36bd664b7c0

4 years agogdb: add type::stub_is_supported / type::set_stub_is_supported
Simon Marchi [Mon, 14 Sep 2020 15:08:03 +0000 (11:08 -0400)]
gdb: add type::stub_is_supported / type::set_stub_is_supported

Add the `stub_is_supported` and `set_stub_is_supported` methods on `struct type`, in
order to remove the `TYPE_STUB_SUPPORTED` macro.  In this patch, the macro is
changed to use the getter, so all the call sites of the macro that are
used as a setter are changed to use the setter method directly.  The
next patch will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <stub_is_supported, set_stub_is_supported>: New methods.
(TYPE_STUB_SUPPORTED): Use type::stub_is_supported, change all write call sites to
use type::set_stub_is_supported.

Change-Id: I4dfecf2b5df9c2b7bb8db1e9252082140adf3028

4 years agogdb: remove TYPE_VECTOR
Simon Marchi [Mon, 14 Sep 2020 15:08:03 +0000 (11:08 -0400)]
gdb: remove TYPE_VECTOR

gdb/ChangeLog:

* gdbtypes.h (TYPE_VECTOR): Remove, replace all
uses with type::is_vector.

Change-Id: I1ac28755af44b1585c190553f9961288c8fb9137

4 years agogdb: add type::is_vector / type::set_is_vector
Simon Marchi [Mon, 14 Sep 2020 15:08:02 +0000 (11:08 -0400)]
gdb: add type::is_vector / type::set_is_vector

Add the `is_vector` and `set_is_vector` methods on `struct type`, in
order to remove the `TYPE_VECTOR` macro.  In this patch, the macro is
changed to use the getter, so all the call sites of the macro that are
used as a setter are changed to use the setter method directly.  The
next patch will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <is_vector, set_is_vector>: New methods.
(TYPE_VECTOR): Use type::is_vector, change all write call sites to
use type::set_is_vector.

Change-Id: I415e8d169f058662e0750329bfa4017bea3ca0cb

4 years agogdb: remove TYPE_VARARGS
Simon Marchi [Mon, 14 Sep 2020 15:08:02 +0000 (11:08 -0400)]
gdb: remove TYPE_VARARGS

gdb/ChangeLog:

* gdbtypes.h (TYPE_VARARGS): Remove, replace all
uses with type::has_varargs.

Change-Id: Ieea4a64b4bfa4b8be643e68cb403081881133740

4 years agogdb: add type::has_varargs / type::set_has_varargs
Simon Marchi [Mon, 14 Sep 2020 15:08:01 +0000 (11:08 -0400)]
gdb: add type::has_varargs / type::set_has_varargs

Add the `has_varargs` and `set_has_varargs` methods on `struct type`, in
order to remove the `TYPE_VARARGS` macro.  In this patch, the macro is
changed to use the getter, so all the call sites of the macro that are
used as a setter are changed to use the setter method directly.  The
next patch will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <has_varargs, set_has_varargs>: New methods.
(TYPE_VARARGS): Use type::has_varargs, change all write call sites to
use type::set_has_varargs.

Change-Id: I898a1093ae40808b37a7c6fced7f6fa2aae604de

4 years agogdb: remove TYPE_PROTOTYPED
Simon Marchi [Mon, 14 Sep 2020 15:08:01 +0000 (11:08 -0400)]
gdb: remove TYPE_PROTOTYPED

gdb/ChangeLog:

* gdbtypes.h (TYPE_PROTOTYPED): Remove, replace all
uses with type::is_prototyped.

Change-Id: Ic96b19c24ce5afcd7e1302a75c39909767e4d885

4 years agogdb: add type::is_prototyped / type::set_is_prototyped
Simon Marchi [Mon, 14 Sep 2020 15:08:00 +0000 (11:08 -0400)]
gdb: add type::is_prototyped / type::set_is_prototyped

Add the `is_prototyped` and `set_is_prototyped` methods on `struct
type`, in order to remove the `TYPE_PROTOTYPED` macro.  In this patch,
the macro is changed to use the getter, so all the call sites of the
macro that are used as a setter are changed to use the setter method
directly.  The next patch will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <is_prototyped, set_is_prototyped>:
New methods.
(TYPE_PROTOTYPED): Use type::is_prototyped, change all write
call sites to use type::set_is_prototyped.

Change-Id: I6ba285250fae413f7c1bf2ffcb5a2cedc8e743da

4 years agogdb: remove TYPE_TARGET_STUB
Simon Marchi [Mon, 14 Sep 2020 15:08:00 +0000 (11:08 -0400)]
gdb: remove TYPE_TARGET_STUB

gdb/ChangeLog:

* gdbtypes.h (TYPE_TARGET_STUB): Remove, replace all
uses with type::target_is_stub.

Change-Id: I3e7dadcb485d991af68a1e93693e3895b0e755d5

4 years agogdb: add type::target_is_stub / type::set_target_is_stub
Simon Marchi [Mon, 14 Sep 2020 15:07:59 +0000 (11:07 -0400)]
gdb: add type::target_is_stub / type::set_target_is_stub

Add the `target_is_stub` and `set_target_is_stub` methods on `struct
type`, in order to remove the `TYPE_TARGET_STUB` macro.  In this patch,
the macro is changed to use the getter, so all the call sites of the
macro that are used as a setter are changed to use the setter method
directly.  The next patch will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <target_is_stub, set_target_is_stub>:
New methods.
(TYPE_TARGET_STUB): Use type::is_stub, change all write call
sites to use type::set_target_is_stub.

Change-Id: I9c71a89adc7ae8d018db9ee156f41c623be0484a

4 years agogdb: remove TYPE_STUB
Simon Marchi [Mon, 14 Sep 2020 15:07:59 +0000 (11:07 -0400)]
gdb: remove TYPE_STUB

gdb/ChangeLog:

* gdbtypes.h (TYPE_STUB): Remove, replace all
uses with type::is_stub.

Change-Id: Iec25b50449a0d10a38f815209e478c343e98632c

4 years agogdb: add type::is_stub / type::set_is_stub
Simon Marchi [Mon, 14 Sep 2020 15:07:58 +0000 (11:07 -0400)]
gdb: add type::is_stub / type::set_is_stub

Add the `is_stub` and `set_is_stub` methods on `struct type`, in order
to remove the `TYPE_STUB` macro.  In this patch, the macro is changed to
use the getter, so all the call sites of the macro that are used as a
setter are changed to use the setter method directly.  The next patch
will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <is_stub, set_is_stub>: New methods.
(TYPE_STUB): Use type::is_stub, change all write call sites to
use type::set_is_stub.

Change-Id: Ie935e8fe72c908afd8718411e83f4ff00c386bf3

4 years agogdb: remove TYPE_NOSIGN
Simon Marchi [Mon, 14 Sep 2020 15:07:58 +0000 (11:07 -0400)]
gdb: remove TYPE_NOSIGN

gdb/ChangeLog:

* gdbtypes.h (TYPE_NOSIGN): Remove, replace all uses with
type::has_no_signedness.

Change-Id: Iaf8d1cedad195d03a4358e90f6ada77290d03bf2

4 years agogdb: add type::has_no_signedness / type::set_has_no_signedness
Simon Marchi [Mon, 14 Sep 2020 15:07:57 +0000 (11:07 -0400)]
gdb: add type::has_no_signedness / type::set_has_no_signedness

Add the `has_no_signedness` and `set_has_no_signednes` methods on `struct
type`, in order to remove the `TYPE_NOSIGN` macro.  In this patch, the macro is
changed to use the getter, so all the call sites of the macro that are used as
a setter are changed to use the setter method directly.  The next patch will
remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <has_no_signedness,
set_has_no_signedness>: New methods.
(TYPE_NOSIGN): Use type::has_no_signedness, change all write
call sites to use type::set_has_no_signedness.

Change-Id: I80d8e774316d146fbd814b2928ad5392bada39d5

4 years agogdb: remove TYPE_UNSIGNED
Simon Marchi [Mon, 14 Sep 2020 15:07:57 +0000 (11:07 -0400)]
gdb: remove TYPE_UNSIGNED

gdb/ChangeLog:

* gdbtypes.h (TYPE_UNSIGNED): Remove, replace all uses with
type::is_unsigned.

Change-Id: I84f76f5cd44ff7294e421d317376a9e476bc8666

4 years agogdb: add type::is_unsigned / type::set_is_unsigned
Simon Marchi [Mon, 14 Sep 2020 15:07:56 +0000 (11:07 -0400)]
gdb: add type::is_unsigned / type::set_is_unsigned

Add the `is_unsigned` and `set_is_unsigned` methods on `struct type`, in
order to remove the `TYPE_UNSIGNED` macro.  In this patch, the
`TYPE_UNSIGNED` macro is changed to use `type::is_unsigned`, so all the
call sites that are used to set this property on a type are changed to
use the new method.  The next patch will remove the macro completely.

gdb/ChangeLog:

* gdbtypes.h (struct type) <is_unsigned, set_is_unsigned>: New
methods.
(TYPE_UNSIGNED): Use type::is_unsigned.  Change all write call
sites to use type::set_is_unsigned.

Change-Id: Ib09ddce84eda160a801a8f288cccf61c8ef136bc

4 years agoFix exception stack unwinding for ARM Cortex-M
Fredrik Hederstierna [Mon, 14 Sep 2020 13:56:34 +0000 (14:56 +0100)]
Fix exception stack unwinding for ARM Cortex-M

For Cortex-M targets using floating-point, eg the Cortex-M4F, its not possible
to get any call-stack backtrace if setting a breakpoint in ISR.

The exception stack unwinder for Cortex-M does not consider if floating-point
registers was stacked or not, further the Cortex-M has two stack pointers: MSP
(Main Stack Pointer) and PSP (Process Stack Pointer).
This is not handled when GDB tries to backtrace in the exception stack
unwinder.

This patch fixes this, and gives a correct call-stack backtrace from
breakpoints set in a handler or ISR.

gdb/ChangeLog:

        * arm-tdep.c (arm_m_exception_cache): Try use correct stack
        pointer and stack frame offset when unwinding.

4 years agoCSKY: Set feature flags for default cpu.
Cooper Qu [Sun, 13 Sep 2020 12:48:06 +0000 (20:48 +0800)]
CSKY: Set feature flags for default cpu.

Fix floating point instructions not recognized when building GCC.

gas/
PR 26608
* config/tc-csky.c (md_begin): Set feature flags for default
cpu.

4 years ago[gdb/testsuite] Fix PATH warning in gdb.rust/traits.exp
Tom de Vries [Mon, 14 Sep 2020 07:54:47 +0000 (09:54 +0200)]
[gdb/testsuite] Fix PATH warning in gdb.rust/traits.exp

When running the rust test-cases with release 1.36.0 and LLVM version 7.0, I
run into:
...
(gdb) UNTESTED: gdb.rust/traits.exp: could not read \
  outputs/gdb.rust/traits/traits with readelf
PATH: gdb.rust/traits.exp: could not read \
  outputs/gdb.rust/traits/traits with readelf
...

Fix the PATH warning by printing [file tail $binfile] instead $binfile.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-09-14  Tom de Vries  <tdevries@suse.de>

* gdb.rust/traits.exp: Fix PATH warning.

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

4 years agogdb/testsuite: Explicitly return from main
Pedro Alves [Sun, 13 Sep 2020 21:47:01 +0000 (22:47 +0100)]
gdb/testsuite: Explicitly return from main

I've been playing with a board file that forces every testcase to
include a header file that does something like:

  #define main __gdb_testcase_main

and then links an actual main() function that does some
initialization and then jumps to __gdb_testcase_main.

That runs into a number of testcases relying on main not having an
explicit return statement, like e.g.,:

 gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.base/catch-follow-exec.c:27:1: warning: non-void function does not return a value [-Wreturn-type]
 gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.base/catch-signal.c:47:1: warning: non-void function does not return a value [-Wreturn-type]

We don't get those warnings without my board because it is valid to
not explicitly return from main.  There's an implicit "return 0;".

Since it doesn't hurt to be explicit, I've went ahead and added the
explicit return statements.

Also, a couple testcases either don't explicitly specify main's return
type, or return void.  Those are tweaked to explicitly return int.

gdb/testsuite/ChangeLog:

* gdb.base/catch-follow-exec.c (main): Add explicit return
statement.
* gdb.base/catch-signal.c (main): Likewise.
* gdb.base/condbreak-call-false.c (main): Likewise.
* gdb.base/consecutive.c (main): Add explicit return
statement and return type.
* gdb.base/cursal.c (main): Add explicit return statement.
* gdb.base/cvexpr.c (main): Likewise.
* gdb.base/display.c (main): Add explicit return statement and
return type.
* gdb.base/dprintf-detach.c (main): Add explicit return statement.
* gdb.base/endianity.c (main): Likewise.
* gdb.base/execd-prog.c (main): Likewise.
* gdb.base/gdb1090.c (main): Likewise.
* gdb.base/info_qt.c (main): Likewise.
* gdb.base/lineinc.c (main): Likewise.
* gdb.base/load-command.c (main): Likewise.
* gdb.base/macscp1.c (main): Likewise.
* gdb.base/pr10179-a.c (main): Likewise.
* gdb.base/quit-live.c (main): Likewise.
* gdb.base/scope0.c (main): Likewise.
* gdb.base/settings.c (main): Likewise.
* gdb.base/stack-checking.c (main): Return int.
* gdb.base/varargs.c (main): Add explicit return statement.
* gdb.cp/ambiguous.cc (main): Likewise.
* gdb.cp/anon-struct.cc (main): Likewise.
* gdb.cp/anon-union.cc (main): Likewise.
* gdb.cp/bool.cc (main): Likewise.
* gdb.cp/bs15503.cc (main): Likewise.
* gdb.cp/cplusfuncs.cc (main): Likewise.
* gdb.cp/cttiadd.cc (main): Likewise.
* gdb.cp/extern-c.cc (main): Likewise.
* gdb.cp/filename.cc (main): Likewise.
* gdb.cp/formatted-ref.cc (main): Likewise.
* gdb.cp/mb-ctor.cc (main): Likewise.
* gdb.cp/member-ptr.cc (main): Likewise.
* gdb.cp/minsym-fallback-main.cc (main): Likewise.
* gdb.cp/overload-const.cc (main): Likewise.
* gdb.cp/paren-type.cc (main): Likewise.
* gdb.cp/parse-lang.cc (main): Likewise.
* gdb.cp/pr-1023.cc (main): Likewise.
* gdb.cp/psmang1.cc (main): Likewise.
* gdb.cp/readnow-language.cc (main): Likewise.
* gdb.cp/ref-params.cc (main): Likewise.
* gdb.cp/rvalue-ref-params.cc (main): Likewise.
* gdb.cp/virtbase2.cc (main): Likewise.
* gdb.dwarf2/dw2-abs-hi-pc.c (main): Likewise.
* gdb.dwarf2/dw2-namespaceless-anonymous.c (main): Likewise.
* gdb.dwarf2/dw4-toplevel-types.cc (main): Likewise.
* gdb.mi/mi-console.c (main): Likewise.
* gdb.mi/mi-read-memory.c (main): Likewise.
* gdb.modula2/multidim.c (main): Likewise.
* gdb.opt/inline-small-func.c (main): Likewise.
* gdb.python/py-rbreak.c (main): Likewise.
* gdb.stabs/exclfwd1.c (main): Likewise.
* gdb.trace/qtro.c (main): Likewise.

4 years agoFix gdb.base/share-env-with-gdbserver.exp with Clang
Pedro Alves [Sun, 13 Sep 2020 20:28:09 +0000 (21:28 +0100)]
Fix gdb.base/share-env-with-gdbserver.exp with Clang

The testcase has GDB call my_getenv in the inferior, and that fails
with Clang, because Clang optimizes out my_getenv completely, since it
isn't called anywhere (in the program).

This commit fixes it.

gdb/testsuite/ChangeLog:

* gdb.base/share-env-with-gdbserver.c (main): Call my_getenv
instead of getenv.

4 years agoMake default_mi_gdb_start/dbx_gdb_start use gdb_spawn
Pedro Alves [Sun, 13 Sep 2020 19:31:25 +0000 (20:31 +0100)]
Make default_mi_gdb_start/dbx_gdb_start use gdb_spawn

If a board file wants to customize how gdb is launched, the obvious
way is to have the board override gdb_spawn.  However, that doesn't
work for either gdb.mi/ testcases or gdb.base/dbx.exp, because
default_mi_gdb_start and dbx_gdb_start don't use gdb_spawn currently.

That is fixed by this patch.

gdb/testsuite/

* gdb.base/dbx.exp (dbx_gdb_start): Adjust to use gdb_spawn
instead of spawning GDB with remote_spawn.
* lib/mi-support.exp (default_mi_gdb_start): Adjust to use
gdb_spawn instead of spawning GDB with remote_spawn.

4 years agoFix a couple gdb.dwarf2/ testcases with "clang -flto"
Pedro Alves [Sun, 13 Sep 2020 17:17:18 +0000 (18:17 +0100)]
Fix a couple gdb.dwarf2/ testcases with "clang -flto"

gdb.dwarf2/atomic-type.exp and gdb.dwarf2/ada-linkage-name.exp fail
when testing with "clang -flto" as compiler, like:

 $ make check TESTS="gdb.dwarf2/ada-linkage-name.exp" RUNTESTFLAGS="CC_FOR_TARGET='clang -flto'"

because with -flto, functions that aren't referenced anywhere are not
emitted in the final binary.  Fix it by adding uses of the functions.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/ada-linkage-name.c (main): Move to the bottom of the
file and add calls to first and second.
* gdb.dwarf2/atomic.c (main): Move to the bottom of the file and
add call to f.

4 years agoAdd MI "-break-insert --qualified"
Pedro Alves [Sun, 13 Sep 2020 17:02:19 +0000 (18:02 +0100)]
Add MI "-break-insert --qualified"

Currently -break-insert always creates a wildmatching breakpoint, and
there's no way to ask for a fullname match.  To address that, this
patch adds the equivalent of "break -qualified" to MI:

  "-break-insert --qualified".

For the testcase, curiously, it doesn't look like we have _any_
testcase that tests a breakpoint with multiple locations, and, the
existing mi_create_breakpoint / mi_make_breakpoint procedures are only
good for breakpoints with a single location.  This patch thus adds a
few new companion routines to mi-support.exp for breakpoints with
multiple locations: mi_create_breakpoint_multi,
mi_make_breakpoint_loc, mi_make_breakpoint_multi.

gdb/ChangeLog:

* NEWS: Document "-break-insert --qualified".
* mi/mi-cmd-break.c (mi_cmd_break_insert_1): Handle "--qualified".

gdb/doc/ChangeLog:

* gdb.texinfo (GDB/MI Breakpoint Commands): Document
"-break-insert --qualified" and "-dprintf-insert --qualified".

gdb/testsuite/ChangeLog:

* gdb.mi/mi-break-qualified.cc: New file.
* gdb.mi/mi-break-qualified.exp: New file.
* lib/mi-support.exp (mi_create_breakpoint_multi)
(mi_make_breakpoint_loc, mi_make_breakpoint_multi): New
procedures.
(mi_create_breakpoint_1): New, factored out from
mi_create_breakpoint.

4 years agoRemove stale "register" bits from gdb.cp/misc.cc
Pedro Alves [Sat, 22 Aug 2020 17:00:55 +0000 (18:00 +0100)]
Remove stale "register" bits from gdb.cp/misc.cc

gdb.cp/misc.cc seems to have been originally copied from
gdb.cp/classes.cc.  The testcases that use it, misc.exp and
inherit.exp don't reference the "register" bits anywhere.  Remove
them, since they trigger warnings with newer GCCs, given "register" is
being removed in C++17.

gdb/testsuite/ChangeLog:

* gdb.cp/inherit.exp: No longer pass -Wno-deprecated-register.
* gdb.cp/misc.exp: No longer pass -Wno-deprecated-register.
* gdb.cp/misc.cc (class small, small::method, marker_reg1)
(register_class): Delete.
(main): Don't call register_class.

4 years agoMove "register" test out of classes.exp to a separate testcase
Pedro Alves [Sun, 13 Sep 2020 14:36:00 +0000 (15:36 +0100)]
Move "register" test out of classes.exp to a separate testcase

The gdb.cp/classes.exp testcase has one test that tries to exercise
the case of calling a method on a variable that has been put in a
register.

See the declaration of small in classes.cc:

/* Try to get the compiler to allocate a class in a register.  */
class small {
 public:
  int x;
  int method ();
};

and the comment in classes.exp:

    # This class is so small that an instance of it can fit in a register.
    # When gdb tries to call a method, it gets embarrassed about taking
    # the address of a register.
    #
    # TODO: I think that message should be a PASS, not an XFAIL.
    # gdb prints an informative message and declines to do something
    # impossible.
    #
    # The method call actually succeeds if the compiler allocates very
    # small classes in memory instead of registers.  So this test does
    # not tell us anything interesting if the call succeeds.
    #
    # -- chastain 2003-12-31

And these comments:

 https://gcc.gnu.org/legacy-ml/gcc/2010-05/msg00116.html
 https://gcc.gnu.org/legacy-ml/gcc/2010-05/msg00117.html

 "register keyword has other uses, e.g. for -O0 code variables
 declared with register keyword can be put into registers, while
 variables declared without it always get stack slots."

 "I think it does, without optimization.  There's some unique GDB
 tests that use this.  It causes them to be live between statements in
 a machine register instead of always stored in stack slots."

The "register" keyword seems to be ignored by the compiler nowadays
even at -O0, though.  With or without the register keyword, the
variable is given a stack slot, at least on x86-64 with GCC 9.

However, if we use the GCC extension to put the variable
in a specific variable:

 https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Local-Register-Variables.html#Local-Register-Variables

 diff --git c/gdb/testsuite/gdb.cp/classes.cc w/gdb/testsuite/gdb.cp/classes.cc
 index 5ea360e4d06..6dcf34689b8 100644
 --- c/gdb/testsuite/gdb.cp/classes.cc
 +++ w/gdb/testsuite/gdb.cp/classes.cc
 @@ -629,7 +629,7 @@ register_class ()
    /* We don't call any methods for v, so gcc version cygnus-2.3.3-930220
       might put this variable in a register.  This is a lose, though, because
       it means that GDB can't call any methods for that variable.  */
 -  register small v;
 +  register small v asm ("rax");

then it works, and we get an XFAIL:

 print v.method ()
 Address requested for identifier "v" which is in register $rax
 (gdb) XFAIL: gdb.cp/classes.exp: calling method for small class (PRMS 2972)

I think that what we should do here is move this test into its own
file, use that GCC syntax to force it to a register, and do as the
comment says -- issue a pass instead of an XFAIL.

That's what this commit does.

Note that we don't need -Wno-deprecated-register (nor -Wno-register)
anymore in the new testcase, because GNU register-asm local variables
don't trigger the warning, with either GCC or Clang.

gdb/testsuite/ChangeLog:

* gdb.cp/classes.exp: No longer pass -Wno-deprecated-register.
(do_tests): Remove "calling method for small class" test.
* gdb.cp/classes.cc (class small, small::method, marker_reg1)
(register_class): Delete.
(main): Don't call register_class.
* gdb.cp/call-method-register.exp: New file, based on bits removed
from classes.exp.
* gdb.cp/call-method-register.cc: New file, based on bits removed
from classes.cc.

4 years agoDon't drop static function bp locations w/o debug info
Pedro Alves [Sun, 13 Sep 2020 12:34:10 +0000 (13:34 +0100)]
Don't drop static function bp locations w/o debug info

Currently, with a program built from these sources:

 $ cat extern.c
 void foo () {}
 $ cat static.c
 static void foo () {}
 $ cat main.c
 int main () { return 0; }

... if you set a breakpoint on "foo", like:

 (gdb) break foo

.. when there's debug info, GDB creates a breakpoint with two
locations, one for each of the external and static functions.

But, when there's no debug info, GDB creates a breakpoint with a
single location, for the external foo.  Vis:

 $ gcc extern.c static.c main.c -o classify.nodebug
 $ gcc extern.c static.c main.c -o classify.debug -g

 $ gdb classify.nodebug
 Reading symbols from classify.nodebug...
 (No debugging symbols found in classify.nodebug)
 (gdb) b foo
 Breakpoint 1 at 0x40048b
 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   0x000000000040048b <foo+4>
 (gdb)

 $ gdb classify.debug
 Reading symbols from classify.debug...
 (gdb) b foo
 Breakpoint 1 at 0x40048b: foo. (2 locations)
 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x000000000040048b in foo at extern.c:1
 1.2                         y   0x0000000000400492 in foo at static.c:1

GDB drops the static function is search_minsyms_for_name, where at the
very end of that function we pick only the locations with highest
classification, according to classify_type.

The classify_type logic was introduced here:

  https://sourceware.org/pipermail/gdb-patches/2011-December/087864.html

which said:

 "Previously, linespec was trying to filter out minsyms as they were
  seen.  However, this isn't faithful to gdb's historical approach,
  which is to priority-order minsyms; see lookup_minimal_symbol."

lookup_minimal_symbol's intro says, in the .c file:

/* Look through all the current minimal symbol tables and find the
   first minimal symbol that matches NAME.  If OBJF is non-NULL, limit
   the search to that objfile.  If SFILE is non-NULL, the only file-scope
   symbols considered will be from that source file (global symbols are
   still preferred).  Returns a pointer to the minimal symbol that
   matches, or NULL if no match is found.

   Note:  One instance where there may be duplicate minimal symbols with
   the same name is when the symbol tables for a shared library and the
   symbol tables for an executable contain global symbols with the same
   names (the dynamic linker deals with the duplication).

   It's also possible to have minimal symbols with different mangled
   names, but identical demangled names.  For example, the GNU C++ v3
   ABI requires the generation of two (or perhaps three) copies of
   constructor functions --- "in-charge", "not-in-charge", and
   "allocate" copies; destructors may be duplicated as well.
   Obviously, there must be distinct mangled names for each of these,
   but the demangled names are all the same: S::S or S::~S.  */

struct bound_minimal_symbol
lookup_minimal_symbol (const char *name, const char *sfile,
       struct objfile *objf)
{

If you look inside this function, you'll see:

  /* External symbols are best.  */
...
  /* File-local symbols are next best.  */
...
  /* Symbols for shared library trampolines are next best.  */
...

While this logic is good when you're looking for the single "best"
symbol by name, I question it for linespecs, since we want to set
breakpoints in all the multiple locations that match.  I see no point
in hidding static functions.

Now, for breakpoints, it does make sense to filter out PLT/trampoline
symbols if we find the actual global matching function symbol.
Otherwise, if we did no filtering (i.e., just removed the
classify_type logic), you would end up with e.g.:

 (gdb) b printf
 Breakpoint 1 at 0x413a60 (2 locations)
 (top-gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1      breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x0000000000413a60 <printf@plt>
 1.2                         y   0x00007ffff4653640 in __printf at printf.c:28

instead of this (which is what we get currently) before the shared
library is loaded (a location set in the PLT):

 (gdb) b printf
 Breakpoint 1 at 0x413a60
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   0x0000000000413a60 <printf@plt>

and this after the library is loaded (only one location, no breakpoint
in the PLT):

 (gdb) b printf
 Breakpoint 1 at 0x7ffff4653640: file printf.c, line 28.
 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   0x00007ffff4653640 in __printf at printf.c:28

This patch fixes the missing breakpoint locations issue by replacing
the classify_type logic in linespec.c with a different logic.
Instead, discard a trampoline symbol if we also found a
global/external symbol with the same name.  The patch adds a couple of
testcases testing locations in external vs static functions vs
trampolines/PLTs.

We now get:

For the msym-bp.exp testcase (extern vs static), without debug info:

 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x000000000040048b <foo+4>          ### missing before patch
 1.2                         y   0x000000000040049d <foo+4>

For the msym-bp.exp testcase (extern vs static), with debug info:

 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x000000000040048b in foo at src/gdb/testsuite/gdb.base/msym-bp.c:21
 1.2                         y   0x000000000040049d in foo at src/gdb/testsuite/gdb.base/msym-bp-2.c:21

For the msym-bp-shl.exp testcase (static vs plt), without debug info, before running to main:

 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x00000000004004e0 <foo@plt>        ### missing before patch
 1.2                         y   0x00000000004005db <foo+4>

For the msym-bp-shl.exp testcase (static vs plt), without debug info, after running to main:

 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x00000000004005db <foo+4>          ### missing before patch
 1.2                         y   0x00007ffff7bd65de <foo+4>

For the msym-bp-shl.exp testcase (static vs plt), with debug info, before running to main:

 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x00000000004004e0 <foo@plt>        ### missing before patch
 1.2                         y   0x00000000004005db in foo at src/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c:21

For the msym-bp-shl.exp testcase (static vs plt), with debug info, after running to main:

 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x00000000004005db in foo at src/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c:21
 1.2                         y   0x00007ffff7bd65de in foo at src/gdb/testsuite/gdb.base/msym-bp-shl-lib.c:21

gdb/ChangeLog:

* linespec.c (classify_mtype, compare_msyms): Delete.
(search_minsyms_for_name): Remove classification logic.  Instead
filter out trampoline symbols if we also found an external
function of the same name.

gdb/testsuite/ChangeLog:

* gdb.base/msym-bp-2.c: New.
* gdb.base/msym-bp-shl-lib.c: New file.
* gdb.base/msym-bp-shl-main-2.c: New file.
* gdb.base/msym-bp-shl-main.c: New file.
* gdb.base/msym-bp-shl.exp: New file.
* gdb.base/msym-bp.c: New file.
* gdb.base/msym-bp.exp: New file.

4 years agoRe: elf: Add -z unique-symbol
Alan Modra [Sun, 13 Sep 2020 08:26:52 +0000 (17:56 +0930)]
Re: elf: Add -z unique-symbol

PR 26391
* testsuite/ld-elf/pr26391.nd: Adjust to match powerpc64 function
descriptors.

4 years agoUpdate NEWS post GDB 10 branch creation.
Joel Brobecker [Sun, 13 Sep 2020 02:43:47 +0000 (19:43 -0700)]
Update NEWS post GDB 10 branch creation.

gdb/ChangeLog:

* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.

4 years agoBump version to 11.0.50.DATE-git.
Joel Brobecker [Sun, 13 Sep 2020 02:34:28 +0000 (19:34 -0700)]
Bump version to 11.0.50.DATE-git.

Now that the GDB 10 branch has been created, we can
bump the version number.

gdb/ChangeLog:

GDB 10 branch created (8087c3fa8b5d695e3e29e69d70d0b35ec902ac59):
* version.in: Bump version to 11.0.50.DATE-git.

gdb/testsuite/ChangeLog:

* gdb.base/default.exp: Change $_gdb_major to 11.

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

4 years agoFix GDB build in infrun.c when configured with unit tests disabled
Joel Brobecker [Sat, 12 Sep 2020 19:30:56 +0000 (12:30 -0700)]
Fix GDB build in infrun.c when configured with unit tests disabled

I noticed this while testing the GDB in the context of the upcoming
GDB 10 release branching, because part of the process involves setting
development to False, which in turn changes the default for including
unittest to false as well. As a result, without this patch, we get
compilation errors in infrun.c such as:

    infrun.c:9219:5: error: `scoped_mock_context' was not declared in this scope

This patch fixes it by bracketing the unitttest in namespace selftest
with an #if GDB_SELF_TEST.

gdb/ChangeLog:

        * infrun.c (namespace selftests): Only define #if GDB_SELF_TEST.

Tested on x86_64-linux, with and without self-tests.

4 years agoelf: Add -z unique-symbol to avoid duplicated local symbol names
H.J. Lu [Sat, 12 Sep 2020 12:37:30 +0000 (05:37 -0700)]
elf: Add -z unique-symbol to avoid duplicated local symbol names

The symbol string table in the .symtab section is optional and cosmetic.
The contents of the .symtab section have no impact on run-time execution.
The symbol names in the symbol string table help distinguish addresses at
different locations.  Add a linker option, -z unique-symbol, to avoid
duplicated local symbol names in the symbol string table.

This feature was well received by the livepatch maintainers.  It not only
solves the duplicated local symbol name problem, but also would allow
livepatch to more precisely locate duplicate symbols in general for
patching.

bfd/

PR ld/26391
* elflink.c (elf_final_link_info): Add local_hash_table.
(local_hash_entry): New.
(local_hash_newfunc): Likewise.
(elf_link_output_symstrtab): Append ".COUNT" to duplicated local
symbols.
(bfd_elf_final_link): Initialize and free local_hash_table for
"-z unique-symbol".

include/

PR ld/26391
* bfdlink.h (bfd_link_info): Add unique_symbol.

ld/

PR ld/26391
* NEWS: Mention "-z unique-symbol".
* emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Handle
"-z unique-symbol" and "-z nounique-symbol".
* ld.texi: Document "-z unique-symbol" and "-z nounique-symbol".
* lexsup.c (elf_static_list_options): Add "-z unique-symbol" and
"-z nounique-symbol".
* testsuite/ld-elf/elf.exp: Add PR ld/26391 tests.
* testsuite/ld-elf/pr26391.nd: New file.
* testsuite/ld-elf/pr26391.out: Likewise.
* testsuite/ld-elf/pr26391a.c: Likewise.
* testsuite/ld-elf/pr26391b.c: Likewise.
* testsuite/ld-elf/pr26391c.c: Likewise.
* testsuite/ld-elf/pr26391d.c: Likewise.

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

4 years agoAdd bfloat16 support for AVX512 register view.
Felix Willgerodt [Thu, 10 Sep 2020 12:29:53 +0000 (14:29 +0200)]
Add bfloat16 support for AVX512 register view.

This adds support for the bfloat16 datatype, which can be seen as a short
version of FP32, skipping the least significant 16 bits of the mantissa.
Since the datatype is currently only supported by the AVX512 registers,
the printing of bfloat16 values is only supported for xmm, ymm and zmm
registers.

gdb/ChangeLog:
2020-09-11  Moritz Riesterer  <moritz.riesterer@intel.com>
    Felix Willgerodt  <Felix.Willgerodt@intel.com>

* gdbarch.sh: Added bfloat16 type.
* gdbarch.c: Regenerated.
* gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_bfloat16): New struct.
(gdbtypes_post_init): Add builtin_bfloat16.
* gdbtypes.h (struct builtin_type) <builtin_bfloat16>: New member.
(floatformats_bfloat16): New struct.
* i386-tdep.c (i386_zmm_type): Add field "v32_bfloat16"
(i386_ymm_type): Add field "v16_bfloat16"
(i386_gdbarch_init): Add set_gdbarch_bfloat16_format.
* target-descriptions.c (make_gdb_type): Add case TDESC_TYPE_BFLOAT16.
* gdbsupport/tdesc.cc (tdesc_predefined_types): New member bfloat16.
* gdbsupport/tdesc.h (tdesc_type_kind): New member TDESC_TYPE_BFLOAT16.
* features/i386/64bit-avx512.xml: Add bfloat16 type.
* features/i386/64bit-avx512.c: Regenerated.
* features/i386/64bit-sse.xml: Add bfloat16 type.
* features/i386/64bit-sse.c: Regenerated.

gdb/testsuite/ChangeLog:
2020-09-11  Moritz Riesterer  <moritz.riesterer@intel.com>
    Felix Willgerodt  <Felix.Willgerodt@intel.com>

* x86-avx512bf16.c: New file.
* x86-avx512bf16.exp: Likewise.
* lib/gdb.exp (skip_avx512bf16_tests): New function.

4 years agoi386-tdep: Fix naming in zmm and ymm type descriptions.
Felix Willgerodt [Thu, 10 Sep 2020 12:29:52 +0000 (14:29 +0200)]
i386-tdep: Fix naming in zmm and ymm type descriptions.

gdb/Changelog:
2020-07-02  Felix Willgerodt  <felix.willgerodt@intel.com>

* i386-tdep.c (i386_zmm_type): Fix field names.
(i386_ymm_type): Fix field names.

4 years agoSync include, libiberty with GCC.
Felix Willgerodt [Thu, 10 Sep 2020 12:29:51 +0000 (14:29 +0200)]
Sync include, libiberty with GCC.

include:
2020-09-10  Felix Willgerodt  <felix.willgerodt@intel.com>

    Sync with GCC
    2020-08-17  Felix Willgerodt  <felix.willgerodt@intel.com>

    * floatformat.h (floatformat_bfloat16_big): New.
    (floatformat_bfloat16_little): New.

libiberty:
2020-09-10  Felix Willgerodt  <felix.willgerodt@intel.com>

    Sync with GCC
    2020-08-17  Felix Willgerodt  <felix.willgerodt@intel.com>

    * floatformat.c (floatformat_bfloat16_big): New.
    (floatformat_bfloat16_little): New.

4 years agogas: Don't error when .debug_line already exists, unless .loc was used
Mark Wielaard [Mon, 7 Sep 2020 12:25:25 +0000 (14:25 +0200)]
gas: Don't error when .debug_line already exists, unless .loc was used

When -g was used to generate DWARF gas would error out when a .debug_line
already exists. But when a .debug_info section already exists it would
simply skip generating one without warning or error. Do the same for
.debug_line. It is only an error when the user explicitly uses .loc
directives and also generates the .debug_line table itself.

The tests are unfortunately arch specific because the line table is only
generated when actual instructions have been emitted. Use i386 because
that is probably the most used architecture. Before this patch the new
dwarf-line-2 testcase would fail, with this patch it succeeds (and doesn't
try to add its own line table).

gas/ChangeLog:

    * as.texi (-g): Explicitly mention when .debug_info and .debug_line
    are generated for the DWARF format.
    (Loc): Add that it is an error to both use a .loc directive and
    generate a .debug_line yourself.
    * dwarf2dbg.c (dwarf2_any_loc_directive_seen): New static variable.
    (dwarf2_directive_loc): Set dwarf2_any_loc_directive_seen to TRUE.
    (dwarf2_finish): Check dwarf2_any_loc_directive_seen before emitting
    an error. Only create .debug_line if it is empty (or doesn't exist).
    * testsuite/gas/i386/i386.exp: Add dwarf2-line-{1,2,3,4} when testing
    an elf target.
    * testsuite/gas/i386/dwarf2-line-{1,2,3,4}.{s,d,l}: New test files.

4 years agoCSKY: Change ISA flag's type to bfd_uint64_t and fix build error.
Cooper Qu [Fri, 11 Sep 2020 15:58:11 +0000 (23:58 +0800)]
CSKY: Change ISA flag's type to bfd_uint64_t and fix build error.

The previous patch missed one modification.
Following is the error message:
gas/config/tc-csky.c:806:5: error: 'CSKY_ARCH_804' undeclared here
(not in a function); did you mean 'CSKY_ARCH_807'?

include/
* opcode/csky.h (CSKYV1_ISA_E1): Convert to bfd_uint64_t type.
(CSKYV2_ISA_E1): Likewise.
(CSKYV2_ISA_1E2): Likewise.
(CSKYV2_ISA_2E3): Likewise.
(CSKYV2_ISA_3E7): Likewise.
(CSKYV2_ISA_7E10): Likewise.
(CSKYV2_ISA_3E3R1): Likewise.
(CSKYV2_ISA_3E3R2): Likewise.
(CSKYV2_ISA_10E60): Likewise.
(CSKYV2_ISA_3E3R3): Likewise.
(CSKY_ISA_TRUST): Likewise.
(CSKY_ISA_CACHE): Likewise.
(CSKY_ISA_NVIC): Likewise.
(CSKY_ISA_CP): Likewise.
(CSKY_ISA_MP): Likewise.
(CSKY_ISA_MP_1E2): Likewise.
(CSKY_ISA_JAVA): Likewise.
(CSKY_ISA_MAC): Likewise.
(CSKY_ISA_MAC_DSP): Likewise.
(CSKY_ISA_DSP): Likewise.
(CSKY_ISA_DSP_1E2): Likewise.
(CSKY_ISA_DSP_ENHANCE): Likewise.
(CSKY_ISA_DSPE60): Likewise.
(CSKY_ISA_FLOAT_E1): Likewise.
(CSKY_ISA_FLOAT_1E2): Likewise.
(CSKY_ISA_FLOAT_1E3): Likewise.
(CSKY_ISA_FLOAT_3E4): Likewise.
(CSKY_ISA_FLOAT_7E60): Likewise.
(CSKY_ISA_VDSP): Likewise.
(CSKY_ISA_VDSP_2): Likewise.
(CSKY_ARCH_804): Define.
(CSKY_ARCH_805): Define.
(CSKY_ARCH_800): Define.

4 years agoFix a segfault when creating an import library with 0 exports.
Jeremy Drake [Fri, 11 Sep 2020 16:51:16 +0000 (17:51 +0100)]
Fix a segfault when creating an import library with 0 exports.

PR 26588
* emultempl/pe.em (_finish): Only generate a import library if not
exporting relocs.
* emultempl/pep.em: Likewise.

4 years ago[gdb/testsuite] Kfail gdb.cp/ambiguous.exp FAILs for PR26602
Tom de Vries [Fri, 11 Sep 2020 13:56:44 +0000 (15:56 +0200)]
[gdb/testsuite] Kfail gdb.cp/ambiguous.exp FAILs for PR26602

Kfail these FAILs as caused by PR exp/26602:
...
FAIL: gdb.cp/ambiguous.exp: print x.x
FAIL: gdb.cp/ambiguous.exp: print n.x
FAIL: gdb.cp/ambiguous.exp: print j.x
FAIL: gdb.cp/ambiguous.exp: print jva1.x
FAIL: gdb.cp/ambiguous.exp: print jva2.x
FAIL: gdb.cp/ambiguous.exp: print (A1)j
FAIL: gdb.cp/ambiguous.exp: print (A1)jva1
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

PR exp/26602
* gdb.cp/ambiguous.exp: Add KFAILs for PR26602.

4 years agox86: Add NT_X86_CET note
H.J. Lu [Fri, 11 Sep 2020 12:51:53 +0000 (05:51 -0700)]
x86: Add NT_X86_CET note

Define NT_X86_CET which is the proposed note for x86 CET state to support
Intel CET in Linux kernel.  Double check it after Intel CET patches have
been merged into Linux kernel.

binutils/

* readelf.c (get_note_type): Support NT_X86_CET.

include/

* elf/common.h (NT_X86_CET): New.

4 years agoFix the debuglink following code to recursively load links found in the newly loaded...
Nick Clifton [Fri, 11 Sep 2020 12:30:38 +0000 (13:30 +0100)]
Fix the debuglink following code to recursively load links found in the newly loaded debug info.

PR 26595
* dwarf.c (load_separate_debug_info): Return NULL rather than
FALSE in error situations.
(load_separate_debug_file): Move code to load debug links to ...
(check_for_and_load_links): ... here.  New function.  Load
separate debug information pointed to by debuglink and
debugaltlink sections.  Recursively scan newly loaded debug
information for more links and load them too.

4 years agogdb/breakpoint: fix typo in help message of "set breakpoint condition-evaluation"
Tankut Baris Aktemur [Fri, 11 Sep 2020 11:50:09 +0000 (13:50 +0200)]
gdb/breakpoint: fix typo in help message of "set breakpoint condition-evaluation"

The options for the "breakpoint condition-evaluation" setting are
"host", "target", and "auto".  The help message mentions the option
"gdb" at one point instead of "host".  Fix this typo.  Also add a period.

gdb/ChangeLog:
2020-09-11  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* breakpoint.c: Fix typo in the help message of the
"set breakpoint condition-evaluation" command.

4 years agogdb/testsuite: remove stale comment in gdb.base/bp-cmds-execution-x-script.exp
Tankut Baris Aktemur [Fri, 11 Sep 2020 11:40:41 +0000 (13:40 +0200)]
gdb/testsuite: remove stale comment in gdb.base/bp-cmds-execution-x-script.exp

Remove a stale command that is apparently forgotten after a copy-paste
from 'gdb.base/break-main-file-remove-fail.exp'.

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

* gdb.base/bp-cmds-execution-x-script.exp: Remove a stale comment.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 11 Sep 2020 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoaarch64: Return an error on conditional branch to an undefined symbol
Siddhesh Poyarekar [Tue, 1 Sep 2020 08:55:52 +0000 (14:25 +0530)]
aarch64: Return an error on conditional branch to an undefined symbol

The fix in 7e05773767820b441b23a16628b55c98cb1aef46 introduced a PLT
for conditional jumps when the target symbol is undefined.  This is
incorrect because conditional branch relocations are not allowed to
clobber IP0/IP1 and hence, should not result in a dynamic relocation.

Revert that change and in its place, issue an error when the target
symbol is undefined.

bfd/

2020-09-10  Siddhesh Poyarekar  <siddesh.poyarekar@arm.com>

* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Revert
changes in 7e05773767820b441b23a16628b55c98cb1aef46.  Set
error for undefined symbol in BFD_RELOC_AARCH64_BRANCH19 and
BFD_RELOC_AARCH64_TSTBR14 relocations.

ld/

2020-09-10  Siddhesh Poyarekar  <siddesh.poyarekar@arm.com>

* testsuite/ld-aarch64/emit-relocs-560.d: Expect error instead
of valid output.

4 years agold: Add more tests for --as-needed
H.J. Lu [Thu, 10 Sep 2020 14:52:03 +0000 (07:52 -0700)]
ld: Add more tests for --as-needed

Prior to

commit 1e3b96fd6cf0c7d018083994ad951ccf92aba582
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Sep 4 13:54:21 2020 +0930

    Allow plugin syms to mark as-needed shared libs needed

when removing unused IR symbol references, ld didn't add unnecessary
DT_NEEDED libraries which may lead to undefined symbol reference in a
--as-needed library when the symbol is defined in a prior --as-needed
library and there is no reference in relocatable inputs.  This behavior
is desirable since it ensures that both lazy and non-lazy bindings work
the same way.  The problem is with --as-needed libraries, which happens
with and without LTO.  Now, the linker may add many unnecessary DT_NEEDED
libraries for IR inputs.

PR ld/26590
* testsuite/ld-elf/pr26590.err: New file.
* testsuite/ld-elf/pr26590a.c: Likewise.
* testsuite/ld-elf/pr26590b.c: Likewise.
* testsuite/ld-elf/pr26590c.c: Likewise.
* testsuite/ld-elf/pr26590d.c: Likewise.
* testsuite/ld-elf/shared.exp: Run ld/26590 tests.

4 years agoPR26597, FAIL: gdb.dlang/demangle.exp: _D8demangle4testFI5identZv
Alan Modra [Thu, 10 Sep 2020 14:16:11 +0000 (23:46 +0930)]
PR26597, FAIL: gdb.dlang/demangle.exp: _D8demangle4testFI5identZv

gcc commit 387d0773f3 changed the D demangler, with the following
commit log:

    libiberty: Add support for `in' and `in ref' storage classes.

    The storage class `in' is now a first-class citizen with its own mangle
    symbol, of which also permits `in ref'.  Previously, `in' was an alias
    to `const [scope]', which is a type constructor.

    The mangle symbol repurposed for this is `I', which was originally used
    by identifier types.  However, while TypeIdentifier is part of the
    grammar, it must be resolved to some other entity during the semantic
    passes, and so shouldn't appear anywhere in the mangled name.

    Old tests that are now no longer valid have been removed.

This patch makes the same changes to the gdb testsuite as were made to
the upstream gcc libiberty testsuite.

gdb/testsuite/
PR 26597
* gdb.dlang/demangle.exp: Update tests as per gcc commit 387d0773f3.

4 years agoAdd minimal and functional NetBSD/amd64 gdbserver
Kamil Rytarowski [Wed, 2 Sep 2020 17:35:42 +0000 (19:35 +0200)]
Add minimal and functional NetBSD/amd64 gdbserver

Implement the following functionality: create_inferior,
post_create_inferior, attach, kill, detach, mourn, join, thread_alive,
resume, wait, fetch_registers, store_registers, read_memory, write_memory,
request_interrupt, supports_read_auxv, read_auxv,
supports_hardware_single_step, sw_breakpoint_from_kind,
supports_z_point_type, insert_point, remove_point,
stopped_by_sw_breakpoint, supports_qxfer_siginfo, qxfer_siginfo,
supports_stopped_by_sw_breakpoint, supports_non_stop,
supports_multi_process, supports_fork_events, supports_vfork_events,
supports_exec_events, supports_disable_randomization,
supports_qxfer_libraries_svr4, qxfer_libraries_svr4,
supports_pid_to_exec_file, pid_to_exec_file, thread_name,
supports_catch_syscall.

The only CPU architecture supported: x86_64.

Implement only support for hardware assisted single step and
software breakpoint.

Implement support only for regular X86 registers, thus no FPU.

gdbserver/ChangeLog:

       * netbsd-low.cc: Add.
       * netbsd-low.h: Likewise.
       * netbsd-amd64-low.cc: Likewise.
       * Makefile.in (SFILES): Register "netbsd-low.cc", "netbsd-low.h",
       "netbsd-amd64-low.cc".
       * configure.srv: Add x86_64-*-netbsd*.

4 years agoSwitch local native code to gdb/nat shared functions
Kamil Rytarowski [Wed, 2 Sep 2020 17:32:54 +0000 (19:32 +0200)]
Switch local native code to gdb/nat shared functions

No functional change as the same functionality inlined in nbsd-nat.c
is offered in gdb/nat/netbsd-nat.c.

gdb/ChangeLog:

* nbsd-nat.c: Include "nat/netbsd-nat.h".
* (nbsd_nat_target::pid_to_exec_file)
(nbsd_nat_target::thread_alive, nbsd_nat_target::thread_name)
(nbsd_nat_target::post_startup_inferior)
(nbsd_nat_target::post_attach, nbsd_nat_target::xfer_partial)
(nbsd_add_threads): Switch local code to common gdb/nat functions.
* (nbsd_pid_to_cmdline): Call sysctl from the global namespace.
* (nbsd_thread_lister): Remove.

4 years agoAvoid double free in startup_inferior
Kamil Rytarowski [Wed, 2 Sep 2020 17:24:05 +0000 (19:24 +0200)]
Avoid double free in startup_inferior

Do not free the last execd pathname as it will be used in
prepare_resume_reply(), after attaching a client side.

gdb/ChangeLog:

* fork-inferior.c (startup_inferior): Avoid double free.

4 years agoAdd a common utility function to read and write siginfo_t in inferior
Kamil Rytarowski [Wed, 2 Sep 2020 17:21:19 +0000 (19:21 +0200)]
Add a common utility function to read and write siginfo_t in inferior

gdb/ChangeLog:

        * netbsd-nat.h (netbsd_nat::qxfer_siginfo): Add.
        * netbsd-nat.c (netbsd_nat::qxfer_siginfo): Likewise.

4 years agoAdd netbsd_nat::enable_proc_events in gdb/nat
Kamil Rytarowski [Wed, 2 Sep 2020 17:18:55 +0000 (19:18 +0200)]
Add netbsd_nat::enable_proc_events in gdb/nat

Add generic function to enable debugger events in a process.

gdb/ChangeLog:

        * netbsd-nat.h (netbsd_nat::enable_proc_events): Add.
* netbsd-nat.c: Include <sys/ptrace.h>.
* (netbsd_nat::enable_proc_events): Add.

4 years agoAdd gdb/nat common functions for listing threads
Kamil Rytarowski [Wed, 2 Sep 2020 17:13:19 +0000 (19:13 +0200)]
Add gdb/nat common functions for listing threads

Add netbsd_nat::netbsd_thread_lister a generic thread lister, used
internally in netbsd-nat.c, copied from gdb/nbsd-nat.c.

Add public extern functions for listing threads:
 * netbsd_nat::thread_alive
 * netbsd_nat::thread_name
 * netbsd_nat::for_each_thread

gdb/ChangeLog:

* netbsd-nat.h: Include "gdbsupport/function-view.h".
* (netbsd_nat::thread_alive, netbsd_nat::thread_name)
(netbsd_nat::for_each_thread): Add.
* netbsd-nat.c: Include "gdbsupport/common-defs.h" and
"gdbsupport/common-debug.h".
* (netbsd_nat::netbsd_thread_lister)
(netbsd_nat::thread_alive, netbsd_nat::thread_name)
(netbsd_nat::for_each_thread): Add.

4 years agoAdd netbsd_nat::pid_to_exec_file
Kamil Rytarowski [Wed, 2 Sep 2020 17:08:37 +0000 (19:08 +0200)]
Add netbsd_nat::pid_to_exec_file

gdb/ChangeLog:

        * netbsd-nat.h: Include <unistd.h>.
        * (netbsd_nat::pid_to_exec_file): Add.
        * netbsd-nat.c: Include <sys/types.h> and <sys/sysctl.h>.
        * (netbsd_nat::pid_to_exec_file) Add.

4 years agoBuild nat/netbsd-nat.o for the NetBSD native target
Kamil Rytarowski [Wed, 2 Sep 2020 17:02:13 +0000 (19:02 +0200)]
Build nat/netbsd-nat.o for the NetBSD native target

gdb/ChangeLog:

* configure.nat (NATDEPFILES): Add nat/netbsd-nat.o when needed.

4 years agoRegister a placeholder for NetBSD shared functions in gdb/nat
Kamil Rytarowski [Wed, 2 Sep 2020 16:53:41 +0000 (18:53 +0200)]
Register a placeholder for NetBSD shared functions in gdb/nat

gdb/ChangeLog:

* netbsd-nat.h: New file.
* netbsd-nat.c: Likewise.

4 years agoAdd handle_eintr to wrap EINTR handling in syscalls
Kamil Rytarowski [Wed, 2 Sep 2020 16:20:53 +0000 (18:20 +0200)]
Add handle_eintr to wrap EINTR handling in syscalls

gdbsupport/ChangeLog:

* eintr.h: New file.

4 years agoStop symbols generated by the annobin gcc plugin from breaking the disassembly of...
Nick Clifton [Thu, 10 Sep 2020 12:23:11 +0000 (13:23 +0100)]
Stop symbols generated by the annobin gcc plugin from breaking the disassembly of PowerPC binaries.

* ppc-dis.c (ppc_symbol_is_valid): New function.  Returns false
for hidden, local, no-type symbols.
(disassemble_init_powerpc): Point the symbol_is_valid field in the
info structure at the new function.

4 years agoCSKY: Enable extend lrw by default for CK802, CK803 and CK860.
Cooper Qu [Thu, 10 Sep 2020 09:37:05 +0000 (17:37 +0800)]
CSKY: Enable extend lrw by default for CK802, CK803 and CK860.

gas/
* config/tc-csky.c (md_begin): Enable extend lrw by default for
CK802, CK803 and CK860.

4 years agoCSKY: Add L2Cache instructions for CK860.
Cooper Qu [Thu, 10 Sep 2020 09:36:51 +0000 (17:36 +0800)]
CSKY: Add L2Cache instructions for CK860.

opcodes/
* csky-opc.h (csky_v2_opcodes): Add L2Cache instructions.
* testsuite/gas/csky/cskyv2_ck860.d : Adjust to icache.iva
opcode fixing.

4 years agoCSKY: Add new arches while refine the cpu option process.
Cooper Qu [Thu, 10 Sep 2020 09:36:24 +0000 (17:36 +0800)]
CSKY: Add new arches while refine the cpu option process.

Add arches CK804, CK805 and CK800. CK800 is an special arch which
support all instructions for CSKYV2. Refine the cpu tables to
simplify adding a new cpu.

Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>
gas/
* config/tc-csky.c (struct csky_cpu_info): Add new members
isa_flag, features and ver.
(struct csky_cpu_feature): New.
(struct csky_cpu_version): New.
(CSKY_FEATURE_MAX): Define.
(CSKY_CPU_REVERISON_MAX): Define.
(FEATURE_DSP_EXT, FEATURE_DSP, FEATURE_MMU, FEATURE_VDSP,
 FEATURE_FLOAT, FEATURE_TRUST, FEATURE_JAVA, FEATURE_SHIELD):
Define, each standard one collection of instructions.
(CSKY_FEATURES_DEF_NULL, CSKY_FEATURES_DEF_e,
 CSKY_FEATURES_DEF_t, CSKY_FEATURES_DEF_f, CSKY_FEATURES_DEF_v,
 CSKY_FEATURES_DEF_ef, CSKY_FEATURES_DEF_jt,
 CSKY_FEATURES_DEF_efht, CSKY_FEATURES_DEF_efv,
 CSKY_FEATURES_DEF_eft, CSKY_FEATURES_DEF_d,
 CSKY_FEATURES_DEF_df, CSKY_FEATURES_DEF_ft,
 CSKY_FEATURES_DEF_tv, CSKY_FEATURES_DEF_fv,
 CSKY_FEATURES_DEF_dft, CSKY_FEATURES_DEF_dfv,
 CSKY_FEATURES_DEF_ftv, CSKY_FEATURES_DEF_eftv): Define,
the features combination used by cpu.
(CSKY_CPU_REVERISON_r0p0, CSKY_CPU_REVERISON_r1p0,
 CSKY_CPU_REVERISON_r2p0, CSKY_CPU_REVERISON_r3p0,
 CSKY_CPU_REVERISON_RESERVED, CSKY_CPU_REVERISON_R3):
Define, version information used by cpu.
(csky_cpus): Refine, and add CK804, CK805 and CK800.
(parse_cpu): Refine.
(parse_arch): Refine.
(md_show_usage): Refine.
(md_begin): Refine.

include/
* opcode/csky.h (CSKY_ARCH_804): Define.
(CSKY_ARCH_805): Define.
(CSKY_ARCH_800): Define.

4 years agoRe: PR26580, Size and alignment of commons vs as-needed shared lib
Alan Modra [Thu, 10 Sep 2020 09:16:14 +0000 (18:46 +0930)]
Re: PR26580, Size and alignment of commons vs as-needed shared lib

Some MIPS targets, for reasons I didn't analyse, use the larger common
symbol in a shared lib rather than a smaller common in an executable.
That doesn't seem unreasonable, so allow that to pass for pr26580-2.

bfin-elf complains about not supporting copy relocs, but it's quite
silly to want a copy reloc for common symbols, so leave the fail
there.  mn10300-elf and score-elf both fail the test with "PHDR
segment not covered by LOAD segment".  Other tests fail similarly so
one more doesn't hurt.  The failure is a consequence of supporting
dynamic objects but setting EMBEDDED in ld scripts.

PR 26580
* testsuite/ld-elf/pr26580-2.sd: Accept undefined symbol.

4 years agoRe: lto-18 test
Alan Modra [Thu, 10 Sep 2020 07:40:57 +0000 (17:10 +0930)]
Re: lto-18 test

Extend the test a little to archives, not that we expect this to
fail.  Nor has the lto-18 test ever failed without -flto.

* testsuite/ld-plugin/lto-18b.c (select): Remove.
* testsuite/ld-plugin/lto-18c.c (select): Remove.
* testsuite/ld-plugin/lto.exp: Build archives for lto-18 too,
and run static versions of the test.

4 years agoFix compile time warnings when building for the CSKY target on a 32-bit host.
Nick Clifton [Thu, 10 Sep 2020 08:58:15 +0000 (09:58 +0100)]
Fix compile time warnings when building for the CSKY target on a 32-bit host.

incldue * opcode/csky.h (CSKY_ISA_FLOAT_7E60): Use a long long type for
this value.

opcodes * csky-dis.c (csky_output_operand): Coerce the immediate values to
long before printing.

4 years agosprintf arg overlaps destination
Alan Modra [Thu, 10 Sep 2020 04:42:52 +0000 (14:12 +0930)]
sprintf arg overlaps destination

* csky-dis.c (csky_output_operand): Don't sprintf str to itself.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 10 Sep 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoFix latent bug in ada-lang.c:remove_extra_symbols
Tom Tromey [Tue, 16 Jun 2020 17:28:23 +0000 (11:28 -0600)]
Fix latent bug in ada-lang.c:remove_extra_symbols

I believe ada-lang.c:remove_extra_symbols has a latent bug.  This
function loops over a vector of symbols, removing duplicates according
to some criteria.

At the end of the loop it does:

      if (remove_p)
syms->erase (syms->begin () + i);
      i += 1;

However, this seems wrong to me -- when removing the i'th element,
this code still increments "i", thus skipping an element.

At first I thought this was a regression from the patches to remove
cleanups from ada-lang.c (this was when std::vector was introduced);
but I found that instead the bug seems to be older:

       if (remove_p)
         {
           for (j = i + 1; j < nsyms; j += 1)
             syms[j - 1] = syms[j];
           nsyms -= 1;
         }

       i += 1;

No test, as I don't know how to write one.

As this is Ada-specific, and was already reviewed internally by Joel,
I am checking it in.

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

* ada-lang.c (remove_extra_symbols): Do not increment when
removing an element

4 years agoFix thinko in the code to check coff archive elements.
Nick Clifton [Wed, 9 Sep 2020 14:00:55 +0000 (15:00 +0100)]
Fix thinko in the code to check coff archive elements.

* cofflink.c (coff_link_check_archive_element): Move the check for
coff type input to the start of the function.

4 years agopower10 on ppc32
Alan Modra [Wed, 9 Sep 2020 12:40:47 +0000 (22:10 +0930)]
power10 on ppc32

We don't support power10 on ppc32, mainly because some instructions
have 34-bit fields for which we don't have relocations on ppc32.
If you try to assemble typical code, you'll see errors saying
"reloc ... not supported by object file format".  Also, on 32-bit
hosts with binutils configured without a 64-bit bfd, you'll see errors
saying "bignum invalid" when using large offsets.  But let's not kill
output of prefix insns entirely on 32-bit hosts.

* config/tc-ppc.c (md_assemble): Emit prefix insn by parts when
valueT is smaller than 64 bits.

4 years agoCSKY: Change mvtc and mulsw's ISA flag.
Cooper Qu [Mon, 7 Sep 2020 09:25:14 +0000 (17:25 +0800)]
CSKY: Change mvtc and mulsw's ISA flag.

gas/
* config/tc-csky.c (CSKYV2_ISA_DSP): CSKY_ISA_DSPE60.
(CSKY_ISA_860): Likewise.

include/
* opcode/csky.h (CSKY_ISA_DSPE60): Define.

opcodes/
* csky-opc.h (csky_v2_opcodes): Change mvtc and mulsw's
ISA flag.

4 years agoCSKY: Support option -mfloat-abi.
Cooper Qu [Mon, 7 Sep 2020 09:25:02 +0000 (17:25 +0800)]
CSKY: Support option -mfloat-abi.

The option corresponds to GCC to control the float calling conversion,
and the value will be stored in .csky.attributes section.

Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>
gas/
* config/tc-csky.c (float_abi): New.
(md_longopts): Add mfloat-abi.
(struct sky_option_value_table): New.
(csky_float_abis): New, the possible values for -mfloat-abi.
(parse_float_abi): New funtion.
(md_show_usage): Show help information for -mfloat-abi.
(set_csky_attribute): Store float-abi value.

4 years agoCSKY: Add FPUV3 instructions, which supported by ck860f.
Cooper Qu [Mon, 7 Sep 2020 09:24:11 +0000 (17:24 +0800)]
CSKY: Add FPUV3 instructions, which supported by ck860f.

Co-Authored-By: Lifang Xia <lifang_xia@c-sky.com>
gas/
* config/tc-csky.c (float_work_fpuv3_fmovi): New function,
helper function to encode fpuv3 fmovi instructions.
(float_work_fpuv3_fstore): New function.
(struct literal): Add new member 'offset'.
(csky_cpus): New cpu CK860f.
(enter_literal): Return literal pool pointer instead of offset.
(parse_rt): Adjust the change of enter_literal.
(parse_rtf): Likewise.
(v1_work_lrw): Likewise.
(v1_work_jbsr): Likewise.
(v2_work_lrw): Likewise.
(v2_work_jbsr): Likewise.
(v2_work_jsri): Likewise.
(vdsp_work_vlrw): Likewise.
(is_freglist_legal): Add handler for FPUV3.
(parse_type_freg): Likewise.
(is_imm_within_range): Set e.X_add_number if it is a signed and
negtive number.
(get_operand_value): Add handler for OPRND_TYPE_IMM9b,
OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI
and OPRND_TYPE_DFLOAT_FMOVI.
(float_to_half): Convert float number to harf float.

opcodes/
* csky-dis.c (csky_output_operand): Add handlers for
OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI and
OPRND_TYPE_DFLOAT_FMOVI. Refine OPRND_TYPE_FREGLIST_DASH
to support FPUV3 instructions.
* csky-opc.h (enum operand_type): New enum OPRND_TYPE_IMM9b,
OPRND_TYPE_HFLOAT_FMOVI, OPRND_TYPE_SFLOAT_FMOVI and
OPRND_TYPE_DFLOAT_FMOVI.
(OPRND_MASK_4_5, OPRND_MASK_6, OPRND_MASK_6_7, OPRND_MASK_6_8,
 OPRND_MASK_7, OPRND_MASK_7_8, OPRND_MASK_17_24,
 OPRND_MASK_20, OPRND_MASK_20_21, OPRND_MASK_20_22,
 OPRND_MASK_20_23, OPRND_MASK_20_24, OPRND_MASK_20_25,
 OPRND_MASK_0_3or5_8, OPRND_MASK_0_3or6_7, OPRND_MASK_0_3or25,
 OPRND_MASK_0_4or21_24, OPRND_MASK_5or20_21,
 OPRND_MASK_5or20_22, OPRND_MASK_5or20_23, OPRND_MASK_5or20_24,
 OPRND_MASK_5or20_25, OPRND_MASK_8_9or21_25,
 OPRND_MASK_8_9or16_25, OPRND_MASK_4_6or20, OPRND_MASK_5_7or20,
 OPRND_MASK_4_5or20or25, OPRND_MASK_4_6or20or25,
 OPRND_MASK_4_7or20or25, OPRND_MASK_6_9or17_24,
 OPRND_MASK_6_7or20, OPRND_MASK_6or20, OPRND_MASK_7or20,
 OPRND_MASK_5or8_9or16_25, OPRND_MASK_5or8_9or20_25): Define.
(csky_v2_opcodes): Add FPUV3 instructions.

include/
* opcode/csky.h (CSKY_ISA_FLOAT_7E60): Define.

4 years agoPR26578, memory leak in parse_gnu_debugaltlink
Alan Modra [Wed, 9 Sep 2020 07:08:36 +0000 (16:38 +0930)]
PR26578, memory leak in parse_gnu_debugaltlink

The associated check function doesn't do anything with its "data"
param, so nothing to adjust there.

PR 26578
* dwarf.c (parse_gnu_debugaltlink): Don't alloc build_id_data.
(load_separate_debug_files): Use a stack var for build_id_data.

4 years agolto-18 test
Alan Modra [Wed, 9 Sep 2020 02:46:23 +0000 (12:16 +0930)]
lto-18 test

Demonstrates a reason to use IR symbols when deciding an --as-needed
library should be loaded.

* testsuite/ld-plugin/lto-18a.c,
* testsuite/ld-plugin/lto-18b.c,
* testsuite/ld-plugin/lto-18c.c,
* testsuite/ld-plugin/lto-18d.c,
* testsuite/ld-plugin/lto-18.out: New test.
* testsuite/ld-plugin/lto.exp: Run it.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 9 Sep 2020 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoRe: MSP430: Support relocations for subtract expressions in .uleb128 directives
Alan Modra [Tue, 8 Sep 2020 23:08:48 +0000 (08:38 +0930)]
Re: MSP430: Support relocations for subtract expressions in .uleb128 directives

Put the prototype where it won't disappear on the next regen of libbfd.h.

* libbfd-in.h (_bfd_write_unsigned_leb128): Declare.
* libbfd.h: Regenerate.