H.J. Lu [Mon, 29 Aug 2016 16:09:14 +0000 (09:09 -0700)]
Run PR ld/19784 tests only if ifunc attribute works
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/19784 tests only
if ifunc attribute works.
H.J. Lu [Mon, 29 Aug 2016 15:49:20 +0000 (08:49 -0700)]
Check the external compression header size
Since the internal compression header size can be bigger than the
external compression header size, we should check the external
compression header size.
* readelf.c (load_specific_debug_section): Check the external
compression header size.
H.J. Lu [Mon, 29 Aug 2016 15:12:59 +0000 (08:12 -0700)]
i386: Issue an error on non-PIC call to IFUNC in PIC object
On i386, IFUNC function must be called via PLT. Since PLT in PIC
object uses EBX register, R_386_PLT32 relocation must be used to
call IFUNC function even when IFUNC function is defined locally.
Linker should issue an error when R_386_PC32 relocation is used
to call IFUNC function.
Since PR ld/19784 tests doesn't use PLT relocation to local IFUNC
function, they are moved to the x86-64 test directory.
bfd/
PR ld/14961
PR ld/20515
* elf32-i386.c (elf_i386_check_relocs): Issue an error when
R_386_PC32 relocation is used to call IFUNC function in PIC
object.
ld/
PR ld/14961
PR ld/20515
* testsuite/ld-i386/i386.exp: Run pr20515.
* testsuite/ld-i386/pr20515.d: New file.
* testsuite/ld-i386/pr20515.s: Likewise.
* testsuite/ld-ifunc/ifunc-14a.s: Use R_386_PLT32 to call IFUNC
function.
* testsuite/ld-ifunc/ifunc-14c.s: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386.s: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386.s: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Move PR ld/19784 tests to ...
* testsuite/ld-x86-64/x86-64.exp: Here.
* testsuite/ld-ifunc/pr19784a.c: Moved to ...
* testsuite/ld-x86-64/pr19784a.c: Here.
* testsuite/ld-ifunc/pr19784b.c: Moved to ...
* testsuite/ld-x86-64/pr19784b.c: Here.
* testsuite/ld-ifunc/pr19784c.c: Moved to ...
* testsuite/ld-x86-64/pr19784c.c: Here.
Jan Kratochvil [Mon, 29 Aug 2016 13:20:04 +0000 (15:20 +0200)]
gdb.base/default.exp regression
tty^M
(gdb) FAIL: gdb.base/default.exp: tty
gdb/testsuite/ChangeLog
2016-08-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/default.exp (tty): Remove.
GDB Administrator [Mon, 29 Aug 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Han Shen [Fri, 26 Aug 2016 22:50:15 +0000 (15:50 -0700)]
PR gold/20529 - relaxing loop never ends.
gold/ChangeLog
2016-08-26 Han Shen <shenhan@google.com>
* powerpc.cc (Stub_table::min_size_threshold_): New member to
limit size.
(Stub_table::set_min_size_threshold): New member function.
(Stub_table::set_address_and_size): Add code to only allow size
increase.
(Target_powerpc::do_relax): Add code to record last size.
GDB Administrator [Sun, 28 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sat, 27 Aug 2016 00:13:42 +0000 (09:43 +0930)]
Lack of SHF_GROUP sections result in ld segfault
PR 20520
* elf.c (_bfd_elf_setup_sections): Check that SHT_GROUP sections
have corresponding SHF_GROUP sections.
(bfd_elf_set_group_contents): Comment.
Alan Modra [Fri, 26 Aug 2016 23:29:29 +0000 (08:59 +0930)]
Fix commit
980aa3e6
Commit
980aa3e6 was supposed to cure dyn_reloc counting problems, but
did the opposite. For PIC we count two types of dyn_reloc, those on
pc-relative relocs, and the total. If a sym needs pc-relative dyn
relocs then all the relocs are dynamic. If not, then only those that
are must_be_dyn_reloc are dynamic.
PR 20519
* elf64-ppc.c (pc_dynrelocs): New function.
(ppc64_elf_relocate_section): Use it and must_be_dyn_reloc to
handle pic dynamic relocs.
GDB Administrator [Sat, 27 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Jose E. Marchesi [Fri, 26 Aug 2016 14:31:31 +0000 (07:31 -0700)]
opcodes, gas: fix mnemonic of sparc camellia_fl
This patch fixes a typo in the mnemonic of the camellia_fl
instruction, which was implemented before as camellia_fi.
gas/ChangeLog:
2016-08-26 Jose E. Marchesi <jose.marchesi@oracle.com>
* testsuite/gas/sparc/crypto.d: Rename invalid opcode camellia_fi
to camellia_fl.
* testsuite/gas/sparc/crypto.s: Likewise.
opcodes/ChangeLog:
2016-08-26 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc-opc.c (sparc_opcodes): Fix typo in opcode, camellia_fi ->
camellia_fl.
Thomas Preud'homme [Fri, 26 Aug 2016 13:00:39 +0000 (14:00 +0100)]
Reduce parameter list in bfd_elf32_arm_target_relocs
2016-08-26 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* bfd-in.h (struct elf32_arm_params): Define.
(bfd_elf32_arm_set_target_relocs): Rename into ...
(bfd_elf32_arm_set_target_params): This. Use a struct
elf32_arm_params to pass all parameters but the bfd and bfd_link_info.
* bfd-in2.h: Regenerate.
* elf32-arm.c (bfd_elf32_arm_set_target_relocs): Rename into ...
(bfd_elf32_arm_set_target_params): This. Pass all values via a struct
elf32_arm_params rather than as individual parameters.
ld/
* emultempl/armelf.em (params): New static variable.
(thumb_entry_symbol, byteswap_code, target1_is_rel, target2_type,
fix_v4bx, use_blx, vfp11_denorm_fix, stm32l4xx_fix, fix_cortex_a8,
no_enum_size_warning, no_wchar_size_warning, pic_veneer,
merge_exidx_entries, fix_arm1176, cmse_implib): move as part of the
above new structure.
(arm_elf_before_allocation): Access static variable from the params
structure.
(gld${EMULATION_NAME}_finish): Likewise.
(arm_elf_create_output_section_statements): Likewise and pass the
address of that structure to bfd_elf32_arm_set_target_relocs instead
of the static variables.
(PARSE_AND_LIST_ARGS_CASES): Access static variable from the params
structure.
Thomas Preud'homme [Fri, 26 Aug 2016 11:01:47 +0000 (12:01 +0100)]
2016-08-26 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* elf32-arm.c (elf32_arm_get_stub_entry): Assert that we don't access
passed the end of htab->stub_group array.
(elf32_arm_create_or_find_stub_sec): Likewise.
(elf32_arm_create_stub): Likewise.
Thomas Preud'homme [Fri, 26 Aug 2016 10:53:30 +0000 (11:53 +0100)]
Add missing ARMv8-M special registers
2016-08-26 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* config/tc-arm.c (v7m_psrs): Add MSPLIM, PSPLIM, MSPLIM_NS,
PSPLIM_NS, PRIMASK_NS, BASEPRI_NS, FAULTMASK_NS, CONTROL_NS, SP_NS and
their lowecase counterpart special registers. Write register
identifier in hex.
* testsuite/gas/arm/archv8m-cmse-msr.s: Reorganize tests per
operation, special register and then case. Use different register for
each operation. Add tests for new special registers.
* testsuite/gas/arm/archv8m-cmse-msr-base.d: Adapt expected result
accordingly.
* testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
opcodes/
* arm-dis.c (psr_name): Use hex as case labels. Add detection for
MSPLIM, PSPLIM, MSPLIM_NS, PSPLIM_NS, PRIMASK_NS, BASEPRI_NS,
FAULTMASK_NS, CONTROL_NS and SP_NS special registers.
Cupertino Miranda [Thu, 21 Jul 2016 13:32:35 +0000 (15:32 +0200)]
Dynamic TLS GOT entries would not be relocated.
Forgot to set should_relocate to TRUE in case of GOT and TLS relocations of
undefined symbols for shared libraries.
In dynamic libraries if symbol is not known the instruction relocation would
not be resolved to point to the respective .got entry.
A test was created to detect similar future mistakes.
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (elf_arc_relocate_section): Changed. Set should_relocate
to TRUE for GOT and TLS relocs.
ld/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
* ld/testsuite/ld-arc/tls_gd-01.s: Added a testcase for this patch.
* ld/testsuite/ld-arc/tls_gd-01.d: Likewise.
Cupertino Miranda [Tue, 19 Jul 2016 12:33:34 +0000 (14:33 +0200)]
Fixed -init, -fini linker options.
ARC was overloading this options by forcing DT_INIT AND DT_FINI
to always point to _init and _fini, respectively.
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synospsys.com>
* elf32-arc.c (elf_arc_finish_dynamic_sections): Changed.
Cupertino Miranda [Wed, 13 Jul 2016 16:04:20 +0000 (18:04 +0200)]
Several fixes related to ARC PIE support.
Fixed conditions related to dynamic relocs relative offset patching.
Added arc_link_hash_table to be able to always generate and track
.rela.bss section.
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
* elf-bfd.h: Added ARC_ELF_DATA to enum elf_target_id.
* elf32-arc.c (struct elf_arc_link_hash_entry): Added.
(struct elf_arc_link_hash_table): Likewise.
(elf_arc_link_hash_newfunc): Likewise.
(elf_arc_link_hash_table_free): Likewise.
(arc_elf_link_hash_table_create): Likewise.
(elf_arc_relocate_section): Fixed conditions related to dynamic
(elf_arc_check_relocs): Likewise.
(arc_elf_create_dynamic_sections): Added
(elf_arc_adjust_dynamic_symbol): Changed access to .rela.bss to be done
through the hash table.
Cupertino Miranda [Tue, 12 Jul 2016 14:31:40 +0000 (16:31 +0200)]
Content for TLS_IE_GOT not written to .got.
When no dynamic relocation was generated the .got content would not be
updated for the TLS_IE_GOT relocation addresses.
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
* arc-got.h (relocate_fix_got_relocs_for_got_info): Fixed addresses in
debug comments. Fixed address in .got related to TLS_IE_GOT dynamic
relocation.
ld/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
* testsuite/ld-arc/tls_ie-01.s: Added to verify associated fix.
* testsuite/ld-arc/tls_ie-01.d: Likewise
Cupertino Miranda [Tue, 7 Jun 2016 08:24:37 +0000 (10:24 +0200)]
Fixes to legacy ARC relocations.
Added support for ARC_SDA_12 reloc.
Fixed ARC_N32_ME.
Added ME (middle-endian) to ARC_SDA_12 reloc.
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
* reloc.c: Fixed type in ARC_SECTOFF relocations. Added ARC_SDA_12
relocation.
* bfd-in2.h: Regenerated from the previous changes.
* libbfd.h: Regenerated from the previous changes.
include/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
* elf/arc-reloc.def: Fixed relocation formula for N*, SDA, SDA_12,
SDA_16_LD*, S13_PCREL, N32_ME, SECTOFF_* relocations.
* opcode/arc-func.h (replace_disp12s): Added. Used for SDA_12 relocation.
Thomas Preud'homme [Fri, 26 Aug 2016 09:59:26 +0000 (10:59 +0100)]
Add support for stable secure gateway veneers addresses
2016-08-26 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* bfd-in.h (bfd_elf32_arm_set_target_relocs): Add a new parameter for
the input import library bfd.
* bfd-in2.h: Regenerate.
* elf32-arm.c (struct elf32_arm_link_hash_table): New in_implib_bfd
and new_cmse_stub_offset fields.
(stub_hash_newfunc): Initialize stub_offset and stub_template_size to
-1.
(elf32_arm_add_stub): Likewise for stub_offset.
(arm_new_stubs_start_offset_ptr): New function.
(arm_build_one_stub): Only allocate a stub_offset if it is -1. Allow
empty SG veneers to have zero relocations.
(arm_size_one_stub): Only initialize stub size and template
information for non empty veneers. Do not update veneer section size
if veneer already has an offset.
(elf32_arm_create_stub): Return the stub entry pointer or NULL instead
of a boolean indicating success or failure.
(cmse_scan): Change stub_changed parameter into an integer pointer
parameter cmse_stub_created to count the number of stub created and
adapt to change of return value in elf32_arm_create_stub.
(cmse_entry_fct_p): New function.
(arm_list_new_cmse_stub): Likewise.
(set_cmse_veneer_addr_from_implib): Likewise.
(elf32_arm_size_stubs): Define cmse_stub_created, pass its address to
cmse_scan instead of that of cmse_stub_changed to compute the number
of stub created and use it to initialize stub_changed. Call
set_cmse_veneer_addr_from_implib after all cmse_scan. Adapt to change
of return value in elf32_arm_create_stub. Use
arm_stub_section_start_offset () if not NULL to initialize size of
secure gateway veneers section. Initialize stub_offset of Cortex-A8
erratum fix to -1. Use ret to hold return value.
(elf32_arm_build_stubs): Use arm_stub_section_start_offset () if not
NULL to initialize size of secure gateway veneers section. Adapt
comment to stress the importance of zeroing veneer section content.
(bfd_elf32_arm_set_target_relocs): Add new in_implib_bfd parameter to
initialize eponymous field in struct elf32_arm_link_hash_table.
ld/
* emultempl/armelf.em (in_implib_filename): Declare and initialize new
variable.
(arm_elf_create_output_section_statements): Open import input library
file for writing and pass resulting in_implib_bfd to
bfd_elf32_arm_set_target_relocs.
(PARSE_AND_LIST_PROLOGUE): Define OPTION_IN_IMPLIB option.
(PARSE_AND_LIST_LONGOPTS): Define --in-implib option.
(PARSE_AND_LIST_OPTIONS): Add help message for --in-implib option.
(PARSE_AND_LIST_ARGS_CASES): Handle new OPTION_IN_IMPLIB case.
* ld.texinfo (--cmse-implib): Update to mention --in-implib.
(--in-implib): Document new option.
* NEWS: Likewise.
* testsuite/ld-arm/arm-elf.exp
(Secure gateway import library generation): add --defsym VER=1 to gas
CLI.
(Secure gateway import library generation: errors): Likewise.
(Input secure gateway import library): New test.
(Input secure gateway import library: no output import library):
Likewise.
(Input secure gateway import library: not an SG input import library):
Likewise.
(Input secure gateway import library: earlier stub section base):
Likewise.
(Input secure gateway import library: later stub section base):
Likewise.
(Input secure gateway import library: veneer comeback): Likewise.
(Input secure gateway import library: entry function change):
Likewise.
* testsuite/ld-arm/cmse-implib.s: Add input import library testing.
* testsuite/ld-arm/cmse-implib.rd: Update accordingly.
* testsuite/ld-arm/cmse-new-implib.out: New file.
* testsuite/ld-arm/cmse-new-implib.rd: Likewise.
* testsuite/ld-arm/cmse-new-implib-no-output.out: Likewise.
* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out: Likewise.
* testsuite/ld-arm/cmse-new-earlier-later-implib.out: Likewise.
* testsuite/ld-arm/cmse-new-comeback-implib.rd: Likewise.
* testsuite/ld-arm/cmse-new-wrong-implib.out: Likewise.
GDB Administrator [Fri, 26 Aug 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Andreas Arnez [Thu, 25 Aug 2016 17:13:57 +0000 (19:13 +0200)]
S390: Add support for core dump NOTE sections
This enhances the 32-bit and 64-bit s390 ELF backends with support for
reading and writing the core dump note sections NT_PRSTATUS and
NT_PRPSINFO. Byte swapping is done as appropriate, such that core files
can now be processed correctly on non-s390 platforms.
bfd/ChangeLog:
* elf32-s390.c (stdarg.h): New include.
(elf_s390_grok_psinfo): New function.
(elf_s390_write_core_note): New function.
(elf_backend_grok_psinfo): Declare backend hook.
(elf_backend_write_core_note): Likewise.
* elf64-s390.c (stdarg.h): New include.
(elf_s390_grok_prstatus): New function.
(elf_s390_grok_psinfo): New function.
(elf_s390_write_core_note): New function.
(elf_backend_grok_prstatus): Declare backend hook.
(elf_backend_grok_psinfo): Likewise.
(elf_backend_write_core_note): Likewise.
Andreas Arnez [Thu, 25 Aug 2016 17:13:57 +0000 (19:13 +0200)]
S390: Indentation fixes in elf32/64-s390.c
Some indentation fixes in elf32-s390.c and elf64-s390.c. Whitespace
changes only.
bfd/ChangeLog:
* elf32-s390.c (allocate_dynrelocs): Fix indentation.
(elf_s390_finish_ifunc_symbol): Likewise.
(elf_s390_finish_dynamic_symbol): Likewise.
(elf_s390_finish_dynamic_sections): Likewise.
(elf_s390_grok_prstatus): Likewise.
* elf64-s390.c (elf_s390_hash_table): Fix indentation.
(elf_s390_finish_dynamic_symbol): Likewise.
Andreas Arnez [Thu, 25 Aug 2016 17:13:57 +0000 (19:13 +0200)]
xtensa: Avoid designated inits, for C++ compliance
C++ does not officially support designators in initializer lists. Thus
some compilers may issue errors when encountering them. Modern versions
of GCC seem to allow them by default, as a GCC extension, even though
the GCC documentation explicitly states otherwise: "[...] This extension
is not implemented in GNU C++." But some older GCC versions (like
4.4.7) did indeed emit an error instead, like this:
.../gdb/xtensa-config.c:219: error: expected primary-expression before
‘.’ token
This patch removes the only such instance I've seen when building with
'--enable-targets=all'.
gdb/ChangeLog:
* xtensa-tdep.h (XTENSA_GDBARCH_TDEP_INSTANTIATE): Replace
designated initializer list by plain initializer list, for C++
compliance.
Alan Modra [Thu, 25 Aug 2016 06:41:40 +0000 (16:11 +0930)]
powerpc ld configure
This fixes a few problems in the powerpc ld configury.
1) Using powerpc*le-* to test for powerpcle and powerpc64le would
incorrectly match a target triple like powerpc-apple-elf.
2) In the same vein, *64* could match 64 in the user supplied MANUF-OS
part of the target triple.
3) tooldir vars were missing, and some target aliases would result in
ridiculous values for those tdir_* vars given.
4) Since 2016-04-25, BE support was added automatically when asking
for an LE target. If that is a good idea, then so is adding LE
support when asking for BE.
* configure.tgt (powerpc*-*-linux* et al): Rewrite, adding LE
support for BE. First output all target endian configury
values, then opposite endian. Handle more tooldirs. Fix
bogus matches with strings in MANUF-OS part of target triple.
Thomas Preud'homme [Thu, 25 Aug 2016 08:44:09 +0000 (09:44 +0100)]
Remove _S version of ARM MSR/MRS special registers
2016-08-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/tc-arm.c (v7m_psrs): Remove msp_s, MSP_S, psp_s and PSP_S
special registers.
* testsuite/gas/arm/archv8m-cmse-msr.s: Remove test for above special
registers.
* testsuite/gas/arm/archv8m-cmse-msr-base.d: Likewise.
* testsuite/gas/arm/archv8m-cmse-msr-main.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-4.d: Likewise.
Adhemerval Zanella [Thu, 25 Aug 2016 07:42:03 +0000 (08:42 +0100)]
Sync proc_service definition with GLIBC
GLIBC BZ#20311 [1] proc_service.h install patch also remove 'const'
attributes from ps_get_thread_area and comment #15 discuss why to remove
the const attribute (basically since it a callback with the struct
ps_prochandle owned by the client it should be able to modify it if
it the case).
On default build this is not the issue and current g++ does not trigger
any issue with this mismatch declaration. However, on some bootstrap
build configuration where gdbserver is build with gcc instead this
triggers:
error: conflicting types for 'ps_get_thread_area'
This patch fixes it by syncing the declaration with GLIBC.
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=20311
gdb/ChangeLog:
2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* aarch64-linux-nat.c (ps_get_thread_area): Remove const from
struct ps_prochandle.
* amd64-linux-nat.c (ps_get_thread_area): Likewise.
* arm-linux-nat.c (ps_get_thread_area): Likewise.
* gdb_proc_service.h (ps_get_thread_area): Likewise.
* i386-linux-nat.c (ps_get_thread_area): Likewise.
* m68klinux-nat.c (ps_get_thread_area): Likewise.
* mips-linux-nat.c (ps_get_thread_area): Likewise.
* nat/aarch64-linux.c (aarch64_ps_get_thread_area): Likewise.
* nat/aarch64-linux.h (aarch64_ps_get_thread_area): Likewise.
* xtensa-linux-nat.c (ps_get_thread_area): Likewise.
gdb/gdbserver/ChangeLog:
2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
PR server/20491
* gdb_proc_service.h (ps_get_thread_area): Remove const from struct
ps_prochandle.
* linux-aarch64-low.c (ps_get_thread_area): Likewise.
* linux-arm-low.c (ps_get_thread_area): Likewise.
* linux-crisv32-low.c (ps_get_thread_area): Likewise.
* linux-m68k-low.c (ps_get_thread_area): Likewise.
* linux-mips-low.c (ps_get_thread_area): Likewise.
* linux-nios2-low.c (ps_get_thread_area): Likewise.
* linux-tic6x-low.c (ps_get_thread_area): Likewise.
* linux-x86-low.c (ps_get_thread_area): Likewise.
* linux-xtensa-low.c (ps_get_thread_area): Likewise.
GDB Administrator [Thu, 25 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Wed, 24 Aug 2016 22:27:11 +0000 (15:27 -0700)]
X86: Add ptwrite instruction
Implement ptwrite instruction defined in Intel64 and IA-32 Architectures
Software Developer’s Manual, June 2016.
gas/
* config/tc-i386.c (cpu_arch): Add .ptwrite.
* doc/c-i386.texi: Document ptwrite and .ptwrite.
* testsuite/gas/i386/i386.exp: Run ptwrite, ptwrite-intel,
x86-64-ptwrite and x86-64-ptwrite-intel.
* testsuite/gas/i386/ptwrite-intel.d: New file.
* testsuite/gas/i386/ptwrite.d: Likewise.
* testsuite/gas/i386/ptwrite.s: Likewise.
* testsuite/gas/i386/x86-64-ptwrite-intel.d: Likewise.
* testsuite/gas/i386/x86-64-ptwrite.d: Likewise.
* testsuite/gas/i386/x86-64-ptwrite.s: Likewise.
opcodes/
* i386-dis.c (PREFIX_MOD_0_0FAE_REG_4): New.
(PREFIX_MOD_3_0FAE_REG_4): Likewise.
(prefix_table): Add PREFIX_MOD_0_0FAE_REG_4 and
PREFIX_MOD_3_0FAE_REG_4.
(mod_table): Use PREFIX_MOD_0_0FAE_REG_4 and
PREFIX_MOD_3_0FAE_REG_4.
* i386-gen.c (cpu_flag_init): Add CPU_PTWRITE_FLAGS.
(cpu_flags): Add CpuPTWRITE.
* i386-opc.h (CpuPTWRITE): New.
(i386_cpu_flags): Add cpuptwrite.
* i386-opc.tbl: Add ptwrite instruction.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.
Kevin Buettner [Mon, 22 Aug 2016 17:14:05 +0000 (10:14 -0700)]
Test case to detect recursive unwinding in Python-based unwinders.
This test case verifies that GDB will not attempt to invoke a python
unwinder recursively.
At the moment, the behavior exhibited by GDB looks like this:
(gdb) source py-recurse-unwind.py
Python script imported
(gdb) b ccc
Breakpoint 1 at 0x4004bd: file py-recurse-unwind.c, line 23.
(gdb) run
Starting program: py-recurse-unwind
TestUnwinder: Recursion detected - returning early.
TestUnwinder: Recursion detected - returning early.
TestUnwinder: Recursion detected - returning early.
TestUnwinder: Recursion detected - returning early.
Breakpoint 1, ccc (arg=<unavailable>) at py-recurse-unwind.c:23
23 }
(gdb) bt
#-1 ccc (arg=<unavailable>) at py-recurse-unwind.c:23
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
[I've shortened pathnames for easier reading.]
The desired / expected behavior looks like this:
(gdb) source py-recurse-unwind.py
Python script imported
(gdb) b ccc
Breakpoint 1 at 0x4004bd: file py-recurse-unwind.c, line 23.
(gdb) run
Starting program: py-recurse-unwind
Breakpoint 1, ccc (arg=789) at py-recurse-unwind.c:23
23 }
(gdb) bt
#0 ccc (arg=789) at py-recurse-unwind.c:23
#1 0x00000000004004d5 in bbb (arg=456) at py-recurse-unwind.c:28
#2 0x00000000004004ed in aaa (arg=123) at py-recurse-unwind.c:34
#3 0x00000000004004fe in main () at py-recurse-unwind.c:40
Note that GDB's problems go well beyond the fact that it invokes the
unwinder recursively. In the process it messes up some internal state
(the frame stash) leading to display of (only) the sentinel frame in
the backtrace.
gdb/testsuite/ChangeLog:
* gdb.python/py-recurse-unwind.c: New file.
* gdb.python/py-recurse-unwind.py: New file.
* gdb.python/py-recurse-unwind.exp: New file.
Simon Marchi [Wed, 24 Aug 2016 17:10:08 +0000 (13:10 -0400)]
Allow resetting an empty inferior-tty
This patch allows the user to set the inferior-tty to "empty", in order
to come back to the default behaviour of using the same tty as gdb is
using.
This is already supported in MI (and tested in gdb.mi/mi-basics.exp).
I added a new test, set-inferior-tty.exp, where I test only the setting
and unsetting of the parameter. It would be nice to actually test that
the inferior output properly goes to the separate tty, but that will be
for another day.
gdb/ChangeLog:
* infcmd.c (set_inferior_io_terminal): Set inferior terminal to
NULL if terminal_name is an empty string.
(_initialize_infcmd): Make the argument of "set inferior-tty"
optional, mention it in the help doc.
gdb/doc/ChangeLog:
* gdb.texinfo (Input/Output): Mention possibility to unset
inferior-tty.
gdb/testsuite/ChangeLog:
* gdb.base/set-inferior-tty.exp: New file.
* gdb.base/set-inferior-tty.c: New file.
Carl E. Love [Wed, 24 Aug 2016 15:08:58 +0000 (08:08 -0700)]
Fix for gdb.base/pc-fp.exp.
It is my understanding that GDB used to require each architecture to
define a Frame Pointer (fp). However, this functionality was deprecated
some time ago so the call to setup the fp_reg was changed to deprecated
(set_gdbarch_deprecated_fp_regnum). It should have been removed from the
Power code.
That said, the code "set_gdbarch_deprecated_fp_regnum
(gdbarch, PPC_R0_REGNUM + 1);" sets up register r1 as the frame pointer.
Register r1 is no longer used to hold the frame pointer on Power. By
removing the fp definition for Power in GDB, it causes GDB to fall back
to the call get_frame_base_address (frame) which returns the correct value
depending on the specific senario but most of the time is the DWARF
canonical frame address.
gdb/ChangeLog
2016-08-24 Carl Love <cel@us.ibm.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Remove call
set_gdbarch_deprecated_fp_regnum() from initialization function.
Anton Kolesov [Tue, 31 May 2016 15:40:09 +0000 (18:40 +0300)]
[ARC] C++ compatibility for arc-dis.h
opcodes/
2016-08-24 Anton Kolesov <Anton.Kolesov@synopsys.com>
* arc-dis.h: Wrap around in extern "C".
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Anton Kolesov [Thu, 12 Sep 2013 11:56:45 +0000 (15:56 +0400)]
[ARC] Parse NOTE section in core dump files
This patch adds function elf32_arc_grok_parse to parse NOTE section of core
dump files. GDB requires this to work properly with core dumps.
bfd/
2016-08-24 Anton Kolesov <Anton.Kolesov@synopsys.com>
* elf32-arc.c (elf32_arc_grok_prstatus): New function.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
Roland McGrath [Tue, 23 Aug 2016 23:43:33 +0000 (16:43 -0700)]
[gold] Implement -z stack-size option
gold/
* options.h (General_options): Grok -z stack-size.
* output.h (Output_segment::set_size): New method.
* layout.cc (Layout::create_executable_stack_info): Renamed to ...
(Layout::create_stack_segment): ... this. Always create the
segment if -z stack-size was used.
(Layout::set_segment_offsets): Don't call ->set_offset on the
PT_GNU_STACK segment.
GDB Administrator [Wed, 24 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Bharathi Seshadri [Tue, 23 Aug 2016 21:50:48 +0000 (14:50 -0700)]
Add --be8 option to gold.
gold/
* options.h (General_options): Add --be8 option.
* arm.cc (Arm_relobj::do_relocate_sections): Add code to swap for be8.
(Output_data_plt_arm_standard::do_fill_first_plt_entry): Likewise.
(Output_data_plt_arm_short::do_fill_plt_entry): Likewise.
(Output_data_plt_arm_long::do_fill_plt_entry): Likewise.
(Target_arm::do_adjust_elf_header): Do EF_ARM_BE8 adjustment.
Simon Marchi [Tue, 23 Aug 2016 17:49:56 +0000 (13:49 -0400)]
Fix typo in comment
gdb/ChangeLog:
* stack.c (parse_frame_specification): Fix typo in comment.
Pedro Alves [Tue, 23 Aug 2016 15:03:28 +0000 (16:03 +0100)]
Fix PR20494 - User input stops being echoed in CLI
This patch fixes a problem that problem triggers if you start an
inferior, e.g., with the "start" command, in a UI created with the
new-ui command, and then run a foreground execution command in the
main UI. Once the program stops for the latter command, typing in the
main UI no longer echoes back to the user.
The problem revolves around this:
- gdb_has_a_terminal computes its result lazily, on first call.
that is what saves gdb's initial main UI terminal state (the UI
associated with stdin):
our_terminal_info.ttystate = serial_get_tty_state (stdin_serial);
This is the state that target_terminal_ours() restores.
- In this scenario, the gdb_has_a_terminal function happens to be
first ever called from within the target_terminal_init call in
startup_inferior:
(top-gdb) bt
#0 gdb_has_a_terminal () at src/gdb/inflow.c:157
#1 0x000000000079db22 in child_terminal_init_with_pgrp () at src/gdb/inflow.c:217
[...]
#4 0x000000000065bacb in target_terminal_init () at src/gdb/target.c:456
#5 0x00000000004676d2 in startup_inferior () at src/gdb/fork-child.c:531
[...]
#7 0x000000000046b168 in linux_nat_create_inferior () at src/gdb/linux-nat.c:1112
[...]
#9 0x00000000005f20c9 in start_command (args=0x0, from_tty=1) at src/gdb/infcmd.c:657
If the command to start the inferior is issued on the main UI, then
readline will have deprepped the terminal when we reach the above, and
the problem doesn't appear.
If however the command is issued on a non-main UI, then when we reach
that gdb_has_a_terminal call, the main UI's terminal state is still
set to whatever readline has sets it to in rl_prep_terminal, which
happens to have echo disabled. Later, when the following synchronous
execution command finishes, we'll call target_terminal_ours to restore
gdb's the main UI's terminal settings, and that restores the terminal
state with echo disabled...
Conceptually, the fix is to move the gdb_has_a_terminal call earlier,
to someplace during GDB initialization, before readline/ncurses have
had a chance to change terminal settings. Turns out that
"set_initial_gdb_ttystate" is exactly such a place.
I say conceptually, because the fix actually inlines the
gdb_has_a_terminal part that saves the terminal state in
set_initial_gdb_ttystate and then simplifies gdb_has_a_terminal, since
there's no point in making gdb_has_a_terminal do lazy computation.
gdb/ChangeLog:
2016-08-23 Pedro Alves <palves@redhat.com>
PR gdb/20494
* inflow.c (our_terminal_info, initial_gdb_ttystate): Update
comments.
(enum gdb_has_a_terminal_flag_enum, gdb_has_a_terminal_flag):
Delete.
(set_initial_gdb_ttystate): Record our_terminal_info here too,
instead of ...
(gdb_has_a_terminal): ... here. Reimplement in terms of
initial_gdb_ttystate. Make static.
* terminal.h (gdb_has_a_terminal): Delete declaration.
(set_initial_gdb_ttystate): Add comment.
* top.c (show_interactive_mode): Use input_interactive_p instead
of gdb_has_a_terminal.
gdb/testsuite/ChangeLog:
2016-08-23 Pedro Alves <palves@redhat.com>
PR gdb/20494
* gdb.base/new-ui-echo.c: New file.
* gdb.base/new-ui-echo.exp: New file.
Nick Clifton [Tue, 23 Aug 2016 14:41:01 +0000 (15:41 +0100)]
Better fix for PR 20499, including preventing strlen from being called on an uninitialised name field.
PR gprof/20499
* corefile.c (BUFSIZE): Define.
(STR_BUFSIZE): Define.
(read_function_mappings): Use BUFSIZE and STR)BUFSIZE.
(num_of_syms_in): Move buf, address and name arrays out of
function and declare as static BUFSIZE arrays.
Use STR_BUFSIZE when scanning for name and address.
(core_create_syms_from): Revert previous delta. Instead
short circuit the parsing of a symbol if all three fields
could not be found.
Yao Qi [Tue, 23 Aug 2016 13:24:03 +0000 (14:24 +0100)]
gdbserver_spawn "" rather than gdbserver_spawn ${binfile}
Hi,
I happen to see gdbserver is spawned like this in gdb.log,
spawn /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2346 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.s
erver/connect-stopped-target/connect-stopped-target /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/connect-stopped-target/connect-stopped-t
arget
spawn /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2347 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.s
erver/connect-stopped-target/connect-stopped-target /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/connect-stopped-target/connect-stopped-t
arget
as we can see, there are two instances of connect-stopped-target or
connect-stopped-target in the command line spawning gdbserver, but
none of these gets parameters from command line. In these two
tests, gdbserver is spawned via "gdbserver_spawn ${binfile}". However,
the argument of gdbserver_spawn is the argument passed the child
inferior, not the program itself.
# Start a gdbserver process running SERVER_EXEC, and connect GDB
# to it. CHILD_ARGS are passed to the inferior.
#
# Returns the target protocol and socket to connect to.
proc gdbserver_spawn { child_args } {
set target_exec [gdbserver_download_current_prog]
GDBserver gets the program via last_loaded_file, which is set by
gdb_file_cmd. In each test, we don't need to pass ${binfile}.
gdb/testsuite:
2016-08-23 Yao Qi <yao.qi@linaro.org>
* gdb.server/connect-stopped-target.exp (do_test): Pass "" to
gdbserver_spawn.
* gdb.server/connect-without-multi-process.exp (do_test):
Likewise.
Yao Qi [Tue, 23 Aug 2016 13:15:50 +0000 (14:15 +0100)]
Fix signals-state-child.exp in remote testing
Remote testing isn't considered in signals-state-child.exp, so the it
fails like
shell diff -s /scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/testsuite/outputs/gdb.base/signals-state-child/standalone.txt /scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/testsuite/outputs/gdb.base/signals-state-child/gdb.txt^M
diff: /scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/testsuite/outputs/gdb.base/signals-state-child/standalone.txt: No such file or directory^M
(gdb) FAIL: gdb.base/signals-state-child.exp: signals states are identical
This patch is to fix it.
gdb/testsuite:
2016-08-23 Yao Qi <yao.qi@linaro.org>
* gdb.base/signals-state-child.exp: Set variables gdb_txt and
standalone_txt. Delete gdb_txt and standalone_txt on host
and target. Spawn the binary on target. Copy files from
target to host.
Nick Clifton [Tue, 23 Aug 2016 08:45:11 +0000 (09:45 +0100)]
Fix seg-fault in ARM linker when trying to parse a binary file.
* elf32-arm.c (elf32_arm_count_additional_relocs): Return zero if
there is no arm data associated with the section.
Richard Sandiford [Tue, 23 Aug 2016 08:03:19 +0000 (09:03 +0100)]
[AArch64] Add V8_2_INSN macro
For consistency with the previous two patches, this one
adds a macro for the two ARMv8.2 table entries. Both table
entries need a non-null aarch64_op field.
I haven't added macros for the RAS and STAT_PROFILE entries
since there's only one of each. The series isn't getting
rid of braced entries altogether, so I've only looked at
replacing things that occur more than once.
opcodes/
* aarch64-tbl.h (V8_2_INSN): New macro.
(aarch64_opcode_table): Use it.
Richard Sandiford [Tue, 23 Aug 2016 08:02:38 +0000 (09:02 +0100)]
[AArch64] Make more use of CORE/FP/SIMD_INSN
After the previous patch, this one makes all CORE, FP
and SIMD table entries with null "verify" fields use
the associated macros.
opcodes/
* aarch64-tbl.h (aarch64_opcode_table): Make more use of
CORE_INSN, __FP_INSN and SIMD_INSN.
Richard Sandiford [Tue, 23 Aug 2016 08:01:54 +0000 (09:01 +0100)]
[AArch64] Add OP parameter to aarch64-tbl.h macros
Nick recently wrapped most of aarch64-tbl.h entries in macros
like CORE_INSN. These new macros assumed that the aarch64_op
"op" field of aarch64_opcode is 0 and that the new "verifier"
field is NULL.
However, there are a lot of CORE, SIMD and FP insns whose table
entries need a nonzero aarch64_op field, so these entries
continued to use a braced list instead of a macro. This makes
the table entries less consistent and means that there are still
quite a few braced entries that need to be updated when making
further changes to the aarch64_opcode structure.
I think the number of entries that need a nonzero aarch64_op
field is high enough to justify having an explicit aarch64_op
entry for all CORE, SIMD and FP entries. This patch adds
one and updates all existing uses of the macros. A following
patch makes more use of the macros.
I've followed existing practice by using 0 instead of OP_NIL
for empty aarch64_op fields. Empty fields are still the norm
and you need to know what the fields are when reading the table
anyway, so it was hard to justify an additional patch to replace
all 0 op fields with OP_NIL.
opcodes/
* aarch64-tbl.h (CORE_INSN, __FP_INSN, SIMD_INSN): Add OP parameter.
(aarch64_opcode_table): Update uses accordingly.
Alan Modra [Tue, 23 Aug 2016 02:52:25 +0000 (12:22 +0930)]
Fix duplicate FAILs from ld testsuite
* testsuite/lib/ld-lib.exp (run_cc_link_tests): Don't fail tests
twice.
Alan Modra [Tue, 23 Aug 2016 02:50:59 +0000 (12:20 +0930)]
R_OR1K_GOTOFF_* relocations
PR 20475
* elf32-or1k.c (or1k_elf_relocate_section): Offset from
_GLOBAL_OFFSET_TABLE_, not start of .got section.
GDB Administrator [Tue, 23 Aug 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Mon, 22 Aug 2016 19:05:09 +0000 (20:05 +0100)]
Fix PR gdb/20505 - Make vDSO detection work with core files
Loading a core dump that was either generated on a system running
pristine glibc master, or on a Fedora/RHEL system with LD_DEBUG=unused
set in the environment, solib-svr4.c:svr4_current_sos fails to filter
out the vDSO, resulting in:
(gdb) core-file corefile.core^M
[New LWP 2362]^M
warning: Could not load shared library symbols for linux-vdso.so.1.^M
Do you need "set solib-search-path" or "set sysroot"?^M
Core was generated by `build-gdb/gdb/testsuite/outputs/gdb.base/corefile/'.^M
...
The problem is that gdbarch_vsyscall_range does not support core
inferiors at all.
When live debugging, we're finding the vDSO's start address with
auxv/AT_SYSINFO_EHDR, and then we find the vDSO's size by look for the
corresponding mapping, by parsing /proc/PID/maps. When debugging a
core dump, we can also determine the starting address from
auxv/AT_SYSINFO_EHDR. However, we obviously can't read the core
mappings out of the host's /proc. But we can instead look for a
corresponding load segment in the core's bfd.
gdb/ChangeLog:
2016-08-22 Pedro Alves <palves@redhat.com>
PR gdb/20505
* linux-tdep.c (linux_vsyscall_range_raw): For core inferiors,
find the vDSO's start address with AT_SYSINFO_EHDR too, and
determine the vDSO's size by finding the PT_LOAD segment that
matches AT_SYSINFO_EHDR.
gdb/testsuite/ChangeLog:
2016-08-22 Pedro Alves <palves@redhat.com>
PR gdb/20505
* gdb.base/vdso-warning.exp: Test core dumps too. Use
with_test_prefix. Factor out bits to ...
(test_no_vdso): ... this new procedure.
Nick Clifton [Mon, 22 Aug 2016 13:23:19 +0000 (14:23 +0100)]
Free the string buffer used by the chew program to hold each file it parses.
* doc/chew.c (main): Free the string buffer used to files as they
are parsed.
Nick Clifton [Mon, 22 Aug 2016 13:16:26 +0000 (14:16 +0100)]
Prevent a seg-fault in gprof when parsing a corrupt core file.
PR gprof/20499
* corefile.c (core_create_syms_from): Avoid walking off the end of
the symbol table.
Alan Modra [Mon, 22 Aug 2016 01:12:26 +0000 (10:42 +0930)]
Error on unsupported PowerPC ifuncs
The pr19784 tests fail on ppc32 due to a gcc bug. The failure should
be noticed when building both libpr19784a.so and libpr19784b.so,
rather than ld building a buggy libpr19784a.so that fails at run time.
This patch fixes that by moving the @local ifunc check out of
check_relocs, where a call destination may not yet be known to be
ifunc. The patch also adds a related error for -mbss-plt code.
* elf32-ppc.c (ppc_elf_check_relocs): Move error for @local ifunc..
(ppc_elf_relocate_section): ..to here. Comment. Error on
detecting -mbss-plt -fPIC local ifuncs too.
(ppc_elf_size_dynamic_sections): Comment on unnecessary glink
branch table entries.
GDB Administrator [Mon, 22 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 21 Aug 2016 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 20 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Carl E. Love [Fri, 19 Aug 2016 18:06:38 +0000 (11:06 -0700)]
Fix missing files for ld when test suite not compiled in the source directory
This patch fixes an issues with six test suite expect files that do not
run correctly when the test suite is not built in the source directory. The
issue is these tests are not using the current "standard_testfile" call
but rather using the older set command to initialize the "testfile",
"srcfile" and "binprefix" variables or are missing the set for the
"binprefix" variable.
-----------------------------------------------
gdb/testsuite/ChangeLog
2016-08-19 Carl Love <cel@us.ibm.com>
* gdb.arch/altivec-regs.exp: Use standard_testfile instead of
maintaining separate logic for constructing the output path.
* gdb.arch/powerpc-d128-regs.exp: Likewise.
* gdb.arch/ppc-dfp.exp: Likewise.
* gdb.arch/ppc-fp.exp: Likewise.
* gdb.arch/vsx-regs.exp: Likewise.
* gdb.arch/altivec-abi.exp: Likewise, plus added local variable
binprefix for generating the additional binary files.
Yao Qi [Fri, 19 Aug 2016 13:49:31 +0000 (14:49 +0100)]
[AArch64] Match instruction "STP with base register" in prologue
Nowadays, we only match pre-indexed STP in prologue. Due to the change
in gcc, https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01933.html, it
may generate "STP with base register" in prologue, which GDB doesn't
handle. That is to say, previously GCC generates prologue like this,
sub sp, sp, #490
stp x29, x30, [sp, #-96]!
mov x29, sp
with the gcc patch above, GCC generates prologue like like this,
sub sp, sp, #4f0
stp x29, x30, [sp]
mov x29, sp
This patch is to teach GDB to recognize this instruction in prologue
analysis.
gdb:
2016-08-19 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_analyze_prologue): Handle register
based STP instruction.
Yao Qi [Thu, 11 Aug 2016 16:04:11 +0000 (17:04 +0100)]
null-terminate string in linespec_location_completer
If I build gdb with -fsanitize=address and run tests, I get error,
malformed linespec error: unexpected colon^M
(gdb) PASS: gdb.linespec/ls-errs.exp: lang=C: break :
break :=================================================================^M
==3266==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000051451 at pc 0x2b5797a972a8 bp 0x7fffd8e0f3c0 sp 0x7fffd8e0f398^M
READ of size 2 at 0x602000051451 thread T0
#0 0x2b5797a972a7 in __interceptor_strlen (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x322a7)^M
#1 0x7bd004 in compare_filenames_for_search(char const*, char const*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:316^M
#2 0x7bd310 in iterate_over_some_symtabs(char const*, char const*, int (*)(symtab*, void*), void*, compunit_symtab*, compunit_symtab*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:411^M
#3 0x7bd775 in iterate_over_symtabs(char const*, int (*)(symtab*, void*), void*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:481^M
#4 0x7bda15 in lookup_symtab(char const*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:527^M
#5 0x7d5e2a in make_file_symbol_completion_list_1 /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:5635^M
#6 0x7d61e1 in make_file_symbol_completion_list(char const*, char const*, char const*) /home/yao/SourceCode/gnu/gdb/git/gdb/symtab.c:5684^M
#7 0x88dc06 in linespec_location_completer /home/yao/SourceCode/gnu/gdb/git/gdb/completer.c:288
....
0x602000051451 is located 0 bytes to the right of 1-byte region [0x602000051450,0x602000051451)^M
mallocated by thread T0 here:
#0 0x2b5797ab97ef in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x547ef)^M
#1 0xbbfb8d in xmalloc /home/yao/SourceCode/gnu/gdb/git/gdb/common/common-utils.c:43^M
#2 0x88dabd in linespec_location_completer /home/yao/SourceCode/gnu/gdb/git/gdb/completer.c:273^M
#3 0x88e5ef in location_completer(cmd_list_element*, char const*, char const*) /home/yao/SourceCode/gnu/gdb/git/gdb/completer.c:531^M
#4 0x8902e7 in complete_line_internal /home/yao/SourceCode/gnu/gdb/git/gdb/completer.c:964^
The code in question is here
file_to_match = (char *) xmalloc (colon - text + 1);
strncpy (file_to_match, text, colon - text + 1);
it is likely that file_to_match is not null-terminated. The patch is
to strncpy 'colon - text' bytes and explicitly set '\0'.
gdb:
2016-08-19 Yao Qi <yao.qi@linaro.org>
* completer.c (linespec_location_completer): Make file_to_match
null-terminated.
Tamar Christina [Fri, 19 Aug 2016 11:57:20 +0000 (12:57 +0100)]
ARM: Issue a warning when the MRRC and MRRC2 instructions are used with the same destination registers.
* config/tc-arm.c (do_co_reg2c): Added constraint.
* testsuite/gas/arm/dest-unpredictable.s: New.
* testsuite/gas/arm/dest-unpredictable.l: New.
* testsuite/gas/arm/dest-unpredictable.d: New.
Pedro Alves [Fri, 19 Aug 2016 11:07:46 +0000 (12:07 +0100)]
x32: Fix gdb.trace/mi-trace-frame-collected.exp
gdb.trace/mi-trace-frame-collected.exp has a couple failures on x32:
FAIL: gdb.trace/mi-trace-frame-collected.exp: live: -trace-frame-collected (register)
FAIL: gdb.trace/mi-trace-frame-collected.exp: tfile: -trace-frame-collected (register)
gdb.log:
-trace-frame-collected
^done,explicit-variables=[{name="gdb_char_test",value="0 '\\000'"}],computed-expressions=[],registers=[{number="16",value="0x4004dc"},{number="204",value="0x4004dc"}],tvars
=[],memory=[{address="0x00601060",length="1"}]
(gdb)
FAIL: gdb.trace/mi-trace-frame-collected.exp: live: -trace-frame-collected (register)
[...]
-trace-frame-collected
^done,explicit-variables=[{name="gdb_char_test",value="0 '\\000'"}],computed-expressions=[],registers=[{number="16",value="0x4004dc"},{number="204",value="0x4004dc"}],tvars
=[],memory=[{address="0x00601060",length="1"}]
(gdb)
FAIL: gdb.trace/mi-trace-frame-collected.exp: tfile: -trace-frame-collected (register)
This test only collects the PC, and thus expects to only see one
register in the output of -trace-frame-collected. However, while on
the 64-bit ABI gdb only exposes 64-bit $pc/$rip (register 16 above),
on x32, GDB exposes 32-bit $eip as well, as a pseudo-register
(register 204 above). Thus, collecting $pc/$rip automatically always
collects $eip as well.
gdb/testsuite/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* gdb.trace/mi-trace-frame-collected.exp
(test_trace_frame_collected): On x32, expect two registers.
Pedro Alves [Fri, 19 Aug 2016 11:07:46 +0000 (12:07 +0100)]
x32: gdb: Fix 'call' insn relocation with qRelocInsn
Running the fast tracepoints tests against x32 gdbserver exposes a
latent bug. E.g.,:
(gdb)
continue
Continuing.
Reading /media/sf_host-pedro/gdb/mygit/build-ubuntu-x32/gdb/testsuite/outputs/gdb.trace/change-loc/change-loc-2.sl from remote target...
Thread 1 "change-loc" received signal SIGSEGV, Segmentation fault.
func4 () at /home/pedro/gdb/src/gdb/testsuite/gdb.trace/change-loc.h:24
24 }
(gdb) FAIL: gdb.trace/change-loc.exp: 1 ftrace: continue to marker 2
The test sets a fast tracepoint on a shared library. On x32, shared
libraries end up loaded somewhere in the upper 2GB of the 4GB address
space x32 has access to. When gdbserver needs to copy an instruction
to execute it in the jump pad, it asks gdb to relocate/adjust it, with
the qRelocInsn packet. gdb converts "call" instructions into a "push
$<2GB-4GB addr> + jmp" sequence, however, the "pushq" instruction sign
extends its operand, so later when the called function returns, it
returns to an incorrectly sign-extended address. E.g.,
0xfffffffffabc0000 instead of 0xfabc0000, resulting in the
segmentation fault.
Fix this by converting calls at such addresses to "sub + mov + jmp"
sequences instead.
gdb/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* amd64-tdep.c (amd64_relocate_instruction) <callq>: Handle return
addresses over 0x7fffffff.
Pedro Alves [Fri, 19 Aug 2016 11:07:45 +0000 (12:07 +0100)]
x32: gdbserver's agent bytecode JIT: fix "call" emission
Running fast tracepoint tests on x32 exposes a latent bug in the agent
bytecode jitting. There's a code path that forgets to emit the call
opcode... Whoops. Fixes a bunch of gdb.trace/trace-condition.exp
FAILs, like:
(gdb)
continue
Continuing.
Thread 1 "trace-condition" received signal SIGSEGV, Segmentation fault.
0x7ffec016 in ?? ()
(gdb) FAIL: gdb.trace/trace-condition.exp: ftrace: $rip == *set_point: advance through tracing
gdb/gdbserver/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* linux-x86-low.c (amd64_emit_call): Emit missing call opcode.
Pedro Alves [Fri, 19 Aug 2016 11:07:45 +0000 (12:07 +0100)]
x32: Avoid unsigned long when installing fast tracepoint jump pads
We're casting through unsigned long to write a 64-bit immediate
operand of movabs (the comment said movl, but that was incorrect).
The problem is that unsigned long is 32-bit on x32, so we were writing
fewer bytes than necessary.
Fix this by using an 8 byte memcpy like in other similar places in the
function.
gdb/gdbserver/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* linux-x86-low.c (amd64_install_fast_tracepoint_jump_pad): Fix
comment. Use memcpy instead of casting through unsigned long.
Pedro Alves [Fri, 19 Aug 2016 11:07:45 +0000 (12:07 +0100)]
x32 Fast tracepoints: Customize jump pad address
MAP_32BIT is ignored on x32, meaning the jump pad can end up somewhere
between 2GB and 4GB, too far away from the executable for 5-byte
relative jumps (JMP rel32). So on x32, try explicitly placing the
jump pad near the middle of the available address space.
gdb/gdbserver/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
* linux-amd64-ipa.c (alloc_jump_pad_buffer) [__ILP32__]: Try
allocating around 0x80000000.
Pedro Alves [Fri, 19 Aug 2016 11:07:44 +0000 (12:07 +0100)]
x32 Fast tracepoints: IPA target descriptions
Building GDB for x32 fails building the IPA, with:
.../src/gdb/gdbserver/linux-amd64-ipa.c: In function ‘const target_desc* get_ipa_tdesc(int)’:
.../src/gdb/gdbserver/linux-amd64-ipa.c:182:14: error: ‘tdesc_amd64_avx_linux’ was not declared in this scope
return tdesc_amd64_avx_linux;
^
.../src/gdb/gdbserver/linux-amd64-ipa.c:184:14: error: ‘tdesc_amd64_mpx_linux’ was not declared in this scope
return tdesc_amd64_mpx_linux;
^
.../src/gdb/gdbserver/linux-amd64-ipa.c:186:14: error: ‘tdesc_amd64_avx_mpx_linux’ was not declared in this scope
return tdesc_amd64_avx_mpx_linux;
^
[...]
The problem is that the IPA is trying to use the 64-bit descriptions,
when it should be using the x32 ones.
gdb/gdbserver/ChangeLog:
2016-08-19 Pedro Alves <palves@redhat.com>
PR gdb/20415
* Makefile.in (x32-linux-ipa.o, x32-avx-linux-ipa.o)
(x32-avx512-linux-ipa.o): New rules.
* configure.ac (x86_64-*-linux*): New x32 check.
* configure.srv (ipa_x32_linux_regobj): New.
(x86_64-*-linux*): Use $ipa_x32_linux_regobj if building for x32.
* linux-amd64-ipa.c (get_ipa_tdesc) [__ILP32__]: Return x32
descriptions.
(initialize_low_tracepoint) [__ILP32__]: Initialize x32
descriptions.
* configure: Regenerate.
Nick Clifton [Fri, 19 Aug 2016 08:27:52 +0000 (09:27 +0100)]
Enable relro by default for AArch64, ARM and SCORE.
ld * emultempl/aarch64elf.em (before_parse): Initialise the relro
field in the link_info structure.
* emultempl/armelf.em (before_parse): Likewise.
* emultempl/linux.em (before_parse): Likewise.
* emultempl/scoreelf.em (before_parse): Likewise.
Nick Clifton [Fri, 19 Aug 2016 08:16:30 +0000 (09:16 +0100)]
Place .shstrtab section after .symtab and .strtab, thus restoring monotonically increasing section offsets.
bfd
* elf.c (assign_section_numbers): Assign number for the .shstrtab
section after the symbol table and string table sections.
binutils
* testsuite/binutils-all/readelf.s: Adjust expected ordering of
sections.
* testsuite/binutils-all/readelf.s-64: Likewise.
gas
* testsuite/gas/i386/ilp32/x86-64-unwind.d: Adjust expected ordering
of sections.
* testsuite/gas/i386/x86-64-unwind.d: Likewise.
* testsuite/gas/ia64/alias-ilp32.d: Likewise.
* testsuite/gas/ia64/alias.d: Likewise.
* testsuite/gas/ia64/group-1.d: Likewise.
* testsuite/gas/ia64/group-2.d: Likewise.
* testsuite/gas/ia64/secname-ilp32.d: Likewise.
* testsuite/gas/ia64/secname.d: Likewise.
* testsuite/gas/ia64/unwind-ilp32.d: Likewise.
* testsuite/gas/ia64/unwind.d: Likewise.
* testsuite/gas/ia64/xdata-ilp32.d: Likewise.
* testsuite/gas/ia64/xdata.d: Likewise.
* testsuite/gas/mmix/bspec-1.d: Likewise.
* testsuite/gas/mmix/bspec-2.d: Likewise.
* testsuite/gas/mmix/byte-1.d: Likewise.
* testsuite/gas/mmix/loc-1.d: Likewise.
* testsuite/gas/mmix/loc-2.d: Likewise.
* testsuite/gas/mmix/loc-3.d: Likewise.
* testsuite/gas/mmix/loc-4.d: Likewise.
* testsuite/gas/mmix/loc-5.d: Likewise.
* testsuite/gas/tic6x/scomm-directive-4.d: Likewise.
ld
* testsuite/ld-alpha/tlsbin.rd: Adjust expected ordering of sections.
* testsuite/ld-alpha/tlsbinr.rd: Likewise.
* testsuite/ld-alpha/tlspic.rd: Likewise.
* testsuite/ld-cris/libdso-2.d: Likewise.
* testsuite/ld-i386/nogot1.d: Likewise.
* testsuite/ld-i386/pr12718.d: Likewise.
* testsuite/ld-i386/pr12921.d: Likewise.
* testsuite/ld-i386/tlsbin-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbin.rd: Likewise.
* testsuite/ld-i386/tlsbin2-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbin2.rd: Likewise.
* testsuite/ld-i386/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbindesc.rd: Likewise.
* testsuite/ld-i386/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsdesc.rd: Likewise.
* testsuite/ld-i386/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsgdesc.rd: Likewise.
* testsuite/ld-i386/tlsnopic-nacl.rd: Likewise.
* testsuite/ld-i386/tlsnopic.rd: Likewise.
* testsuite/ld-i386/tlspic-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic.rd: Likewise.
* testsuite/ld-i386/tlspic2-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic2.rd: Likewise.
* testsuite/ld-ia64/tlsbin.rd: Likewise.
* testsuite/ld-ia64/tlspic.rd: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-10.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-50.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-60.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-70.d: Likewise.
* testsuite/ld-mmix/bspec1.d: Likewise.
* testsuite/ld-mmix/bspec2.d: Likewise.
* testsuite/ld-mmix/local1.d: Likewise.
* testsuite/ld-mmix/local3.d: Likewise.
* testsuite/ld-mmix/local5.d: Likewise.
* testsuite/ld-mmix/local7.d: Likewise.
* testsuite/ld-mmix/undef-3.d: Likewise.
* testsuite/ld-powerpc/tlsexe.r: Likewise.
* testsuite/ld-powerpc/tlsexe32.r: Likewise.
* testsuite/ld-powerpc/tlsexetoc.r: Likewise.
* testsuite/ld-powerpc/tlsso.r: Likewise.
* testsuite/ld-powerpc/tlsso32.r: Likewise.
* testsuite/ld-powerpc/tlstocso.r: Likewise.
* testsuite/ld-s390/tlsbin.rd: Likewise.
* testsuite/ld-s390/tlsbin_64.rd: Likewise.
* testsuite/ld-s390/tlspic.rd: Likewise.
* testsuite/ld-s390/tlspic_64.rd: Likewise.
* testsuite/ld-sh/sh64/crange1.rd: Likewise.
* testsuite/ld-sh/sh64/crange2.rd: Likewise.
* testsuite/ld-sh/sh64/crange3-cmpct.rd: Likewise.
* testsuite/ld-sh/sh64/crange3-media.rd: Likewise.
* testsuite/ld-sh/sh64/crange3.rd: Likewise.
* testsuite/ld-sh/sh64/crangerel1.rd: Likewise.
* testsuite/ld-sh/sh64/crangerel2.rd: Likewise.
* testsuite/ld-sh/tlsbin-2.d: Likewise.
* testsuite/ld-sh/tlspic-2.d: Likewise.
* testsuite/ld-sparc/gotop32.rd: Likewise.
* testsuite/ld-sparc/gotop64.rd: Likewise.
* testsuite/ld-sparc/tlssunbin32.rd: Likewise.
* testsuite/ld-sparc/tlssunbin64.rd: Likewise.
* testsuite/ld-sparc/tlssunnopic32.rd: Likewise.
* testsuite/ld-sparc/tlssunnopic64.rd: Likewise.
* testsuite/ld-sparc/tlssunpic32.rd: Likewise.
* testsuite/ld-sparc/tlssunpic64.rd: Likewise.
* testsuite/ld-tic6x/common.d: Likewise.
* testsuite/ld-tic6x/shlib-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
* testsuite/ld-tic6x/static-app-1.rd: Likewise.
* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
* testsuite/ld-x86-64/ilp32-4.d: Likewise.
* testsuite/ld-x86-64/nogot1.d: Likewise.
* testsuite/ld-x86-64/pr12718.d: Likewise.
* testsuite/ld-x86-64/pr12921.d: Likewise.
* testsuite/ld-x86-64/split-by-file-nacl.rd: Likewise.
* testsuite/ld-x86-64/split-by-file.rd: Likewise.
* testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin.rd: Likewise.
* testsuite/ld-x86-64/tlsbin2-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin2.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc.rd: Likewise.
* testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic.rd: Likewise.
* testsuite/ld-x86-64/tlspic2-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic2.rd: Likewise.
* testsuite/ld-xtensa/tlsbin.rd: Likewise.
* testsuite/ld-xtensa/tlspic.rd: Likewise.
Alan Modra [Fri, 19 Aug 2016 01:36:53 +0000 (11:06 +0930)]
PowerPC64, Don't copy weak symbol dyn_relocs to weakdef.
At the cost of an extra field in the symbol table hash entries, this
simplification to the relocate_section dynamic reloc test should help
maintainability.
* elf64-ppc.c (struct ppc_link_hash_entry): Add weakref.
(ppc64_elf_copy_indirect_symbol): Set weakref. Don't merge
dyn_relocs for weakdefs.
(alias_readonly_dynrelocs): New function.
(ppc64_elf_adjust_dynamic_symbol): Use alias_readonly_dynrelocs.
(ppc64_elf_relocate_section): Simplify condition under which
dyn_relocs are emitted.
Alan Modra [Fri, 19 Aug 2016 01:36:41 +0000 (11:06 +0930)]
PR 20472, PowerPC64 ifunc confusion
This patch fixes quite a lot of confusion in allocate_dynrelocs over
ifuncs. Function descriptors make ELFv1 quite different to ELFv2.
PR 20472
* elf64-ppc.c (ppc64_elf_before_check_relocs): Tweak abiversion test.
(readonly_dynrelocs): Comment fix.
(global_entry_stub): New function.
(ppc64_elf_adjust_dynamic_symbol): Tweak abiversion test. Match
ELFv2 code deciding on dynamic relocs vs. global entry stubs to
that in size_global_entry_stubs, handling ifunc too. Delete dead
weak sym code.
(allocate_dynrelocs): Ensure dyn_relocs field is cleared when no
dyn_relocs are needed. Correct handling of ifunc dyn_relocs.
Tidy ELIMINATE_COPY_RELOCS code, only setting dynindx for
undefweak syms. Expand and correct comments.
(size_global_entry_stubs): Ensure symbol is defined.
(ppc64_elf_relocate_section): Match condition under which
dyn_relocs are emitted to that in allocate_dynrelocs.
GDB Administrator [Fri, 19 Aug 2016 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in
Carl E. Love [Thu, 18 Aug 2016 21:36:36 +0000 (14:36 -0700)]
Add ChangeLog updates to my previous two commits
gdb/ChangeLog:
* MAINTAINERS (Write After Approval): Add "Carl Love".
gdb/testsuite/ChangeLog:
* gdb.arch/powerpc-power.s: Add new Power9 instruction tests
and sync up the test with tests in gas/testsuite/gas/ppc.
* gdb.arch/powerpc-power.exp: Likewise.
Carl Love [Thu, 19 May 2016 17:02:41 +0000 (13:02 -0400)]
Fix for powerpc-power.exp gdb regression test for Power 9
The GDB testsuite reports 5 test failures on Power 7 instructions.
Additionally the ppc test is missing the new Power 9 instructions as
well as a large number of older instructions. Additionally, some
instruction names have changed or been deleted. This patch
fixes the test failures and completely updates the test to make it
consistent with the supported Power 9 instructions listed in:
gas/testsuite/gas/ppc/power7.d
gas/testsuite/gas/ppc/power8.d
gas/testsuite/gas/ppc/power9.d
gas/testsuite/gas/ppc/altivec.d
gas/testsuite/gas/ppc/altivec2.d
gas/testsuite/gas/ppc/altivec3.d
gas/testsuite/gas/ppc/vsx.d
gas/testsuite/gas/ppc/vsx2.d
gas/testsuite/gas/ppc/vsx3.d
-----------------------------------------------------
gdb/testsuite/ChangeLog
2016-08-18 Carl Love <cel@us.ibm.com>
* gdb.arch/powerpc-power.s: Add new Power9 instruction tests
and sync up the test with tests in gas/testsuite/gas/ppc.
* gdb.arch/powerpc-power.exp: Likewise.
Carl E. Love [Thu, 18 Aug 2016 19:47:55 +0000 (12:47 -0700)]
Add myself as write-after-approval GDB maintainer.
gdb/ChangeLog:
* MAINTAINERS (Write After Approval): Add "Carl Love".
Edjunior Barbosa Machado [Thu, 18 Aug 2016 13:45:12 +0000 (10:45 -0300)]
ppc: Fix record of HTM instructions
The patch fixes the record support of Hardware Transactional Memory
instructions on Power. It also solves a large number of unexpected failures
from gdb.reverse testcases sigall-precsave.exp and sigall-reverse.exp that
occur on distros which glibc uses HTM instructions.
gdb/ChangeLog
2016-08-18 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* rs6000-tdep.c (ppc_process_record_op31): Handle HTM instructions.
Alan Modra [Thu, 18 Aug 2016 10:54:47 +0000 (20:24 +0930)]
Fix thinko in new weak undefined function test
* testsuite/ld-undefined/weak-undef.exp: Use unsupported not
unresolved.
GDB Administrator [Thu, 18 Aug 2016 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 17 Aug 2016 20:02:27 +0000 (16:02 -0400)]
Fix remove-inferior error message
This error message should not contain the word symbol:
(gdb) remove-inferiors 1
Warning: Can not remove current symbol inferior 1.
gdb/ChangeLog:
* inferior.c (remove_inferior_command): Fix error message.
gdb/testsuite/ChangeLog:
* gdb.multi/remove-inferiors.exp (test_remove_inferiors): Fix
expected error message.
Simon Marchi [Wed, 17 Aug 2016 19:53:29 +0000 (15:53 -0400)]
Add remove-inferiors test
I noticed that the remove-inferiors command was not tested, and as I am
doing some changes related to the user selection, I want to make sure I
don't break it. For example, I want to make sure it's not possible to
remove the current inferior.
gdb/testsuite/ChangeLog:
* gdb.multi/remove-inferiors.exp: New file.
* gdb.multi/remove-inferiors.c: New file.
Cary Coutant [Wed, 17 Aug 2016 17:53:31 +0000 (10:53 -0700)]
Fix extraneous complaints about missing expected TLS relocation (i386).
Build the test objects with the in-tree assembler. Also fix some cascading
error messages caused by not resetting the skip_call_tls_get_addr_ flag
after printing the error.
gold/
* i386.cc (Target_i386): Reset skip_call_tls_get_addr_ after printing
error message.
* testsuite/Makefile.am (pr20216a): Add missing dependencies.
(pr20308a): Add -Bgcctestdir/ to compile rules.
* testsuite/Makefile.in: Regenerate.
Simon Marchi [Wed, 17 Aug 2016 14:26:37 +0000 (10:26 -0400)]
Remove stale comment
This comment seems outdated, since exiting an inferior does not remove
it.
gdb/ChangeLog:
* inferior.c (exit_inferior_1): Remove comment.
GDB Administrator [Wed, 17 Aug 2016 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Mon, 15 Aug 2016 14:39:59 +0000 (07:39 -0700)]
sim: m68hc11: use standard STATIC_INLINE helper
Rather than redefine inline locally, use the common STATIC_INLINE.
GDB Administrator [Tue, 16 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Fri, 22 Jan 2016 03:17:59 +0000 (22:17 -0500)]
sim: unify symbol table handling
The common sim tracing code already handles loading and tracking of
symbols from the target program so that it can show symbol info in
trace/disassembly calls. Once we touch up the trace code and add a
few API callbacks, ports don't need to do loading and searching of
symbol tables themselves anymore.
Matthew Wahab [Mon, 15 Aug 2016 12:09:04 +0000 (13:09 +0100)]
[GDB] Fix builds broken by proc-service changes.
GLIBC BZ#20311 introduced a change to install proc_service.h so that gdb
didn't have to use the version it embeds in gdb_proc_service.h. The
embedded version is guarded by HAVE_PROC_SERVICE_H and
gdb_proc_service.h has a number other of includes and definitions, all
of which are uncondional except for an include for gregset.h. This is
only included if HAVE_PROC_SERIVCE_H is not defined.
This causes a build failure when cross compiling gdb with the latest
glibc because type definitions in gregset are used independently of
HAVE_PROC_SERIVCE_H. In particular, they are used in gdb_proc_service.h
when PRFPREGSET_T_BROKEN is set.
The error messages on the failure are
----
binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does
not name a type; did you mean ‘elf_fpregset_t’?
typedef gdb_fpregset_t gdb_prfpregset_t;
^~~~~~~~~~~~~~
elf_fpregset_t
binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does
not name a type; did you mean ‘elf_fpregset_t’?
typedef gdb_fpregset_t gdb_prfpregset_t;
^~~~~~~~~~~~~~
elf_fpregset_t
binutils-gdb/gdb/proc-service.c:218:15: error: ‘gdb_prfpregset_t’ does
not name a type; did you mean ‘gdb_fpregset_t’?
const gdb_prfpregset_t *fpregset)
^~~~~~~~~~~~~~~~
gdb_fpregset_t
----
This patch moves the include for gregset.h to before the code guarded by
HAVE_PROC_SERIVCE_H, so that it is always included. This is enough to
fix the build.
2016-08-15 Matthew Wahab <matthew.wahab@arm.com>
PR gdb/20457
* gdb_proc_service.h: Add an include of gregset.h
[!HAVE_PROC_SERVICE_H]: Remove the include of gregset.h.
Yao Qi [Mon, 15 Aug 2016 11:28:56 +0000 (12:28 +0100)]
Fix heap-buffer-overflow in explicit_location_lex_one
I build GDB with -fsanitize=address, and see the error in tests,
(gdb) PASS: gdb.linespec/ls-errs.exp: lang=C++: break 3 foo
break -line 3 foo^M
=================================================================^M
==4401==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000047487 at pc 0x819d8e bp 0x7fff4e4e6bb0 sp 0x7fff4e4e6ba8^M
READ of size 1 at 0x603000047487 thread T0^[[1m^[[0m^M
#0 0x819d8d in explicit_location_lex_one /home/yao/SourceCode/gnu/gdb/git/gdb/location.c:502^M
#1 0x81a185 in string_to_explicit_location(char const**, language_defn const*, int) /home/yao/SourceCode/gnu/gdb/git/gdb/location.c:556^M
#2 0x81ac10 in string_to_event_location(char**, language_defn const*) /home/yao/SourceCode/gnu/gdb/git/gdb/location.c:687^
the code in question is:
> /* Special case: C++ operator,. */
> if (language->la_language == language_cplus
> && strncmp (*inp, "operator", 8) <--- [1]
> && (*inp)[9] == ',')
> (*inp) += 9;
> ++(*inp);
The error is caused by the access to (*inp)[9] if 9 is out of its bounds.
However [1] looks odd to me, because if strncmp returns true (non-zero),
the following check "(*inp)[9] == ','" makes no sense any more. I
suspect it was a typo in the code we meant to "strncmp () == 0". Another
problem in the code above is that if *inp is "operator,", we first
increment *inp by 9, and then increment it by one again, which is wrong
to me. We should only increment *inp by 8 to skip "operator", and go
back to the loop header to decide where we stop.
gdb:
2016-08-15 Yao Qi <yao.qi@linaro.org>
* location.c (explicit_location_lex_one): Compare the return
value of strncmp with zero. Don't check (*inp)[9]. Increment
*inp by 8.
GDB Administrator [Mon, 15 Aug 2016 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sat, 13 Aug 2016 15:44:24 +0000 (08:44 -0700)]
sim: m68hc11: standardize sim_cpu naming
We use "sim_cpu *cpu" in the sim code base, not "struct _sim_cpu" or
the name "proc", so clean up this sim to follow along.
Mike Frysinger [Sat, 13 Aug 2016 08:41:57 +0000 (01:41 -0700)]
sim: m68hc11: fix up various prototype related warnings
A few funcs are only used locally, so mark them static to avoid warnings
due to -Wmissing-prototypes.
Some funcs cast the return value wrong, so drop them (and let void * just
work by default).
Update some prototypes to be new style.
Mike Frysinger [Fri, 12 Aug 2016 14:11:26 +0000 (22:11 +0800)]
sim: cgen: constify mode_names
GDB Administrator [Sun, 14 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Fri, 22 Jan 2016 02:04:18 +0000 (21:04 -0500)]
sim: cgen: drop unused argv/envp definitions
The common argv/envp are used now by all ports, so drop this old
cgen fragment.
Mike Frysinger [Mon, 8 Aug 2016 05:06:49 +0000 (13:06 +0800)]
sim: bfin: split out common mach/model defines into arch.h [PR sim/20438]
The current machs.h mixes common enums with Blackfin-specific defines.
This causes us troubles with header inclusion order such that we can't
drop the old SIM_CPU typedef (which is duplicated in common code). By
splitting the two up, we can unwind this dependency chain, and drop the
old typedef. It also fixes building with older gcc versions.
GDB Administrator [Sat, 13 Aug 2016 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Fri, 12 Aug 2016 19:36:20 +0000 (20:36 +0100)]
Warn if the sh_info field of a symbol table does not index the first non-local symbol in the section.
* readelf.c (process_symbol_table): Generate a warning if a local
symbol is found at and offste greater than or equal to the sh_info
field of it's section header.
Roland McGrath [Fri, 12 Aug 2016 16:55:25 +0000 (09:55 -0700)]
PR gold/20462: Fix bogus layout on ARM with linker script using PHDRS clause
gold/
PR gold/20462
* script-sections.cc (Script_sections::release_segments):
Reset this->segments_created_.
Roland McGrath [Fri, 12 Aug 2016 16:50:49 +0000 (09:50 -0700)]
[gold] Implement HIDDEN syntax in linker scripts
gold/
* yyscript.y (HIDDEN): New %token.
(assignment): Handle HIDDEN(string = expr) syntax.
* script.cc (script_keyword_parsecodes): Add HIDDEN.
Alan Modra [Fri, 12 Aug 2016 14:33:43 +0000 (00:03 +0930)]
Correct .dynsym sh_info
bfd/
* elf-bfd.h (struct elf_link_hash_table): Add local_dynsymcount.
* elflink.c (_bfd_elf_link_renumber_dynsyms): Set local_dynsymcount.
(bfd_elf_final_link): Set .dynsym sh_info from local_dynsymcount.
ld/
* testsuite/ld-tic6x/shlib-1.rd: Correct expected .dynsym sh_info.
* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
* testsuite/ld-tic6x/static-app-1.rd: Likewise.
* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
Nick Clifton [Fri, 12 Aug 2016 10:35:32 +0000 (11:35 +0100)]
Undo the previous change to the aarch64 sim - exporting aarch64_step() - and instead make aarch64_run correctly process sim events.
* simulator.c (aarch64_step): Revert pervious delta.
(aarch64_run): Call sim_events_tick after each
instruction is simulated, and if necessary call
sim_events_process.
* simulator.h: Revert previous delta.