Another significant difference in the ELFv2 ABI is that "homogeneous"
floating-point and vector aggregates, i.e. aggregates the consist
(recursively) only of members of the same floating-point or vector type,
are passed in a series of floating-point / vector registers, as if they
were seperate parameters. (This is similar to the ARM ABI.) This
applies to both calls and returns.
In addition when returning any aggregate of up to 16 bytes, ELFv2 now
used general-purpose registers.
This patch adds support for these aspects of the ABI, which is relatively
straightforward after the refactoring patch to ppc-sysv-tdep.c.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine.
(ppc64_elfv2_abi_homogeneous_aggregate): Likewise.
(ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs.
(ppc64_sysv_abi_return_value): Likewise. Also, handle small
structures returned in GPRs.
This implementes another change in ELFv2: the stack frame no longer
contains the reserved double words for linker and compiler use
(which weren't really used for much of anything anyway). This
affects placement of on-stack parameters in inferior calls.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct
offset to the stack parameter list for the ELFv2 ABI.
This implements the most significant difference with the ELFv2 ABI:
we no longer use function descriptors. The patch consists mostly
of switching off code to deal with descriptors :-)
In addition, when calling an inferior function, we no longer need
to provide its TOC in r2. Instead, ELFv2 code expects to be called
with r12 pointing to the code address itself.
gdb/ChangeLog:
* ppc-linux-tdep.c (ppc_linux_init_abi): Only call
set_gdbarch_convert_from_func_ptr_addr and
set_gdbarch_elf_make_msymbol_special for ELFv1.
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_param): Only handle
function descriptors on ELFv1.
(ppc64_sysv_abi_push_dummy_call): Likewise. On ELFv2,
set up r12 at function entry.
This is the first patch of a series to implement support for the
PowerPC ELFv2 ABI. While powerpc64le-linux will use ELFv2, and
the existing powerpc64-linux code will continue to use ELFv1,
in theory ELFv2 is also defined for big-endian systems (and
ELFv1 was also defined for little-endian systems).
Therefore this patch adds a new tdep->elf_abi variable to decide
which ABI version to use. This is detected from the ELF header
e_flags value; if this is not present, we default to ELFv2 on
little-endian and ELFv1 otherwise.
This patch does not yet introduce any actual difference in GDB's
handling of the two ABIs. Those will be added by the remainder
of this patch series.
For an overview of the changes in ELFv2, have a look at the
comments in the patch series that added ELFv2 to GCC, starting at:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html
gdb/ChangeLog:
* ppc-tdep.h (enum powerpc_elf_abi): New data type.
(struct gdbarch_tdep): New member elf_abi.
* rs6000-tdep.c: Include "elf/ppc64.h".
(rs6000_gdbarch_init): Detect ELF ABI version.
The powerpc64le-linux ABI specifies that when a 128-bit DFP value is
passed in a pair of floating-point registers, the first register holds
the most-significant part of the value. This is as opposed to the
usual rule on little-endian systems, where the first register would
hold the least-significant part.
This affects two places in GDB, the read/write routines for the
128-bit DFP pseudo-registers, and the function call / return
sequence. For the former, current code already distinguishes
between big- and little-endian targets, but gets the latter
wrong. This is presumably because *GCC* also got it wrong,
and GDB matches the old GCC behavior. But GCC is now fixed:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02145.html
so GDB needs to be fixed too. (Old code shouldn't really be
an issue since there is no code "out there" so far that uses
dfp128 on little-endian ...)
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order
within a register pair holding a DFP 128-bit value on little-endian.
(ppc64_sysv_abi_return_value_base): Likewise.
* rs6000-tdep.c (dfp_pseudo_register_read): Likewise.
(dfp_pseudo_register_write): Likewise.
gdb/testsuite/ChangeLog:
* gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*.
Passing a 32-bit DFP in register needs to use the least-significant part
of the register. Like with a previous patch that addressed the same
issue for small structs, this patch makes sure the appropriate offset
is used on little-endian systems.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct
offset on little-endian when passing _Decimal32.
(ppc64_sysv_abi_return_value_base): Likewise for return values.
Many VSX test were failing on powerpc64le-linux, since -as opposed to the
AltiVec tests- there never were little-endian versions of the test patterns.
This patch adds such patterns, along the lines of altivec-regs.exp.
In addition, there is an actual code change required: For those VSX
registers that overlap a floating-point register, the FP register
overlaps the most-significant half of the VSX register both on big-
and little-endian systems. However, on little-endian systems, that
half is stored at an offset of 8 bytes (not 0). This works already
for the "real" FP registers, but current code gets it wrong for
the "extended" pseudo FP register GDB generates for the second
half of the VSX register bank.
This patch updates the corresponding pseudo read/write routines
to take the appropriate offset into consideration.
gdb/ChangeLog:
* rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset
of the overlapped FP register within the VSX register on little-
endian platforms.
(efpr_pseudo_register_write): Likewise.
gdb/testsuite/ChangeLog:
* gdb.arch/vsx-regs.exp: Check target endianness. Provide variants
of the test patterns for use on little-endian systems.
A couple of AltiVec tests fail spuriously on powerpc64le-linux, because
they compare against an incorrect pattern. Note that those tests already
contain little-endian variants of the patterns, but those seem to have
bit-rotted a bit: when outputting a vector, GDB no longer omits trailing
zero elements (as it used to do in the past).
This patch updates the pattern to the new GDB output behavior.
In addition, the patch updates the endian test to use the new
gdb_test_multiple logic instead of gdb_expect.
gdb/testsuite/ChangeLog:
* gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test.
(decimal_vector): Fix for little-endian.
When passing a small structure in a GPR, the ABI specifies that it
should be passed in the least-significant bytes of the register
(or stack slot). On big-endian systems, this means the value
needs to be stored at an offset, which is what current code does.
However, on little-endian systems, the least-significant bytes are
addresses with offset 0. This patch fixes that.
gdb/ChangeLog:
* ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct
offset on little-endian when passing small structures.
This patch refactors the ppc64 function call and return value handling code
in ppc-sysv-tdep.c. The main problem to be addressed by this refactoring
is the code duplication caused by certain aggregate types:
According to the ABI, some types are to be decomposed into component types
for parameter and return value handling. For example, complex types are
to be passed as if the real and imaginary component were separate arguments.
Similarly, certain OpenCL vector types are passed as if they were multiple
separate arguments of the vector element type. With the new ELFv2 ABI,
there is another case: "homogeneous aggregates" (e.g. a struct containing
4 floats) are passed in multiple floating point registers as well.
Unfortunately, the current code is not structured to easily model these
ABI properties. For example, code to pass complex values re-implements
code to pass the underlying (floating-point) type. This has already
led to some unfortunate code duplication, and with the addition of
ELFv2 ABI support, I would have had to add yet more such duplication.
To avoid that, I've decided to refactor the code in order to re-use
subroutines that handle the "base" types when handling those aggregate
types. This was not intended to cause any difference on current
(ELFv1) ABI code, but in fact it fixes a bug:
FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4)
This was caused by the old code in ppc64_sysv_abi_push_float incorrectly
handling floating-point arguments to vararg routines, which just happens
to work out correctly automatically in the refactored code ...
gdb/ChangeLog:
* ppc-sysv-tdep.c (get_decimal_float_return_value): Update comment.
(struct ppc64_sysv_argpos): New data structure.
(ppc64_sysv_abi_push_float): Remove.
(ppc64_sysv_abi_push_val): New function.
(ppc64_sysv_abi_push_integer): Likewise.
(ppc64_sysv_abi_push_freg): Likewise.
(ppc64_sysv_abi_push_vreg): Likewise.
(ppc64_sysv_abi_push_param): Likewise.
(ppc64_sysv_abi_push_dummy_call): Refactor to use those new routines.
(ppc64_sysv_abi_return_value_base): New function.
(ppc64_sysv_abi_return_value): Refactor to use it.
gdb/ChangeLog:
* sparc64obsd-tdep.c (sparc64obsd_gregset): New variable.
(sparc64obsd_supply_gregset): Handle registers sets used in ELF
core dumps.
(sparc64obsd_init_abi): Adjust minimum size of the general purpose
register set used in ELF core dumps. Add floating-point register set.
This change updates the mn10300 dwarf register map. It reduces the
failure count when doing simulator testing against the default
multilib from 788 to 99.
gdb/ChangeLog:
* mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Rewrite
dwarf2_to_gdb[] table using symbolic constants. Adjust
penultimate entry from number representing the PC register
to symbolic constant representing the MDR register. Add
constant for the PC register to the end of the table.
This implements a work-around for an icache bug on 476 that can cause
execution of stale instructions when control falls through from one
page to the next. The idea is to prevent such fall-through by
replacing the last instruction on a page with a branch to a patch
area containing the instruction, then branch to the next page.
The patch also fixes a number of bugs in the existing support for long
branch trampolines.
bfd/
* elf32-ppc.c (struct ppc_elf_link_hash_table): Add params.
Delete emit_stub_syms, no_tls_get_addr_opt. Update all uses.
(ppc_elf_link_params): New function.
(ppc_elf_create_glink): Align .glink to 64 bytes for ppc476
workaround.
(ppc_elf_select_plt_layout): Remove plt_style and emit_stub_syms
parameters. Use htab->params instead.
(ppc_elf_tls_setup): Remove no_tls_get_addr_opt parameter.
(ppc_elf_size_dynamic_sections): Align __glink_PLTresolve to
64 bytes for ppc476 workaround.
(struct ppc_elf_relax_info): New.
(ppc_elf_relax_section): Exclude linker created sections and
those too small to hold one instruction. Don't add another
branch around trampolines on later relax passes. Don't
generate trampolines for undefined symbols when !relocatable,
nor for plugin symbols. Allocate space for ppc476 workaround
patch area. Free fixups on error return path.
(ppc_elf_relocate_section): Handle ppc476 workaround patching.
* elf32-ppc.h (struct ppc_elf_params): New.
(ppc_elf_select_plt_layout, ppc_elf_tls_setup): Update prototype.
(ppc_elf_link_params): Declare.
* section.c (SEC_INFO_TYPE_TARGET): Define.
* bfd-in2.h: Regenerate.
ld/
* emultempl/ppc32elf.em (no_tls_get_addr_opt, emit_stub_syms)
plt_style): Delete. Adjust all refs to instead use..
(params): ..this. New variable.
(ppc_after_open_output): New function. Tweak params and pass to
ppc_elf_link_params.
(ppc_after_open): Adjust ppc_elf_select_plt_layout call.
(ppc_before_allocation): Adjust ppc_elf_tls_setup call. Enable
relaxation for ppc476 workaround.
(PARSE_AND_LIST_*): Add --{no-,}ppc476-workaround support.
(LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Define.
I happen to notice this extern function declaration in ada-lang.h
which does not actually exist...
gdb/ChangeLog:
* ada-lang.h (clear_ada_sym_cache): Delete.
Recent ppc64 Linux kernels provide a new auxv entry AT_HWCAP2,
which is currently not recognized by GDB, causing every use of
"info auxv" to show an error.
This commit adds the AT_HWCAP2 define to include/elf/common.h
and handles it in GDB.
include/elf/ChangeLog:
* common.h (AT_HWCAP2): Define.
gdb/ChangeLog:
* auxv.c (fprint_target_auxv): Handle AT_HWCAP2.
It is added for
commit 409ff343a4
Author: Alan Modra <amodra@gmail.com>
Date: Tue Nov 8 13:49:11 2011 +0000
* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark syms in
executables when export_dynamic.
* ld-elf/rdynamic-1.c: New file.
* ld-elf/rdynamic-1.rd: Likewise.
* ld-elf/shared.exp (build_tests): Add rdynamic-1.
breakpoint is set in a `ta 0x6d´ which is not a sigreturn syscall. In
these cases no rt_frame exists in the stack and thus the read PC is
wrong.
ChangeLog
2014-01-29 Jose E. Marchesi <jose.marchesi@oracle.com>
* sparc64-linux-tdep.c (sparc64_linux_step_trap): Get PC from
the sigreturn register save area only if the syscall is
sigreturn.
testsuite/ChangeLog
2014-01-29 Jose E. Marchesi <jose.marchesi@oracle.com>
* gdb.arch/sparc-sysstep.exp: New file.
* gdb.arch/sparc-sysstep.c: Likewise.
* gdb.arch/Makefile.in (EXECUTABLES): Add sparc-sysstep.
ELFOSABI_GNU for binaries containing unique symbols. So I am reverting that patch and
instead applying the patch below to fix up the targets that were triggering the test failure.
bfd/ChangeLog
2014-01-29 Nick Clifton <nickc@redhat.com>
* elf32-metag.c (elf_metag_post_process_headers): Call
_bfd_elf_post_process_headers.
* elf32-sh64.c (sh64_elf_copy_private_data): Call
_bfd_elf_copy_private_data.
* elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise.
binutils/testsuite/ChangeLog
2014-01-29 Nick Clifton <nickc@redhat.com>
* binutils-all/strip-10.d: Revert previous delta.
I noticed that a small lexical block was over indented by 2 characters.
So this patch starts by reducing the indentation.
While looking at this area of the code, I also noticed a couple of lines
that had trailing spaces, so this patch also removes them.
And finally, it fixes one tiny to put the assignment operator at
the start of the next line, rather than at the end of the first line.
gdb/ChangeLog:
* valops.c (value_slice): Minor reformatting.
This patch adds support for .gdb_index version 7, which adds several
flag bits to the symbol index. It also fixes a problem where it did
not handle compressed debug sections correctly.
Tested with a google/gcc-4_8 branch compiler, which supports
the -ggnu-pubnames option to generate .debug_gnu_pubnames/pubtypes
tables. (We will submit that patch to GCC when stage 1 reopens.)
2014-01-28 Cary Coutant <ccoutant@google.com>
* gold/dwarf_reader.cc: include <utility> (for make_pair).
(Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
debug sections.
(Dwarf_ranges_table::read_ranges_table): Likewise.
(Dwarf_pubnames_table::read_section): Check for GNU-style
sections, and for compressed debug sections.
(Dwarf_pubnames_table::read_header): Compute end address of table.
(Dwarf_pubnames_table::next_name): Return flag_byte. Check
for end of list by offset, not by offset == 0.
(Dwarf_info_reader::do_read_string_table): Check for compressed
debug sections.
* gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
Initialize new data members.
(Dwarf_pubnames_table::next_name): return flag_byte.
(Dwarf_pubnames_table::end_of_table_): New data member.
(Dwarf_pubnames_table::is_gnu_style_): New data member.
* gold/gdb-index.cc (gdb_index_version): Update to version 7.
(Gdb_index_info_reader::read_pubtable): Read flag_byte.
(Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
read skeleton type unit DIEs.
(Gdb_index::add_symbol): Add flag_byte; adjust all callers.
(Gdb_index::do_write): Write flag_byte.
* gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
(Gdb_index::Cu_vector): Store flags along with cu indexes.
* gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
* gold/testsuite/gdb_index_test_comm.sh: Likewise.
The ppc64_standard_linkage7 pattern added by Alan's recent patch:
https://sourceware.org/ml/gdb-patches/2013-11/msg00274.html
contains a typo: the ELFv2 TOC slot offset is 24, not 40.
This was correct in the comment, but not the actual code.
ChangeLog:
* ppc64-tdep.c (ppc64_standard_linkage7): Fix typo.
abbreviation may not be the current CU. Thus we need to make sure
that when we read the abbreviation we use the correct CU.
* dwarf2.c (find_abstract_instance_name): For DW_FORM_ref_addr
attributes select the CU containing the abbreviation, which may not
be the current CU.
ELF headers will be copied from input files. This in turn has broken
the strip-10 test in the binutils testsuite, so this patch updates the
expected output.
PR binutils/16318
* binutils-all/strip-10.d: Allow "System V" in the osabi field.
Since all MCUs now have their own specific linker script (courtesy of
TI) there is no need for these emulations and so this patch removes
them.
* Makefile.am: Remove obsolete MSP430 emulations.
* configure.tgt: Likewise.
* emulparams/msp430all.sh: Likewise.
* Makefile.in: Regenerate.
SHF_INFO_LINK bit set, which shows up in readelf section dumps. This
has broken a couple of IA64 testcases in the gas testsuite, which are
fixed by this patch.
PR binutils/16317
* gas/ia64/group-2.d: Expect I attribute with RELA sections.
* gas/ia64/xdata.d: Likewise.
Currently, Ada debugging requires the use of certain GNAT-specific
encodings, which are generated by the compiler. These encodings
were created a long time ago to work around the fairly limited
capabilities of the stabs debugging format. With DWARF, the vast
majority of the encodings could be abandoned in favor of a pure
DWARF approach.
In order to make it easier to evaluate the quality of the DWARF
debugging information generated by the compiler, and how the debugger
handles it, we are introducing a small Ada-specific maintenance
setting which changes the debugger's behavior to ignore descriptive
types. Descriptive types are artificial types generated by the
compiler purely to give the debugger hints as to how to properly
decode certain properties of a type. For instance, for array
types, it generates a parallel type whose name is the name of
the array suffixed with ___XA, whose contents tells us what
the array's index type is, and possibly its bounds. See GCC's
gcc/ada/exp_dbug.ads for the full description of all encodings.
This is only a first step, as this setting does not deactivate
all encodings; More settings dedicated to each type of encoding
will likely be implemented in the future, as we make progress.
gdb/ChangeLog:
* ada-lang.c (maint_set_ada_cmdlist, maint_show_ada_cmdlist):
New static globals.
(maint_set_ada_cmd, maint_show_ada_cmd): New functions.
(ada_ignore_descriptive_types_p): New static global.
(find_parallel_type_by_descriptive_type): Return immediately
if ada_ignore_descriptive_types_p is set.
(_initialize_ada_language): Register new commands "maintenance
set ada", "maintenance show ada", "maintenance set ada
ignore-descriptive-types" and "maintenance show ada
ignore-descriptive-types".
* NEWS: Add entry for new "maint ada set/show
ignore-descriptive-types" commands.
gdb/doc/ChangeLog:
* gdb.texinfo (Ada Glitches): Document the new "maint ada set/show
ignore-descriptive-types". commands.
The to_teardown_btrace target method is used to free btrace resources
during shutdown when target record has already been unpushed and we
can't reliably talk to a remote target to disable branch tracing.
Tracing resources are freed for each thread when the thread is removed;
both on the GDB side and on the gdbserver side.
In the remote case, the remote target that provides to_teardown_btrace
to free the GDB side resources has already been unpushed when threads
are destroyed. This results in a complaint "You can't do this ..." and
in a few bytes of memory leaked for each thread.
Initiate btrace teardown in record_btrace_close, so the remote target is
still in place.
2014-01-27 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_close): Call btrace_teardown
for all threads.
Currently, ada-lang.c pretends to include "ui-out.h" as follow:
#ifdef UI_OUT
#include "ui-out.h"
#endif
However, UI_OUT is never defined as far as I can tell. This is confirmed
by rebuilding with a #error pragma inside the #ifdef UI_OUT block,
which never triggers.
Since this unit makes references to declarations from ui-out.h,
this patch simply removes the #ifdef/#endif condition. This has not
been an error so far because "ui-out.h" indirectly gets included,
via one of the other .h files being included.
gdb/ChangeLog:
* ada-lang.c: Remove "#ifdef UI_OUT" condition for including
"ui-out.h".
type Char_Table is array (Character range Character'First .. Character'Last)
of Natural;
Trying to print the type description of this type currently yields:
(gdb) ptype char_table
type = array ('["00"]' .. '["ff"]') of natural
Although technically correct, it seemed more useful to print the array
range as:
(gdb) ptype char_table
type = array (character) of natural
This patch implements this suggestion.
gdb/ChangeLog:
* ada-typeprint (type_is_full_subrange_of_target_type):
New function.
(print_range): Add parameter bounds_prefered_p. If not set,
try printing range types using the name of their base type.
(print_range_type): Add parameter bounds_prefered_p.
Use it in call to print_range.
(print_array_type, ada_print_type): Update calls to print_range
and print_range_type.
gdb/testsuite/ChangeLog:
* gdb.ada/array_char_idx: New testcase.
These declarations are unncessary, and make it extra work when trying
to change the profile of one of these functions. This patch just
removes them.
Note that one of them (print_dynamic_range_bound), was improperly
indented.
gdb/ChangeLog:
* ada-typeprint.c (print_array_type, print_choices, print_range)
(print_range_bound, print_dynamic_range_bound, print_range_type):
Remove declaration.