Alan Modra [Wed, 26 Nov 2014 00:40:29 +0000 (11:10 +1030)]
Retry powerpc gold stub grouping when groups prove too large
An unusually large number of stubs can result in the default section
group size being too large; sections plus stubs exceed the range of a
branch. Restarting the relaxation pass with a smaller group size can
sometimes help.
* powerpc.cc (struct Stub_table_owner): New.
(Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
unsigned int vector. Update all references.
(powerpc_relobj::set_stub_table): Take an unsigned int param
rather than a Stub_table. Update callers.
(Powerpc_relobj::clear_stub_table): New function.
(Target_powerpc): Add relax_failed_, relax_fail_count_ and
stub_group_size_ vars.
(Target_powerpc::new_stub_table): Delete.
(max_branch_delta): New function, extracted from..
(Target_powerpc::Relocate::relocate): ..here..
(Target_powerpc::Branch_info::make_stub): ..and here. Return
status on whether stub created successfully.
(Stub_control::Stub_control): Add "no_size_errors" param. Move
default sizing to..
(Target_powerpc::do_relax): ..here. Init stub_group_size_ and
reduce on relax failure.
(Target_powerpc::group_sections): Add "no_size_errors" param.
Use stub_group_size_. Set up group info in a temp vector,
before building Stub_table vector. Account for input sections
possibly already converted to relaxed sections.
(Stub_table::init): Delete. Merge into..
(Stub_table::Stub_table): ..here.
(Stub_table::can_reach_stub): New function.
(Stub_table::add_plt_call_entry): Add "from" parameter and
return true iff stub could be reached.
(Stub_table::add_long_branch_entry): Similarly. Add "r_type"
param too.
(Stub_table::clear_stubs): Add "all" param.
Sandra Loosemore [Wed, 26 Nov 2014 02:40:28 +0000 (18:40 -0800)]
Fix Nios II prologue analyzer to handle multiple stack adjustments.
2014-11-25 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* nios2-tdep.c (nios2_analyze_prologue): Replace restriction
that there can be only one stack adjustment in the prologue
with tests to detect specific disallowed stack adjustments.
Sandra Loosemore [Wed, 26 Nov 2014 02:37:41 +0000 (18:37 -0800)]
Fix Nios II GDB epilogue detection to handle multiple stack adjustments.
2014-11-25 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* nios2-tdep.c (nios2_in_epilogue_p): Handle multiple stack
adjustments.
Sandra Loosemore [Wed, 26 Nov 2014 02:34:51 +0000 (18:34 -0800)]
Refactor Nios II GDB support to use helper functions for disassembly and
instruction matching.
2014-11-25 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* nios2-tdep.c (nios2_fetch_insn): Move up in file. Disassemble
the instruction as well as reading it from memory.
(nios2_match_add): New.
(nios2_match_sub): New.
(nios2_match_addi): New.
(nios2_match_orhi): New.
(nios2_match_stw): New.
(nios2_match_ldw): New.
(nios2_match_rdctl): New.
(enum branch_condition): New.
(nios2_match_branch): New.
(nios2_match_jmpi): New.
(nios2_match_calli): New.
(nios2_match_jmpr): New.
(nios2_match_callr): New.
(nios2_match_break): New.
(nios2_match_trap): New.
(nios2_in_epilogue_p): Rewrite to use new functions.
(nios2_analyze_prologue): Likewise.
(nios2_skip_prologue): Delete unused local limit_pc.
(nios2_breakpoint_from_pc): Make R1-specific encodings explicit.
(nios2_get_next_pc): Rewrite to use new functions.
Alan Modra [Tue, 25 Nov 2014 23:36:07 +0000 (10:06 +1030)]
[GOLD] PowerPC relaxation corner case
It's possible for the section grouping code to decide that the last
section looked at (the first section by address) doesn't fit into a
group. In one case that section is already a group owner and that is
handled correctly. In other cases the section should be put into its
own group. Like this:
* powerpc.cc (Stub_control::set_output_and_owner): New function.
(Target_powerpc::group_sections): Use it.
GDB Administrator [Wed, 26 Nov 2014 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Cary Coutant [Tue, 25 Nov 2014 22:33:51 +0000 (14:33 -0800)]
Add file size to ELF symbol labelling start of a binary file.
gold/
* binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
(Binary_to_elf::write_symbol): Add st_size parameter.
* binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
Cary Coutant [Tue, 25 Nov 2014 21:55:42 +0000 (13:55 -0800)]
Fix corrupted .eh_frame section with LTO and --gc-sections.
When --gc-sections is turned on during an LTO link, the .eh_frame sections
from deferred files are processed before those from the replacement files.
As a result, the section end-cap from crtendS.o is placed ahead of
the .eh_frame data from the replacement files. This patch fixes the bug
by skipping the layout of the deferred sections during GC pass 2.
gold/
PR gold/17639
* object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
(Sized_relobj_file::do_layout): Handle deferred sections properly
during GC pass 1. Don't add reloc sections to deferred list twice.
* object.h (Sized_relobj_file::is_deferred_layout): New function.
(Sized_relobj_file::is_deferred_layout_): New data member.
H.J. Lu [Tue, 25 Nov 2014 21:40:19 +0000 (13:40 -0800)]
Update ld-alpha tests for secureplt
* ld-alpha/tlsbin.dd: Updated for secureplt.
* ld-alpha/tlsbin.rd: Likewise.
* ld-alpha/tlsbin.sd: Likewise.
* ld-alpha/tlsbinr.dd: Likewise.
* ld-alpha/tlsbinr.rd: Likewise.
* ld-alpha/tlspic.dd: Likewise.
* ld-alpha/tlspic.rd: Likewise.
* ld-alpha/tlspic.sd: Likewise.
Max Filippov [Tue, 25 Nov 2014 18:33:21 +0000 (21:33 +0300)]
Fix trampolines search code for conditional branches
For conditional branches that need more than one trampoline to reach its
target assembler couldn't always find suitable trampoline because
post-loop condition check was placed inside the loop, resulting in
premature loop termination. Move check outside the loop.
This fixes the following build errors seen when assembling huge files
produced by gcc:
Error: jump target out of range; no usable trampoline found
Error: operand 1 of 'j' has out of range value '307307'
2014-11-25 Max Filippov <jcmvbkbc@gmail.com>
gas/
* config/tc-xtensa.c (search_trampolines): Move post-loop
condition check outside the search loop.
gas/testsuite/
* gas/xtensa/trampoline.d: Add expected output for branches.
* gas/xtensa/trampoline.s: Add test case for branches.
H.J. Lu [Tue, 25 Nov 2014 17:28:32 +0000 (09:28 -0800)]
Use get_symbol_version_string in BFD_JUMP_TABLE_SYMBOLS
This patch adds get_symbol_version_string to BFD_JUMP_TABLE_SYMBOLS so
that we can use bfd_get_symbol_version_string in objdump for non-ELF
targets.
bfd/
* targets.c (BFD_JUMP_TABLE_SYMBOLS): Use
NAME##_get_symbol_version_string.
(bfd_get_symbol_version_string): New.
* aout-adobe.c (aout_32_get_symbol_version_string): Define using
_bfd_nosymbols define.
* aout-target.h (MY_get_symbol_version_string): Likewise.
* aout-tic30.c (MY_get_symbol_version_string): Likewise.
* binary.c (binary_get_symbol_version_string): Likewise.
* bout.c (aout_32_get_symbol_version_string): Likewise.
* coff-rs6000.c (_bfd_xcoff_get_symbol_version_string): Likewise.
* i386msdos.c (msdos_get_symbol_version_string): Likewise.
* i386os9k.c (aout_32_get_symbol_version_string): Likewise.
* ieee.c (ieee_get_symbol_version_string): Likewise.
* ihex.c (ihex_get_symbol_version_string): Likewise.
* libecoff.h (_bfd_ecoff_get_symbol_version_string): Likewise.
* mach-o-target.c (bfd_mach_o_get_symbol_version_string): Likewise.
* mmo.c (mmo_get_symbol_version_string): Likewise.
* nlm-target.h (nlm_get_symbol_version_string): Likewise.
* oasys.c (oasys_get_symbol_version_string): Likewise.
* pef.c (bfd_pef_get_symbol_version_string): Likewise.
* plugin.c (bfd_plugin_get_symbol_version_string): Likewise.
* ppcboot.c (ppcboot_get_symbol_version_string): Likewise.
* som.c (som_get_symbol_version_string): Likewise.
* srec.c (srec_get_symbol_version_string): Likewise.
* tekhex.c (tekhex_get_symbol_version_string): Likewise.
* versados.c (versados_get_symbol_version_string): Likewise.
* vms-alpha.c (alpha_vms_get_symbol_version_string): Likewise.
* xsym.c (bfd_sym_get_symbol_version_string): Likewise.
* coff64-rs6000.c (rs6000_xcoff64_vec): Use
coff_get_symbol_version_string.
(rs6000_xcoff64_aix_vec): Likewise.
* elf-bfd.h (bfd_elf_get_symbol_version_string): Renamed to ...
(_bfd_elf_get_symbol_version_string): This.
* elf.c: Likewise.
(bfd_elf_print_symbol): Updated.
* elfxx-target.h (bfd_elfNN_get_symbol_version_string): Define.
* libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Define.
* libcoff-in.h (coff_get_symbol_version_string): Likewise.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
* libcoff.h: Likewise.
binutils/
* objdump.c (objdump_print_symname): Replace
bfd_elf_get_symbol_version_string with
bfd_get_symbol_version_string.
H.J. Lu [Tue, 25 Nov 2014 14:47:44 +0000 (06:47 -0800)]
Display symbol version when dumping dynrelocs
Both readelf/objdump know how to get symbol version string for dynamic
symbols. This patch extracts this functionality into a separate
function and uses it to add symbol version string to versioned symbol
names when dumping dynamic relocations.
bfd/
PR binutils/16496
* elf-bfd.h (bfd_elf_get_symbol_version_string): New.
* elf.c (bfd_elf_get_symbol_version_string): New. Extracted
from bfd_elf_print_symbol.
(bfd_elf_print_symbol): Use it.
binutils/
PR binutils/16496
* objdump.c (objdump_print_symname): Call
bfd_elf_get_symbol_version_string to get ELF symbol version
string. Append version string if needed.
* readelf.c (versioned_symbol_info): New enum.
(get_symbol_version_string): New. Extracted from
process_symbol_table.
(dump_relocations): Add a new argument to indicate if dynamic
symbol table is used. Use get_symbol_version_string to get
symbol version string for dynamic symbol. Append version string
if needed.
(process_relocs): Updated dump_relocations call.
(process_symbol_table): Use get_symbol_version_string.
ld/testsuite/
PR binutils/16496
* ld-cris/weakref3.d: Add symbol version string to versioned
symbol names in dynamic relocation.
* ld-cris/weakref4.d: Likewise.
* ld-elfvers/vers24.rd: Likewise.
* ld-elf/pr16496a.c: New file.
* ld-elf/pr16496a.map: Likewise.
* ld-elf/pr16496b.c: Likewise.
* ld-elf/pr16496b.od: Likewise.
* ld-elf/shared.exp (build_tests): Add libpr16496a.so and
libpr16496b.so tests.
H.J. Lu [Tue, 25 Nov 2014 13:05:39 +0000 (05:05 -0800)]
Optimize out i386/x86-64 JUMP_SLOT relocation
When there are both PLT and GOT references to the same function symbol,
linker will create a GOTPLT slot for PLT entry and a GOT slot for GOT
reference. A run-time JUMP_SLOT relocation is created to update the
GOTPLT slot and a run-time GLOB_DAT relocation is created to update the
GOT slot. Both JUMP_SLOT and GLOB_DAT relocations will apply the same
symbol value to GOTPLT and GOT slots, respectively, at run-time.
This optimization combines GOTPLT and GOT slots into a single GOT slot
and removes the run-time JUMP_SLOT relocation. It replaces the regular
PLT entry:
indirect jump [GOTPLT slot]
push relocation index
jump PLT0
with an GOT PLT entry with an indirect jump via the GOT slot:
indirect jump [GOT slot]
nop
and resolves PLT reference to the GOT PLT entry.
We must avoid this optimization if pointer equality is needed since
we don't clear symbol value in this case and the dynamic linker won't
update the GOT slot. Otherwise, the resulting binary will get into an
infinite loop at run-time.
bfd/
* elf32-i386.c (elf_i386_got_plt_entry): New.
(elf_i386_pic_got_plt_entry): Likewise.
(elf_i386_link_hash_entry): Add plt_got.
(elf_i386_link_hash_table): Likewise.
(elf_i386_link_hash_newfunc): Initialize plt_got.offset to -1.
(elf_i386_get_local_sym_hash): Likewise.
(elf_i386_check_relocs): Create the GOT PLT if there are both
PLT and GOT references when the regular PLT is used.
(elf_i386_allocate_dynrelocs): Use the GOT PLT if there are
both PLT and GOT references unless pointer equality is needed.
(elf_i386_relocate_section): Also check the GOT PLT when
resolving R_386_PLT32.
(elf_i386_finish_dynamic_symbol): Use the GOT PLT if it is
available.
* elf64-x86-64.c (elf_x86_64_link_hash_entry): Add plt_got.
(elf_x86_64_link_hash_table): Likewise.
(elf_x86_64_link_hash_newfunc): Initialize plt_got.offset to -1.
(elf_x86_64_get_local_sym_hash): Likewise.
(elf_x86_64_check_relocs): Create the GOT PLT if there are both
PLT and GOT references when the regular PLT is used.
(elf_x86_64_allocate_dynrelocs): Use the GOT PLT if there are
both PLT and GOT references unless pointer equality is needed.
(elf_x86_64_relocate_section): Also check the GOT PLT when
resolving R_X86_64_PLT32.
(elf_x86_64_finish_dynamic_symbol): Use the GOT PLT if it is
available.
ld/
* emulparams/elf_i386.sh (TINY_READONLY_SECTION): New.
* emulparams/elf_x86_64.sh (TINY_READONLY_SECTION): Add .plt.got.
ld/testsuite/
* ld-i386/i386.exp: Add run-time relocation tests for plt-main.
* ld-i386/plt-main.rd: New file.
* ld-x86-64/plt-main-bnd.dd: Likewise.
* ld-x86-64/plt-main.rd: Likewise.
* ld-x86-64/x86-64.exp: Add run-time relocation tests for
plt-main.
GDB Administrator [Tue, 25 Nov 2014 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 24 Nov 2014 17:14:09 +0000 (09:14 -0800)]
Update libtool.m4 from GCC trunk
* libtool.m4: Updated from GCC trunk.
bfd/
* configure: Regenerated.
binutils/
* configure: Regenerated.
gas/
* configure: Regenerated.
gprof/
* configure: Regenerated.
ld/
* configure: Regenerated.
opcodes/
* configure: Regenerated.
Jan Kratochvil [Mon, 24 Nov 2014 17:05:04 +0000 (18:05 +0100)]
Reindent code (resolve_dynamic_type_internal).
gdb/ChangeLog
2014-11-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdbtypes.c (resolve_dynamic_type_internal): Reindent the code.
Jiong Wang [Mon, 24 Nov 2014 13:43:39 +0000 (13:43 +0000)]
[AArch64] Cortex-A53 Erratum 835769 -- sort maps
2014-11-24 Tejas Belagod <tejas.belagod@arm.com>
bfd/
* elfnn-aarch64.c (elf_aarch64_compare_mapping): New.
(erratum_835769_scan): Sort map list.
Samuel Thibault [Sun, 23 Nov 2014 15:19:46 +0000 (16:19 +0100)]
[Hurd] Fix deallocation after proc_getprocinfo call
2014-11-24 Samuel Thibault <samuel.thibault@ens-lyon.org>
* gdb/gnu-nat.c (inf_validate_procinfo): Multiply the number of
elements pi_len by the size of the elements before calling
vm_deallocate.
(inf_validate_task_sc): Likewise, and properly deallocate the
noise array.
Doug Evans [Mon, 24 Nov 2014 04:30:34 +0000 (20:30 -0800)]
Fix dumping of function arguments.
gdb/ChangeLog:
* gdbtypes.c (print_args): Renamed from print_arg_types. Print arg
number and name if present. All callers updated.
(dump_fn_fieldlists): Fix indentation of args.
Alan Modra [Mon, 24 Nov 2014 02:11:33 +0000 (12:41 +1030)]
PowerPC64 --plt-align
Alignment of plt stubs was broken, firstly because the option was
being dropped due to the alignment value not being set in the "params"
struct used in elf64-ppc.c, and secondly due to not calculating the
number of alignment boundary crossings correctly.
bfd/
* elf64-ppc.c (plt_stub_pad): Correct.
ld/
* ld.texinfo: Correct --plt-align documentation.
* emultempl/ppc64elf.em (plt_stub_align): Delete. Use and set
params.plt_stub_align instead.
GDB Administrator [Mon, 24 Nov 2014 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
Patrick Palka [Sun, 23 Nov 2014 16:14:13 +0000 (11:14 -0500)]
Add myself as write-after-approval GDB maintainer
gdb/ChangeLog:
* MAINTAINERS (Write After Approval): Add myself.
H.J. Lu [Sun, 23 Nov 2014 13:54:02 +0000 (05:54 -0800)]
Assert size of elf_x86_64_{bnd|legacy}_plt2_entry
Assert size of elf_x86_64_bnd_plt2_entry and elf_x86_64_legacy_plt2_entry
only in elf_x86_64_check_relocs.
* elf64-x86-64.c (elf_x86_64_check_relocs): Assert size of
elf_x86_64_bnd_plt2_entry and elf_x86_64_legacy_plt2_entry.
(elf_x86_64_allocate_dynrelocs): Don't assert size of
elf_x86_64_bnd_plt2_entry and elf_x86_64_legacy_plt2_entry.
Joel Brobecker [Thu, 20 Nov 2014 16:41:25 +0000 (20:41 +0400)]
Always consider infcall breakpoints as non-permanent.
A recent change...
commit
1a853c5224e2b8fedfac6d029365522b83080b40
Date: Wed Nov 12 10:10:49 2014 +0000
Subject: make "permanent breakpoints" per location and disableable
... broke function calls on sparc-elf when running over QEMU. Any
function call should demonstrate the problem.
For instance, seen from the debugger:
(gdb) call pn(1234)
[Inferior 1 (Remote target) exited normally]
The program being debugged exited while in a function called from GDB.
Evaluation of the expression containing the function
And seen from QEMU:
qemu: fatal: Trap 0x02 while interrupts disabled, Error state
[register dump removed]
What happens in this case is that GDB sets the inferior function call
by not only creating the dummy frame, but also writing a breakpoint
instruction at the return address for our function call. See infcall.c:
/* Write a legitimate instruction at the point where the infcall
breakpoint is going to be inserted. While this instruction
is never going to be executed, a user investigating the
memory from GDB would see this instruction instead of random
uninitialized bytes. We chose the breakpoint instruction
as it may look as the most logical one to the user and also
valgrind 3.7.0 needs it for proper vgdb inferior calls.
If software breakpoints are unsupported for this target we
leave the user visible memory content uninitialized. */
bp_addr_as_address = bp_addr;
bp_bytes = gdbarch_breakpoint_from_pc (gdbarch, &bp_addr_as_address,
&bp_size);
if (bp_bytes != NULL)
write_memory (bp_addr_as_address, bp_bytes, bp_size);
This instruction triggers a change introduced by the commit above,
where we consider bp locations as being permanent breakpoints
if there is already a breakpoint instruction at that address:
+ if (bp_loc_is_permanent (loc))
+ {
+ loc->inserted = 1;
+ loc->permanent = 1;
+ }
As a result, when resuming the program's execution for the inferior
function call, GDB decides that it does not need to insert a breakpoint
at this address, expecting the target to just report a SIGTRAP when
trying to execute that instruction.
But unfortunately for us, at least some versions of QEMU for SPARC
just terminate the execution entirely instead of reporting a breakpoint,
thus producing the behavior reported here.
Although it appears like QEMU might be misbehaving and should therefore
be fixed (to be verified) from the user's point of view, the recent
change does introduce a regression. So this patch tries to mitigate
a bit the damage by handling such infcall breakpoints as special and
making sure that they are never considered permanent, thus restoring
the previous behavior specifically for those breakpoints.
The option of not writing the breakpoint instructions in the first
place was considered, and would probably work also. But the comment
associated to it seems to indicate that there is still reason to
keep it.
gdb/ChangeLog:
* breakpoint.c (bp_loc_is_permanent): Return 0 if LOC corresponds
to a bp_call_dummy breakpoint type.
Tested on x86_64-linux. Also testing on sparc-elf/QEMU using
AdaCore's testsuite.
Patrick Palka [Sat, 30 Aug 2014 19:33:08 +0000 (15:33 -0400)]
Specify SA_RESTART when registering the SIGWINCH signal handler
SA_RESTART allows system calls to be restarted across a signal handler.
By specifying this flag we fix the issue where if the user is being
prompted to answer yes or no, and the terminal gets resized in the
meantime, the prompt will think that the user sent an EOF and so it will
take the default action for that prompt (in the case of the quit prompt,
it will quit GDB).
gdb/ChangeLog:
* tui/tui-win.c (tui_initialize_win): Specify SA_RESTART when
registering the signal handler.
Patrick Palka [Sun, 23 Nov 2014 10:03:39 +0000 (14:03 +0400)]
Fix the processing of Meta-key commands in TUI
This patch fixes the annoying bug where key sequences such as Alt_F or
Alt_B (go forward or backwards by a word) do not behave promptly in TUI.
You have to press a third key in order for the key sequence to register.
This is mostly ncurses' fault. Calling wgetch() normally causes ncurses
to read only a single key from stdin. However if the key read is the
start-sequence key (^[ a.k.a. ESC) then wgetch() reads TWO keys from
stdin, storing the 2nd key into an internal FIFO buffer and returning
the start-sequence key. The extraneous read of the 2nd key makes us
miss its corresponding stdin event, so the event loop blocks until a
third key is pressed. This explains why such key sequences do not
behave promptly in TUI.
To fix this issue, we must somehow compensate for the missed stdin event
corresponding to the 2nd byte of a key sequence. This patch achieves
this by hacking up the stdin event handler to conditionally execute the
readline callback multiple times in a row. This is done via a new
global variable, call_stdin_event_handler_again_p, which is set from
tui_getc() when we receive a start-sequence key and notice extra pending
input in the ncurses buffer.
Tested on x86_64-unknown-linux-gnu.
gdb/ChangeLog:
* event-top.h (call_stdin_event_handler_again_p): Declare.
* event-top.c (call_stdin_event_handler_again_p): Define.
(stdin_event_handler): Use it.
* tui/tui-io.c (tui_getc): Prepare to call the stdin event
handler again if there is pending input following a
start sequence.
Patrick Palka [Fri, 14 Nov 2014 19:04:50 +0000 (14:04 -0500)]
checkpoint: print index of new checkpoint in response message
This way the user can know the index of the latest checkpoint without
having to run "info checkpoints" afterwards.
gdb/ChangeLog:
* linux-fork.c (checkpoint_command): Print index of new
checkpoint in response message.
Yao Qi [Sun, 23 Nov 2014 05:57:00 +0000 (13:57 +0800)]
Refine read_string
In read_string, we have this line
chunksize = (len == -1 ? min (8, fetchlimit) : fetchlimit);
but chunksize is only used in the block that lne == -1, so IWBN to
move chunksize to the block in which it is used, and simplify the
condition setting chunksize. This patch also moves 'found_nul' to
inner block. This patch also splits a paragraph of comment into two,
and move them to different condition blocks (len > 0 and len == -1)
respectively.
gdb:
2014-11-23 Yao Qi <yao@codesourcery.com>
* valprint.c (read_string): Move local variables 'found_nul',
'chunksize' and 'limit' to inner scope. Update comments.
Joel Sherrill [Sun, 23 Nov 2014 03:11:39 +0000 (07:11 +0400)]
sim/ppc/*: Change immediatly to immediately
sim/ppc/ChangeLog:
* ChangeLog, ChangeLog.00, hw_com.c, ld-cache.h, ppc-instructions:
Change immediatly to immediately.
Joel Sherrill [Sun, 23 Nov 2014 03:09:16 +0000 (07:09 +0400)]
sim/igen/: Change immediatly to immediately
sim/igen/ChangeLog:
* igen/ld-cache.h, igen/table.h: Change immediatly to immediately.
Joel Sherrill [Sun, 23 Nov 2014 02:59:54 +0000 (06:59 +0400)]
s/immediatly/immediately/ in sim/sh/ChangeLog entry.
GDB Administrator [Sun, 23 Nov 2014 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Doug Evans [Sat, 22 Nov 2014 19:29:08 +0000 (11:29 -0800)]
symtab.c: Comment and whitespace improvements.
gdb/ChangeLog:
* symtab.c (lookup_symbol_in_objfile_from_linkage_name): Improve
function comment.
(search_symbols): Fix comments and whitespace.
Doug Evans [Sat, 22 Nov 2014 18:46:52 +0000 (10:46 -0800)]
cp-namespace.c (cp_lookup_symbol_nonlocal): Fix comment.
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_nonlocal): Fix comment.
H.J. Lu [Sat, 22 Nov 2014 16:58:07 +0000 (08:58 -0800)]
Check branch displacement overflow in x86-64 PLT entry
Displacement of branch to PLT0 in x86-64 PLT entry is signed 32-bit.
This patch adds a sanity check. We will only see the failure when PLT
size is > 2GB.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Check
branch displacement overflow in PLT entry.
Yao Qi [Sat, 22 Nov 2014 13:28:31 +0000 (21:28 +0800)]
Use MACRO_AT_func in entry-values.exp
MACRO_AT_func can be used in gdb.trace/entry-values.exp to correctly
get function's address in generated debug info. As a result, the test
is more friendly to clang. Currently, there are some fails in
entry-values.exp when the test is compiled by clang. With this patch
applied, all fails go away.
gdb/testsuite:
2014-11-22 Yao Qi <yao@codesourcery.com>
* gdb.trace/entry-values.c: Remove asms.
(foo): Add foo_label.
(bar): Add bar_label.
* gdb.trace/entry-values.exp: Remove code computing foo's
length and bar's length.
(Dwarf::assemble): Invoke function_range for bar and use
MACRO_AT_func for foo.
Yao Qi [Sat, 22 Nov 2014 13:22:01 +0000 (21:22 +0800)]
[arm] Fix fails in dw2-compdir-oldgcc.exp
This patch fixes two fails in dw2-compdir-oldgcc.exp I've seen on arm
target thumb mode.
FAIL: gdb.dwarf2/dw2-compdir-oldgcc.exp: info source gcc42
FAIL: gdb.dwarf2/dw2-compdir-oldgcc.exp: info source gcc43
When fill in DW_AT_low_pc, the label should be used rather than the
function, otherwise, the LSB bit of the address in DW_AT_low_pc is
set and the debug info is wrong. This patch is to add two labels for
functions gcc42 and gcc43 respectively, and use them. These two
fails are fixed.
gdb/testsuite:
2014-11-22 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dw2-compdir-oldgcc.S: Define label .Lgcc42_procstart
and .Lgcc43_procstart. Use .Lgcc42_procstart instead of gcc42.
Use .Lgcc43_procstart instead of gcc43.
GDB Administrator [Sat, 22 Nov 2014 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Tue, 18 Nov 2014 23:41:15 +0000 (23:41 +0000)]
Merge include/* files from GCC commit
69a2f316d3.
include/ChangeLog:
* dwarf2.def (DW_AT_APPLE_optimized, DW_AT_APPLE_flags)
(DW_AT_APPLE_isa, DW_AT_APPLE_block)
(DW_AT_APPLE_major_runtime_vers, DW_AT_APPLE_runtime_class)
(DW_AT_APPLE_omit_frame_ptr, DW_AT_APPLE_property_name)
(DW_AT_APPLE_property_getter, DW_AT_APPLE_property_setter)
(DW_AT_APPLE_property_attribute, DW_AT_APPLE_objc_complete_type)
(DW_AT_APPLE_property): New macros.
Andrew Burgess [Tue, 18 Nov 2014 23:37:52 +0000 (23:37 +0000)]
Merge include/* files from GCC commit
77cab4753.
include/ChangeLog:
PR debug/63239
* dwarf2.def (DW_AT_GNU_deleted): New attribute.
Nick Clifton [Fri, 21 Nov 2014 21:44:04 +0000 (21:44 +0000)]
Fixes for memory access violations exposed by fuzzinf various binaries.
PR binutils/17512
* dwarf.c (get_encoded_value): Check for an encoded size of 0.
(display_debug_lines_raw): Check for an invalid line range value.
(display_debug_frames): Check for corrupt augmentation data.
* coffgen.c (coff_get_normalized_symtab): Check for an excessive
number of auxillary entries.
* ieee.c (next_byte): Convert to a function. Return FALSE if the
next byte is beyond the end of the buffer.
(parse_int): Test the return value of next_byte.
(parse_expression): Convert to boolean. Return FALSE if the
parsing failed. Test the return value of next_byte.
(ieee_seek): Convert to a function. Return FALSE if the seek goes
beyond the end of the buffer.
(ieee_slurp_external_symbols): Test the return value of ieee_seek
and next_byte.
(ieee_slurp_sections): Convert to boolean. Return FALSE if the
operation failed. Test the return value of ieee_seek and
next_byte.
(ieee_archive_p): Test the return value of ieee_seek and
next_byte.
(do_one): Likewise.
(ieee_slurp_section_data): Likewise.
(ieee_object_p): Likewise. Store the size of the buffer in the
total_amt field in the header.
* libieee.h (common_header_type): Add amt field.
* mach-o.c (bfd_mach_o_canonicalize_one_reloc): Check that the
reloc's value is within range.
(bfd_mach_o_read_symtab_symbols): Nullify the symbols field if the
operation fails.
* pei-x86_64.c (pex64_xdata_print_uwd_codes): Replace abort with
an error message.
(pex64_dump_xdata): Check for buffer overflows.
* versados.c (process_otr): Check that the section exists before
taking its size.
(versados_object_p): Make sure that enough data was read for the
header to be checked.
* vms-alpha.c (vms_get_remaining_object_record): Change
read_so_far parameter to an unsigned int. Check that the amount
read is in range.
H.J. Lu [Fri, 21 Nov 2014 20:12:30 +0000 (12:12 -0800)]
Optimize PC-relative offset overflow check
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Optimize
PC-relative offset overflow check.
H.J. Lu [Tue, 18 Nov 2014 19:34:11 +0000 (11:34 -0800)]
Check PC-relative offset overflow in PLT entry
PR gold/17619
* x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
Check PC-relative offset overflow in PLT entry.
Doug Evans [Fri, 21 Nov 2014 17:50:56 +0000 (09:50 -0800)]
psymtab.c (psymtab_search_name): Fix whitespace.
gdb/ChangeLog:
* psymtab.c (psymtab_search_name): Fix whitespace.
H.J. Lu [Fri, 21 Nov 2014 16:45:02 +0000 (08:45 -0800)]
Add function and function pointer tests for i386
This patch adds tests for function and function pointer for i386.
* ld-i386/plt-lib.c: New file.
* ld-i386/plt-main.out: Likewise.
* ld-i386/plt-main1.c: Likewise.
* ld-i386/plt-main1.rd: Likewise.
* ld-i386/plt-main2.c: Likewise.
* ld-i386/plt-main2.rd: Likewise.
* ld-i386/plt-main3.c: Likewise.
* ld-i386/plt-main3.rd: Likewise.
* ld-i386/plt-main4.c: Likewise.
* ld-i386/plt-main4.rd: Likewise.
* ld-i386/plt-main5.c: Likewise.
* ld-i386/i386.exp: Run plt-main tests.
H.J. Lu [Fri, 21 Nov 2014 15:57:38 +0000 (07:57 -0800)]
Run plt-main test with -pie
* ld-x86-64/x86-64.exp: Run plt-main test with -pie.
Yao Qi [Fri, 21 Nov 2014 14:05:42 +0000 (22:05 +0800)]
Import errno explicitly
errno.h is included in common/common-defs.h, and gnulib errno module
was imported to gdb. This patch is to import it explicitly.
gdb:
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
errno.
* gnulib/import/Makefile.am: Re-generated.
* gnulib/import/Makefile.in: Likewise.
* gnulib/import/m4/gnulib-cache.m4: Likewise.
Yao Qi [Fri, 21 Nov 2014 14:05:41 +0000 (22:05 +0800)]
Include wchar.h and wctype.h unconditionally
As gnulib modules wchar and wctype is imported, we can include wchar.h
and wctype.h unconditionally. This patch is also to remove HAVE_WCHAR_H
check.
gdb:
2014-11-21 Yao Qi <yao@codesourcery.com>
* gdb_wchar.h: Include wchar.h and wctype.h.
[HAVE_ICONV && HAVE_BTOWC]: Don't check HAVE_WCHAR_T and don't
include wchar.h and wctype.h.
Don't check HAVE_WCHAR_H.
Yao Qi [Fri, 21 Nov 2014 14:05:41 +0000 (22:05 +0800)]
Import wchar and wctype-h explicitly
gnulib module wchar and wctype-h was imported as a dependency, but
they are used by gdb_wchar.h too. This patch is to import them
explicitly.
gdb:
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add wchar
and wctype-h.
* gnulib/import/Makefile.am: Re-generated.
* gnulib/import/Makefile.in: Likewise.
* gnulib/import/m4/gnulib-cache.m4: Likewise.
Yao Qi [Fri, 21 Nov 2014 14:05:41 +0000 (22:05 +0800)]
Import memchr explicitly
memchr has been used in gdb source and gnulib memchr module was
imported as a dependency. This patch is to import it explicitly.
gdb:
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
memchr.
* gnulib/import/Makefile.am: Re-generated.
* gnulib/import/Makefile.in: Likewise.
* gnulib/import/m4/gnulib-cache.m4: Likewise.
Yao Qi [Fri, 21 Nov 2014 14:05:41 +0000 (22:05 +0800)]
Include alloca.h unconditionally
Since gnulib alloca module was imported, we can include alloca.h in
both gdb and gdbserver unconditionally, so this patch adds inclusion
of alloca.h in common-defs.h. This patch also removes AC_FUNC_ALLOCA
in configure.ac because we don't need to check alloca any more.
This patch below is removed in fact.
[RFA/commit] include alloca.h if available.
https://www.sourceware.org/ml/gdb-patches/2010-08/msg00566.html
Since alloca.h is from gnulib now, we don't have to check malloc.h in
configure and include malloc.h in code. This patch also remove them
too.
gdb:
2014-11-21 Yao Qi <yao@codesourcery.com>
* common/common-defs.h: Include alloca.h
* configure.ac: Don't invoke AC_FUNC_ALLOCA.
* configure: Re-generated.
* defs.h: Remove code handling alloca.
* utils.c (gdb_realpath): Don't check HAVE_ALLOCA is defined
or not.
gdb/gdbserver:
2014-11-21 Yao Qi <yao@codesourcery.com>
* configure.ac: Don't invoke AC_FUNC_ALLOCA.
(AC_CHECK_HEADERS): Remove malloc.h.
* configure: Re-generated.
* config.in: Re-generated.
* server.h: Don't include alloca.h and malloc.h.
* gdbreplay.c: Don't check HAVE_ALLOCA_H is defined.
Don't include malloc.h.
Yao Qi [Fri, 21 Nov 2014 14:05:41 +0000 (22:05 +0800)]
Import alloca explicitly
gnulib's alloca module was imported to gdb, and alloca is used. This
patch is to explicitly import it.
gdb:
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULE): Add
alloca.
* gnulib/import/Makefile.am: Re-generated.
* gnulib/import/Makefile.in: Likewise..
* gnulib/import/m4/gnulib-cache.m4: Likewise.
Yao Qi [Fri, 21 Nov 2014 14:05:41 +0000 (22:05 +0800)]
Make IMPORTED_GNULIB_MODULES in alphabetical order
Since we'll add more modules in this list, better to keep them in
alphabetical order.
gdb:
* gnulib/update-gnulib.sh: Make IMPORTED_GNULIB_MODULES in
alphabetical order.
Nick Clifton [Fri, 21 Nov 2014 13:37:39 +0000 (13:37 +0000)]
Resolve more problems with readelf uncovered by fuzzing binary files.
PR binutils/17531
* readelf.c (process_version_sections): Prevent an infinite loop
processing corrupt version need data.
(process_corefile_note_segment): Handle corrupt notes.
Alexander Cherepanov [Fri, 21 Nov 2014 11:19:49 +0000 (11:19 +0000)]
Fix a snafu setting up the string table read in from a COFF file.
PR binutils/17512
* coffgen.c (_bfd_coff_read_string_table): Test allocation of
string table before clearing the first few bytes.
Terry Guo [Fri, 21 Nov 2014 03:54:39 +0000 (11:54 +0800)]
Calculate ARM arch attribute after relaxation
gas/
2014-11-21 Terry Guo <terry.guo@arm.com>
* config/tc-arm.c (md_assemble): Do not consider relaxation.
(md_convert_frag): Test and set target arch attribute accordingly.
(aeabi_set_attribute_string): Turn it into a global function.
* config/tc-arm.h (md_post_relax_hook): Enable it for ARM target.
(aeabi_set_public_attributes): Declare it.
gas/testsuite/
2014-11-21 Terry Guo <terry.guo@arm.com>
* gas/arm/attr-arch-assumption.d: New file.
* gas/arm/attr-arch-assumption.s: Likewise.
ld/testsuite/
2014-11-21 Terry Guo <terry.guo@arm.com>
* ld-arm/tls-longplt-lib.s: Require ARMv6T2.
* ld-arm/tls-longplt.s: Likewise.
* ld-arm/tls-longplt-lib.d: Updated.
* ld-arm/tls-longplt.d: Likewise.
Terry Guo [Fri, 21 Nov 2014 03:31:37 +0000 (11:31 +0800)]
Support ARM Cortex-M7
include/ChangeLog:
2014-11-21 Terry Guo <terry.guo@arm.com>
* opcode/arm.h (FPU_VFP_EXT_ARMV8xD): New macro.
(FPU_VFP_V5D16): Likewise.
(FPU_VFP_V5_SP_D16): Likewise.
(FPU_ARCH_VFP_V5D16): Likewise.
(FPU_ARCH_VFP_V5_SP_D16): Likewise.
bfd/ChangeLog:
2014-11-21 Terry Guo <terry.guo@arm.com>
* elf32-arm.c (elf32_arm_merge_eabi_attributes): Support FPv5.
binutils/ChangeLog:
2014-11-21 Terry Guo <terry.guo@arm.com>
* readelf.c (arm_attr_tag_FP_arch): Extended to support FPv5.
gas/ChangeLog:
2014-11-21 Terry Guo <terry.guo@arm.com>
* config/tc-arm.c (fpu_vfp_ext_armv8xd): New.
(arm_cpus): Support cortex-m7.
(arm_fpus): Support fpv5-sp-d16 and fpv5-d16.
(do_vfp_nsyn_cvt_fpv8): Generate error when use D register for S
register only target like FPv5-SP-D16.
(do_neon_cvttb_1): Likewise.
(do_vfp_nsyn_fpv8): Likewise.
(do_vrint_1): Likewise.
(aeabi_set_public_attributes): Set proper FP arch for FPv5.
* doc/c-arm.texi: Document new cpu and fpu names for cortex-m7.
gas/testsuite/ChangeLog:
2014-11-21 Terry Guo <terry.guo@arm.com>
* gas/arm/armv7e-m+fpv5-d16.s: New.
* gas/arm/armv7e-m+fpv5-d16.d: Likewise.
* gas/arm/armv7e-m+fpv5-sp-d16.s: Likewise.
* gas/arm/armv7e-m+fpv5-sp-d16.d: Likewise.
ld/testsuite/ChangeLog:
2014-11-21 Terry Guo <terry.guo@arm.com>
* ld-arm/attr-merge-vfp-4-sp.s: New test source file.
* ld-arm/attr-merge-vfp-5-sp.s: Likewise.
* ld-arm/attr-merge-vfp-5.s: Likewise.
* ld-arm/attr-merge-vfp-8.d: New test.
* ld-arm/attr-merge-vfp-8r.d: Likewise.
* ld-arm/attr-merge-vfp-9.d: Likewise.
* ld-arm/attr-merge-vfp-9r.d: Likewise.
* ld-arm/attr-merge-vfp-10.d: Likewise.
* ld-arm/attr-merge-vfp-10r.d: Likewise.
* ld-arm/attr-merge-vfp-11.d: Likewise.
* ld-arm/attr-merge-vfp-11r.d: Likewise.
* ld-arm/attr-merge-vfp-12.d: Likewise.
* ld-arm/attr-merge-vfp-12r.d: Likewise.
* ld-arm/attr-merge-vfp-13.d: Likewise.
* ld-arm/attr-merge-vfp-13r.d: Likewise.
* ld-arm/attr-merge-vfp-14.d: Likewise.
* ld-arm/attr-merge-vfp-14r.d: Likewise.
* ld-arm/arm-elf.exp: Run the new tests.
Joel Brobecker [Thu, 2 Oct 2014 22:17:49 +0000 (15:17 -0700)]
Handling of empty Ada ranges with a negative upper bound.
Consider the following variable declaration:
type Array_Type is array (Integer range <>) of Integer;
Var: Array_Type (0 .. -1);
"ptype var" prints the wrong upper bound for that array:
(gdb) ptype var
type = array (0 ..
4294967295) of integer
The debugging info for the type of variable "Var" is as follow:
<2><cf>: Abbrev Number: 13 (DW_TAG_structure_type)
<d0> DW_AT_name : foo__var___PAD
<3><db>: Abbrev Number: 14 (DW_TAG_member)
<dc> DW_AT_name : F
<e0> DW_AT_type : <0xa5>
This is just an artifact from code generation, which is just
a wrapper that we should ignore. The real type is the type of
field "F" in that PAD type, which is described as:
<2><a5>: Abbrev Number: 10 (DW_TAG_array_type)
<a6> DW_AT_name : foo__TvarS
<3><b6>: Abbrev Number: 11 (DW_TAG_subrange_type)
<b7> DW_AT_type : <0xc1>
<bb> DW_AT_lower_bound : 0
<bc> DW_AT_upper_bound : 0xffffffff
Trouble occurs because DW_AT_upper_bound is encoded using
a DW_FORM_data4, which is ambiguous regarding signedness.
In that case, dwarf2read.c::dwarf2_get_attr_constant_value
reads the value as unsigned, which is not what we want
in this case.
As it happens, we already have code dealing with this situation
in dwarf2read.c::read_subrange_type which checks whether
the subrange's type is signed or not, and if it is, fixes
the bound's value by sign-extending it:
if (high.kind == PROP_CONST
&& !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask))
high.data.const_val |= negative_mask;
Unfortunately, what happens in our case is that the base type
of the array's subrange type is marked as being unsigned, and
so we never get to apply the sign extension. Following the DWARF
trail, the range's base type is described as another subrange type...
<2><c1>: Abbrev Number: 12 (DW_TAG_subrange_type)
<c7> DW_AT_name : foo__TTvarSP1___XDLU_0__1m
<cb> DW_AT_type : <0x2d>
... whose base type is, (finally), a basic type (signed):
<1><2d>: Abbrev Number: 2 (DW_TAG_base_type)
<2e> DW_AT_byte_size : 4
<2f> DW_AT_encoding : 5 (signed)
<30> DW_AT_name : integer
The reason why GDB thinks that foo__TTvarSP1___XDLU_0__1m
(the base type of the array's range type) is an unsigned type
is found in gdbtypes.c::create_range_type. We consider that
a range type is unsigned iff its lower bound is >= 0:
if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0)
TYPE_UNSIGNED (result_type) = 1;
That is normally sufficient, as one would expect the upper bound to
always be greater or equal to the lower bound. But Ada actually
allows the declaration of empty range types where the upper bound
is less than the lower bound. In this case, the upper bound is
negative, so we should not be marking the type as unsigned.
This patch fixes the issue by simply checking the upper bound as well
as the lower bound, and clears the range type's unsigned flag when
it is found to be constant and negative.
gdb/ChangeLog:
* gdbtypes.c (create_range_type): Unset RESULT_TYPE's
flag_unsigned if HIGH_BOUND is constant and negative.
gdb/testsuite/ChangeLog:
* gdb.ada/n_arr_bound: New testcase.
Tested on x86_64-linux.
GDB Administrator [Fri, 21 Nov 2014 00:00:10 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Thu, 20 Nov 2014 21:45:04 +0000 (08:15 +1030)]
PPC gold doesn't check for overflow properly
* powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
for undefined weaks.
H.J. Lu [Thu, 20 Nov 2014 21:35:29 +0000 (13:35 -0800)]
Don't run pr17618 test on x32
* ld-x86-64/pr17618.d: Don't run on x32.
H.J. Lu [Thu, 20 Nov 2014 21:29:41 +0000 (13:29 -0800)]
Update plt-main tests for x32
* ld-x86-64/plt-main1.rd: Updated for x32.
* ld-x86-64/plt-main2.rd: Likewise.
* ld-x86-64/plt-main3.rd: Likewise.
* ld-x86-64/plt-main4.rd: Likewise.
H.J. Lu [Thu, 20 Nov 2014 20:41:11 +0000 (12:41 -0800)]
Add function and function pointer tests
This patch adds tests for function and function pointer.
* ld-x86-64/plt-lib.c: New file.
* ld-x86-64/plt-main.out: Likewise.
* ld-x86-64/plt-main1.c: Likewise.
* ld-x86-64/plt-main1.rd: Likewise.
* ld-x86-64/plt-main2.c: Likewise.
* ld-x86-64/plt-main2.rd: Likewise.
* ld-x86-64/plt-main3.c: Likewise.
* ld-x86-64/plt-main3.rd: Likewise.
* ld-x86-64/plt-main4.c: Likewise.
* ld-x86-64/plt-main4.rd: Likewise.
* ld-x86-64/plt-main5.c: Likewise.
* ld-x86-64/x86-64.exp: Run plt-main tests.
H.J. Lu [Thu, 20 Nov 2014 19:29:45 +0000 (11:29 -0800)]
Always load function pointer into a stack variable
This patch makes sure that compiler won't optimize out loading function
into a stack variable.
* ld-ifunc/ifunc-main.c (get_bar): New function.
(main): Use it.
H.J. Lu [Thu, 20 Nov 2014 18:48:47 +0000 (10:48 -0800)]
Add ifunc-main IFUNC tests
* ld-ifunc/ifunc.exp: Run ifunc-main.
* ld-ifunc/ifunc-lib.c: New file.
* ld-ifunc/ifunc-main.c: Likewise.
* ld-ifunc/ifunc-main.out: Likewise.
Sergio Durigan Junior [Thu, 20 Nov 2014 18:33:28 +0000 (13:33 -0500)]
Fix build breakage from previous commit
In the previous commit, I forgot to adjust the prototypes of the
functions inside gdb/xml-syscall.c for the case when GDB is compiled
without XML support.
gdb/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* xml-syscall.c (set_xml_syscall_file_name): Remove "const"
modifier from "struct gdbarch" when compiling without Expat (XML)
support.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
Sergio Durigan Junior [Thu, 20 Nov 2014 17:28:18 +0000 (12:28 -0500)]
Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global
This patch intends to partially fix PR breakpoints/10737, which is
about making the syscall information (for the "catch syscall" command)
be per-arch, instead of global. This is not a full fix because of the
other issues pointed by Pedro here:
<https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5>
However, I consider it a good step towards the real fix. It will also
help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>.
What this patch does, basically, is move the "syscalls_info"
struct to gdbarch. Currently, the syscall information is stored in a
global variable inside gdb/xml-syscall.c, which means that there is no
easy way to correlate this info with the current target or
architecture being used, for example. This causes strange behaviors,
because the syscall info is not re-read when the arch changes. For
example, if you put a syscall catchpoint in syscall 5 on i386 (syscall
open), and then load a x86_64 program on GDB and put the same syscall
5 there (fstat on x86_64), you will still see that GDB tells you that
it is catching "open", even though it is not. With this patch, GDB
correctly says that it will be catching fstat syscalls.
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'open' [5])
But with the patch:
(gdb) set architecture i386
The target architecture is assumed to be i386
(gdb) catch syscall 5
Catchpoint 1 (syscall 'open' [5])
(gdb) set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
(gdb) catch syscall 5
Catchpoint 2 (syscall 'fstat' [5])
As I said, there are still some problems on the "catch syscall"
mechanism, because (for example) the user should be able to "catch
syscall open" on i386, and then expect "open" to be caught also on
x86_64. Currently, it doesn't work. I intend to work on this later.
gdb/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* arm-linux-tdep.c (arm_linux_init_abi): Likewise.
* bfin-linux-tdep.c (bfin_linux_init_abi): Likewise.
* breakpoint.c (print_it_catch_syscall): Adjust call to
get_syscall_by_number to provide gdbarch.
(print_one_catch_syscall): Likewise.
(print_mention_catch_syscall): Likewise.
(print_recreate_catch_syscall): Likewise.
(catch_syscall_split_args): Adjust calls to get_syscall_by_number
and get_syscall_by_name to provide gdbarch.
(catch_syscall_completer): Adjust call to get_syscall_names to
provide gdbarch.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* gdbarch.sh: Forward declare "struct syscalls_info".
(xml_syscall_file): New variable.
(syscalls_info): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Adjust call to
set_xml_syscall_file_name to provide gdbarch.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* ppc-linux-tdep.c (ppc_linux_init_abi): Likewise.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise.
* sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise.
* xml-syscall.c: Include gdbarch.h.
(set_xml_syscall_file_name): Accept gdbarch parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
(my_gdb_datadir): Delete global variable.
(struct syscalls_info) <my_gdb_datadir>: New variable.
(struct syscalls_info) <sysinfo>: Rename variable to
"syscalls_info".
(sysinfo): Delete global variable.
(have_initialized_sysinfo): Likewise.
(xml_syscall_file): Likewise.
(sysinfo_free_syscalls_desc): Rename to...
(syscalls_info_free_syscalls_desc): ... this.
(free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust
code to the new layout of "struct syscalls_info".
(make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to
"syscalls_info".
(syscall_create_syscall_desc): Likewise.
(syscall_start_syscall): Likewise.
(syscall_parse_xml): Likewise.
(xml_init_syscalls_info): Likewise. Drop "const" from return value.
(init_sysinfo): Rename to...
(init_syscalls_info): ...this. Add gdbarch as a parameter.
Adjust function to deal with gdbarch.
(xml_get_syscall_number): Delete parameter sysinfo. Accept
gdbarch as a parameter. Adjust code.
(xml_get_syscall_name): Likewise.
(xml_list_of_syscalls): Likewise.
(set_xml_syscall_file_name): Accept gdbarch as parameter.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
* xml-syscall.h (set_xml_syscall_file_name): Likewise.
(get_syscall_by_number): Likewise.
(get_syscall_by_name): Likewise.
(get_syscall_names): Likewise.
gdb/testsuite/
2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/10737
* gdb.base/catch-syscall.exp (do_syscall_tests): Call
test_catch_syscall_multi_arch.
(test_catch_syscall_multi_arch): New function.
Richard Earnshaw [Thu, 20 Nov 2014 17:02:47 +0000 (17:02 +0000)]
* config/tc-arm.c (rotate_left): Avoid undefined behaviour when N = 0.
H.J. Lu [Thu, 20 Nov 2014 16:59:42 +0000 (08:59 -0800)]
Run IFUNC run-time tests only if IFUNC is supported
* lib/ld-lib.exp (check_ifunc_available): New.
* ld-ifunc/ifunc.exp: Run IFUNC run-time tests only if IFUNC
is supported.
Doug Evans [Thu, 20 Nov 2014 15:42:48 +0000 (07:42 -0800)]
Split struct symtab into two: struct symtab and compunit_symtab.
Currently "symtabs" in gdb are stored as a single linked list of
struct symtab that contains both symbol symtabs (the blockvectors)
and file symtabs (the linetables).
This has led to confusion, bugs, and performance issues.
This patch is conceptually very simple: split struct symtab into
two pieces: one part containing things common across the entire
compilation unit, and one part containing things specific to each
source file.
Example.
For the case of a program built out of these files:
foo.c
foo1.h
foo2.h
bar.c
foo1.h
bar.h
Today we have a single list of struct symtabs:
objfile -> foo.c -> foo1.h -> foo2.h -> bar.c -> foo1.h -> bar.h -> NULL
where "->" means the "next" pointer in struct symtab.
With this patch, that turns into:
objfile -> foo.c(cu) -> bar.c(cu) -> NULL
| |
v v
foo.c bar.c
| |
v v
foo1.h foo1.h
| |
v v
foo2.h bar.h
| |
v v
NULL NULL
where "foo.c(cu)" and "bar.c(cu)" are struct compunit_symtab objects,
and the files foo.c, etc. are struct symtab objects.
So now, for example, when we want to iterate over all blockvectors
we can now just iterate over the compunit_symtab list.
Plus a lot of the data that was either unused or replicated for each
symtab in a compilation unit now lives in struct compunit_symtab.
E.g., the objfile pointer, the producer string, etc.
I thought of moving "language" out of struct symtab but there is
logic to try to compute the language based on previously seen files,
and I think that's best left as is for now.
With my standard monster benchmark with -readnow (which I can't actually
do, but based on my calculations), whereas today the list requires
77MB to store all the struct symtabs, it now only requires 37MB.
A modest space savings given the gigabytes needed for all the debug info,
etc. Still, it's nice. Plus, whereas today we create a copy of dirname
for each source file symtab in a compilation unit, we now only create one
for the compunit.
So this patch is basically just a data structure reorg,
I don't expect significant performance improvements from it.
Notes:
1) A followup patch can do a similar split for struct partial_symtab.
I have left that until after I get the changes I want in to
better utilize .gdb_index (it may affect how we do partial syms).
2) Another followup patch *could* rename struct symtab.
The term "symtab" is ambiguous and has been a source of confusion.
In this patch I'm leaving it alone, calling it the "historical" name
of "filetabs", which is what they are now: just the file-name + line-table.
gdb/ChangeLog:
Split struct symtab into two: struct symtab and compunit_symtab.
* amd64-tdep.c (amd64_skip_xmm_prologue): Fetch producer from compunit.
* block.c (blockvector_for_pc_sect): Change "struct symtab *" argument
to "struct compunit_symtab *". All callers updated.
(set_block_compunit_symtab): Renamed from set_block_symtab. Change
"struct symtab *" argument to "struct compunit_symtab *".
All callers updated.
(get_block_compunit_symtab): Renamed from get_block_symtab. Change
result to "struct compunit_symtab *". All callers updated.
(find_iterator_compunit_symtab): Renamed from find_iterator_symtab.
Change result to "struct compunit_symtab *". All callers updated.
* block.h (struct global_block) <compunit_symtab>: Renamed from symtab.
hange type to "struct compunit_symtab *". All uses updated.
(struct block_iterator) <d.compunit_symtab>: Renamed from "d.symtab".
Change type to "struct compunit_symtab *". All uses updated.
* buildsym.c (struct buildsym_compunit): New struct.
(subfiles, buildsym_compdir, buildsym_objfile, main_subfile): Delete.
(buildsym_compunit): New static global.
(finish_block_internal): Update to fetch objfile from
buildsym_compunit.
(make_blockvector): Delete objfile argument.
(start_subfile): Rewrite to use buildsym_compunit. Don't initialize
debugformat, producer.
(start_buildsym_compunit): New function.
(free_buildsym_compunit): Renamed from free_subfiles_list.
All callers updated.
(patch_subfile_names): Rewrite to use buildsym_compunit.
(get_compunit_symtab): New function.
(get_macro_table): Delete argument comp_dir. All callers updated.
(start_symtab): Change result to "struct compunit_symtab *".
All callers updated. Create the subfile of the main source file.
(watch_main_source_file_lossage): Rewrite to use buildsym_compunit.
(reset_symtab_globals): Update.
(end_symtab_get_static_block): Update to use buildsym_compunit.
(end_symtab_without_blockvector): Rewrite.
(end_symtab_with_blockvector): Change result to
"struct compunit_symtab *". All callers updated.
Update to use buildsym_compunit. Don't set symtab->dirname,
instead set it in the compunit.
Explicitly make sure main symtab is first in its list.
Set debugformat, producer, blockvector, block_line_section, and
macrotable in the compunit.
(end_symtab_from_static_block): Change result to
"struct compunit_symtab *". All callers updated.
(end_symtab, end_expandable_symtab): Ditto.
(set_missing_symtab): Change symtab argument to
"struct compunit_symtab *". All callers updated.
(augment_type_symtab): Ditto.
(record_debugformat): Update to use buildsym_compunit.
(record_producer): Update to use buildsym_compunit.
* buildsym.h (struct subfile) <dirname>: Delete.
<producer, debugformat>: Delete.
<buildsym_compunit>: New member.
(get_compunit_symtab): Declare.
* dwarf2read.c (struct type_unit_group) <compunit_symtab>: Renamed
from primary_symtab. Change type to "struct compunit_symtab *".
All uses updated.
(dwarf2_start_symtab): Change result to "struct compunit_symtab *".
All callers updated.
(dwarf_decode_macros): Delete comp_dir argument. All callers updated.
(struct dwarf2_per_cu_quick_data) <compunit_symtab>: Renamed from
symtab. Change type to "struct compunit_symtab *". All uses updated.
(dw2_instantiate_symtab): Change result to "struct compunit_symtab *".
All callers updated.
(dw2_find_last_source_symtab): Ditto.
(dw2_lookup_symbol): Ditto.
(recursively_find_pc_sect_compunit_symtab): Renamed from
recursively_find_pc_sect_symtab. Change result to
"struct compunit_symtab *". All callers updated.
(dw2_find_pc_sect_compunit_symtab): Renamed from
dw2_find_pc_sect_symtab. Change result to
"struct compunit_symtab *". All callers updated.
(get_compunit_symtab): Renamed from get_symtab. Change result to
"struct compunit_symtab *". All callers updated.
(recursively_compute_inclusions): Change type of immediate_parent
argument to "struct compunit_symtab *". All callers updated.
(compute_compunit_symtab_includes): Renamed from
compute_symtab_includes. All callers updated. Rewrite to compute
includes of compunit_symtabs and not symtabs.
(process_full_comp_unit): Update to work with struct compunit_symtab.
(process_full_type_unit): Ditto.
(dwarf_decode_lines_1): Delete argument comp_dir. All callers updated.
(dwarf_decode_lines): Remove special case handling of main subfile.
(macro_start_file): Delete argument comp_dir. All callers updated.
(dwarf_decode_macro_bytes): Ditto.
* guile/scm-block.c (bkscm_print_block_syms_progress_smob): Update to
use struct compunit_symtab.
* i386-tdep.c (i386_skip_prologue): Fetch producer from compunit.
* jit.c (finalize_symtab): Build compunit_symtab.
* jv-lang.c (get_java_class_symtab): Change result to
"struct compunit_symtab *". All callers updated.
* macroscope.c (sal_macro_scope): Fetch macro table from compunit.
* macrotab.c (struct macro_table) <compunit_symtab>: Renamed from
comp_dir. Change type to "struct compunit_symtab *".
All uses updated.
(new_macro_table): Change comp_dir argument to cust,
"struct compunit_symtab *". All callers updated.
* maint.c (struct cmd_stats) <nr_compunit_symtabs>: Renamed from
nr_primary_symtabs. All uses updated.
(count_symtabs_and_blocks): Update to handle compunits.
(report_command_stats): Update output, "primary symtabs" renamed to
"compunits".
* mdebugread.c (new_symtab): Change result to
"struct compunit_symtab *". All callers updated.
(parse_procedure): Change type of search_symtab argument to
"struct compunit_symtab *". All callers updated.
* objfiles.c (objfile_relocate1): Loop over blockvectors in a
separate loop.
* objfiles.h (struct objfile) <compunit_symtabs>: Renamed from
symtabs. Change type to "struct compunit_symtab *". All uses updated.
(ALL_OBJFILE_FILETABS): Renamed from ALL_OBJFILE_SYMTABS.
All uses updated.
(ALL_OBJFILE_COMPUNITS): Renamed from ALL_OBJFILE_PRIMARY_SYMTABS.
All uses updated.
(ALL_FILETABS): Renamed from ALL_SYMTABS. All uses updated.
(ALL_COMPUNITS): Renamed from ALL_PRIMARY_SYMTABS. All uses updated.
* psympriv.h (struct partial_symtab) <compunit_symtab>: Renamed from
symtab. Change type to "struct compunit_symtab *". All uses updated.
* psymtab.c (psymtab_to_symtab): Change result type to
"struct compunit_symtab *". All callers updated.
(find_pc_sect_compunit_symtab_from_partial): Renamed from
find_pc_sect_symtab_from_partial. Change result type to
"struct compunit_symtab *". All callers updated.
(lookup_symbol_aux_psymtabs): Change result type to
"struct compunit_symtab *". All callers updated.
(find_last_source_symtab_from_partial): Ditto.
* python/py-symtab.c (stpy_get_producer): Fetch producer from compunit.
* source.c (forget_cached_source_info_for_objfile): Fetch debugformat
and macro_table from compunit.
* symfile-debug.c (debug_qf_find_last_source_symtab): Change result
type to "struct compunit_symtab *". All callers updated.
(debug_qf_lookup_symbol): Ditto.
(debug_qf_find_pc_sect_compunit_symtab): Renamed from
debug_qf_find_pc_sect_symtab, change result type to
"struct compunit_symtab *". All callers updated.
* symfile.c (allocate_symtab): Delete objfile argument.
New argument cust.
(allocate_compunit_symtab): New function.
(add_compunit_symtab_to_objfile): New function.
* symfile.h (struct quick_symbol_functions) <lookup_symbol>:
Change result type to "struct compunit_symtab *". All uses updated.
<find_pc_sect_compunit_symtab>: Renamed from find_pc_sect_symtab.
Change result type to "struct compunit_symtab *". All uses updated.
* symmisc.c (print_objfile_statistics): Compute blockvector count in
separate loop.
(dump_symtab_1): Update test for primary source symtab.
(maintenance_info_symtabs): Update to handle compunit symtabs.
(maintenance_check_symtabs): Ditto.
* symtab.c (set_primary_symtab): Delete.
(compunit_primary_filetab): New function.
(compunit_language): New function.
(iterate_over_some_symtabs): Change type of arguments "first",
"after_last" to "struct compunit_symtab *". All callers updated.
Update to loop over symtabs in each compunit.
(error_in_psymtab_expansion): Rename symtab argument to cust,
and change type to "struct compunit_symtab *". All callers updated.
(find_pc_sect_compunit_symtab): Renamed from find_pc_sect_symtab.
Change result type to "struct compunit_symtab *". All callers updated.
(find_pc_compunit_symtab): Renamed from find_pc_symtab.
Change result type to "struct compunit_symtab *". All callers updated.
(find_pc_sect_line): Only loop over symtabs within selected compunit
instead of all symtabs in the objfile.
* symtab.h (struct symtab) <blockvector>: Moved to compunit_symtab.
<compunit_symtab> New member.
<block_line_section>: Moved to compunit_symtab.
<locations_valid>: Ditto.
<epilogue_unwind_valid>: Ditto.
<macro_table>: Ditto.
<dirname>: Ditto.
<debugformat>: Ditto.
<producer>: Ditto.
<objfile>: Ditto.
<call_site_htab>: Ditto.
<includes>: Ditto.
<user>: Ditto.
<primary>: Delete
(SYMTAB_COMPUNIT): New macro.
(SYMTAB_BLOCKVECTOR): Update definition.
(SYMTAB_OBJFILE): Update definition.
(SYMTAB_DIRNAME): Update definition.
(struct compunit_symtab): New type. Common members among all source
symtabs within a compilation unit moved here. All uses updated.
(COMPUNIT_OBJFILE): New macro.
(COMPUNIT_FILETABS): New macro.
(COMPUNIT_DEBUGFORMAT): New macro.
(COMPUNIT_PRODUCER): New macro.
(COMPUNIT_DIRNAME): New macro.
(COMPUNIT_BLOCKVECTOR): New macro.
(COMPUNIT_BLOCK_LINE_SECTION): New macro.
(COMPUNIT_LOCATIONS_VALID): New macro.
(COMPUNIT_EPILOGUE_UNWIND_VALID): New macro.
(COMPUNIT_CALL_SITE_HTAB): New macro.
(COMPUNIT_MACRO_TABLE): New macro.
(ALL_COMPUNIT_FILETABS): New macro.
(compunit_symtab_ptr): New typedef.
(DEF_VEC_P (compunit_symtab_ptr)): New vector type.
gdb/testsuite/ChangeLog:
* gdb.base/maint.exp: Update expected output.
Richard Earnshaw [Thu, 20 Nov 2014 15:28:52 +0000 (15:28 +0000)]
[AArch64] Fix mis-detection of unpredictable load/store operations with FP regs.
* config/tc-aarch64.c (warn_unpredictable_ldst): Check that transfer
registers are in the GP register set. Adjust warnings. Use correct
field member for address register.
* testsuite/gas/aarch64/diagnostic.l: Update.
Alan Modra [Thu, 20 Nov 2014 08:31:23 +0000 (19:01 +1030)]
PPC gold doesn't check for overflow properly
Corrects overflow test for rel14, addr14, rel24, addr24 branch relocs,
and prints an information message to give a hint as to how a branch
that can't reach a stub might be cured.
bfd/
* elf64-ppc.c (group_sections): Init stub14_group_size from
--stub-group-size parameter divided by 1024.
gold/
* powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
from --stub-group-size parameter divided by 1024.
(Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
template parameter. Update all uses.
(Target_powerpc::Relocate::relocate): Rename has_plt_value to
has_stub_value. Set for long branches. Don't report overflow for
branch to undefined weak symbols. Print info message on
overflowing branch to stub.
Alan Modra [Thu, 20 Nov 2014 10:37:58 +0000 (21:07 +1030)]
ppc476 workaround sizing
* elf32-ppc.c (ppc_elf_relax_section): Correct ppc476 workaround
alignment calculation.
Joel Brobecker [Thu, 20 Nov 2014 08:10:41 +0000 (12:10 +0400)]
[Ada] XA type is not redundant if the ranges' subtypes do not match
Jan noticed that gdb.ada/arrayidx.exp regressed after I applied
the following patch:
commit
8908fca5772fcff9f7766158ba2aa59f5a2b1f68
Author: Joel Brobecker <brobecker@adacore.com>
Date: Sat Sep 27 09:09:34 2014 -0700
Subject: [Ada] Ignore __XA types when redundant.
What happens is that we're trying to print the value of
r_two_three, which is defined as follow:
type Index is (One, Two, Three);
type RTable is array (Index range Two .. Three) of Integer;
R_Two_Three : RTable := (2, 3);
The expected output is:
(gdb) p r_two_three
$1 = (two => 2, 3)
But after the patch above was applied, with the program program
compiled using gcc-gnat-4.9.2-1.fc21.x86_64 (x86_64-linux),
the output becomes:
(gdb) p r_two_three
$1 = (2, 3)
(the name of the first bound is missing). The problem comes from
the fact that the compiler described the array's index type as
a plain base type, instead of as a subrange of the enumerated type.
More particularly, this is what gcc-gnat-4.9.2-1.fc21.x86_64
generated:
<3><7ce>: Abbrev Number: 9 (DW_TAG_array_type)
<7cf> DW_AT_name : (indirect string, offset: 0xc13): p__rtable
[...]
<7d7> DW_AT_GNAT_descriptive_type: <0x98a>
[...]
<4><7df>: Abbrev Number: 8 (DW_TAG_subrange_type)
<7e0> DW_AT_type : <0xa79>
where DIE 0xa79 is:
<1><a79>: Abbrev Number: 2 (DW_TAG_base_type)
<a7a> DW_AT_byte_size : 8
<a7b> DW_AT_encoding : 7 (unsigned)
<a7c> DW_AT_name : (indirect string, offset: 0xfc): sizetype
The actual array subrange type can be found in the array's
parallel XA type (the DW_AT_GNAT_descriptive_type).
The recent commit correctly found that that bounds taken from
the descriptive type are the same as bounds of our array's index
type. But it failed to notice that ignoring this descriptive
type would make us lose the actual array index type, making us
think that we're printing an array indexed by integers.
I hadn't seen that problem, because the compiler I used produced
debugging info where the array's index type is correctly described:
<3><79f>: Abbrev Number: 10 (DW_TAG_array_type)
<7a0> DW_AT_name : (indirect string, offset: 0xb3d): p__rtable
[...]
<4><7b0>: Abbrev Number: 8 (DW_TAG_subrange_type)
<7b1> DW_AT_type : <0x9b2>
<7b5> DW_AT_upper_bound : 2
... where DIE 0x9b2 leads us to ...
<3><9b2>: Abbrev Number: 9 (DW_TAG_subrange_type)
[...]
<9b8> DW_AT_type : <0x962>
<2><962>: Abbrev Number: 22 (DW_TAG_enumeration_type)
<963> DW_AT_name : (indirect string, offset: 0xb34): p__index
[...]
This patch fixes the issue by also making sure that the subtype
of the original range type does match the subtype found in the
descriptive type.
gdb/ChangeLog:
* ada-lang.c (ada_is_redundant_range_encoding): Return 0
if the TYPE_CODE of range_type's base type does not match
the TYPE_CODE of encoding_type's base type.
Terry Guo [Thu, 20 Nov 2014 05:54:27 +0000 (13:54 +0800)]
Enable to link ARM object file that hasn't attribute section.
bfd/ChangeLog
2014-11-20 Terry Guo <terry.guo@arm.com>
* elf32-arm.c (elf32_arm_merge_eabi_attributes): Skip if input bfd
hasn't attribute section.
ld/testsuite/ChangeLog:
2014-11-20 Terry Guo <terry.guo@arm.com>
* ld-arm/attr-merge-nosection-1.d: New file.
* ld-arm/attr-merge-nosection-1a.s: Likewise.
* ld-arm/attr-merge-nosection-1b.s: Likewise.
* ld-arm/arm-elf.exp: Include the new test.
GDB Administrator [Thu, 20 Nov 2014 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 19 Nov 2014 22:22:46 +0000 (08:52 +1030)]
Default powerpc64 to --plt-thread-safe for Go
Go is multi-threaded, so use thread-safe plt stubs. __go_go doesn't
actually start threads, but is a convenient libgo function with a
reasonably unique name that is called by all Go executables. (Threads
are started by a static function of libgo, runtime_newosproc, called
by a whole lot of global functions, including runtime_starttheworld
and runtime_main.)
bfd/
* elf64-ppc.c (ppc64_elf_size_stubs): Add __go_go to thread_starters.
gold/
* powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
Jan-Benedict Glaw [Wed, 19 Nov 2014 13:18:17 +0000 (14:18 +0100)]
Fix date in ChangeLog entry
Jan-Benedict Glaw [Wed, 19 Nov 2014 13:13:30 +0000 (14:13 +0100)]
Fix signedness warning
This is the updated version using uintptr_t as Alan Modra suggested.
2014-11-18 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* dwarf.c (process_extended_line_op): Fix signedness warning.
Jiong Wang [Wed, 19 Nov 2014 09:35:23 +0000 (09:35 +0000)]
[AArch64] Warn on load pair to same register
2014-11-19 Ryan Mansfield <rmansfield@qnx.com>
* config/tc-aarch64.c (md_assemble): Call warn_unpredictable_ldst.
(warn_unpredictable_ldst): New.
2014-11-19 Ryan Mansfield <rmansfield@qnx.com>
* gas/aarch64/diagnostic.s: Add new warnings test patterns.
* gas/aarch64/diagnostic.l: Update expected diagnostic output.
Andreas Arnez [Mon, 17 Nov 2014 15:22:48 +0000 (15:22 +0000)]
Use 2-byte instead of 4-byte NOP on S390 in 'bp-permanent' test case
The bp-permanent test case assumes that a NOP is exactly as long as a
software breakpoint. This is not the case for the S390 "nop"
instruction, which is 4 bytes long, while a software breakpoint is
just 2 bytes long. The "nopr" instruction has the right size and can
be used instead.
Without this patch the test case fails on S390 when trying to continue
after SIGTRAP on the permanent breakpoint:
...
Continuing.
Program received signal SIGILL, Illegal instruction.
test () at /home/arnez/src/binutils-gdb/gdb/testsuite/gdb.base/bp-permanent.c:40
40 NOP; /* after permanent bp */
(gdb)
FAIL: gdb.base/bp-permanent.exp: always_inserted=off, sw_watchpoint=0:
basics: stop at permanent breakpoint
With this patch the test case succeeds without any FAILs.
gdb/testsuite/ChangeLog:
* gdb.base/bp-permanent.c (NOP): Define as 2-byte instead of
4-byte instruction on S390.
Joel Brobecker [Tue, 7 Oct 2014 00:22:21 +0000 (02:22 +0200)]
[Ada] gdb.ada/complete.exp failure on x86_64-windows
Using the example in gdb.ada/complete.exp, the following command
on x86_64-windows returns one unwanted completion choice :
(gdb) complete p pck
p <pck_E>>
[all following completions entries snipped, all expected]
I tracked down this suprising entry to a minimal symbol whose name
is ".refptr.pck_E". The problem occurs while trying to see if
this symbol matches "pck" when doing wild-matching as we are doing
here:
/* Second: Try wild matching... */
if (!match && wild_match_p)
{
/* Since we are doing wild matching, this means that TEXT
may represent an unqualified symbol name. We therefore must
also compare TEXT against the unqualified name of the symbol. */
sym_name = ada_unqualified_name (ada_decode (sym_name));
if (strncmp (sym_name, text, text_len) == 0)
match = 1;
}
What happens is that ada_decode correctly identifies the fact that
SYM_NAME (".refptr.pck_E") is not following any GNAT encoding, and
therefore returns that same name, but bracketed: "<.refptr.pck_E>".
This is the convention we use for telling GDB that the decoded name
is not a real Ada name - and therefore should not be encoded for
operations such as name matching, symbol lookups, etc. So far, so good.
Next is the call to ada_unqualified_name, which unfortunately does
not notice that the decoded name it is being given isn't a natural
symbol, and just blindly strips everything up to the last do, returning
"pck_E>". And of course, "pck_E>" matches "pck" now, and so we end
up accepting this symbol as a match.
This patch fixes the problem by making ada_unqualified_name a little
smarter by making sure that the given decoded symbol name does not
start with '<'.
gdb/ChangeLog:
* ada-lang.c (ada_unqualified_name): Return DECODED_NAME if
it starts with '<'.
Tested on x86_64-windows using AdaCore's testsuite as well as
on x86_64-linux.
Joel Brobecker [Sat, 27 Sep 2014 16:09:34 +0000 (09:09 -0700)]
[Ada] Ignore __XA types when redundant.
Consider the following code which declares a variable A2 which
is an array of arrays of integers.
type Array2_First is array (24 .. 26) of Integer;
type Array2_Second is array (1 .. 2) of Array2_First;
A1 : Array1_Second := ((10, 11, 12), (13, 14, 15));
Trying to print the type of that variable currently yields:
(gdb) ptype A2
type = array (1 .. 2, 24 .. 26) of integer
This is not correct, as this is the description of a two-dimension
array, which is different from an array of arrays. The expected
output is:
(gdb) ptype a2
type = array (1 .. 2) of foo_n926_029.array2_first
GDB's struct type currently handles multi-dimension arrays the same
way arrays of arrays, where each dimension is stored as a sub-array.
The ada-valprint module considers that consecutive array layers
are in fact multi-dimension arrays. For array of arrays, a typedef
layer is introduced between the two arrays, creating a break between
each array type.
In our situation, A2 is a described as a typedef of an array type...
.uleb128 0x8 # (DIE (0x125) DW_TAG_variable)
.ascii "a2\0" # DW_AT_name
.long 0xfc # DW_AT_type
.uleb128 0x4 # (DIE (0xfc) DW_TAG_typedef)
.long .LASF5 # DW_AT_name: "foo__array2_second"
.long 0x107 # DW_AT_type
.uleb128 0x5 # (DIE (0x107) DW_TAG_array_type)
.long .LASF5 # DW_AT_name: "foo__array2_second"
.long 0xb4 # DW_AT_type
.uleb128 0x6 # (DIE (0x114) DW_TAG_subrange_type)
.long 0x11b # DW_AT_type
.byte 0x2 # DW_AT_upper_bound
.byte 0 # end of children of DIE 0x107
... whose element type is, as expected, a typedef to the sub-array
type:
.uleb128 0x4 # (DIE (0xb4) DW_TAG_typedef)
.long .LASF4 # DW_AT_name: "foo__array2_first"
.long 0xbf # DW_AT_type
.uleb128 0x9 # (DIE (0xbf) DW_TAG_array_type)
.long .LASF4 # DW_AT_name: "foo__array2_first"
.long 0xd8 # DW_AT_GNAT_descriptive_type
.long 0x1c5 # DW_AT_type
.uleb128 0xa # (DIE (0xd0) DW_TAG_subrange_type)
.long 0xf0 # DW_AT_type
.byte 0x18 # DW_AT_lower_bound
.byte 0x1a # DW_AT_upper_bound
.byte 0 # end of children of DIE 0xbf
The reason why things fails is that, during expression evaluation,
GDB tries to "fix" A1's type. Because the sub-array has a parallel
(descriptive) type (DIE 0xd8), GDB thinks that our array's index
type must be dynamic and therefore needs to be fixed. This in turn
causes the sub-array to be "fixed", which itself results in the
typedef layer to be stripped.
However, looking closer at the parallel type, we see...
.uleb128 0xb # (DIE (0xd8) DW_TAG_structure_type)
.long .LASF8 # DW_AT_name: "foo__array2_first___XA"
[...]
.uleb128 0xc # (DIE (0xe4) DW_TAG_member)
.long .LASF10 # DW_AT_name: "foo__Tarray2_firstD1___XDLU_24__26"
... that all it tells us is that the array bounds are 24 and 26,
which is already correctly provided by the array's DW_TAG_subrange_type
bounds, meaning that this parallel type is just redundant.
Parallel types in general are slowly being removed in favor of
standard DWARF constructs. But in the meantime, this patch kills
two birds with one stone:
1. It recognizes this situation where the XA type is useless,
and saves an unnecessary range-type fixing;
2. It fixes the issue at hand because ignoring the XA type results
in no type fixing being required, which allows the typedef layer
to be preserved.
gdb/ChangeLog:
* ada-lang.c (ada_is_redundant_range_encoding): New function.
(ada_is_redundant_index_type_desc): New function.
(to_fixed_array_type): Ignore parallel XA type if redundant.
gdb/testsuite/ChangeLog:
* gdb.ada/arr_arr: New testcase.
Tested on x86_64-linux.
Joel Brobecker [Fri, 12 Sep 2014 01:38:04 +0000 (18:38 -0700)]
varsize-limit error printing element of packed array...
... when that packed array is part of a discriminated record and
one of the bounds is a discriminant.
Consider the following code:
type FUNNY_CHAR_T is (NUL, ' ', '"', '#', [etc]);
type FUNNY_STR_T is array (POSITIVE range <>) of FUNNY_CHAR_T;
pragma PACK (FUNNY_STR_T);
type FUNNY_STRING_T (SIZE : NATURAL := 1) is
record
STR : FUNNY_STR_T (1 .. SIZE) := (others => '0');
LENGTH : NATURAL := 4;
end record;
TEST: FUNNY_STRING_T(100);
GDB is able to print the value of variable "test" and "test.str".
But not "test.str(1)":
(gdb) p test
$1 = (size => 100, str => (33 'A', nul <repeats 99 times>), length => 1)
(gdb) p test.str
$2 = (33 'A', nul <repeats 99 times>)
(gdb) p test.str(1)
object size is larger than varsize-limit
The problem occurs during the phase where we are trying to resolve
the expression subscript operation. On the one hand of the subscript
operator, we have the result of the evaluation of "test.str", which
is our packed array. We have the following code to handle packed
arrays in particular:
if (ada_is_constrained_packed_array_type
(desc_base_type (value_type (argvec[0]))))
argvec[0] = ada_coerce_to_simple_array (argvec[0]);
This eventually leads to a call to constrained_packed_array_type
to return the "simple array". This function relies on a parallel
___XA type, when available, to determine the bounds. In our case,
we find type...
failure__funny_string_t__T4b___XA"
... which has one field describing the bounds of our array as:
failure__funny_string_t__T3b___XDLU_1__size
The part that interests us is after the ___XD suffix or,
in other words: "LU_1__size". What this means in GNAT encoding
parlance is that the lower bound is 1, and that the upper bound
is the value of "size". "size" is our discriminant in this case.
Normally, we would access the record's discriminant in order to
get the upper bound's value, but we do not have that information,
here. We are in a mode where we are just trying to "fix" the type
without an actual value. This is what the call to to_fixed_range_type
is doing, and because the fix'ing fails, it ends up returning
the ___XDLU type unmodified as our index type.
This shouldn't be a problem, except that the later part of
constrained_packed_array_type then uses that index_type to
determine the array size, via a call to get_discrete_bounds.
The problem is that the upper bound of the ___XDLU type is
dynamic (in the DWARF sense) while get_discrete_bounds implicitly
assumes that the bounds are static, and therefore accesses
them using macros that assume the bounds values are constants:
case TYPE_CODE_RANGE:
*lowp = TYPE_LOW_BOUND (type);
*highp = TYPE_HIGH_BOUND (type);
This therefore returns a bogus value for the upper bound,
leading to an unexpectedly large size for our array, which
later triggers the varsize-limit guard we've seen above.
This patch avoids the problem by adding special handling
of dynamic range types. It also extends the documentation
of the constrained_packed_array_type function to document
what happens in this situation.
gdb/ChangeLog:
* ada-lang.c (constrained_packed_array_type): Set the length
of the return array as if both bounds where zero if that
returned array's index type is dynamic.
gdb/testsuite/ChangeLog:
* gdb.ada/pkd_arr_elem: New Testcase.
Tested on x86_64-linux.
Yao Qi [Sat, 15 Nov 2014 08:03:40 +0000 (16:03 +0800)]
Don't set CC in config/i386/go32.mh
I cross-compile gdb for msdosdjgpp (both target and host is
i586-pc-msdosdjgpp), so the CC should be i586-pc-msdosdjgpp-gcc.
However, CC is set incorrectly to gcc after config/i386/go32.mh is inlined
into the Makefile.
This patch is to remove the CC setting in config/i386/go32.mh.
gdb:
2014-11-19 Yao Qi <yao@codesourcery.com>
* config/i386/go32.mh (CC): Remove.
GDB Administrator [Wed, 19 Nov 2014 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 18 Nov 2014 19:03:09 +0000 (11:03 -0800)]
Check PC-relative offset overflow in PLT entry
This patch checks PC-relative offset overflow in pushq instruction in
x86-64 PLT entry.
bfd/
PR ld/17618
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Check
PC-relative offset overflow in PLT entry.
ld/testsuite/
PR ld/17618
* ld-x86-64/x86-64.exp: Run pr17618 for Linux target.
* ld-x86-64/pr17618.d: New file.
* ld-x86-64/pr17618.s: Likewise.
Doug Evans [Tue, 18 Nov 2014 17:41:45 +0000 (09:41 -0800)]
symtab.h (SYMTAB_BLOCKVECTOR): Renamed from BLOCKVECTOR. All uses updated.
gdb/ChangeLog:
* symtab.h (SYMTAB_BLOCKVECTOR): Renamed from BLOCKVECTOR. All uses
updated.
Doug Evans [Tue, 18 Nov 2014 17:36:15 +0000 (09:36 -0800)]
buildsym API cleanup
gdb/ChangeLog:
* buildsym.c (buildsym_objfile): New static global.
(buildsym_comp_dir): New static global.
(finish_block_internal): Delete arg objfile. All callers updated.
(finish_block): Delete arg objfile. All callers updated.
(start_subfile): Delete arg dirname. All callers updated.
(patch_subfile_names): Update buildsym_comp_dir.
(get_macro_table): Delete arg objfile. All callers updated.
(start_symtab): New arg objfile. All callers updated.
Rename arg dirname to comp_dir.
(reset_symtab_globals): Initialize buildsym_objfile, buildsym_comp_dir.
(end_symtab_get_static_block): Delete arg objfile. All callers
updated.
(end_symtab_without_blockvector): Ditto.
(end_symtab_with_blockvector): Ditto.
(end_symtab_from_static_block): Ditto.
(end_symtab): Ditto.
(end_expandable_symtab): Ditto.
(augment_type_symtab): Ditto.
* coffread.c (coff_start_symtab): New arg objfile. All callers
updated.
Nick Clifton [Tue, 18 Nov 2014 17:35:39 +0000 (17:35 +0000)]
Fixes a seg-fault when displaying the time data for a corrupt archive.
PR binutuls/17605
* bucomm.c (print_arelt_descr): Check for ctime returning NULL.
Doug Evans [Tue, 18 Nov 2014 17:32:10 +0000 (09:32 -0800)]
symtab.h (SYMTAB_LINETABLE): Renamed from LINETABLE. All uses updated.
gdb/ChangeLog:
* symtab.h (SYMTAB_LINETABLE): Renamed from LINETABLE. All uses
updated.
Doug Evans [Tue, 18 Nov 2014 17:28:32 +0000 (09:28 -0800)]
SYMTAB_DIRNAME: New macro.
gdb/ChangeLog:
* symtab.h (SYMTAB_DIRNAME): New macro. All uses of member
symtab.dirname updated to use it.
Doug Evans [Tue, 18 Nov 2014 17:19:11 +0000 (09:19 -0800)]
SYMTAB_OBJFILE: New macro.
gdb/ChangeLog:
* symtab.h (SYMTAB_OBJFILE): New macro. All uses of member
symtab.objfile updated to use it.
Doug Evans [Tue, 18 Nov 2014 17:00:15 +0000 (09:00 -0800)]
Fix memory leak in watch_main_source_file_lossage.
gdb/ChangeLog:
* buildsym.c (watch_main_source_file_lossage): Fix memory leak.
Doug Evans [Tue, 18 Nov 2014 16:54:06 +0000 (08:54 -0800)]
Use SYMBOL_OBJFILE more.
gdb/ChangeLog:
* cp-namespace.c (cp_lookup_symbol_imports_or_template): Use
SYMBOL_OBJFILE.
* findvar.c (default_read_var_value): Ditto.
* jv-lang.c (add_class_symtab_symbol): Ditto.
* parse.c (operator_check_standard): Ditto.
* printcmd.c (address_info): Ditto.
* symtab.c (fixup_symbol_section): Ditto.
(skip_prologue_sal): Ditto.
* tracepoint.c (scope_info): Ditto.
* valops.c (find_function_in_inferior): Ditto.
* guile/scm-symbol.c (syscm_eq_symbol_smob): Ditto.
* python/py-symbol.c (set_symbol): Ditto.
Doug Evans [Tue, 18 Nov 2014 16:28:04 +0000 (08:28 -0800)]
Split up end_symtab_from_static_block into two.
This patch is conceptually quite simple.
If you look at end_symtab_from_static_block you'll see
that the static_block == NULL case is completely different
than the non-NULL case.
There's a lot of complexity to handle the NULL case but it seems
entirely unnecessary. For example, whether blockvector is NULL
is decided at the start, before this for loop:
for (subfile = subfiles; subfile; subfile = nextsub)
Secondly, after the for loop, we test symtab for non-NULL here:
/* Set this for the main source file. */
if (symtab)
but symtab will only ever be non-NULL if blockvector was non-NULL.
And if blockvector was non_NULL so will symtab.
The other case to consider is these lines of code executed before
the for loop:
/* Read the line table if it has to be read separately.
This is only used by xcoffread.c. */
if (objfile->sf->sym_read_linetable != NULL)
objfile->sf->sym_read_linetable (objfile);
/* Handle the case where the debug info specifies a different path
for the main source file. It can cause us to lose track of its
line number information. */
watch_main_source_file_lossage ();
From my reading of the code, neither of these is useful
in the static_block == NULL case.
Thus we can make the code more readable by splitting these two cases up,
which is what this patch does.
gdb/ChangeLog:
* buildsym.c (main_subfile): New static global.
(free_subfiles_list): New function.
(start_symtab): Set main_subfile.
(restart_symtab): Replace init of subfiles, current_subfile with
call to free_subfiles_list.
(watch_main_source_file_lossage): Use main_subfile.
(reset_symtab_globals): Replace init of current_subfile with call
to free_subfiles_list.
(end_symtab_without_blockvector, end_symtab_with_blockvector): New
functions, split out from ...
(end_symtab_from_static_block): ... here. Rewrite to call them.
Doug Evans [Tue, 18 Nov 2014 16:08:00 +0000 (08:08 -0800)]
The result of symtab expansion is always a primary symtab.
gdb/ChangeLog:
* dwarf2read.c (dw2_instantiate_symtab): Add assert.
(dw2_lookup_symbol): Remove unnecessary test for primary symbol table.
* psymtab.c (lookup_symbol_aux_psymtabs): Ditto.
(psymtab_to_symtab): Add comment and assert.
(map_matching_symbols_psymtab): Remove unnecessary test for
non-primary symtab.
Nick Clifton [Tue, 18 Nov 2014 14:40:05 +0000 (14:40 +0000)]
More fixes for illegal memory accesses exposed by fuzzed binaries.
PR binutils/17512
* peXXIgen.c (pe_print_pdata): Fail if the section's virtual size
is larger than its real size.
(rsrc_print_section): Fix off-by-one error checking for overflow.
* pei-x86_64.c (pex64_bfd_print_pdata): Handle empty unwind
sections.
* dwarf.c (get_encoded_value): Warn and return if the encoded
value is more than 64-bits long.
(SAFE_BYTE_GET): Do not attempt to read more than 64-bits.
(process_extended_line_op): Add more range checks.
(decode_location_expression): Use the return value from
display_block. Add more range checks.
(read_debug_line_header): Add range check.
(display_debug_lines_raw): Add range checks.
(display_debug_frames): Silently skip multiple zero terminators.
Add range checks.
(process_cu_tu_index): Check for non-existant or empty sections.
Use SAFE_BYTE_GET instead of byte_get.
H.J. Lu [Tue, 18 Nov 2014 13:55:32 +0000 (05:55 -0800)]
Always run mpx3 and mpx4 tests in 64-bit
* ld-x86-64/mpx.exp: Always run mpx3 and mpx4 tests in 64-bit.
Igor Zamyatin [Tue, 18 Nov 2014 07:52:36 +0000 (10:52 +0300)]
Add -z bndplt to generate BND prefix in PLT entries
This patch adds "-z bndplt" option Linux/x86-64 linker to generate BND
prefix in PLT entries. It also updated Linux/x86-64 assembler not to
generate R_X86_64_PLT32_BND nor R_X86_64_PC32_BND relocations.
bfd/
2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com>
* elf64-x86-64.c (elf_x86_64_check_relocs): Enable MPX PLT only
for -z bndplt.
gas/
2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com>
* config/tc-i386-intel.c (i386_operator): Remove last argument
from lex_got call.
* config/tc-i386.c (reloc): Remove bnd_prefix from parameters'
list. Return always BFD_RELOC_32_PCREL.
* (output_branch): Remove condition for BFD_RELOC_X86_64_PC32_BND.
* (output_jump): Update call to reloc accordingly.
* (output_interseg_jump): Likewise.
* (output_disp): Likewise.
* (output_imm): Likewise.
* (x86_cons_fix_new): Likewise.
* (lex_got): Remove bnd_prefix from parameters' list in macro and
declarations. Don't use BFD_RELOC_X86_64_PLT32_BND.
* (x86_cons): Update call to lex_got accordingly.
* (i386_immediate): Likewise.
* (i386_displacement): Likewise.
* (md_apply_fix): Don't use BFD_RELOC_X86_64_PLT32_BND nor
BFD_RELOC_X86_64_PC32_BND.
* (tc_gen_reloc): Likewise.
include/
2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com>
* bfdlink.h (struct bfd_link_info): Add bndplt.
ld/
2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com>
* emulparams/elf_x86_64.sh (BNDPLT): Set to yes for x86_64.
* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle
"-z bndplt" if BNDPLT is yes.
(gld${EMULATION_NAME}_list_options): Add "-z bndplt" entry.
* ld.texinfo: Add description for bndplt.
ld/testsuite/
2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com>
* testsuite/ld-x86-64/bnd-ifunc-1.d: Add bndplt option.
* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1.d: Likewise. Update dissassembly
sections.
* testsuite/ld-x86-64/mpx.exp: Handle mpx3 and mpx4 tests.
* testsuite/ld-x86-64/mpx1a.rd: Remove _BND from relocation name.
* testsuite/ld-x86-64/mpx1c.rd: Likewise.
* testsuite/ld-x86-64/mpx2a.rd: Likewise.
* testsuite/ld-x86-64/mpx2c.rd: Likewise.
* testsuite/ld-x86-64/mpx3.dd: New file.
* testsuite/ld-x86-64/mpx3a.s: Likewise.
* testsuite/ld-x86-64/mpx3b.s: Likewise.
* testsuite/ld-x86-64/mpx4.dd: Likewise.
* testsuite/ld-x86-64/mpx4a.s: Likewise.
* testsuite/ld-x86-64/mpx4b.s: Likewise.