Nick Clifton [Tue, 27 Feb 2018 10:15:13 +0000 (10:15 +0000)]
Have info_to_howto functions return a success/fail status. Check this result. Stop strip from completeing if one of these functions fails.
bfd PR 22875
* elf-bfd.h (struct elf_backend_data): Change the return type of
the elf_info_to_howto and elf_info_to_howto_rel function pointers
to bfd_boolean.
* elfcode.h (elf_slurp_reloc_table_from_section): Check the return value from the info_to_howto function and fail if that function failed.
* elf32-h8300.c (elf32_h8_relocate_section): Check return value from the info_to_howto function.
(elf32_h8_relax_section): Likewise.
* elf32-lm32.c (lm32_elf_relocate_section): Likewise.
* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
* elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise.
* elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
* elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
* elfnn-ia64.c (elfNN_ia64_relocate_section): Likewise.
* elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
(riscv_elf_relocate_section): Likewise.
* elf-hppa.h (elf_hppa_info_to_howto): Change return type to
bfd_boolean. Issue an error message, set an error value and
return FALSE if the reloc is not recognized.
(elf_hppa_info_to_howto_rel): Likewise.
* elf-m10200.c (mn10200_info_to_howto): Likewise.
* elf-m10300.c (mn10300_info_to_howto): Likewise.
* elf.c (_bfd_elf_no_info_to_howto): Likewise.
* elf32-arc.c (arc_info_to_howto_rel): Likewise.
* elf32-arm.c (elf32_arm_info_to_howto): Likewise.
* elf32-avr.c (avr_info_to_howto_rela): Likewise.
* elf32-bfin.c (bfin_info_to_howto): Likewise.
* elf32-cr16.c (elf_cr16_info_to_howto): Likewise.
* elf32-cr16c.c (elf_cr16c_info_to_howto): Likewise.
* elf32-cris.c (elf_cr16c_info_to_howto_rel, cris_info_to_howto_rela): Likewise.
* elf32-crx.c (elf_crx_info_to_howto): Likewise.
* elf32-d10v.c (d10v_info_to_howto_rel): Likewise.
* elf32-d30v.c (d30v_info_to_howto_rel, d30v_info_to_howto_rela): Likewise.
* elf32-dlx.c (dlx_rtype_to_howto, elf32_dlx_info_to_howto, elf32_dlx_info_to_howto_rel): Likewise.
* elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise.
* elf32-fr30.c (fr30_info_to_howto_rela): Likewise.
* elf32-frv.c (frv_info_to_howto_rela, frvfdpic_info_to_howto_rel): Likewise.
* elf32-ft32.c (ft32_info_to_howto_rela): Likewise.
* elf32-gen.c (elf_generic_info_to_howto, elf_generic_info_to_howto_rel): Likewise.
* elf32-h8300.c (elf32_h8_info_to_howto, elf32_h8_info_to_howto_rel): Likewise.
* elf32-i370.c (i370_elf_info_to_howto): Likewise.
* elf32-i386.c (elf_i386_reloc_type_lookup, elf_i386_rtype_to_howto, elf_i386_info_to_howto_rel): Likewise.
* elf32-i860.c (lookup_howto, elf32_i860_info_to_howto_rela): Likewise.
* elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise.
* elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise.
* elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise.
* elf32-lm32.c (lm32_info_to_howto_rela): Likewise.
* elf32-m32c.c (m32c_info_to_howto_rela): Likewise.
* elf32-m32r.c (m32r_info_to_howto_rel, m32r_info_to_howto): Likewise.
* elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise.
* elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise.
* elf32-m68k.c (rtype_to_howto): Likewise.
* elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
* elf32-mep.c (mep_info_to_howto_rela): Likewise.
* elf32-metag.c (metag_info_to_howto_rela): Likewise.
* elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
* elf32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela): Likewise.
* elf32-moxie.c (moxie_info_to_howto_rela): Likewise.
* elf32-msp430.c (msp430_info_to_howto_rela): Likewise.
* elf32-mt.c (mt_info_to_howto_rela): Likewise.
* elf32-nds32.c (nds32_info_to_howto_rel, nds32_info_to_howto): Likewise.
* elf32-nios2.c (nios2_elf32_info_to_howto): Likewise.
* elf32-or1k.c (or1k_info_to_howto_rela): Likewise.
* elf32-pj.c (pj_elf_info_to_howto): Likewise.
* elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
* elf32-pru.c (pru_elf32_info_to_howto): Likewise.
* elf32-rl78.c (rl78_info_to_howto_rela): Likewise.
* elf32-rx.c (rx_info_to_howto_rela): Likewise.
* elf32-s390.c (elf_s390_info_to_howto): Likewise.
* elf32-score.c (s3_bfd_score_info_to_howto, _bfd_score_info_to_howto): Likewise.
* elf32-score7.c (s7_bfd_score_info_to_howto): Likewise.
* elf32-sh.c (sh_elf_info_to_howto): Likewise.
* elf32-spu.c (spu_elf_info_to_howto): Likewise.
* elf32-tic6x.c (elf32_tic6x_info_to_howto, elf32_tic6x_info_to_howto_rel): Likewise.
* elf32-tilepro.c (tilepro_info_to_howto_rela): Likewise.
* elf32-v850.c (v850_elf_info_to_howto_rel, v850_elf_info_to_howto_rela, v800_elf_info_to_howto): Likewise.
* elf32-vax.c (rtype_to_howto): Likewise.
* elf32-visium.c (visium_info_to_howto_rela): Likewise.
* elf32-wasm32.c (elf32_wasm32_rtype_to_howto, elf32_wasm32_info_to_howto_rela): Likewise.
* elf32-xc16x.c (elf32_xc16x_info_to_howto): Likewise.
* elf32-xgate.c (xgate_info_to_howto_rel): Likewise.
* elf32-xstormy16.c (xstormy16_info_to_howto_rela): Likewise.
* elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise.
* elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
* elf64-gen.c (elf_generic_info_to_howto, elf_generic_info_to_howto_rel): Likewise.
* elf64-ia64-vms.c (elf64_ia64_info_to_howto): Likewise.
* elf64-mips.c (mips_elf64_info_to_howto_rela): Likewise.
* elf64-mmix.c (mmix_info_to_howto_rela): Likewise.
* elf64-ppc.c (ppc64_elf_info_to_howto): Likewise.
* elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
* elf64-sh64.c (elf_s390_info_to_howto, sh_elf64_info_to_howto): Likewise.
* elf64-x86-64.c (elf_x86_64_info_to_howto): Likewise.
* elfn32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_info_to_howto): Likewise.
* elfnn-ia64.c (elfNN_ia64_info_to_howto): Likewise.
* elfnn-riscv.c (riscv_info_to_howto_rela): Likewise.
* elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_info_to_howto): Likewise.
* elfxx-tilegx.c (tilegx_info_to_howto_rela): Likewise.
* elf32-score.h (s7_bfd_score_info_to_howto): Update prototype.
* elfxx-sparc.h (_bfd_sparc_elf_info_to_howto): Update prototype.
* elfxx-tilegx.h (tilegx_info_to_howto_rela): Update prototype.
* elfxx-target.h (elf_info_to_howto, elf_info_to_howto_rel): Default to NULL.
binutils PR 22875
* objcopy.c (copy_object): Check the error status after marking symbols used in relocations.
* testsuite/binutils-all/strip-13.s: New test source file.
* testsuite/binutils-all/strip-13.s: New test driver file.
* testsuite/binutils-all/objcopy.exp: Run the new test.
GDB Administrator [Tue, 27 Feb 2018 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Mon, 26 Feb 2018 22:09:12 +0000 (14:09 -0800)]
ChangeLog entry for previous commit.
Jim Wilson [Mon, 26 Feb 2018 22:05:13 +0000 (14:05 -0800)]
IA-64: Fix linker error with --no-keep-memory.
bfd/
PR 15904
* elfnn-ia64.c (elfNN_ia64_relax_section): After ia64_elf_relax_brl
call, set changed_contents and changed_relocs. Likewise after
successful ia64_elf_relax_br call.
Simon Marchi [Mon, 26 Feb 2018 19:30:43 +0000 (14:30 -0500)]
Add test for load command
There doesn't seem to by any test for the load command. I suggest to
add this test, so that we can have a minimum of confidence we don't
break it completely while refactoring the code that implements it.
gdb/testsuite/ChangeLog:
* gdb.base/load-command.c: New file.
* gdb.base/load-command.exp: New file.
* lib/gdb.exp (gdb_is_target_remote_prompt): Rename to...
(gdb_is_target_1): ...this, and generalize for other targets
than just remote.
(gdb_is_target_remote): Use gdb_is_target_1.
(gdb_is_target_native): use gdb_is_target_1.
Maciej W. Rozycki [Mon, 26 Feb 2018 19:43:17 +0000 (19:43 +0000)]
MIPS: Don't use a 32-bit BFD architecture with a 64-bit ABI
Select `bfd_mach_mips4000', which corresponds to the MIPS III ISA, the
earlies with 64-bit support, whenever a 32-bit BFD architecture has been
chosen to use with a 64-bit ABI. The situation can happen in a few
cases:
1. When the user has used `set architecture' or `set mips abi' commands
to override automatic selection and then starts a debug session by
requesting to run, attach or connect to a target.
2. In native debugging when reattaching to a previously debugged process
where the program to be debugged has been since discarded, as
observed with:
FAIL: gdb.base/attach.exp: attach2, with no file (GDB internal error)
in n32 and n64 regression testing.
3. In remote debugging with a non-XML debug stub when discarding the
program to be debugged while connected to the remote target, as
observed with:
FAIL: gdb.base/break-unload-file.exp: cmdline: always-inserted on: break: file (GDB internal error)
in n32 and n64 regression testing.
In the latter two cases the ABI, quite rightfully, is retained while the
program to be debugged is discarded. This is because in that case the
ABI previously determined is carried over along with `gdbarch' in use,
which is retained. The BFD architecture is however discarded and the
default then applies, because it is not attached to `gdbarch'.
In all these cases we trip with an internal error message as follows:
.../gdb/mips-tdep.c:766: internal-error: bad register size
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
This is a bug, please report it. For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.
coming from `mips_pseudo_register_read', because the raw register width
inferred from the BFD architecture turns out to be 4 for the general
registers while the cooked register width inferred from the ABI in
effect is 8.
We do not hit this internal error in remote debugging with an XML debug
stub, because in that case raw register width information is passed by
the stub along with the XML target description.
Ultimately I think we ought to make the BFD architecture sticky like the
ABI, however in the interim this simple fix will do, removing the error
across all three cases. The case where the user has used `set mips abi'
or `set architecture' commands has to be handled anyway, and although a
more sophisticated solution could be envisaged, such as reporting an
error with the respective `set' command, I think this is too much of a
corner case to bother.
gdb/
* mips-tdep.c (mips_gdbarch_init): Don't use a 32-bit BFD
architecture with a 64-bit ABI.
Maciej W. Rozycki [Mon, 26 Feb 2018 19:43:17 +0000 (19:43 +0000)]
MIPS: Reorder ABI determination ahead of target description loading
Move ABI determination code ahead of target description loading so that
architecture information can be adjusted according to the ABI selected,
and then used in OS dependent register information initialization needed
for target description processing. No functional change.
gdb/
* gdb/mips-tdep.c (mips_gdbarch_init): Reorder ABI determination
ahead of target description loading.
Tom Tromey [Wed, 26 Apr 2017 04:33:50 +0000 (22:33 -0600)]
Change frame_filter_flags to use DEF_ENUM_FLAGS_TYPE
This changes frame_filter_flags to use DEF_ENUM_FLAGS_TYPE, and
updates all the uses. It also changes the enum constants to use <<,
as suggested by Sergio.
ChangeLog
2018-02-26 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command_1): Update.
* python/python-internal.h (gdbpy_apply_frame_filter): Change type
of "flags".
* python/py-framefilter.c (py_print_frame)
(gdbpy_apply_frame_filter): Change type of "flags".
* mi/mi-cmd-stack.c (mi_apply_ext_lang_frame_filter): Change type
of "flags".
(mi_cmd_stack_list_frames, mi_cmd_stack_list_locals)
(mi_cmd_stack_list_args, mi_cmd_stack_list_variables): Update.
* extension.h (enum frame_filter_flag): Rename from
frame_filter_flags.
(frame_filter_flags): Define using DEF_ENUM_FLAGS_TYPE.
(apply_ext_lang_frame_filter): Change type of "flags".
* extension.c (apply_ext_lang_frame_filter): Change type of
"flags".
* extension-priv.h (struct extension_language_ops)
<apply_frame_filter>: Change type of "flags".
Tom Tromey [Mon, 20 Jun 2016 16:36:29 +0000 (10:36 -0600)]
Make "bt N" print correct number of frames when using a frame filter
PR python/16497 notes that using "bt" with a positive argument prints
the wrong number of frames when a frame filter is in use. Also, in this
case, the non-frame-filter path will print a message about "More stack
frames" when there are more; but this is not done in the frame-filter
case.
The first problem is that backtrace_command_1 passes the wrong value
to apply_ext_lang_frame_filter -- that function takes the final
frame's number as an argument, but backtrace_command_1 passes the
count, which is off by one.
The solution to the second problem is to have the C stack-printing
code stop at the correct number of frames and then print the message.
Tested using the buildbot.
ChangeLog
2018-02-26 Tom Tromey <tom@tromey.com>
PR python/16497:
* stack.c (backtrace_command_1): Set PRINT_MORE_FRAMES flag. Fix
off-by-one in py_end computation.
* python/py-framefilter.c (gdbpy_apply_frame_filter): Handle
PRINT_MORE_FRAMES.
* extension.h (enum frame_filter_flags) <PRINT_MORE_FRAMES>: New
constant.
2018-02-26 Tom Tromey <tom@tromey.com>
PR python/16497:
* gdb.python/py-framefilter.exp: Update test.
Tom Tromey [Wed, 10 Jan 2018 20:53:18 +0000 (13:53 -0700)]
Handle DW_TAG_variant_part and DW_TAG_variant
This changes dwarf2read to understand DW_TAG_variant_part and
DW_TAG_variant.
Note that DW_AT_discr_list is not handled. I did not need this for
Rust. I imagine this should not be too hard to add later, should
someone need it. Meanwhile I have gdb emit a complaint if it is seen.
There is a lurking issue concerning the placement of the discriminant
in the DWARF. For Rust, I ended up following the letter of the
standard and having the discriminant be a child of the
DW_TAG_variant_part. However, GCC's Ada support does not do this.
Pierre-Marie filed this with the DWARF committee:
http://dwarfstd.org/ShowIssue.php?issue=180123.1
However as that is read-only, if you have comments you might consider
adding them to the GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83935
Finally, there is a DWARF extension lurking in here. In Rust, a
univariant enum will not have a discriminant. However, in order to
unify the representation of all data-carrying enums, I've made LLVM
(and my forthcoming rustc patch) emit a univariant enum using a
DW_TAG_variant with a single variant part and without DW_AT_discr.
The lack of this DW_AT_discr is the extension. I will submit an issue
on dwarfstd.org about this.
2018-02-26 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct variant_field): New.
(struct nextfield) <variant>: New field.
(dwarf2_add_field): Handle DW_TAG_variant_part.
(dwarf2_attach_fields_to_type): Attach a discriminant_info to a
discriminated union.
(read_structure_type): Handle DW_TAG_variant_part.
(handle_struct_member_die): New function, extracted from
process_structure_scope. Handle DW_TAG_variant.
(process_structure_scope): Handle discriminated unions. Call
handle_struct_member_die.
2018-02-26 Tom Tromey <tom@tromey.com>
* gdb.dwarf2/variant.c: New file.
* gdb.dwarf2/variant.exp: New file.
Tom Tromey [Fri, 9 Feb 2018 20:31:51 +0000 (13:31 -0700)]
Convert Rust to use discriminated unions
A Rust enum is, essentially, a discriminated union. Currently the
Rust language support handles Rust enums locally, in rust-lang.c.
However, because I am changing the Rust compiler to use
DW_TAG_variant* to represent enums, it seemed better to have a single
internal representation for Rust enums in gdb.
This patch implements this idea by moving the current Rust enum
handling code to dwarf2read. This allows the simplification of some
parts of rust-lang.c as well.
2018-02-26 Tom Tromey <tom@tromey.com>
* rust-lang.h (rust_last_path_segment): Declare.
* rust-lang.c (rust_last_path_segment): Now public. Change
contract.
(struct disr_info): Remove.
(RUST_ENUM_PREFIX, RUST_ENCODED_ENUM_REAL)
(RUST_ENCODED_ENUM_HIDDEN, rust_union_is_untagged)
(rust_get_disr_info, rust_tuple_variant_type_p): Remove.
(rust_enum_p, rust_enum_variant): New function.
(rust_underscore_fields): Remove "offset" parameter.
(rust_print_enum): New function.
(rust_val_print) <TYPE_CODE_UNION>: Remove enum code.
<TYPE_CODE_STRUCT>: Call rust_print_enum when appropriate.
(rust_print_struct_def): Add "for_rust_enum" parameter. Handle
enums.
(rust_internal_print_type): New function, from rust_print_type.
Remove enum code.
(rust_print_type): Call rust_internal_print_type.
(rust_evaluate_subexp) <STRUCTOP_ANONYMOUS, STRUCTOP_STRUCT>:
Update enum handling.
* dwarf2read.c (struct dwarf2_cu) <rust_unions>: New field.
(rust_fully_qualify, alloc_discriminant_info, quirk_rust_enum)
(rust_union_quirks): New functions.
(process_full_comp_unit, process_full_type_unit): Call
rust_union_quirks.
(process_structure_scope): Update rust_unions if necessary.
2018-02-26 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Accept more possible results in enum test.
Tom Tromey [Fri, 9 Feb 2018 20:31:42 +0000 (13:31 -0700)]
Initial support for variant parts
This adds some initial support for variant parts to gdbtypes.h. A
variant part is represented as a union. The union has a flag
indicating that it has a discriminant, and information about the
discriminant is attached using the dynamic property system.
2018-02-26 Tom Tromey <tom@tromey.com>
* value.h (value_union_variant): Declare.
* valops.c (value_union_variant): New function.
* gdbtypes.h (TYPE_FLAG_DISCRIMINATED_UNION): New macro.
(struct discriminant_info): New.
(enum dynamic_prop_node_kind) <DYN_PROP_DISCRIMINATED>: New
enumerator.
(struct main_type) <flag_discriminated_union>: New field.
Tom Tromey [Wed, 21 Feb 2018 17:36:55 +0000 (10:36 -0700)]
Sign-extend non-bit-fields in unpack_bits_as_long
unpack_bits_as_long is documented as sign-extending its result when
the type is signed. However, it was only doing sign-extension in the
case where the field was a bitfield -- that is, not when the "bitsize"
parameter was 0, indicating the size should be taken from the type.
Also, unpack_bits_as_long was incorrectly computing the shift for
big-endian architectures for the non-bitfield case.
This patch fixes these bugs in a straightforward way. A new selftest
is included.
2018-02-26 Tom Tromey <tom@tromey.com>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/unpack-selftests.c.
* unittests/unpack-selftests.c: New file.
* value.c (unpack_bits_as_long): Fix bugs in non-bitfield cases.
Maciej W. Rozycki [Mon, 26 Feb 2018 16:11:03 +0000 (16:11 +0000)]
GAS/doc: Clean up `.dc' and `.ds' directive descriptions
gas/
* doc/as.texinfo (Pseudo Ops): Clean up `.dc' and `.ds'
descriptions.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Move read_partial_die to partial_die_info::read
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info) <read>: New method.
(read_partial_die): Remove the declaration.
(load_partial_dies): Update.
(partial_die_info::partial_die_info):
(read_partial_die): Change it to partial_die_info::read.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Move fixup_partial_die to partial_die_info::fixup
fixup_partial_die can be a partial_die_info method fixup.
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info) <fixup>: New method.
(fixup_partial_die): Remove declaration.
(scan_partial_symbols): Update.
(partial_die_parent_scope): Likewise.
(partial_die_full_name): Likewise.
(fixup_partial_die): Change it to partial_die_info::fixup.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Remove one argument abbrev_len in read_partial_die
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (read_partial_die): Update the declaration.
(load_partial_dies): Caller update.
(read_partial_die): Remove one argument abbrev_len.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Class-fy partial_die_info
This patch is to class-fy partial_die_info. Two things special here,
- disable assignment operator, but keep copy ctor, which is used in
load_partial_dies,
- have a private ctor which is only used by dwarf2_cu::find_partial_die,
I don't want other code use it, so make it private,
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct partial_die_info): Add ctor, delete
assignment operator.
(load_partial_dies): Use ctor and copy ctor.
(read_partial_die): Update.
(dwarf2_cu::find_partial_die): Use ctor.
Yao Qi [Mon, 26 Feb 2018 15:38:01 +0000 (15:38 +0000)]
Change find_partial_die_in_comp_unit to dwarf2_cu::find_partial_die
This patch changes find_partial_die_in_comp_unit to a dwarf2_cu method
find_partial_die.
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (struct dwarf2_cu) <find_partial_die>: New method.
(find_partial_die_in_comp_unit): Change it to
dwarf2_cu::find_partial_die.
(find_partial_die): Update.
Yao Qi [Mon, 26 Feb 2018 15:38:00 +0000 (15:38 +0000)]
Don't check abbrev is NULL in read_partial_die
'abbrev' won't be NULL, so don't check it.
gdb:
2018-02-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (read_partial_die): Remove the code checking abbrev
is NULL.
Yao Qi [Mon, 26 Feb 2018 15:38:00 +0000 (15:38 +0000)]
Re-write partial_die_info allocation in load_partial_dies
load_partial_dies has a "while (1)" loop to visit each die, and create
partial_die_info if needed in each iteration, like this,
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
while (1)
{
if (foo1) continue;
if (foo2) continue;
read_partial_die (, , part_die, ,);
....
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
};
the code was written in a way that spaces are allocated on necessary on
cu->comp_unit_obstack. I want to class-fy partial_die_info, but
partial_die_info ctor can't follow XOBNEW immediately, so this patch
rewrite this loop to:
while (1)
{
if (foo1) continue;
if (foo2) continue;
struct partial_die_info pdi;
read_partial_die (, , &pdi, ,);
part_die = XOBNEW (&cu->comp_unit_obstack, struct partial_die_info);
memcpy (part_die, &pdi, sizeof (pdi));
};
we create a local variable pdi, if we need it, call XOBNEW, and copy.
This also reduce one XOBNEW call. I measured the number of XOBNEW call in
load_partial_dies when gdb reads dwarf2read.o, without this patch, it is
18827, and with this patch, it is 18826.
gdb:
2018-026-26 Yao Qi <yao.qi@linaro.org>
* dwarf2read.c (load_partial_dies): Move the location of XOBNEW.
Alan Hayward [Mon, 26 Feb 2018 10:51:36 +0000 (10:51 +0000)]
Move arch/tdesc.h to common/tdesc.h
gdb/
* arch/amd64.h: Use common/tdesc.h.
* arch/i386.c: Likewise.
* arch/i386.h: Likewise.
* arch/tic6x.c: Likewise.
* arch/tdesc.h: Move file from here...
* common/tdesc.h: ...to here.
* features/aarch64-core.c: Regenerate.
* features/aarch64-fpu.c: Regenerate.
* features/i386/32bit-avx.c: Regenerate.
* features/i386/32bit-avx512.c: Regenerate.
* features/i386/32bit-core.c: Regenerate.
* features/i386/32bit-linux.c: Regenerate.
* features/i386/32bit-mpx.c: Regenerate.
* features/i386/32bit-pkeys.c: Regenerate.
* features/i386/32bit-sse.c: Regenerate.
* features/i386/64bit-avx.c: Regenerate.
* features/i386/64bit-avx512.c: Regenerate.
* features/i386/64bit-core.c: Regenerate.
* features/i386/64bit-linux.c: Regenerate.
* features/i386/64bit-mpx.c: Regenerate.
* features/i386/64bit-pkeys.c: Regenerate.
* features/i386/64bit-segments.c: Regenerate.
* features/i386/64bit-sse.c: Regenerate.
* features/i386/x32-core.c: Regenerate.
* features/tic6x-c6xp.c: Regenerate.
* features/tic6x-core.c: Regenerate.
* features/tic6x-gp.c: Regenerate.
* target-descriptions.c: Use common/tdesc.h.
* target-descriptions.h: Likewise.
gdbserver/
* tdesc.c: Use common/tdesc.h.
* tdesc.h: Likewise.
Nick Clifton [Mon, 26 Feb 2018 11:28:23 +0000 (11:28 +0000)]
Fix typo in documentation of assembler's .dc directive.
* doc/as.texinfo (Dc): Fix typo.
Alan Modra [Sun, 25 Feb 2018 21:46:24 +0000 (08:16 +1030)]
Segfault on phdrs allocated but not created
A number of ARM tests show results like:
ld-new: no address assigned to the veneers output section .gnu.sgstubs
ld-new: can not size stub section: invalid operation
ld-new: warning: cannot find entry symbol _start; defaulting to
0000000000010074
ld-new: tmpdir/cmse-veneers-no-gnu_sgstubs: warning: allocated section `.text' not in segment
Segmentation fault
PASS: Secure gateway veneers: no .gnu.sgstubs section
The PASS despite the segv shows the danger of using "#..." to match
error output. This patch doesn't try to fix the testuite, but does
prevent the segfault.
* elf.c (assign_file_positions_except_relocs): Don't segfault
when actual number of phdrs is less than allocated. Delete
outdated comment. Formatting.
Alan Modra [Fri, 23 Feb 2018 23:58:12 +0000 (10:28 +1030)]
ld error/warning messages
This patch standardizes messages in ld, to better conform to the GNU
coding standard. Besides issues of capitalization and full-stops,
I've
- Split up help messages for target options, so that adding a new
option does not mean loss of translation for all the others.
- Embedded tabs have been removed, since a user might have tab stops
set at other than 8 char intervals.
- Added missing program name (%P). ld isn't the compiler.
- Put %F and %X first (and removed %X if %F was present). These can
go anywhere, but look silly in the m%Fiddle of a message, and
choosing "%P%F:" in some messages but "%F%P:" in others leads to the
likelihood of duplication in ld.pot. Besides, the colon belongs
with %P.
* emulparams/call_nop.sh, * emulparams/cet.sh,
* emulparams/elf32mcore.sh, * emultempl/aarch64elf.em
* emultempl/aix.em, * emultempl/alphaelf.em, * emultempl/armcoff.em,
* emultempl/armelf.em, * emultempl/avrelf.em, * emultempl/beos.em,
* emultempl/bfin.em, * emultempl/cr16elf.em, * emultempl/elf32.em,
* emultempl/elf-generic.em, * emultempl/hppaelf.em,
* emultempl/linux.em, * emultempl/lnk960.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kcoff.em,
* emultempl/m68kelf.em, * emultempl/metagelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nds32elf.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc32elf.em, * emultempl/ppc64elf.em,
* emultempl/scoreelf.em, * emultempl/sh64elf.em,
* emultempl/spuelf.em, * emultempl/sunos.em, * emultempl/tic6xdsbt.em,
* emultempl/ticoff.em, * emultempl/v850elf.em, * emultempl/vms.em,
* emultempl/vxworks.em, * emultempl/xtensaelf.em, * ldcref.c,
* ldctor.c, * ldexp.c, * ldfile.c, * ldgram.y, * ldlang.c,
* ldmain.c, * ldmisc.c, * ldwrite.c, * lexsup.c, * mri.c, * pe-dll.c,
* plugin.c: Standardize error/warning messages.
* testsuite/ld-arc/jli-overflow.err,
* testsuite/ld-arm/cmse-implib-errors.out,
* testsuite/ld-arm/cmse-new-earlier-later-implib.out,
* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out,
* testsuite/ld-arm/cmse-new-wrong-implib.out,
* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out,
* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out,
* testsuite/ld-arm/vxworks1-static.d,
* testsuite/ld-cris/tls-err-20x.d, * testsuite/ld-cris/tls-err-29.d,
* testsuite/ld-cris/tls-err-31.d, * testsuite/ld-cris/tls-err-33.d,
* testsuite/ld-cris/tls-err-35.d, * testsuite/ld-cris/tls-err-37.d,
* testsuite/ld-cris/tls-err-39.d, * testsuite/ld-cris/tls-err-41.d,
* testsuite/ld-cris/tls-err-43.d, * testsuite/ld-cris/tls-err-45.d,
* testsuite/ld-cris/tls-err-47.d, * testsuite/ld-cris/tls-err-49.d,
* testsuite/ld-cris/tls-err-51.d, * testsuite/ld-cris/tls-err-67.d,
* testsuite/ld-elf/dwarf2.err, * testsuite/ld-elf/dwarf3.err,
* testsuite/ld-elf/orphan-5.l, * testsuite/ld-elf/orphan-6.l,
* testsuite/ld-i386/vxworks1-static.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic.d,
* testsuite/ld-mips-elf/jal-global-overflow-1.d,
* testsuite/ld-mips-elf/jal-local-overflow-1.d,
* testsuite/ld-mips-elf/mode-change-error-1.d,
* testsuite/ld-mips-elf/unaligned-branch-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-2.d,
* testsuite/ld-mips-elf/unaligned-branch.d,
* testsuite/ld-mips-elf/unaligned-jalx-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jump-micromips.d,
* testsuite/ld-mips-elf/unaligned-jump-mips16.d,
* testsuite/ld-mips-elf/unaligned-jump.d,
* testsuite/ld-mips-elf/unaligned-ldpc-1.d,
* testsuite/ld-mips-elf/unaligned-lwpc-1.d,
* testsuite/ld-mips-elf/undefined.d,
* testsuite/ld-mips-elf/vxworks1-static.d,
* testsuite/ld-mmix/bpo-20.d, * testsuite/ld-mmix/bpo-20m.d,
* testsuite/ld-mmix/bpo-7.d, * testsuite/ld-mmix/bpo-7m.d,
* testsuite/ld-mmix/bpo-8.d, * testsuite/ld-mmix/bpo-8m.d,
* testsuite/ld-mmix/greg-17.d, * testsuite/ld-mmix/greg-18.d,
* testsuite/ld-mmix/greg-8.d, * testsuite/ld-mmix/greg-9.d,
* testsuite/ld-plugin/plugin-14.d, * testsuite/ld-plugin/plugin-15.d,
* testsuite/ld-plugin/plugin-16.d, * testsuite/ld-plugin/plugin-20.d,
* testsuite/ld-plugin/plugin-21.d, * testsuite/ld-plugin/plugin-22.d,
* testsuite/ld-plugin/plugin-23.d, * testsuite/ld-plugin/plugin-6.d,
* testsuite/ld-plugin/plugin-7.d, * testsuite/ld-plugin/plugin-8.d,
* testsuite/ld-powerpc/aix-weak-3-32.d,
* testsuite/ld-powerpc/aix-weak-3-64.d,
* testsuite/ld-powerpc/vxworks1-static.d,
* testsuite/ld-sh/vxworks1-static.d,
* testsuite/ld-sparc/vxworks1-static.d,
* testsuite/ld-undefined/undefined.exp,
* testsuite/ld-x86-64/pie1.d: Update for changed errors and warnings.
* testsuite/ld-elf/warn1.d, * testsuite/ld-elf/warn2.d: Correct regex.
Alan Modra [Sat, 24 Feb 2018 08:20:21 +0000 (18:50 +1030)]
ld message translation for emultempl and emulparams
Most of the emultempl/*.em error/warning messages do not currently
appear in ld.pot, and fixing that is not simply a matter of adding
missing files to POTFILES. The difficulty is the shell-script
quoting, for example aarch64elf.em:PARSE_AND_LIST_OPTIONS "Don'\''t".
I suppose you could avoid contractions like "don't" but I'm unsure as
to whether gettext could handle everything in the emulparams scripts.
The right thing to do is feed the generated C files to gettext, as
this patch does. The patch just copies what is already done in bfd/
for generated files.
* Makefile.am (EMULATION_FILES, POTFILES): Delete.
(SRC_POTFILES, BLD_POTFILES): Define.
(po/POTFILES.in): Delete rule.
(po/SRC-POTFILES.in, po/BLD-POTFILES.in): New rules.
* configure.ac: Add AC_CONFIG_COMMANDS to create po/Makefile.
* po/Make-in (DISTFILES): Remove POTFILES.in, add SRC-POTFILES.in
and BLD-POTFILES.in.
(POTFILES): Delete.
(SRC-POTFILES, BLD-POTFILES): Define place marker.
(ld.pot): Build from SRC-POTFILES plus BLD-POTFILES.
(distclean, maintainer-clean): Tidy up new files.
(POTFILES, POTFILES.in): Delete rules.
(SRC-POTFILES, BLD-POTFILES, SRC-POTFILES.in, BLD-POTFILES.in):
New rules.
(Makefile): Depend on SRC-POTFILES and BLD-POTFILES.
* po/SRC-POTFILES.in: Rename from po/POTFILES.in.
* po/BLD-POTFILES.in: New file.
* Makefile.in: Regenerate.
* configure: Regenerate.
Alan Modra [Sat, 24 Feb 2018 00:03:33 +0000 (10:33 +1030)]
crx string overflow warning
gcc8 complains wrongly about the buffer not being large enough, at
least at -Og optimization.
* crx-dis.c (getregliststring): Allocate a large enough buffer
to silence false positive gcc8 warning.
GDB Administrator [Mon, 26 Feb 2018 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 21 Feb 2018 02:39:46 +0000 (13:09 +1030)]
assorted target messages
bfd/
* elf-m10300.c, * elf-s390-common.c, * elf32-arc.c, * elf32-cris.c,
* elf32-dlx.c, * elf32-frv.c, * elf32-i370.c, * elf32-lm32.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c,
* elf32-microblaze.c, * elf32-msp430.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-rl78.c, * elf32-rx.c,
* elf32-score.c, * elf32-score7.c, * elf32-sh-symbian.c,
* elf32-sh.c, * elf32-spu.c, * elf32-v850.c, * elf32-xtensa.c,
* elf64-alpha.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-sh64.c, * elf64-sparc.c, * elfnn-ia64.c, * elfxx-tilegx.c,
* mmo.c, * osf-core.c, * srec.c, * vms-alpha.c: Standardize
error/warning messages.
ld/
* testsuite/ld-cris/pcrelcp-1.d,
* testsuite/ld-mmix/start-2.d: Update.
Alan Modra [Wed, 21 Feb 2018 02:39:29 +0000 (13:09 +1030)]
BFD messages
bfd/
* archive.c, * bfd.c, * linker.c, * reloc.c, * stabs.c,
* syms.c: Standardize error/warning messages.
binutils/
* testsuite/binutils-all/mips/mips-reginfo-n32.d,
* testsuite/binutils-all/mips/mips-reginfo.d: Update.
gas/
* testsuite/gas/mips/reginfo-2.l: Update.
ld/
* testsuite/ld-arm/cmse-implib-errors.out,
* testsuite/ld-arm/cmse-new-earlier-later-implib.out,
* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out,
* testsuite/ld-arm/cmse-new-wrong-implib.out,
* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out,
* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out,
* testsuite/ld-cris/badgotr1.d,
* testsuite/ld-cris/tls-err-24.d,
* testsuite/ld-cris/tls-err-25.d,
* testsuite/ld-cris/tls-err-26.d,
* testsuite/ld-cris/tls-err-27.d,
* testsuite/ld-cris/tls-err-28.d,
* testsuite/ld-cris/tls-err-40.d,
* testsuite/ld-cris/tls-err-44.d,
* testsuite/ld-cris/tls-err-48.d,
* testsuite/ld-cris/tls-err-52.d,
* testsuite/ld-cris/tls-err-53.d,
* testsuite/ld-cris/tls-err-55.d,
* testsuite/ld-cris/tls-err-56.d,
* testsuite/ld-cris/tls-err-62.d,
* testsuite/ld-cris/tls-err-65.d,
* testsuite/ld-cris/tls-err-77.d,
* testsuite/ld-elf/empty-implib.out,
* testsuite/ld-elf/indirect.exp: Update.
Alan Modra [Wed, 21 Feb 2018 02:37:59 +0000 (13:07 +1030)]
AOUT/COFF/PE messages
Capitalization, full-stops and unnecessary trailing \n fixes.
* aout-adobe.c, * aout-cris.c, * i386linux.c, * m68klinux.c,
* sparclinux.c, * coff-alpha.c, * coff-arm.c, * coff-mcore.c,
* coffcode.h, * coffgen.c, * cofflink.c, * ecoff.c, * pe-mips.c,
* peXXigen.c, * peicode.h: Standardize error/warning messages.
Alan Modra [Wed, 21 Feb 2018 02:34:48 +0000 (13:04 +1030)]
ARM and AArch64 messages
More standarization of error/warning messages. The ARM backend has
some multi-line error messages, which don't fit particularly well with
the GNU coding standard insistence that error messages shouldn't be
capitalized or have a full-stop. I've replaced the line breaks with
semicolons.
So for instance the following
system/path/to/ld: myobject.o: invalid special symbol `foo'.
system/path/to/ld: It must be a global or weak function symbol.
becomes
system/path/to/ld: myobject.o: invalid special symbol `foo'; it must be a global or weak function symbol
bfd/
* elf32-arm.c, * elfnn-aarch64.c: Standardize error/warning messages.
ld/
* testsuite/ld-aarch64/reloc-overflow-bad.d,
* testsuite/ld-arm/attr-merge-9.out,
* testsuite/ld-arm/attr-merge-arch-2.d,
* testsuite/ld-arm/attr-merge-unknown-1.d,
* testsuite/ld-arm/attr-merge-unknown-2.d,
* testsuite/ld-arm/attr-merge-unknown-2r.d,
* testsuite/ld-arm/attr-merge-unknown-3.d,
* testsuite/ld-arm/cmse-implib-errors.out,
* testsuite/ld-arm/cmse-new-earlier-later-implib.out,
* testsuite/ld-arm/cmse-new-implib-no-output.out,
* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out,
* testsuite/ld-arm/cmse-new-implib.out,
* testsuite/ld-arm/cmse-new-wrong-implib.out,
* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out,
* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out,
* testsuite/ld-arm/group-relocs-alu-bad-2.d,
* testsuite/ld-arm/group-relocs-alu-bad.d,
* testsuite/ld-arm/group-relocs-ldc-bad-2.d,
* testsuite/ld-arm/group-relocs-ldc-bad.d,
* testsuite/ld-arm/group-relocs-ldr-bad-2.d,
* testsuite/ld-arm/group-relocs-ldr-bad.d,
* testsuite/ld-arm/group-relocs-ldrs-bad-2.d,
* testsuite/ld-arm/group-relocs-ldrs-bad.d,
* testsuite/ld-arm/stm32l4xx-cannot-fix-far-ldm.d: Update.
Alan Modra [Tue, 20 Feb 2018 10:32:16 +0000 (21:02 +1030)]
MIPS messages
More standardization of messages.
bfd/
* elfxx-mips.c: Standardize error/warning messages.
binutils/
* testsuite/binutils-all/mips/mips-reginfo-n32.d,
* testsuite/binutils-all/mips/mips-reginfo.d: Update.
gas/
* testsuite/gas/mips/reginfo-2.l: Update.
ld/
* testsuite/ld-mips-elf/attr-gnu-4-12.d,
* testsuite/ld-mips-elf/attr-gnu-4-13.d,
* testsuite/ld-mips-elf/attr-gnu-4-14.d,
* testsuite/ld-mips-elf/attr-gnu-4-16.d,
* testsuite/ld-mips-elf/attr-gnu-4-17.d,
* testsuite/ld-mips-elf/attr-gnu-4-18.d,
* testsuite/ld-mips-elf/attr-gnu-4-19.d,
* testsuite/ld-mips-elf/attr-gnu-4-21.d,
* testsuite/ld-mips-elf/attr-gnu-4-23.d,
* testsuite/ld-mips-elf/attr-gnu-4-24.d,
* testsuite/ld-mips-elf/attr-gnu-4-25.d,
* testsuite/ld-mips-elf/attr-gnu-4-26.d,
* testsuite/ld-mips-elf/attr-gnu-4-27.d,
* testsuite/ld-mips-elf/attr-gnu-4-28.d,
* testsuite/ld-mips-elf/attr-gnu-4-29.d,
* testsuite/ld-mips-elf/attr-gnu-4-31.d,
* testsuite/ld-mips-elf/attr-gnu-4-32.d,
* testsuite/ld-mips-elf/attr-gnu-4-34.d,
* testsuite/ld-mips-elf/attr-gnu-4-35.d,
* testsuite/ld-mips-elf/attr-gnu-4-36.d,
* testsuite/ld-mips-elf/attr-gnu-4-37.d,
* testsuite/ld-mips-elf/attr-gnu-4-38.d,
* testsuite/ld-mips-elf/attr-gnu-4-39.d,
* testsuite/ld-mips-elf/attr-gnu-4-41.d,
* testsuite/ld-mips-elf/attr-gnu-4-42.d,
* testsuite/ld-mips-elf/attr-gnu-4-43.d,
* testsuite/ld-mips-elf/attr-gnu-4-45.d,
* testsuite/ld-mips-elf/attr-gnu-4-46.d,
* testsuite/ld-mips-elf/attr-gnu-4-47.d,
* testsuite/ld-mips-elf/attr-gnu-4-48.d,
* testsuite/ld-mips-elf/attr-gnu-4-49.d,
* testsuite/ld-mips-elf/attr-gnu-4-52.d,
* testsuite/ld-mips-elf/attr-gnu-4-53.d,
* testsuite/ld-mips-elf/attr-gnu-4-54.d,
* testsuite/ld-mips-elf/attr-gnu-4-58.d,
* testsuite/ld-mips-elf/attr-gnu-4-59.d,
* testsuite/ld-mips-elf/attr-gnu-4-61.d,
* testsuite/ld-mips-elf/attr-gnu-4-62.d,
* testsuite/ld-mips-elf/attr-gnu-4-63.d,
* testsuite/ld-mips-elf/attr-gnu-4-64.d,
* testsuite/ld-mips-elf/attr-gnu-4-68.d,
* testsuite/ld-mips-elf/attr-gnu-4-69.d,
* testsuite/ld-mips-elf/attr-gnu-4-71.d,
* testsuite/ld-mips-elf/attr-gnu-4-72.d,
* testsuite/ld-mips-elf/attr-gnu-4-73.d,
* testsuite/ld-mips-elf/attr-gnu-4-74.d,
* testsuite/ld-mips-elf/attr-gnu-4-78.d,
* testsuite/ld-mips-elf/attr-gnu-4-79.d,
* testsuite/ld-mips-elf/attr-gnu-4-81.d,
* testsuite/ld-mips-elf/attr-gnu-4-89.d,
* testsuite/ld-mips-elf/attr-gnu-8-12.d,
* testsuite/ld-mips-elf/attr-gnu-8-21.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n32.d,
* testsuite/ld-mips-elf/bal-jalx-pic-n64.d,
* testsuite/ld-mips-elf/bal-jalx-pic.d,
* testsuite/ld-mips-elf/mode-change-error-1.d,
* testsuite/ld-mips-elf/unaligned-branch-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-micromips.d,
* testsuite/ld-mips-elf/unaligned-branch-mips16.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-1.d,
* testsuite/ld-mips-elf/unaligned-branch-r6-2.d,
* testsuite/ld-mips-elf/unaligned-branch.d,
* testsuite/ld-mips-elf/unaligned-jalx-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-3.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d,
* testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d,
* testsuite/ld-mips-elf/unaligned-jump-micromips.d,
* testsuite/ld-mips-elf/unaligned-jump-mips16.d,
* testsuite/ld-mips-elf/unaligned-jump.d: Update.
Alan Modra [Tue, 20 Feb 2018 09:02:12 +0000 (19:32 +1030)]
ELF linker messages
This fixes a number of cases where we capitalized error messages or
printed a full-stop, and corrects "Dwarf" to "DWARF".
bfd/
* dwarf2.c, * elf-attrs.c, * elf-eh-frame.c, * elf.c, * elf32-gen.c,
* elflink.c: Standardize error/warning messages. Replace use of
linker callback einfo with _bfd_error_handler when possible.
ld/
* testsuite/ld-elf/indirect.exp,
* testsuite/ld-elf/pr22649-2ab-mips.msg,
* testsuite/ld-elf/pr22649-2cd-mips.msg,
* testsuite/ld-elf/pr22649.msg,
* testsuite/ld-elf/tls_common.exp,
* testsuite/ld-elfcomm/elfcomm.exp,
* testsuite/ld-arm/attr-merge-incompatible.d,
* testsuite/ld-tic6x/attr-compatibility-gnu-other.d,
* testsuite/ld-tic6x/attr-compatibility-other-gnu.d,
* testsuite/ld-tic6x/attr-compatibility-other-other.d,
* testsuite/ld-i386/warn1.d: Update expected error/warning messages.
Alan Modra [Wed, 21 Feb 2018 11:17:07 +0000 (21:47 +1030)]
unrecognized/unsupported reloc message
It must get boring translating all the variants we have of
unrecognized/unsupported/invalid/unexpected reloc number. This patch
cuts down on the number of variations.
* aoutx.h, * coff-alpha.c, * coff-i860.c, * coff-m68k.c,
* coff-mcore.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
* coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-w65.c,
* elf-bfd.h, * elf-m10300.c, * elf.c, * elf32-avr.c, * elf32-bfin.c,
* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
* elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
* elf32-fr30.c, * elf32-frv.c, * elf32-i370.c, * elf32-i386.c,
* elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
* elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c,
* elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
* elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-or1k.c,
* elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-rx.c,
* elf32-s390.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-wasm32.c,
* elf32-xgate.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
* elfnn-riscv.c, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-riscv.h,
* elfxx-sparc.c, * elfxx-sparc.h, * reloc.c: Standardize
unrecognized/unsupported reloc message.
Alan Modra [Tue, 20 Feb 2018 08:59:09 +0000 (19:29 +1030)]
PPC error/warning messages
The GNU coding standard says error messages should be of the form
program:sourcefile:lineno: message
or
program: message
and
"The string message should not begin with a capital letter when it
follows a program name and/or file name, because that isn’t the
beginning of a sentence. (The sentence conceptually starts at the
beginning of the line.) Also, it should not end with a period."
This patch does that for ppc, and removes some British spelling.
I've also switched some error output from using the linker callback
einfo to _bfd_error_handler, due to improved compilation time
argument checking now done for the latter function.
bfd/
* elf32-ppc.c: Standardize error/warning messages. Use
_bfd_error_handler rather than einfo when einfo features not used.
* elf64-ppc.c: Likewise.
ld/
* testsuite/ld-powerpc/attr-gnu-12-21.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-12.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-13.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-21.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-23.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-31.d: Update.
* testsuite/ld-powerpc/attr-gnu-4-32.d: Update.
* testsuite/ld-powerpc/attr-gnu-8-23.d: Update.
Simon Marchi [Sun, 25 Feb 2018 20:11:56 +0000 (15:11 -0500)]
Fix double space expected in cp_test_ptype_class
I noticed some failures of some buildbot slaves, e.g.:
FAIL: gdb.cp/nested-types.exp: ptype S10 (limit = 1) // wrong nested type enum definition: enum S10::E10 {S10::A10, S10::B10, S10::C10};
The issue is that they have an older gcc (not c++11 by default?) that
doesn't emit the enum underlying type information. When the
enum type is printed by ptype, it looks like this:
enum S10::E10 {S10::A10, S10::B10, S10::C10};
instead of this on older gccs:
enum S10::E10 : unsigned int {S10::A10, S10::B10, S10::C10};
The regex that matches this is in cp_test_ptype_class, and is
enum $nested_name (: (unsigned )?int)? \{
If the "unsigned int" portion is not present, then it requires the
string to have two spaces between the enum name and opening bracket.
The fix is simply to move the trailing space inside the ? group.
gdb/testsuite/ChangeLog:
* lib/cp-support.exp (cp_test_ptype_class): Move space inside
parentheses.
GDB Administrator [Sun, 25 Feb 2018 00:00:59 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 21 Feb 2018 23:39:18 +0000 (16:39 -0700)]
Remove most cleanups from linux-thread-db.c
This removes most (but not all) cleanups from linux-thread-db.c.
std::string and std::vector are used in place of manual memory
management.
The remaining cleanup in linux-thread-db.c uses
make_cleanup_free_char_ptr_vec, which requires a somewhat bigger
change.
Regression tested by the buildbot.
ChangeLog
2018-02-24 Tom Tromey <tom@tromey.com>
* linux-thread-db.c (try_thread_db_load_from_pdir_1)
(try_thread_db_load_from_dir, thread_db_load_search): Use
std::string.
(info_auto_load_libthread_db_compare): Return bool. Change
argument types.
(info_auto_load_libthread_db): Use std::vector, std::string.
Remove cleanups.
Tom Tromey [Wed, 21 Feb 2018 23:53:56 +0000 (16:53 -0700)]
Remove cleanups from check_fast_tracepoint_sals
This changes the gdbarch fast_tracepoint_valid_at method to use a
std::string as its out parameter, and then updates all the uses. This
allows removing a cleanup from breakpoint.c.
Regression tested by the buildbot.
ChangeLog
2018-02-24 Tom Tromey <tom@tromey.com>
* i386-tdep.c (i386_fast_tracepoint_valid_at): "msg" now a
std::string.
* gdbarch.sh (fast_tracepoint_valid_at): Change "msg" to a
std::string*.
* gdbarch.c: Rebuild.
* gdbarch.h: Rebuild.
* breakpoint.c (check_fast_tracepoint_sals): Use std::string.
* arch-utils.h (default_fast_tracepoint_valid_at): Update.
* arch-utils.c (default_fast_tracepoint_valid_at): "msg" now a
std::string*.
GDB Administrator [Sat, 24 Feb 2018 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Fri, 23 Feb 2018 20:14:41 +0000 (20:14 +0000)]
GDB/testsuite: Fix a typo in $actual_line
Fix a commit
883fd55ab104 ("Record nested types") issue:
ERROR: tcl error sourcing .../gdb/testsuite/gdb.cp/nested-types.exp.
ERROR: can't read "actual_linejj": no such variable
while executing
"append txt " definition: $actual_linejj""
(procedure "cp_test_ptype_class" line 324)
invoked from within
"cp_test_ptype_class $name "ptype $name (limit = $limit)" $key $name $children" (procedure "test_nested_limit" line 28)
invoked from within
"test_nested_limit -1 false"
(file ".../gdb/testsuite/gdb.cp/nested-types.exp" line 310)
invoked from within
"source .../gdb/testsuite/gdb.cp/nested-types.exp"
("uplevel" body line 1)
invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.cp/nested-types.exp"
invoked from within
"catch "uplevel #0 source $test_file_name""
testcase .../gdb/testsuite/gdb.cp/nested-types.exp completed in 9 seconds
caused by $actual_line having been accidentally referred to as
$actual_linejj in one place.
gdb/testsuite/
* lib/cp-support.exp (cp_test_ptype_class): Fix a typo in the
name of a variable: $actual_linejj -> $actual_line.
Simon Marchi [Fri, 23 Feb 2018 18:03:33 +0000 (13:03 -0500)]
dwarf: Make sect_offset 64-bits
Does anybody have an opinion about this? It would be nice to unbreak
the "default" build with clang (i.e. without passing special -Wno-error=
flags).
Here's a version rebased on today's master.
From
47d28075117fa2ddb93584ec50881e33777a85e5 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Sat, 30 Dec 2017 22:48:18 -0500
Subject: [PATCH] dwarf: Make sect_offset 64-bits
Compiling with Clang 6 shows these errors:
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:26610:43: error: result of comparison of constant
4294967296 with expression of type 'typename std::underlying_type<sect_offset>::type' (a
ka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (to_underlying (per_cu.sect_off) >= (static_cast<uint64_t> (1) << 32))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/emaisin/src/binutils-gdb/gdb/dwarf2read.c:26618:43: error: result of comparison of constant
4294967296 with expression of type 'typename std::underlying_type<sect_offset>::type' (a
ka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (to_underlying (per_cu.sect_off) >= (static_cast<uint64_t> (1) << 32))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The code in question checks if there is any offset exceeding 32 bits,
and therefore if we need to use the 64-bit DWARF format when writing the
.debug_names section. The type we use currently to represent section
offsets is an unsigned int (32-bits), which means a value of this type
will never exceed 32 bits, hence the errors above.
There are many signs that we want to support 64-bits DWARF (although I
haven't tested), such as:
- We correctly read initial length fields (read_initial_length)
- We take that into account when reading offsets (read_offset_1)
- The check_dwarf64_offsets function
However, I don't see how it can work if sect_offset is a 32-bits type.
Every time we record a section offset, we risk truncating the value.
And if a file uses the 64-bit DWARF format, it's most likely because
there are such offset values that overflow 32 bits.
Because of this, I think the way forward is to change sect_offset to be
a uint64_t. It will be able to represent any offset, regardless of the
bitness of the DWARF info.
This patch was regtested on the buildbot.
gdb/ChangeLog:
* gdbtypes.h (sect_offset): Change type to uint64_t.
(sect_offset_str): New function.
* dwarf2read.c (create_addrmap_from_aranges): Use
sect_offset_str.
(error_check_comp_unit_head): Likewise.
(create_debug_type_hash_table): Likewise.
(read_cutu_die_from_dwo): Likewise.
(init_cutu_and_read_dies): Likewise.
(init_cutu_and_read_dies_no_follow): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(partial_die_parent_scope): Likewise.
(peek_die_abbrev): Likewise.
(process_queue): Likewise.
(dwarf2_physname): Likewise.
(read_namespace_alias): Likewise.
(read_import_statement): Likewise.
(create_dwo_cu_reader): Likewise.
(create_cus_hash_table): Likewise.
(lookup_dwo_cutu): Likewise.
(inherit_abstract_dies): Likewise.
(read_func_scope): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_add_member_fn): Likewise.
(read_common_block): Likewise.
(read_module_type): Likewise.
(read_typedef): Likewise.
(read_subrange_type): Likewise.
(load_partial_dies): Likewise.
(read_partial_die): Likewise.
(find_partial_die): Likewise.
(read_str_index): Likewise.
(dwarf2_string_attr): Likewise.
(build_error_marker_type): Likewise.
(lookup_die_type): Likewise.
(dump_die_shallow): Likewise.
(follow_die_ref): Likewise.
(dwarf2_fetch_die_loc_sect_off): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(follow_die_sig): Likewise.
(get_signatured_type): Likewise.
(get_DW_AT_signature_type): Likewise.
(dwarf2_find_containing_comp_unit): Likewise.
(set_die_type): Likewise.
Alan Modra [Fri, 23 Feb 2018 10:52:43 +0000 (21:22 +1030)]
PR22881, null pointer dereference in assign_file_positions_for_non_load_sections
PR 22881
* elf.c (assign_file_positions_for_non_load_sections): Remove RELRO
segment if no matching LOAD segment.
Nick Clifton [Fri, 23 Feb 2018 10:43:53 +0000 (10:43 +0000)]
Document the assembler's .dc, .dcb and .ds directives.
* doc/as.texinfo (Pseudo Ops): Add nodes for .dc, .dcb and .ds.
Kuan-Lin Chen [Fri, 23 Feb 2018 06:25:25 +0000 (14:25 +0800)]
nds32: Support target directive .ict_model.
Kuan-Lin Chen [Fri, 23 Feb 2018 06:21:31 +0000 (14:21 +0800)]
Fix up one ChangeLog date.
GDB Administrator [Fri, 23 Feb 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Sriraman Tallam [Thu, 22 Feb 2018 21:56:46 +0000 (13:56 -0800)]
New plugin interface to get list of symbols wrapped with --wrap option.
2018-02-22 Sriraman Tallam <tmsriram@google.com>
* plugin.cc (get_wrap_symbols): New plugin interface.
(load): Add get_wrap_symbols to transfer vector.
* plugin-api.h (ld_plugin_get_wrap_symbols): New plugin interface.
* testsuite/plugin_test.c (onload): Call and check get_wrap_symbols
interface.
* testsuite/plugin_test_wrap_symbols.sh: New test script.
* testsuite/plugin_test_wrap_symbols_1.cc: New file.
* testsuite/plugin_test_wrap_symbols_2.cc: New file.
* testsuite/Makefile.am (plugin_test_wrap_symbols): New test.
* testsuite/Makefile.in: Regenerate.
Jim Wilson [Thu, 22 Feb 2018 19:28:51 +0000 (11:28 -0800)]
RISC-V: Make disassebler work for --enable-targets=all config.
opcodes/
* disassemble.c (ARCH_riscv): Define if ARCH_all.
Andre Simoes Dias Vieira [Wed, 21 Feb 2018 15:11:50 +0000 (15:11 +0000)]
Diagnose when trying to assemble conditional FP16 vmovx and vins
This patch makes GAS emit a warning when trying to assemble the Armv8.2
FP16 instructions VMOVX and VINS with condition codes. The Armv8-A
Reference Manual specifies these instructions without conditional codes
and says that if they are found in an IT block that they are CONSTRAINED
UNPREDICABLE.
gas/ChangeLog:
2018-02-22 Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/tc-arm.c (do_neon_movhf): If conditional error out when in arm
mode and emit warning in thumb mode.
* testsuite/gas/arm/armv8-2-fp16-scalar-bad.s: Add new tests.
* testsuite/gas/arm/armv8-2-fp16-scalar-bad.l: Idem.
H.J. Lu [Thu, 22 Feb 2018 14:18:27 +0000 (06:18 -0800)]
x86: Add {rex} pseudo prefix
Add {rex} pseudo prefix to generate a REX byte for integer and legacy
vector instructions if possible. Note that this differs from the rex
prefix which generates REX prefix unconditionally.
gas/
* config/tc-i386.c (_i386_insn): Add rex_encoding.
(md_assemble): When i.rex_encoding is true, generate a REX byte
if possible.
(parse_insn): Set i.rex_encoding for {rex}.
* doc/c-i386.texi: Document {rex}.
* testsuite/gas/i386/x86-64-pseudos.s: Add {rex} tests.
* testsuite/gas/i386/x86-64-pseudos.d: Updated.
opcodes/
* i386-opc.tbl: Add {rex},
* i386-tbl.h: Regenerated.
A. Wilcox [Thu, 22 Feb 2018 12:49:49 +0000 (12:49 +0000)]
Fix memory access violation when attempting to shorten a suffixed micromips instruction during lookup.
PR 22014
* config/tc-mips.c (mips_lookup_insn): Use memmove to strip the
instruction size suffix.
GDB Administrator [Thu, 22 Feb 2018 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Wed, 21 Feb 2018 19:11:17 +0000 (11:11 -0800)]
Fix a typo.
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-i386-address.exp: Fix a typo.
John Baldwin [Wed, 21 Feb 2018 19:03:41 +0000 (11:03 -0800)]
Add "common-defs.h" include to files in arch/ subdir not yet including it.
This fixes a build breakage on FreeBSD hosts.
gdb/ChangeLog:
* arch/aarch64.c: Include "common-defs.h".
* arch/amd64.c: Likewise.
* arch/i386.c: Likewise.
Tom Tromey [Fri, 16 Feb 2018 05:41:03 +0000 (22:41 -0700)]
Remove a cleanup from parse_expression_for_completion
This removes a cleanup from parse_expression_for_completion, by
changing various expression-completion functions to use
gdb::unique_xmalloc_ptry rather than explicit malloc+free.
Regression tested by the buildbot.
gdb/ChangeLog
2018-02-21 Tom Tromey <tom@tromey.com>
* value.h: (extract_field_op): Update.
* eval.c (extract_field_op): Return a const char *.
* expression.h (parse_expression_for_completion): Update.
* completer.c (complete_expression): Update.
(add_struct_fields): Make fieldname const.
* parse.c (expout_completion_name): Now a unique_xmalloc_ptr.
(mark_completion_tag, parse_exp_in_context_1): Update.
(parse_expression_for_completion): Change "name" to
unique_xmalloc_ptr*.
Tom Tromey [Fri, 16 Feb 2018 23:11:29 +0000 (16:11 -0700)]
Remove a cleanup from call_function_by_hand_dummy
This removes a cleanup from call_function_by_hand_dummy, replacing
manual allocation with std::vector.
Regression tested by the buildbot.
gdb/ChangeLog
2018-02-21 Tom Tromey <tom@tromey.com>
* infcall.c (call_function_by_hand_dummy): Use std::vector.
Yao Qi [Wed, 21 Feb 2018 11:20:03 +0000 (11:20 +0000)]
Pass readable_regcache to gdbarch method read_pc
We can pass readable_regcache to gdbarch method read_pc where it is
allowed to do read from regcache.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* avr-tdep.c (avr_read_pc): Change parameter type to
readable_regcache.
* gdbarch.sh (read_pc): Likewise.
* gdbarch.c: Re-generated.
* gdbarch.h: Re-generated.
* hppa-tdep.c (hppa_read_pc): Change parameter type to
readable_regcache.
* ia64-tdep.c (ia64_read_pc): Likewise.
* mips-tdep.c (mips_read_pc): Likewise.
* spu-tdep.c (spu_read_pc): Likewise.
Yao Qi [Wed, 21 Feb 2018 11:20:03 +0000 (11:20 +0000)]
Move register_dump to regcache-dump.c
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* Makefile.in (COMMON_SFILES): Add regcache-dump.c
* regcache-dump.c: New file.
* regcache.c: Move register_dump to regcache-dump.c.
(maintenance_print_registers): Likewise.
(maintenance_print_raw_registers): Likewise.
(maintenance_print_cooked_registers): Likewise.
(maintenance_print_register_groups): Likewise.
(maintenance_print_remote_registers): Likewise.
(_initialize_regcache): Likewise.
* regcache.h (register_dump): Moved from regcache.c.
Yao Qi [Wed, 21 Feb 2018 11:20:03 +0000 (11:20 +0000)]
Remove regcache::m_readonly_p
Now, m_readonly_p is always false, so we can remove it, and regcache no
longer includes pseudo registers. Some regcache methods are lift up to
its parent class, like reg_buffer or detached_regcache.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache::regcache): Update.
(regcache::invalidate): Move it to detached_regcache::invalidate.
(get_thread_arch_aspace_regcache): Update.
(regcache::raw_update): Update.
(regcache::cooked_read): Remove some code.
(regcache::cooked_read_value): Likewise.
(regcache::raw_write): Remove assert on m_readonly_p.
(regcache::raw_supply_integer): Move it to
detached_regcache::raw_supply_integer.
(regcache::raw_supply_zeroed): Likewise.
* regcache.h (detached_regcache) <raw_supply_integer>: New
declaration.
<raw_supply_zeroed, invalidate>: Likewise.
(regcache) <raw_supply_integer, raw_supply_zeroed>: Removed.
<invalidate>: Likewise.
<m_readonly_p>: Removed.
Yao Qi [Wed, 21 Feb 2018 11:20:03 +0000 (11:20 +0000)]
No longer create readonly regcache
Nowadays, we create a readonly regcache in get_return_value, and pass it
to gdbarch_return_value to get the return value. In theory, we can pass a
readable_regcache instance and get the return value, because we don't need
to modify the regcache. Unfortunately, gdbarch_return_value is designed
to multiplex regcache, according to READBUF and WRITEBUF.
# If READBUF is not NULL, extract the return value and save it in this
# buffer.
#
# If WRITEBUF is not NULL, it contains a return value which will be
# stored into the appropriate register.
In fact, gdbarch_return_value should be split to three functions, 1) only
return return_value_convention, 2) pass regcache_readonly and readbuf, 3)
pass regcache and writebuf. These changes are out of the scope of this
patch series, so I pass regcache to gdbarch_return_value even for read,
and trust each gdbarch backend doesn't modify regcache.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* infcmd.c (get_return_value): Let stop_regs point to
get_current_regcache.
* regcache.c (regcache::regcache): Remove.
(register_dump_reg_buffer): New class.
(regcache_print): Adjust.
* regcache.h (regcache): Remove constructors.
Yao Qi [Wed, 21 Feb 2018 11:20:03 +0000 (11:20 +0000)]
Replace regcache::dump with class register_dump
Nowadays, we need to dump registers contents from "readwrite" regcache and
"readonly" regcache,
if (target_has_registers)
get_current_regcache ()->dump (out, what_to_dump);
else
{
/* For the benefit of "maint print registers" & co when
debugging an executable, allow dumping a regcache even when
there is no thread selected / no registers. */
regcache dummy_regs (target_gdbarch ());
dummy_regs.dump (out, what_to_dump);
}
since we'll have two different types/classes for "readwrite" regcache and
"readonly" regcache, we have to move dump method to their parent class,
reg_buffer. However, the functionality of "dump" looks unnecessary to
reg_buffer (because some dump modes like regcache_dump_none,
regcache_dump_remote and regcache_dump_groups don't need reg_buffer at
all, they need gdbarch to do the dump), so I decide to move "dump" into a
separate classes, and each sub-class is about each mode of dump.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (class register_dump): New class.
(register_dump_regcache, register_dump_none): New class.
(register_dump_remote, register_dump_groups): New class.
(regcache_print): Update.
* regcache.h (regcache_dump_what): Move it to regcache.c.
(regcache) <dump>: Remove.
Yao Qi [Wed, 21 Feb 2018 11:20:03 +0000 (11:20 +0000)]
Class detached_regcache
jit.c uses the regcache in a slightly different way, the regcache dosen't
write through to target, but it has read and write methods. If I apply
regcache in record-full.c, it has the similar use pattern. This patch
adds a new class detached_regcache, a register buffer, but can be
read and written.
Since jit.c doesn't want to write registers through to target, it uses
regcache as a readonly regcache (because only readonly regcache
disconnects from the target), but it adds a hole in regcache
(raw_set_cached_value) in order to modify a readonly regcache. This patch
fixes this hole completely.
regcache inherits detached_regcache, and detached_regcache inherits
readable_regcache. The ideal design is that both detached_regcache and
readable_regcache inherit reg_buffer, and regcache inherit
detached_regcache and regcache_read (virtual inheritance). I concern
about the performance overhead of virtual inheritance, so I don't do it in
the patch.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* jit.c (struct jit_unwind_private) <regcache>: Change its type to
reg_buffer_rw *.
(jit_unwind_reg_set_impl): Call raw_supply.
(jit_frame_sniffer): Use reg_buffer_rw.
* record-full.c (record_full_core_regbuf): Change its type.
(record_full_core_open_1): Use reg_buffer_rw.
(record_full_close): Likewise.
(record_full_core_fetch_registers): Use regcache->raw_supply.
(record_full_core_store_registers): Likewise.
* regcache.c (regcache::get_register_status): Move it to
reg_buffer.
(regcache_raw_set_cached_value): Remove.
(regcache::raw_set_cached_value): Remove.
(regcache::raw_write): Call raw_supply.
(regcache::raw_supply): Move it to reg_buffer_rw.
* regcache.h (regcache_raw_set_cached_value): Remove.
(reg_buffer_rw): New class.
Yao Qi [Wed, 21 Feb 2018 11:20:03 +0000 (11:20 +0000)]
Class readonly_detached_regcache
This patch adds a new class (type) for readonly regcache, which is
created via regcache::save. readonly_detached_regcache inherits
readable_regcache.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* dummy-frame.c (dummy_frame_cache) <prev_regcache>: Use
readonly_detached_regcache.
(dummy_frame_prev_register): Use regcache->cooked_read.
* frame.c (frame_save_as_regcache): Change return type.
(frame_pop): Update.
* frame.h (frame_save_as_regcache): Update declaration.
* inferior.h (get_infcall_suspend_state_regcache): Update
declaration.
* infrun.c (infcall_suspend_state) <registers>: use
readonly_detached_regcache.
(save_infcall_suspend_state): Don't use regcache_dup.
(get_infcall_suspend_state_regcache): Change return type.
* linux-fork.c (struct fork_info) <savedregs>: Change to
readonly_detached_regcache.
<pc>: New field.
(fork_save_infrun_state): Don't use regcache_dup.
(info_checkpoints_command): Adjust.
* mi/mi-main.c (register_changed_p): Update declaration.
(mi_cmd_data_list_changed_registers): Use
readonly_detached_regcache.
(register_changed_p): Change parameter type to
readonly_detached_regcache.
* ppc-linux-tdep.c (ppu2spu_cache) <regcache>: Use
readonly_detached_regcache.
(ppu2spu_sniffer): Construct a new readonly_detached_regcache.
* regcache.c (readonly_detached_regcache::readonly_detached_regcache):
New.
(regcache::save): Move it to reg_buffer.
(regcache::restore): Change parameter type.
(regcache_dup): Remove.
* regcache.h (reg_buffer) <save>: New method.
(readonly_detached_regcache): New class.
* spu-tdep.c (spu2ppu_cache) <regcache>: Use
readonly_detached_regcache.
(spu2ppu_sniffer): Construct a new readonly_detached_regcache.
Yao Qi [Wed, 21 Feb 2018 11:20:03 +0000 (11:20 +0000)]
Remove regcache_save and regcache_cpy
... instead we start to use regcache methods save and restore. It is
quite straightforward to replace regcache_save with regcache->save.
regcache_cpy has some asserts, some of them not necessary, like
gdb_assert (src != dst);
because we already assert !m_readonly_p and src->m_readonly_p, so
src isn't dst. Some of the asserts are moved to ::restore.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* frame.c (frame_save_as_regcache): Use regcache method save.
(frame_pop): Use regcache method restore.
* infrun.c (restore_infcall_suspend_state): Likewise.
* linux-fork.c (fork_load_infrun_state): Likewise.
* ppc-linux-tdep.c (ppu2spu_sniffer): User regcache method
save.
* regcache.c (regcache_save): Remove.
(regcache::restore): More asserts.
(regcache_cpy): Remove.
* regcache.h (regcache_save): Remove the declaration.
(regcache::restore): Move from private to public.
Remove the friend declaration of regcache_cpy.
(regcache_cpy): Remove declaration.
Yao Qi [Wed, 21 Feb 2018 11:20:03 +0000 (11:20 +0000)]
class readable_regcache and pass readable_regcache to gdbarch pseudo_register_read and pseudo_register_read_value
pseudo registers are either from raw registers or memory, so
gdbarch methods pseudo_register_read and pseudo_register_read_value
should have regcache object which only have read methods. In other
words, we should disallow writing to regcache in these two gdbarch
methods. In order to apply this restriction, this patch adds a new
class readable_regcache, derived from reg_buffer, and it only has
raw_read and cooked_read methods. regcache is derived from
readable_regcache. This patch also passes readable_regcache instead of
regcache to gdbarch methods pseudo_register_read and
pseudo_register_read_value.
This patch moves raw_read* and cooked_read* methods to readable_regcache,
which is straightforward. One thing not straightforward is that I split
regcache::xfer_part to readable_regcache::read_part and regcache::write_part,
because readable_regcache can only have methods to read.
readable_regcache is an abstract base class, and it has a pure virtual
function raw_update, because I don't want readable_regcache know where
these raw registers are from. They can be from either the target
(readwrite regcache) or the regcache itself (readonly regcache).
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* aarch64-tdep.c (aarch64_pseudo_register_read_value): Change
parameter type to 'readable_regcache *'.
* amd64-tdep.c (amd64_pseudo_register_read_value): Likewise.
* arm-tdep.c (arm_neon_quad_read): Likewise.
(arm_pseudo_read): Likewise.
* avr-tdep.c (avr_pseudo_register_read): Likewise.
* bfin-tdep.c (bfin_pseudo_register_read): Likewise.
* frv-tdep.c (frv_pseudo_register_read): Likewise.
* gdbarch.c: Re-generated.
* gdbarch.h: Re-generated.
* gdbarch.sh (pseudo_register_read): Change parameter type to
'readable_regcache *'.
(pseudo_register_read_value): Likewise.
* h8300-tdep.c (pseudo_from_raw_register): Likewise.
(h8300_pseudo_register_read): Likewise.
* hppa-tdep.c (hppa_pseudo_register_read): Likewise.
* i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise.
(i386_pseudo_register_read_into_value): Likewise.
(i386_pseudo_register_read_value): Likewise.
* i386-tdep.h (i386_pseudo_register_read_into_value): Update
declaration.
* ia64-tdep.c (ia64_pseudo_register_read): Likewise.
* m32c-tdep.c (m32c_raw_read): Likewise.
(m32c_read_flg): Likewise.
(m32c_banked_register): Likewise.
(m32c_banked_read): Likewise.
(m32c_sb_read): Likewise.
(m32c_part_read): Likewise.
(m32c_cat_read): Likewise.
(m32c_r3r2r1r0_read): Likewise.
(m32c_pseudo_register_read): Likewise.
* m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise.
* mep-tdep.c (mep_pseudo_cr32_read): Likewise.
(mep_pseudo_cr64_read): Likewise.
(mep_pseudo_register_read): Likewise.
* mips-tdep.c (mips_pseudo_register_read): Likewise.
* msp430-tdep.c (msp430_pseudo_register_read): Likewise.
* nds32-tdep.c (nds32_pseudo_register_read): Likewise.
* regcache.c (regcache::raw_read): Move it to readable_regcache.
(regcache::cooked_read): Likewise.
(regcache::cooked_read_value): Likewise.
(regcache_cooked_read_signed):
(regcache::cooked_read): Likewise.
* regcache.h (readable_regcache): New class.
(regcache): Inherit readable_regcache. Move some methods to
readable_regcache.
* rl78-tdep.c (rl78_pseudo_register_read): Change
parameter type to 'readable_regcache *'.
* rs6000-tdep.c (do_regcache_raw_read): Remove.
(e500_pseudo_register_read): Change parameter type to
'readable_regcache *'.
(dfp_pseudo_register_read): Likewise.
(vsx_pseudo_register_read): Likewise.
(efpr_pseudo_register_read): Likewise.
* s390-tdep.c (s390_pseudo_register_read): Likewise.
* sh-tdep.c (sh_pseudo_register_read): Likewise.
* sh64-tdep.c (pseudo_register_read_portions): Likewise.
(sh64_pseudo_register_read): Likewise.
* sparc-tdep.c (sparc32_pseudo_register_read): Likewise.
* sparc64-tdep.c (sparc64_pseudo_register_read): Likewise.
* spu-tdep.c (spu_pseudo_register_read_spu): Likewise.
(spu_pseudo_register_read): Likewise.
* xtensa-tdep.c (xtensa_register_read_masked): Likewise.
(xtensa_pseudo_register_read): Likewise.
Yao Qi [Wed, 21 Feb 2018 11:20:02 +0000 (11:20 +0000)]
Class reg_buffer
This patch adds a new class reg_buffer, and regcache inherits it. Class
reg_buffer is a very simple class, which has the buffer for register
contents and status only. It doesn't have any methods to set contents and
status, and it is expected that its children classes can inherit it and
add different access methods.
Another reason I keep class reg_buffer so simple is that I think
reg_buffer can be even reused in other classes which need to record the
registers contents and status, like frame cache for example.
gdb:
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache::regcache): Call reg_buffer ctor.
(regcache::arch): Move it to reg_buffer::arch.
(regcache::register_buffer): Likewise.
(regcache::assert_regnum): Likewise.
(regcache::num_raw_registers): Likewise.
* regcache.h (reg_buffer): New class.
(regcache): Inherit reg_buffer.
Alan Modra [Wed, 21 Feb 2018 07:06:29 +0000 (17:36 +1030)]
ia64 testsuite changes for --gc-sections
* testsuite/ld-elf/group8b.d: Run test on ia64. Use xfail rather
than notarget.
* testsuite/ld-elf/pr12851.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/group9a.d: Run test on ia64 and alpha. Use xfail
rather than notarget.
* testsuite/ld-elf/group9b.d: Likewise.
* testsuite/ld-elf/pr22677.d: Likewise.
GDB Administrator [Wed, 21 Feb 2018 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Tue, 20 Feb 2018 20:51:37 +0000 (20:51 +0000)]
MIPS16/GAS/testsuite: Add cross-section R_MIPS16_PC16_S1 relocation tests
Add a pair of MIPS16 branch tests to verify correct R_MIPS16_PC16_S1
relocation generation for cross-section references in a single source.
This complements commit
c9775dde3277 ("MIPS16: Add R_MIPS16_PC16_S1
branch relocation support").
gas/
* testsuite/gas/mips/mips16-branch-reloc-4.d: New test.
* testsuite/gas/mips/mips16-branch-reloc-5.d: New test.
* testsuite/gas/mips/mips16-branch-reloc-4.s: New test source.
* testsuite/gas/mips/mips16-branch-reloc-5.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
Maciej W. Rozycki [Tue, 20 Feb 2018 20:51:36 +0000 (20:51 +0000)]
MIPS16/opcodes: Free up `M' operand code
The `M' and `m' MIPS16 operand codes are functionally the same, denoting
a 7-bit register list that is encoded the same way for both SAVE and
RESTORE. Use `m' for both instructions then, making `M' available for a
different use.
opcodes/
* mips16-opc.c (decode_mips16_operand) <'M'>: Remove case.
(mips16_opcodes): Replace `M' with `m' for "restore".
include/
* opcode/mips.h: Remove `M' operand code.
Max Filippov [Thu, 8 Feb 2018 18:28:52 +0000 (10:28 -0800)]
gas: xtensa: limit size of auto litpools
Literal movement code may grow auto litpool so big that it won't be
possible to jump around it. Limit the size of auto litpools by 1/2 of
the jump range.
gas/
2018-02-20 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (struct litpool_frag): Add new field
literal_count.
(MAX_AUTO_POOL_LITERALS, MAX_EXPLICIT_POOL_LITERALS)
(MAX_POOL_LITERALS): New macro definitions.
(auto_litpool_limit): Initialize to 0.
(md_parse_option): Set auto_litpool_limit in the presence of
--auto-litpools option.
(xtensa_maybe_create_literal_pool_frag): Zero-initialize
literal_count field.
(xg_find_litpool): New function. Make sure that found literal
pool size is within the limit.
(xtensa_move_literals): Extract literal pool search code into
the new function.
* testsuite/gas/xtensa/all.exp: Add auto-litpools-2 test.
* testsuite/gas/xtensa/auto-litpools-2.d: New file.
* testsuite/gas/xtensa/auto-litpools-2.s: New file.
* testsuite/gas/xtensa/auto-litpools.d: Fix up changed
addresses.
* testsuite/gas/xtensa/auto-litpools.s: Change literal value so
that objdump doesn't get out of sync.
Simon Marchi [Tue, 20 Feb 2018 16:41:54 +0000 (11:41 -0500)]
remote-sim: Add missing ATTRIBUTE_PRINTF
Fixes:
/home/emaisin/src/binutils-gdb/gdb/remote-sim.c:385:34: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vfprintf_filtered (gdb_stdout, format, args);
^~~~~~
/home/emaisin/src/binutils-gdb/gdb/remote-sim.c:394:34: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vfprintf_filtered (gdb_stdout, format, ap);
^~~~~~
/home/emaisin/src/binutils-gdb/gdb/remote-sim.c:402:34: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vfprintf_filtered (gdb_stderr, format, ap);
^~~~~~
/home/emaisin/src/binutils-gdb/gdb/remote-sim.c:413:11: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
verror (format, args);
^~~~~~
4 errors generated.
gdb/ChangeLog:
* remote-sim.c (gdb_os_printf_filtered, gdb_os_vprintf_filtered,
gdb_os_evprintf_filtered, gdb_os_error): Add ATTRIBUTE_PRINTF.
Ronald Hoogenboom [Tue, 20 Feb 2018 13:33:15 +0000 (13:33 +0000)]
Fix typo in listing of objcopy's command line options.
binutils* doc/binutils.texi (objcopy): Add missing closing square
parenthesis to listing of objcopy's command line options.
Jason Duerstock [Tue, 20 Feb 2018 13:21:55 +0000 (13:21 +0000)]
Enable link time garbage collection support for the IA64 target.
As suggested in long ago in a galaxy far, far away [1], I tried
turning it on and it seems to work, as is evidenced by the Mesa
package in Debian/ia64. Please enable it with the following patch.
[1] https://sourceware.org/ml/binutils/2007-07/msg00241.html
bfd * elfnn-ia64.c (elf_backend_can_gc_sections): Enable.
Markus Metzger [Tue, 20 Feb 2018 10:48:01 +0000 (11:48 +0100)]
gnulib: import mkstemp
Older versions of MinGW do not support mkstemp causing:
gdb/unittests/scoped_fd-selftests.c:37:29: error: \
'mkstemp' was not declared in this scope
int fd = mkstemp (filename);
^
gdb/unittests/scoped_fd-selftests.c: In function 'void
selftests::scoped_fd::test_release()':
gdb/unittests/scoped_fd-selftests.c:56:29: error: \
'mkstemp' was not declared in this scope
int fd = mkstemp (filename);
^
Import mkstemp from gnulib.
gdb/
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add mkstemp.
* gnulib/aclocal.m4: Regenerated.
* gnulib/config.in: Regenerated.
* gnulib/configure: Regenerated.
* gnulib/import/Makefile.am: Regenerated.
* gnulib/import/Makefile.in: Regenerated.
* gnulib/import/m4/gnulib-cache.m4: Regenerated.
* gnulib/import/m4/gnulib-comp.m4: Regenerated.
* gnulib/import/m4/mkstemp.m4: Imported.
* gnulib/import/m4/secure_getenv.m4: Imported.
* gnulib/import/m4/tempname.m4: Imported.
* gnulib/import/mkstemp.c: Imported.
* gnulib/import/secure_getenv.c: Imported.
* gnulib/import/tempname.c: Imported.
* gnulib/import/tempname.h: Imported.
Markus Metzger [Tue, 9 Jan 2018 15:12:24 +0000 (16:12 +0100)]
btrace, testsuite: do not force BTS
In gdb.btrace/buffer-size.exp we explicitly ask for the BTS recording format.
This may lead to spurious fails on systems where PT is being used by some other
process at the same time.
Set both PT and BTS buffer sizes to 1 and check that whatever recording format
is used will use a 4KB buffer.
testsuite/
* gdb.btrace/buffer-size.exp: Do not force BTS.
Thomas Preud'homme [Tue, 20 Feb 2018 12:48:50 +0000 (12:48 +0000)]
Clarify .arch_extension possible values
Documentation for .arch_extension says it accepts the same architectural
extensions as those accepted by -mcpu. Given the name and the fact that
-march for obvious reason also accept the same extensions, I believe
it's worth mentioning that it accepts the same extensions as both
-march and -mcpu. This commit addresses that.
2018-02-20 Thomas Preud'homme <thomas.preudhomme@arm.com>
gas/
* doc/c-arm.texi (.arch_extension): Mention extensions it accepts are
also the same as -march.
Alan Hayward [Tue, 20 Feb 2018 10:03:56 +0000 (10:03 +0000)]
Fix make 3.81 build errors
gdbserver/
* Makefile.in: Switch order of make rules.
GDB Administrator [Tue, 20 Feb 2018 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 16 Feb 2018 15:37:05 +0000 (15:37 +0000)]
gdb/doc: Additional information about 'info line'
Extend the documentation of 'info line' command to:
1. Make 'info line' with no argument more obvious, and make it clearer
what this does.
2. Cover what happens when a secod 'info line' with no argument is
issued.
3. Extend the example output for 'info line ...' to include
symbolic addresses.
gdb/doc/ChangeLog:
* gdb.texinfo (Machine Code): Additional information about "info
line" command.
Maciej W. Rozycki [Mon, 19 Feb 2018 18:38:41 +0000 (18:38 +0000)]
Revert "_bfd_mips_elf_final_link: Notify user about wrong .reginfo size"
Revert commit
58807c48a5a3 ("_bfd_mips_elf_final_link: Notify user about
wrong .reginfo size") now that the size of the `.reginfo' section has
been truly fixed in `_bfd_mips_elf_section_processing', meaning that the
offending condition can be asserted again.
bfd/
Revert
2018-01-12 Vlad Ivanov <vlad@ivanov.email>
* elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
.reginfo section has wrong size.
Maciej W. Rozycki [Mon, 19 Feb 2018 18:38:41 +0000 (18:38 +0000)]
MIPS/BFD: Fix the size of `.reginfo' and `.MIPS.abiflags' sections
Use the SEC_FIXED_SIZE flag to actually fix the size of `.reginfo' and
`.MIPS.abiflags' sections in `_bfd_mips_elf_always_size_sections', as
originally intended, removing link failures such as:
ld: final link failed: Section has no contents
or:
ld: final link failed: Bad value
or:
ld: foo: .reginfo section size should be 24 bytes, actual size is 32
and assertion failures like:
ld: BFD (GNU Binutils) 2.30.51.
20180131 assertion fail .../bfd/elfxx-mips.c:14322
in link scenarios involving a linker script that either creates an
output `.reginfo' or `.MIPS.abiflags' section from scratch or produces
either section from different sections. If such an output section's
size turns out to be incorrect according to the psABI, then the section
is either truncated or padded out to the correct size, as relevant.
This allows people to handle these sections in a link in an unusual way,
while still addressing the issue covered by commit
58807c48a5a3
("_bfd_mips_elf_final_link: Notify user about wrong .reginfo size").
The original arrangement, coming from an unindentified change made to
what was called `mips_elf_always_size_sections' back then, between
commit
02650bd0a97e ("This adds ABI flags to MIPS/ELF object files.")
and commit
252b5132c753 ("
19990502 sourceware import"), also missing
from BFD ChangeLog files, assumed that the output section size is not
going to change after return from `bfd_elf_size_dynamic_sections', the
caller of that function, called in turn from `ldemul_before_allocation'
via `gld${EMULATION_NAME}_before_allocation' in ld/emultempl/elf32.em,
and ultimately from `lang_process'. This is because later on in
`lang_process' processing `lang_size_sections' is called , happily
recalculating the section size, and it has actually already been the
case at the time of commit
252b5132c753 ("
19990502 sourceware import"),
so the assumption was clearly incorrect right from the beginning.
bfd/
* elfxx-mips.c (_bfd_mips_elf_always_size_sections): Set
SEC_FIXED_SIZE and SEC_HAS_CONTENTS flags for `.reginfo' and
`.MIPS.abiflags' sections.
(_bfd_mips_elf_final_link): Avoid reading beyond `.reginfo'
section's end.
ld/
* testsuite/ld-mips-elf/reginfo-0.d: New test.
* testsuite/ld-mips-elf/reginfo-0r.d: New test.
* testsuite/ld-mips-elf/reginfo-1.d: New test.
* testsuite/ld-mips-elf/reginfo-1r.d: New test.
* testsuite/ld-mips-elf/reginfo-2.d: New test.
* testsuite/ld-mips-elf/reginfo-2r.d: New test.
* testsuite/ld-mips-elf/mips-abiflags-0.d: New test.
* testsuite/ld-mips-elf/mips-abiflags-0r.d: New test.
* testsuite/ld-mips-elf/mips-abiflags-1.d: New test.
* testsuite/ld-mips-elf/mips-abiflags-1r.d: New test.
* testsuite/ld-mips-elf/mips-abiflags-2.d: New test.
* testsuite/ld-mips-elf/mips-abiflags-2r.d: New test.
* testsuite/ld-mips-elf/reginfo-0.ld: New test linker script.
* testsuite/ld-mips-elf/reginfo-1.ld: New test linker script.
* testsuite/ld-mips-elf/mips-abiflags-0.ld: New test linker
script.
* testsuite/ld-mips-elf/mips-abiflags-1.ld: New test linker
script.
* testsuite/ld-mips-elf/reginfo-1.s: New test source.
* testsuite/ld-mips-elf/reginfo-2.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Maciej W. Rozycki [Mon, 19 Feb 2018 18:38:41 +0000 (18:38 +0000)]
LD: Support fixed-size sections some psABIs may require
Define a SEC_FIXED_SIZE section flag for target backends to use for
output sections whose size has been fixed in the psABI. The size of
such sections will not be changed anyhow by the generic linker and it is
up to the target backend to get their size right.
bfd/
* section.c (SEC_FIXED_SIZE): New macro.
* bfd-in2.h: Regenerate.
ld/
* ldlang.c (insert_pad): Do not change output section's size if
SEC_FIXED_SIZE is set in the flags.
(size_input_section): Likewise.
(lang_size_sections_1): Likewise.
(lang_reset_memory_regions): Likewise.
Maciej W. Rozycki [Mon, 19 Feb 2018 18:38:41 +0000 (18:38 +0000)]
BFD: Remove unused SEC_HAS_GOT_REF section flag
Remove the SEC_HAS_GOT_REF section flag no longer in use since commit
a252afa4cdff ("Fix linking of PIC code on PA"),
<https://sourceware.org/ml/binutils/2003-08/msg00467.html>, to make the
bit position available for reuse.
bfd/
* section.c (SEC_HAS_GOT_REF): Remove macro.
* bfd-in2.h: Regenerate.
Alan Modra [Mon, 19 Feb 2018 13:06:55 +0000 (23:36 +1030)]
Add attribute printf to _bfd_error_handler
and fix a few stray errors.
* elf-attrs.c (_bfd_elf_parse_attributes): Correct _bfd_error_handler
arguments.
* elfxx-mips.c (_bfd_mips_elf_final_link): Likewise.
* elfnn-riscv.c (_bfd_riscv_relax_align): Likewise.
(_bfd_riscv_relax_pc): Likewise and fix typos.
* libbfd-in.h (_bfd_error_handler): Add attribute printf.
* libbfd.h: Regenerate.
Alan Modra [Mon, 19 Feb 2018 08:18:15 +0000 (18:48 +1030)]
Don't use %ll
* dwarf2.c (read_section): Don't use 'll' format modifier.
(find_abstract_instance): Likewise.
* elfcore.h (elf_core_file_p): Likewise.
Alan Modra [Mon, 19 Feb 2018 08:04:15 +0000 (18:34 +1030)]
%L conversions
* bfd-in.h: Include inttypes.h or if not available define
PRId64, PRIu64 and PRIx64.
* bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Remove support for L
modifier to print bfd_vma.
* coff-arm.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c,
* coff-sh.c, * coff-tic80.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * dwarf2.c, * elf-m10300.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-bfin.c, * elf32-cris.c, * elf32-hppa.c,
* elf32-i386.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32r.c,
* elf32-m68k.c, * elf32-metag.c, * elf32-nds32.c, * elf32-nios2.c,
* elf32-ppc.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-sh64.c, * elf32-spu.c,
* elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c,
* elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c,
* elf64-mmix.c, * elf64-s390.c, * elf64-sh64.c, * elf64-x86-64.c,
* elfcode.h, * elfcore.h, * elflink.c, * elfnn-aarch64.c,
* elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * ieee.c, * ihex.c, * mach-o.c, * merge.c, * mmo.c,
* peXXigen.c, * xcofflink.c: Replace use of Lx modifier with PRIx64,
and cast input to uint64_t, and similarly for Ld and Lu.
* bfd-in2.h: Regenerate.
Alan Modra [Mon, 19 Feb 2018 08:00:41 +0000 (18:30 +1030)]
Use %pI, %pR, %pS, %pT in place of %I, %R, %S and %T.
bfd/
* elf32-arm.c, * elf32-hppa.c, * elf32-lm32.c, * elf32-m32r.c,
* elf32-metag.c, * elf32-nds32.c, * elf32-or1k.c, * elf32-ppc.c,
* elf32-s390.c, * elf32-sh.c, * elf32-tic6x.c, * elf32-tilepro.c,
* elf64-ppc.c, * elf64-s390.c, * elflink.c, * elfnn-aarch64.c,
* elfnn-riscv.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c,
* reloc.c: Replace use of %R and %T in format strings passed to
einfo and friends by %pR and %pT.
ld/
* ldmisc.c (vfinfo) Handle %pI, %pR, %pS and %pT in place of
%I, %R, %S and %T.
* ldcref.c, * ldctor.c, * ldemul.c, * ldexp.c, * ldgram.y,
* ldlang.c, * ldlex.l, * ldmain.c, * ldmisc.c, * pe-dll.c,
* emultempl/sh64elf.em: Replace use of of %I, %R, %S and %T in
format strings passed to einfo and friends by %pI, %pR, %pS and %pT.
Alan Modra [Mon, 19 Feb 2018 04:51:40 +0000 (15:21 +1030)]
Use %pA and %pB in messages rather than %A and %B
First step towards compiler verification of _bfd_error_handler
arguments, and better verification of translated messages.
bfd/
* bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Handle %pA and %pB in place
of %A and %B.
* aout-adobe.c: Update all messages using %A and %B.
* aout-cris.c: Likewise.
* aoutx.h: Likewise.
* archive.c: Likewise.
* binary.c: Likewise.
* cache.c: Likewise.
* coff-alpha.c: Likewise.
* coff-arm.c: Likewise.
* coff-i860.c: Likewise.
* coff-mcore.c: Likewise.
* coff-ppc.c: Likewise.
* coff-rs6000.c: Likewise.
* coff-sh.c: Likewise.
* coff-tic4x.c: Likewise.
* coff-tic54x.c: Likewise.
* coff-tic80.c: Likewise.
* coff64-rs6000.c: Likewise.
* coffcode.h: Likewise.
* coffgen.c: Likewise.
* cofflink.c: Likewise.
* coffswap.h: Likewise.
* compress.c: Likewise.
* cpu-arm.c: Likewise.
* ecoff.c: Likewise.
* elf-attrs.c: Likewise.
* elf-eh-frame.c: Likewise.
* elf-ifunc.c: Likewise.
* elf-m10300.c: Likewise.
* elf-properties.c: Likewise.
* elf-s390-common.c: Likewise.
* elf.c: Likewise.
* elf32-arc.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-avr.c: Likewise.
* elf32-bfin.c: Likewise.
* elf32-cr16.c: Likewise.
* elf32-cr16c.c: Likewise.
* elf32-cris.c: Likewise.
* elf32-crx.c: Likewise.
* elf32-d10v.c: Likewise.
* elf32-d30v.c: Likewise.
* elf32-epiphany.c: Likewise.
* elf32-fr30.c: Likewise.
* elf32-frv.c: Likewise.
* elf32-gen.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-i370.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-i960.c: Likewise.
* elf32-ip2k.c: Likewise.
* elf32-iq2000.c: Likewise.
* elf32-lm32.c: Likewise.
* elf32-m32c.c: Likewise.
* elf32-m32r.c: Likewise.
* elf32-m68hc11.c: Likewise.
* elf32-m68hc12.c: Likewise.
* elf32-m68hc1x.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-mcore.c: Likewise.
* elf32-mep.c: Likewise.
* elf32-metag.c: Likewise.
* elf32-microblaze.c: Likewise.
* elf32-moxie.c: Likewise.
* elf32-msp430.c: Likewise.
* elf32-mt.c: Likewise.
* elf32-nds32.c: Likewise.
* elf32-nios2.c: Likewise.
* elf32-or1k.c: Likewise.
* elf32-pj.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-rl78.c: Likewise.
* elf32-rx.c: Likewise.
* elf32-s390.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elf32-sh-symbian.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-sh64.c: Likewise.
* elf32-sparc.c: Likewise.
* elf32-spu.c: Likewise.
* elf32-tic6x.c: Likewise.
* elf32-tilepro.c: Likewise.
* elf32-v850.c: Likewise.
* elf32-vax.c: Likewise.
* elf32-visium.c: Likewise.
* elf32-wasm32.c: Likewise.
* elf32-xgate.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-gen.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ia64-vms.c: Likewise.
* elf64-mmix.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-s390.c: Likewise.
* elf64-sh64.c: Likewise.
* elf64-sparc.c: Likewise.
* elf64-x86-64.c: Likewise.
* elfcode.h: Likewise.
* elfcore.h: Likewise.
* elflink.c: Likewise.
* elfnn-aarch64.c: Likewise.
* elfnn-ia64.c: Likewise.
* elfnn-riscv.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-tilegx.c: Likewise.
* elfxx-x86.c: Likewise.
* hpux-core.c: Likewise.
* ieee.c: Likewise.
* ihex.c: Likewise.
* libbfd.c: Likewise.
* linker.c: Likewise.
* mach-o.c: Likewise.
* merge.c: Likewise.
* mmo.c: Likewise.
* oasys.c: Likewise.
* pdp11.c: Likewise.
* pe-mips.c: Likewise.
* peXXigen.c: Likewise.
* peicode.h: Likewise.
* reloc.c: Likewise.
* rs6000-core.c: Likewise.
* srec.c: Likewise.
* stabs.c: Likewise.
* vms-alpha.c: Likewise.
* xcofflink.c: Likewise.
ld/
* ldmisc.c (vfinfo): Handle %pA and %pB in place of %A and %B.
* ldcref.c: Update all messages using %A and %B.
* ldexp.c: Likewise.
* ldlang.c: Likewise.
* ldmain.c: Likewise.
* ldmisc.c: Likewise.
* pe-dll.c: Likewise.
* plugin.c: Likewise.
* emultempl/beos.em: Likewise.
* emultempl/cr16elf.em: Likewise.
* emultempl/elf32.em: Likewise.
* emultempl/m68kcoff.em: Likewise.
* emultempl/m68kelf.em: Likewise.
* emultempl/mmo.em: Likewise.
* emultempl/nds32elf.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/sunos.em: Likewise.
* emultempl/xtensaelf.em: Likewise.
H.J. Lu [Mon, 19 Feb 2018 13:07:33 +0000 (05:07 -0800)]
ld: Add -z separate-code tests to frame.exp
On x86, "-z separate-code" leads to assertion fail at bfd/elf.c:5917.
Alsp skip tests if -shared isn't supported.
PR ld/22845
* testsuite/ld-elf/frame.exp: Skip if -shared isn't supported.
Add tests for "-z noseparate-code" and "-z separate-code".
Remove unsupported -shared check.
Thomas Preud'homme [Mon, 19 Feb 2018 12:05:18 +0000 (12:05 +0000)]
[ARM] Fix bxns mask
Bit 7 of BXNS is a fixed bit which distinguish it from BLXNS. Yet it is
not set in the disassembler entry mask. This commit fixes that.
2018-02-19 Thomas Preud'homme <thomas.preudhomme@arm.com>
opcodes/
* arm-dis.c (thumb_opcodes): Fix BXNS mask.
Matthias Klose [Mon, 19 Feb 2018 11:56:53 +0000 (11:56 +0000)]
Fix mistake in the declaration of the --include-all-whitespace option of the strings utility.
* strings.c (long_options): Include-all-whitespace does not take
an extra agument.
Alan Hayward [Mon, 19 Feb 2018 09:37:24 +0000 (09:37 +0000)]
Add common/ dir in build directories
gdb/
* Makefile.in: (COMMON_SFILES): Add common/*.c files.
(SFILES): Remove common/*.c files.
(COMMON_OBS): Remove some *.o files built from common/*.c files.
* common/common.host: Add common reference.
* configure.ac: Likewise.
* configure: Regenerate.
gdbserver/
* Makefile.in: Add common directory in build.
* configure.ac: Add common reference.
* configure: Regenerate.
Alan Modra [Sun, 18 Feb 2018 23:22:53 +0000 (09:52 +1030)]
PT_LOAD and PT_GNU_RELRO segment overlap
Commit
325ba6fb34 excluded degenerate zero length PT_LOAD segments,
but that only fixed part of the problem, which was that the load
segment limits were not calculated properly.
PR 22845
* elf.c (IS_TBSS): Define.
(_bfd_elf_map_sections_to_segments): Use IS_TBSS.
(assign_file_positions_for_non_load_sections): Revert last change.
Properly calculate load segment limits to compare against relro limits.
GDB Administrator [Mon, 19 Feb 2018 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 18 Feb 2018 00:00:57 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 17 Feb 2018 22:54:16 +0000 (14:54 -0800)]
ld-elf/ehdr_start: Pass --build-id to ld
ld-elf/ehdr_start fails with -z separate-code. Since there is no data
LOAD segment before code LOAD segment:
There are 2 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x200000 0x0000000000600000 0x0000000000600000 0x000010 0x000010 R E 0x200000
LOAD 0x400000 0x0000000000800000 0x0000000000800000 0x000008 0x000008 R 0x200000
Section to Segment mapping:
Segment Sections...
00 .text
01 .rodata
the program header isn't included in any LOAD segment. As the result,
reference to __ehdr_start is resolved to zero. Pass --build-id to ld
to add a data LOAD segment before code LOAD segment to put the program
header in the data LOAD segment.
PR ld/22845
* testsuite/ld-elf/ehdr_start.d: Pass --build-id to ld.
H.J. Lu [Sat, 17 Feb 2018 13:37:37 +0000 (05:37 -0800)]
ld: Add -z separate-code test for zero size section
PR ld/22845
* testsuite/ld-elf/binutils.exp (tls_opts): Add tests for
"-z noseparate-code" and "-z separate-code".