1. 11 Jun, 2020 19 commits
    • Vivek Das Mohapatra's avatar
    • Vivek Das Mohapatra's avatar
      Define DT_GNU_UNIQUE for gold · 4a38352d
      Vivek Das Mohapatra authored
    • Vivek Das Mohapatra's avatar
      Handle DT_GNU_UNIQUE in readelf · 9284fd8f
      Vivek Das Mohapatra authored
    • Vivek Das Mohapatra's avatar
    • Vivek Das Mohapatra's avatar
    • Vivek Das Mohapatra's avatar
    • Jonny Grant's avatar
      gdb: add mailing list and IRC information to --help · 4412332f
      Jonny Grant authored
      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: default avatarJonathan Grant <jg@jguk.org>
      Change-Id: Ibd0746a348d558fb35b5cd7e366f107742806565
    • Keith Seitz's avatar
      Compute proper length for dynamic types of TYPE_CODE_TYPEDEF · 2f33032a
      Keith Seitz authored
      This patch fixes gdb/21356 in which we hit an assertion in
      (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
      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);
                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.
      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.
      2020-06-11  Keith Seitz  <keiths@redhat.com>
      	PR gdb/21356
      	* gdb.base/vla-datatypes.c (vla_factory): Add typedef for 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.
    • Tom de Vries's avatar
      [gdb/testsuite] Make gdb.base/dbx.exp more robust · a8baf0a3
      Tom de Vries authored
      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.
      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.
    • Alex Coplan's avatar
      [PATCH]: aarch64: Refactor representation of system registers · 14962256
      Alex Coplan authored
      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
       * 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.
       * 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.
      2020-06-11  Alex Coplan  <alex.coplan@arm.com>
      	* opcode/aarch64.h (aarch64_sys_reg): Add required features to struct
      	describing system registers.
      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.
    • Alan Modra's avatar
      Run certain ld-plugun lto tests only for ELF · 38226418
      Alan Modra authored
      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.
    • Nick Clifton's avatar
      Fix a compile time warning in the linker testsuite when compiling using clang. · 928055a3
      Nick Clifton authored
      	* testsuite/ld-elf/pr26094-1b.c (main): Change return type to
    • Alan Modra's avatar
      PR26107, Compilation failure in pdp11.c · f0aa3025
      Alan Modra authored
      	PR 26107
      	* pdp11.c (is_stab): Replace legacy "index" function with "strchr".
    • Alan Modra's avatar
      Re: asan: readelf: process_mips_specific buffer overflow · fd17d1e6
      Alan Modra authored
      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
    • Alan Modra's avatar
      asan: readelf: process_mips_specific buffer overflow · d0c4e780
      Alan Modra authored
      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.
      	* elf/mips.h (Elf32_RegInfo): Use fixed width integer types.
      	(Elf64_Internal_RegInfo, Elf_Internal_Options): Likewise.
      	* 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.
    • Simon Marchi's avatar
      gdb: fix whitespaces in ChangeLog · ec16513e
      Simon Marchi authored
      Replace 8 spaces with tabs.
      Change-Id: I60f2df3a2866f75f0307077bf6cb1fa3918f8180
    • Jonny Grant's avatar
      gdb/doc: remove broken links Previous and Up from contents · c5a6a07f
      Jonny Grant authored
      	* gdb.texinfo: Remove broken links Previous and Up from
      Signed-off-by: default avatarJonny Grant <jg@jguk.org>
      Change-Id: Iad7323580a3c0c7f00eab1264d66f39e8d156e38
    • H.J. Lu's avatar
      ia64: Set DF_TEXTREL instead of reltext · 447f6d86
      H.J. Lu authored
      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.
    • GDB Administrator's avatar
      Automatic date update in version.in · 6cff1eab
      GDB Administrator authored
  2. 10 Jun, 2020 7 commits
    • Alan Modra's avatar
      Fix x86 ld testsuite fails with glibc < 2.28 · 84df1f9d
      Alan Modra authored
      	* 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.
    • Tom de Vries's avatar
      [gdb/symtab] Enable ada .gdb_index · 7ab96794
      Tom de Vries authored
      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.
      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
      2020-06-10  Tom de Vries  <tdevries@suse.de>
      	* gdb.ada/ptype_union.exp: Remove PR24713 workaround.
    • Tom de Vries's avatar
      [gdb/symtab] Fix name lookup in dw2_map_matching_symbols · e5f3ece2
      Tom de Vries authored
      In commit 9a0bacfb "[gdb/symtab] Handle .gdb_index in ada language mode", a
      missing part of dw2_map_matching_symbols was added, containing a call to
      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.
      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
    • H.J. Lu's avatar
      ELF: Properly handle section symbols · e1b5d517
      H.J. Lu authored
      When defining the section symbol, __start_FOO, for the section FOO:
      1. Treat the common symbol, __start_FOO, in input object file as
      2. Clear verinfo.verdef.
      	PR ld/26094
      	* elflink.c (bfd_elf_define_start_stop): Handle common symbols.
      	Clear verinfo.verdef.
      	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.
    • Ralf Habacker's avatar
      Fix the windmc program to conform to the behaviour of mc.exe by rejecting... · 25065fcd
      Ralf Habacker authored
      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.
    • Simon Marchi's avatar
      gdb/testsuite: fix duplicate test names in gdb.base/index-cache.exp · cab5c3b7
      Simon Marchi authored
          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.base/index-cache.exp (test_cache_disabled): Add test_prefix
      	parameter, update callers.
      Change-Id: Idf382fd380c77a654e8a7aa236af50b65c96b1d2
    • GDB Administrator's avatar
      Automatic date update in version.in · f5163fdc
      GDB Administrator authored
  3. 09 Jun, 2020 14 commits
    • H.J. Lu's avatar
      IFUNC: Update IFUNC resolver check with DT_TEXTREL · cebd6b8a
      H.J. Lu authored
      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.
      	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
      	* 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):
      	* 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
      	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
      	* testsuite/ld-i386/pr18801b.d: Likewise.
      	* estsuite/ld-x86-64/pr18801a.d: Likewise.
      	* estsuite/ld-x86-64/pr18801b.d: Likewise.
    • H.J. Lu's avatar
      i386-dis.c: Fix a typo in comments · f9630fa6
      H.J. Lu authored
      	* i386-dis.c (prefix_table): Fix a typo in comments.
    • Seth Girvan's avatar
      [PATCH] gas/doc: improve AVR modifiers wording. · 18ca16be
      Seth Girvan authored
      	* doc/c-avr.texi: Improve wording.
    • Jan Beulich's avatar
      x86: add missing 64-bit tests for "don't ignore mandatory pseudo prefixes" · 6778f1c4
      Jan Beulich authored
      Commit da4977e0 added the 32-bit test files, but failed to add the
      64-bit ones.
    • Alan Modra's avatar
      PR26065, ld/testsuite/ld-elf symbolic tests dl4e and dl4f fail · a61e3060
      Alan Modra authored
      	PR 26065
      	* testsuite/ld-elf/shared.exp: Compile dl4main.c -fPIC.
      	(dl4e, dl4f): Expect dl4a.out.
      	* testsuite/ld-elf/dl4e.out: Delete.
    • Jan Beulich's avatar
      x86: consistently print prefixes explicitly which are invalid with VEX etc · 73239888
      Jan Beulich authored
      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).
    • Jan Beulich's avatar
      x86: fix {,V}MOV{L,H}PD disassembly · 18897deb
      Jan Beulich authored
      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
      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.
    • Jan Beulich's avatar
      x86: utilize X macro in EVEX decoding · 97e6786a
      Jan Beulich authored
      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.
    • Jan Beulich's avatar
      x86: correct decoding of packed-FP-only AVX encodings · bf926894
      Jan Beulich authored
      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
    • Jan Beulich's avatar
      x86: correct mis-named MOD_0F51 enumerator · a5aaedb9
      Jan Beulich authored
      This is for extension major opcode 50, so name it accordingly.
    • Jan Beulich's avatar
      x86-64: adjust far indirect branch handling · 828c2a25
      Jan Beulich authored
      An unwanted side effect of 5990e377 ("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.
    • Jan Beulich's avatar
      x86: don't ignore mandatory pseudo prefixes · da4977e0
      Jan Beulich authored
      {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.
    • Alan Modra's avatar
      PowerPC64: Downgrade ifunc with textrel error to a warning · efb2a7b4
      Alan Modra authored
      For ppc64 I set flags when recording the dynamic relocation rather
      than when allocating space.  That allows you to distinguish three
      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
      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.
    • GDB Administrator's avatar
      Automatic date update in version.in · c3cd6601
      GDB Administrator authored