Simon Marchi [Wed, 13 Jan 2021 19:32:23 +0000 (14:32 -0500)]
gdb: turn arc_debug into a bool
Shahab suggested we get rid of the verbosity level for the ARC debug
logging [1]. This patch does that, before doing any other change.
gdb/ChangeLog:
* arc-tdep.h (arc_debug): Change type to bool.
* arc-tdep.c (arc_debug): Change type to bool.
(arc_analyze_prologue): Adjust.
(_initialize_arc_tdep): Use add_setshow_boolean_cmd.
* arc-linux-nat.c (ps_get_thread_area): Adjust.
[1] https://sourceware.org/pipermail/gdb-patches/2021-January/175075.html
Change-Id: I16688bd42ed8978ae1acf57012c8d41a943044a5
Simon Marchi [Wed, 13 Jan 2021 17:09:58 +0000 (12:09 -0500)]
gdb: bool-ify maybe_add_script_{text,file}
Bool-ify the return type of maybe_add_script_text and
maybe_add_script_file, the loaded parameter and related things.
gdb/ChangeLog:
* auto-load.c (struct loaded_script) <loaded>: Change to bool.
(maybe_add_script_file): Change return type to bool.
(maybe_add_script_text): Change return type and
loaded parameter to bool.
(source_script_file): Adjust.
(execute_script_contents): Adjust.
Change-Id: I59ab5862796fa7d154721b56e2ff8612ad5d734b
Simon Marchi [Wed, 13 Jan 2021 17:00:37 +0000 (12:00 -0500)]
gdb: bool-ify users of file_is_auto_load_safe
A previous patch missed those.
gdb/ChangeLog:
* auto-load.c (auto_load_objfile_script_1): Use bool.
(execute_script_contents): Use bool.
Change-Id: I214bf7ed25af36ced375eb3ec5a403ded2fa572e
Simon Marchi [Wed, 13 Jan 2021 16:57:24 +0000 (11:57 -0500)]
gdb: bool-ify ext_lang_auto_load_enabled and friends
Make it and related functions return bool. Move function comments to
header where applicable.
gdb/ChangeLog:
* auto-load.h (auto_load_gdb_scripts_enabled): Return bool, move
comment here.
* auto-load.c (auto_load_gdb_scripts_enabled): Return bool, move
comment to header.
* extension-priv.h (struct extension_language_script_ops)
<auto_load_enabled>: Return bool.
* extension.h (ext_lang_auto_load_enabled): Return bool, move
comment here.
* extension.c (ext_lang_auto_load_enabled): Return bool, move
comment to header.
* guile/guile-header.h (gdbscm_auto_load_enabled): Return bool,
move comment here.
* guile/scm-auto-load.c (gdbscm_auto_load_enabled): Return bool,
move comment to header.
* python/python-header.h (gdbpy_auto_load_enabled): Return bool,
move comment here.
* python/py-auto-load.c (gdbpy_auto_load_enabled): Return bool,
move comment to header.
Change-Id: I657a17d2dab77a36884a137ce9b23a2cc6d53140
Simon Marchi [Wed, 13 Jan 2021 16:44:24 +0000 (11:44 -0500)]
gdb: bool-ify file_is_auto_load_safe
Make it return bool and change the advice_printed to bool as well. Move
doc to header file.
gdb/ChangeLog:
* auto-load.h (file_is_auto_load_safe): Change return type to
bool, move comment here.
* auto-load.c (file_is_auto_load_safe): Change return type and
advice_printed to bool. Move comment to header.
Change-Id: Ia7395e7cea8880377800240833316e4be5251d49
Simon Marchi [Wed, 13 Jan 2021 15:48:51 +0000 (10:48 -0500)]
gdb: convert jit to new-style debug macros
Here's a sample output, with infrun debug enabled as well to show
nesting:
[infrun] fetch_inferior_event: enter
[infrun] print_target_wait_results: target_wait (-1.0.0 [process -1], status) =
[infrun] print_target_wait_results:
4116727.
4116727.0 [process
4116727],
[infrun] print_target_wait_results: status->kind = stopped, signal = GDB_SIGNAL_TRAP
[infrun] handle_inferior_event: status->kind = stopped, signal = GDB_SIGNAL_TRAP
[infrun] start_step_over: enter
[infrun] start_step_over: stealing global queue of threads to step, length = 0
[infrun] operator(): step-over queue now empty
[infrun] start_step_over: exit
[infrun] handle_signal_stop: stop_pc=0x555555555229
[infrun] handle_jit_event: handling bp_jit_event
[jit] jit_read_descriptor: descriptor_addr = 0x5555555580b0
[jit] jit_register_code: symfile_addr = 0x7000000, symfile_size = 15560
[jit] jit_bfd_try_read_symtab: symfile_addr = 0x7000000, symfile_size = 15560
[jit] jit_breakpoint_re_set_internal: breakpoint_addr = 0x555555555229
[infrun] process_event_stop_test: BPSTAT_WHAT_SINGLE
[infrun] process_event_stop_test: no stepping, continue
[infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=1, current thread [process
4116727] at 0x555555555229
[infrun] prepare_to_wait: prepare_to_wait
[infrun] fetch_inferior_event: exit
gdb/ChangeLog:
* jit.c (jit_debug_printf): New, use throughout file.
Change-Id: Ic0f5eb3ffc926fb555de4914e7dc1076ada63a97
H.J. Lu [Wed, 13 Jan 2021 14:48:07 +0000 (06:48 -0800)]
ld: Check for ELF input before accessing ELF section data
commit
b209b5a6b8a accesses ELF section data without checking if input is
ELF. It caused:
sh: line 1:
1355479 Segmentation fault (core dumped) /export/build/gnu/tools-build/binutils-gitlab-x32/build-x86_64-linux-gnux32/ld/ld-new -o tmpdir/pe-x86-64-1 -z norelro -L/export/gnu/import/git/gitlab/x86-binutils/ld/testsuite/ld-x86-64 -m elf_x86_64 --entry=begin tmpdir/pe-x86-64-1a.obj tmpdir/pe-x86-64-1b.obj tmpdir/pe-x86-64-1c.obj 2>&1
FAIL: Build pe-x86-64-1
on Linux/x86-64 with PE/x86-64 inputs. Add check for ELF input before
accessing ELF section data.
* ldelfgen.c (add_link_order_input_section): Check for ELF input
before accessing ELF section data.
H.J. Lu [Wed, 13 Jan 2021 13:42:11 +0000 (05:42 -0800)]
x86: Don't generate GOT_symbol for PLT relocations
Don't generate the _GLOBAL_OFFSET_TABLE_ symbol for PLT relocations
since it isn't needed.
PR gas/27178
* config/tc-i386.c (lex_got::gotrel): Add need_GOT_symbol.
Don't generate GOT_symbol for PLT relocations.
* testsuite/gas/i386/i386.exp: Run PR gas/27178 tests.
* testsuite/gas/i386/no-got.d: New file.
* testsuite/gas/i386/no-got.s: Likewise.
* testsuite/gas/i386/x86-64-no-got.d: Likewise.
* testsuite/gas/i386/x86-64-no-got.s: Likewise.
Alan Modra [Wed, 13 Jan 2021 08:43:23 +0000 (19:13 +1030)]
Regen Makefile.in for jobserver.m4 aclocal.m4 dependency
bfd/
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
binutils/
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
gas/
* Makefile.in: Regenerate.
* Makefile.in: Regenerate.
gprof/
* Makefile.in: Regenerate.
ld/
* Makefile.in: Regenerate.
libctf/
* Makefile.in: Regenerate.
opcodes/
* Makefile.in: Regenerate.
Alan Modra [Wed, 13 Jan 2021 03:03:34 +0000 (13:33 +1030)]
SHF_LINK_ORDER fixup_link_order in ld
This moves the SHF_LINK_ORDER sorting from bfd_elf_final_link to
the linker which means generic ELF targets now support SHF_LINK_ORDER
and we cope with odd cases that require resizing of output sections.
The patch also fixes two bugs in the current implementation,
introduced by commit
cd6d537c48fa. The pattern test used by that
commit meant that sections matching something like
"*(.IA_64.unwind* .gnu.linkonce.ia64unw.*)" would not properly sort a
mix of sections matching the two wildcards. That commit also assumed
a stable qsort.
bfd/
PR 27160
* section.c (struct bfd_section): Remove pattern field.
(BFD_FAKE_SECTION): Adjust to suit.
* bfd-in2.h: Regenerate.
* elflink.c (compare_link_order, elf_fixup_link_order): Delete.
(bfd_elf_final_link): Don't call elf_fixup_link_order.
ld/
PR 27160
* ldlang.h (lang_output_section_statement_type): Add data field.
(lang_input_section_type, lang_section_bst_type): Add pattern field.
(statement_list): Declare.
(lang_add_section): Adjust prototype.
* emultempl/aarch64elf.em: Adjust lang_add_section calls.
* emultempl/armelf.em: Likewise.
* emultempl/beos.em: Likewise.
* emultempl/cskyelf.em: Likewise.
* emultempl/hppaelf.em: Likewise.
* emultempl/m68hc1xelf.em: Likewise.
* emultempl/metagelf.em: Likewise.
* emultempl/mipself.em: Likewise.
* emultempl/mmo.em: Likewise.
* emultempl/msp430.em: Likewise.
* emultempl/nios2elf.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/vms.em: Likewise.
* ldelf.c: Likewise.
* ldelfgen.c: Include ldctor.h.
(struct os_sections): New.
(add_link_order_input_section, link_order_scan): New functions.
(compare_link_order, fixup_link_order): New functions.
(ldelf_map_segments): Call link_order_scan and fixup_link_order.
* ldlang.c (statement_list): Make global.
(output_section_callback_fast): Save pattern in tree node.
(lang_add_section): Add pattern parameter, save in lang_input_section.
(output_section_callback_tree_to_list): Adjust lang_add_section calls.
(lang_insert_orphan, output_section_callback): Likewise.
(ldlang_place_orphan): Likewise.
(gc_section_callback): Don't set section->pattern
* testsuite/ld-elf/pr26256-2a.d: Don't xfail generic.
* testsuite/ld-elf/pr26256-3b.d: Likewise.
* testsuite/ld-elf/pr26256-2b.d: Likewise. notarget xgate.
Alan Modra [Wed, 13 Jan 2021 04:47:56 +0000 (15:17 +1030)]
Remove sflag_info param from wild callback functions
* ldlang.h (callback_t): Remove flag_info function parameter.
* ldlang.c (walk_wild_consider_section): Adjust to suit.
(walk_wild_section_general): Likewise.
(output_section_callback_fast, output_section_callback): Likewise.
(check_section_callback, gc_section_callback): Likewise.
(find_relro_section_callback): Likewise.
Zebediah Figura [Wed, 13 Jan 2021 10:55:46 +0000 (10:55 +0000)]
Add SEH support to code generated by dlltool.
PR 27037
* dlltool.c (i386_trampoline): Adjust %rsp immediately on entry
and before exit.
(i386_x64_trampoline): Add SEH annotations.
(struct mac): Add how_seh field.
(make_delay_head): If how_set field is true add SEh instructions.
Mike Frysinger [Wed, 13 Jan 2021 06:22:05 +0000 (01:22 -0500)]
sim: watch: fix range expression processing
The code supports a <start>[,<end>] syntax, but the logic for handling
the <end> check was broken: it would detect the first byte was ",", but
then include that in the strtoul call meaning the result is always 0.
Further, it (re)assigned to arg0 when it meant arg1 which means this
code always processed a range expression as 0,0. Oops.
Mike Frysinger [Wed, 13 Jan 2021 06:21:22 +0000 (01:21 -0500)]
sim: watch: fix pc watchpoints on little endian host systems
My change
1ac72f0659d64d6a14da862242db0d841d2878d0 ("sim: convert to
bfd_endian") subtly broke the watchpoint module on little endian host
systems. The old code used 0 to mean "whatever the host endian is",
and while that was changed to use BFD_ENDIAN_UNKNOWN, this caller was
missed. Since its API used an int instead of an enum, the coercion
from 0 to the BFD endian enum was silently missed, and 0 happens to
be BFD_ENDIAN_BIG.
Instead of restoring the old logic by passing in BFD_ENDIAN_UNKNOWN,
we know the right host endian at compile time, so use that directly.
GDB Administrator [Wed, 13 Jan 2021 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sun, 10 Jan 2021 00:06:27 +0000 (19:06 -0500)]
src-release: fix indentation
The indentation of the body of the nested statements got out of sync
leading to the entire function being indented incorrectly and looking
like it's part of the for loop.
Simon Marchi [Tue, 12 Jan 2021 23:09:51 +0000 (18:09 -0500)]
gdb: fix indentation in infrun.c
gdb/ChangeLog:
* infrun.c (normal_stop): Fix indentation.
Change-Id: Icbae5272188f6ddb464b585a9194abd611f5ad27
Simon Marchi [Tue, 12 Jan 2021 19:19:49 +0000 (14:19 -0500)]
gdb: move read{now,never}_symbol_files declarations to symfile.h
... since they are defined in symfile.c.
gdb/ChangeLog:
* top.h (readnow_symbol_files, readnever_symbol_files): Move
declarations to ...
* symfile.h: ... here.
* symfile.c: Update doc.
Change-Id: Ie35a80d236bea70947bc496f66f62c8c621670b4
Simon Marchi [Tue, 12 Jan 2021 19:19:49 +0000 (14:19 -0500)]
gdb: move baud_rate and serial_parity declarations to serial.h
They are currently in target.h, it would make more sense to have them in
serial.h, since they are defined in serial.c.
gdb/ChangeLog:
* target.h (baud_rate, serial_parity): Move declarations...
* serial.h: ... here.
* main.c: Include serial.h.
* serial.c (baud_rate, serial_parity): Update doc.
Change-Id: Idc983c154c80ccc29b07ce68df3483cefe03fb71
Tom de Vries [Tue, 12 Jan 2021 16:36:51 +0000 (17:36 +0100)]
[gdb/testsuite] Add have_mpx in lib/gdb.exp
The sources for the test-cases gdb.arch/i386-mpx*.exp contain have_mpx
functions that test whether the processor supports mpx instructions.
OTOH, the test-cases are compiled using -mmpx -fcheck-pointer-bounds, which
instrument all functions with mpx instructions.
So, the function that is supposed to test whether mpx instruction are
supported contains mpx instructions, which is a bit odd.
We could fix this by:
- factoring out the have_mpx function into a single source file, and
- compiling it without "-mmpx -fcheck-pointer-bounds".
But having the mpx support test as part of the test-cases seems like an
unnecessary complication that makes the test-cases more difficult to analyze,
reason about and modify.
So we go one step further and factor out the mpx support test in into a
gdb_caching_proc.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-12 Tom de Vries <tdevries@suse.de>
* gdb.arch/i386-mpx-call.c (have_mpx): Remove.
(main): Remove call to have_mpx.
* gdb.arch/i386-mpx-call.exp: Use have_mpx.
* gdb.arch/i386-mpx-map.c (have_mpx): Remove.
(main): Remote call to have_mpx.
* gdb.arch/i386-mpx-map.exp: Use have_mpx.
* gdb.arch/i386-mpx-sigsegv.c (have_mpx): Remove.
(main): Remove call to have_mpx.
* gdb.arch/i386-mpx-sigsegv.exp: Use have_mpx.
* gdb.arch/i386-mpx-simple_segv.c (have_mpx): Remove.
(main): Remove call to have_mpx.
* gdb.arch/i386-mpx-simple_segv.exp: Use have_mpx.
* gdb.arch/i386-mpx.c (have_mpx): Remove.
(main): Remote call to have_mpx.
* gdb.arch/i386-mpx.exp: Use have_mpx.
* lib/gdb.exp (have_mpx): New proc.
Simon Marchi [Tue, 12 Jan 2021 15:42:43 +0000 (10:42 -0500)]
gdb: remove pre_init_ui_hook from top.c
This hook appears to be unused. I guess it was used from insight or
something like that at some point. But I grepped in today's source of
insight [1] and there was no match. So I think it's safe to remove.
gdb/ChangeLog:
* top.c (pre_init_ui_hook): Remove.
[1] https://sourceware.org/git/?p=insight.git
Change-Id: Ia14499a4b6b9d79bb9a526d635fe44a654ef2a27
Srinath Parvathaneni [Tue, 12 Jan 2021 13:57:23 +0000 (13:57 +0000)]
aarch64: Add support for bfloat16 in gdb.
This patch adds support for bfloat16 in AArch64 gdb.
Also adds the field "bf" to vector registers h0-h31.
Also adds the vector "bf" to h field in vector registers v0-v31.
The following is how the vector register h and v looks like.
Before this patch:
(gdb) p $h0
$1 = {f = 0, u = 0, s = 0}
(gdb) p/x $h0
$2 = {f = 0x0, u = 0x0, s = 0x0}
(gdb) p $v0.h
$3 = {f = {0, 0, 0, 0, 0, 0, 0, 0}, u = {0, 0, 0, 0, 0, 0, 0, 0}, s = {0, 0, 0, 0, 0, 0, 0, 0}}
(gdb) p/x $v0.h
$4 = {f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, u = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
s = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
After this patch:
(gdb) p $h0
$1 = {bf = 0, f = 0, u = 0, s = 0}
(gdb) p/x $h0
$2 = {bf = 0x0, f = 0x0, u = 0x0, s = 0x0}
(gdb) p $v0.h
$3 = {bf = {0, 0, 0, 0, 0, 0, 0, 0}, f = {0, 0, 0, 0, 0, 0, 0, 0}, u = {0, 0, 0, 0, 0, 0, 0, 0},
s = {0, 0, 0, 0, 0, 0, 0, 0}}
(gdb) p/x $v0.h
$4 = {bf = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, f = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
u = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, s = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
gdb/ChangeLog:
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* aarch64-tdep.c (aarch64_vnh_type): Add "bf" field in h registers.
(aarch64_vnv_type): Add "bf" type in h field of v registers.
* features/aarch64-fpu.c (create_feature_aarch64_fpu): Regenerated.
* features/aarch64-fpu.xml: Add bfloat16 type.
gdb/testsuite/ChangeLog:
2021-01-12 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
* gdb.arch/aarch64-fp.exp: Modify to test bfloat16 support.
H.J. Lu [Tue, 12 Jan 2021 13:45:28 +0000 (05:45 -0800)]
Implement a workaround for GNU mak jobserver
Compiling binutils using -flto=jobserver with GCC 11 leads to
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I../../gas/../zlib -g -O2 -fprofile-generate -flto=jobserver -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o config/tc-i386.o config/obj-elf.o config/atof-ieee.o ../opcodes/.libs/libopcodes.a ../bfd/.libs/libbfd.a -L/tmp/binutils-gdb/objdir/zlib -lz ../libiberty/libiberty.a -ldl
lto-wrapper: warning: jobserver is not available: '--jobserver-auth=' is not present in 'MAKEFLAGS'
since the '+' is missing on the recipe line in Makefiles generated by
automake. Add the '+' to the recipe line by hand.
bfd/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
binutils/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
config/
PR binutils/26792
* jobserver.m4: New file.
gas/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
gprof/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
ld/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
libctf/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
opcodes/
PR binutils/26792
* configure.ac: Use GNU_MAKE_JOBSERVER.
* aclocal.m4: Regenerated.
* configure: Likewise.
Tom de Vries [Tue, 12 Jan 2021 13:34:06 +0000 (14:34 +0100)]
[gdb/testsuite] Require is_amd64_regs_target in gdb.base/disasm-optim.exp
When running test-case gdb.base/disasm-optim.exp with target board unix/-m32,
we get:
...
Running disasm-optim.exp ...
gdb compile failed, disasm-optim.c: Assembler messages:
disasm-optim.c:35: Error: bad register name `%rip)'
disasm-optim.c:46: Error: bad register name `%rax)'
disasm-optim.c:57: Error: bad register name `%rip)'
=== gdb Summary ===
# of untested testcases 1
...
Fix this by requiring is_amd64_regs_target instead of istarget
"x86_64-*-linux*".
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-12 Tom de Vries <tdevries@suse.de>
* gdb.base/disasm-optim.exp: Require is_amd64_regs_target.
H.J. Lu [Tue, 12 Jan 2021 13:10:58 +0000 (05:10 -0800)]
elf/x86-64: Adjust R_AMD64_DIR64/R_AMD64_DIR32 for PE/x86-64 inputs
Subtract the value of the section contents for R_AMD64_DIR64 and
R_AMD64_DIR32 relocations when generating ELF output from PE/x86-64
inputs.
bfd/
PR ld/27171
* reloc.c (bfd_perform_relocation): Adjust R_AMD64_DIR64 and
R_AMD64_DIR32 relocations for PE/x86-64 inputs.
ld/
PR ld/27171
* testsuite/ld-x86-64/pe-x86-64-5.obj.bz2: New file.
* testsuite/ld-x86-64/pe-x86-64-5.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-5.rd: Likewise.
* testsuite/ld-x86-64/pe-x86-64.exp: Run PR ld/27171 test.
Nick Clifton [Tue, 12 Jan 2021 13:18:50 +0000 (13:18 +0000)]
Updated translations for some subdirectories
Andrew Burgess [Mon, 11 Jan 2021 15:40:18 +0000 (15:40 +0000)]
gdb: fix debug dump of OP_BOOL expressions
Consider this GDB session:
(gdb) set language fortran
(gdb) set debug expression 1
(gdb) p .TRUE.
Dump of expression @ 0x4055d90, before conversion to prefix form:
Language fortran, 3 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_BOOL 79 O...............
1 BINOP_ADD 1 ................
2 OP_BOOL 79 O...............
Dump of expression @ 0x4055d90, after conversion to prefix form:
Expression: `TRUE'
Language fortran, 3 elements, 16 bytes each.
0 OP_BOOL Unknown format
1 BINOP_ADD
2 OP_BOOL Unknown format
3 OP_NULL Unknown format
$1 = .TRUE.
The final dump of the OP_BOOL is completely wrong. After this patch
we now get:
(gdb) set language fortran
(gdb) set debug expression 1
(gdb) p .TRUE.
Dump of expression @ 0x2d07470, before conversion to prefix form:
Language fortran, 3 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_BOOL 79 O...............
1 BINOP_ADD 1 ................
2 OP_BOOL 79 O...............
Dump of expression @ 0x2d07470, after conversion to prefix form:
Expression: `TRUE'
Language fortran, 3 elements, 16 bytes each.
0 OP_BOOL TRUE
$1 = .TRUE.
Much better. I added a test for this into the Fortran testsuite.
gdb/ChangeLog:
* expprint.c (dump_subexp_body_standard): Handle OP_BOOL.
gdb/testsuite/ChangeLog:
* gdb.fortran/debug-expr.exp: Add new tests.
Andrew Burgess [Mon, 11 Jan 2021 14:14:02 +0000 (14:14 +0000)]
gdb/fortran: add symbol base comparison operators
Fortran supports symbol based comparison operators as well as the
classic text based comparison operators, so we have:
Text | Symbol
Operator | Operator
---------|---------
.eq. | ==
.ne. | /=
.le. | <=
.ge. | >=
.gt. | >
.lt. | <
This commit adds the symbol based operators as well as some tests.
gdb/ChangeLog:
* f-exp.y (dot_ops): Rename to...
(fortran_operators): ...this. Add a header comment. Add symbol
based operators.
(yylex): Update to use fortran_operators not dot_ops. Remove
special handling for '**', this is now included in
fortran_operators.
gdb/testsuite/ChangeLog:
* gdb.fortran/dot-ops.exp: Add new tests.
Mike Frysinger [Tue, 12 Jan 2021 09:11:29 +0000 (04:11 -0500)]
sim: or1k: fix mixing of code & decl warning
Use the correct style of declaring variables at top of scope.
This fixes a few compiler warnings in the process.
Mike Frysinger [Tue, 12 Jan 2021 09:06:18 +0000 (04:06 -0500)]
sim: or1k: clean up stale build entries
This logic was migrated to the common code long ago so ports don't
need to declare them themselves.
Mike Frysinger [Tue, 12 Jan 2021 09:04:08 +0000 (04:04 -0500)]
sim: README-HACKING: clean up stale run references
The run.c interface was deleted long ago and everyone moved to nrun.c
(which is also the default), so no one needs to declare this anymore.
Mike Frysinger [Tue, 12 Jan 2021 08:51:44 +0000 (03:51 -0500)]
sim: common: use #error properly
Mike Frysinger [Tue, 12 Jan 2021 08:34:24 +0000 (03:34 -0500)]
sim: or1k: delete redundant SIM_AC_OPTION_INLINE call
This was merged into the common code a long time ago, so ports
shouldn't be calling this themselves.
H.J. Lu [Tue, 12 Jan 2021 00:37:03 +0000 (16:37 -0800)]
binuitils: Check if AR is usable for LTO build
Check if AR is usable for LTO build with --enable-pgo-build=lto:
checking for -plugin option... ar: no operation specified
Failed: ar --plugin /usr/gcc-11.0.0-x32/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/liblto_plugin.so rc
no
configure: error: AR with --plugin and rc is required for LTO build
instead of build failure later.
PR binutils/26766
* configure.ac:
* configure: Regenerated.
H.J. Lu [Tue, 12 Jan 2021 00:29:31 +0000 (16:29 -0800)]
Binutils: Check if AR works with --plugin and rc
Check if AR works with --plugin and rc before passing --plugin to AR and
RANLIB.
bfd/
PR ld/27173
binutils/
PR ld/27173
* configure: Regenerated.
gas/
PR ld/27173
* configure: Regenerated.
gprof/
PR ld/27173
* configure: Regenerated.
ld/
PR ld/27173
* configure: Regenerated.
libctf/
PR ld/27173
* configure: Regenerated.
opcodes/
PR ld/27173
* configure: Regenerated.
H.J. Lu [Tue, 12 Jan 2021 00:26:39 +0000 (16:26 -0800)]
GCC: Check if AR works with --plugin and rc
AR from older binutils doesn't work with --plugin and rc:
[hjl@gnu-cfl-2 bin]$ touch foo.c
[hjl@gnu-cfl-2 bin]$ ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
[hjl@gnu-cfl-2 bin]$ ./ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
./ar: no operation specified
[hjl@gnu-cfl-2 bin]$ ./ar --version
GNU ar (Linux/GNU Binutils) 2.29.51.0.1.
20180112
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
[hjl@gnu-cfl-2 bin]$
Check if AR works with --plugin and rc before passing --plugin to AR and
RANLIB.
PR ld/27173
* configure: Regenerated.
* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Check if AR works with
--plugin and rc before enabling --plugin.
config/
PR ld/27173
* gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with
--plugin and rc before enabling --plugin.
libiberty/
PR ld/27173
* configure: Regenerated.
zlib/
PR ld/27173
* configure: Regenerated.
GDB Administrator [Tue, 12 Jan 2021 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sat, 9 Jan 2021 22:57:48 +0000 (17:57 -0500)]
sim: tests: get common tests working again
These were written with 32-bit host assumptions baked into it.
Simplify the printf formats to use ll length modifier as it's
in C11 rather than trying to manually break it up into two,
and cleanup some of the casts to stop assuming sizeof(long) is
the same as sizeof(int).
We also have to add a few more includes for the various funcs
used in here.
The tests aren't compiled automatically still. We can figure
that out later with more work.
Simon Marchi [Mon, 11 Jan 2021 21:52:42 +0000 (16:52 -0500)]
gdb: convert aarch64 to new-style debug macros
I haven't tried this on an actual aarch64 machine, but I am able to
exercise it like this:
(gdb) set debug aarch64
(gdb) maintenance selftest aa
Running selftest aarch64-analyze-prologue.
[aarch64] aarch64_analyze_prologue: prologue analysis gave up addr=0x14 opcode=0xf94013e0
Running selftest aarch64-process-record.
Ran 2 unit tests, 0 failed
gdb/ChangeLog:
* arch/aarch64-insn.h (aarch64_debug_printf): New.
* arch/aarch64-insn.c: Use aarch64_debug_printf.
* aarch64-tdep.c: Use aarch64_debug_printf.
Change-Id: Ifdb40e2816ab8e55a9aabb066d1833d9b5a46094
Simon Marchi [Mon, 11 Jan 2021 21:30:44 +0000 (16:30 -0500)]
gdb: convert solib-aix to new-style debug macros
This is only compile-tested.
gdb/ChangeLog:
* solib-aix.c (solib_aix_debug_printf): New, use throughout
file.
Change-Id: I7ec4baa15ab5b8ad786212b8b9de61c2c447bac1
Simon Marchi [Mon, 11 Jan 2021 21:18:48 +0000 (16:18 -0500)]
gdb: change jit_debug to a bool
gdb/ChangeLog:
* jit.c (jit_debug): Change type to bool.
(_initialize_jit): Adjust.
Change-Id: Ic2b1eec28eafe8ccb2899f38ddc91ba9703cb38e
Tom de Vries [Mon, 11 Jan 2021 17:24:55 +0000 (18:24 +0100)]
[gdb/testsuite] Fix gdb.arch/amd64-stap-three-arg-disp.S
On SLE-11 I ran into:
...
(gdb) print $_probe_arg0^M
Cannot access memory at address 0x8000003fe05c^M
(gdb) FAIL: gdb.arch/amd64-stap-special-operands.exp: probe: three_arg: \
print $_probe_arg0
...
The memory cannot be accessed because the address used to evaluate
$_probe_arg0 at the probe point is incorrect.
The address is calculated using this expression:
...
.asciz "-4@-4(%rbp,%ebx,0)"
...
which uses $ebx, but $ebx is uninitialized at the probe point.
The test-case does contain a "movl $0, %ebx" insn to set $ebx to 0, but that
insn is placed after the probe point. We could fix this by moving the insn
to before the probe point. But, $ebx is also a callee-save register, so
normally, if we modify it, we also need to save and restore it, which is
currently not done. This is currently not harmful, because we don't run the
test-case further than the probe point, but it's bound to cause confusion.
So, fix this instead by using $eax instead in the expression, and moving the
insn setting $eax to 0 to before the probe point.
gdb/testsuite/ChangeLog:
2021-01-11 Tom de Vries <tdevries@suse.de>
PR testsuite/26968
* gdb.arch/amd64-stap-three-arg-disp.S: Remove insn modifying $ebx.
Move insn setting $eax to before probe point.
Kyrylo Tkachov [Tue, 5 Jan 2021 17:39:04 +0000 (17:39 +0000)]
aarch64: Remove support for CSRE
This patch removes support for the CSRE extension from aarch64
gas/objdump.
CSRE (FEAT_CSRE) is part of the Future Architecture Technologies program
and at this time Arm is withdrawing this particular feature.
The patch removes the system registers and the CSR PDEC instruction.
gas/ChangeLog
* NEWS: Remove CSRE.
* config/tc-aarch64.c (parse_csr_operand): Delete.
(parse_operands): Delete handling of AARCH64_OPND_CSRE_CSR.
(aarch64_features): Remove csre.
* doc/c-aarch64.texi: Remove CSRE.
* testsuite/gas/aarch64/csre.d: Delete.
* testsuite/gas/aarch64/csre-invalid.s: Likewise.
* testsuite/gas/aarch64/csre-invalid.d: Likewise.
* testsuite/gas/aarch64/csre_csr.s: Likewise.
* testsuite/gas/aarch64/csre_csr.d: Likewise.
* testsuite/gas/aarch64/csre_csr-invalid.s: Likewise.
* testsuite/gas/aarch64/csre_csr-invalid.l: Likewise.
* testsuite/gas/aarch64/csre_csr-invalid.d: Likewise.
include/ChangeLog
* opcode/aarch64.h (AARCH64_FEATURE_CSRE): Delete.
(aarch64_opnd): Delete AARCH64_OPND_CSRE_CSR.
opcodes/ChangeLog
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Likewise.
* aarch64-opc-2.c: Likewise.
* aarch64-opc.c (aarch64_print_operand): Delete handling of
AARCH64_OPND_CSRE_CSR.
* aarch64-tbl.h (aarch64_feature_csre): Delete.
(CSRE): Likewise.
(_CSRE_INSN): Likewise.
(aarch64_opcode_table): Delete csr.
Matt Jenkins [Mon, 11 Jan 2021 14:31:55 +0000 (14:31 +0000)]
Add support for more MIPS variants to the linker command line.
PR ld/27167
* ldmain.c (get_emulation): Add mipsmips32r3, mips32r5, mips64r3
and mips64r5 to list of known mips targets.
Mike Frysinger [Sat, 9 Jan 2021 19:43:02 +0000 (14:43 -0500)]
sim: always call SIM_AC_OPTION_WARNINGS
Now that all ports have opted in to this, we can require it in the
core. It guarantees that new ports have them turned on, and defaults
to -Werror in the hopes that new ports keep their code clean from the
start. We do this as a sep commit to make it clear that there are no
changes to existing ports as they've all explicitly called it already.
Mike Frysinger [Sat, 9 Jan 2021 19:16:10 +0000 (14:16 -0500)]
sim: call SIM_AC_OPTION_WARNINGS(no) in remaining ports
We want all ports to opt into extra warnings as the default compiler
settings lets a lot slide. Opt all the ports that haven't already in
to the warning system. None of them build with -Werror, so disable
that by default. Hopefully someone finds these important enough to
start fixing at some point.
Mike Frysinger [Sat, 9 Jan 2021 19:10:20 +0000 (14:10 -0500)]
sim: or1k: fix include ordering with sim-main.h
Make sure config.h is included before C library headers otherwise the
later libiberty.h include gets confused about asprintf state leading
to warnings like:
common/sim-utils.c:330:9:
warning: implicit declaration of function 'vasprintf';
did you mean 'xvasprintf'? [-Wimplicit-function-declaration]
Mike Frysinger [Sat, 9 Jan 2021 19:06:15 +0000 (14:06 -0500)]
sim: common: fix printf formats
For 32-bit targets, %x happens to work for unsigned_word. But for
64-bit targets, it's too small, and gcc throws an error. Use the
right printf format define for them.
Mike Frysinger [Sat, 9 Jan 2021 15:18:50 +0000 (10:18 -0500)]
sim: rl78: move storage out of header
This port declares its pc variable in a header and then includes
it multiple times. This causes linker errors with newer gcc due
to the change in -fno-common behavior. Move the storage to a C
file so we only have one instance of it in the final program.
Mike Frysinger [Sat, 9 Jan 2021 08:56:10 +0000 (03:56 -0500)]
sim: clean up C11 header includes
Since we require C11 now, we can assume many headers exist, and
clean up all of the conditional includes. It's not like any of
this code actually accounted for the headers not existing, just
whether we could include them.
The strings.h cleanup is a little nuanced: it isn't in C11, but
every use of it in the codebase will include strings.h only if
string.h doesn't exist. Since we now assume the C11 string.h
exists, we'll never include strings.h, so we can delete it.
Nick Clifton [Mon, 11 Jan 2021 12:55:33 +0000 (12:55 +0000)]
Updated translations for multiple subdirectories
GDB Administrator [Mon, 11 Jan 2021 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 10 Jan 2021 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 9 Jan 2021 18:38:41 +0000 (11:38 -0700)]
Avoid crash in compile_to_object
PR 23672 points out a crash in compile_to_object. This crash came in
during a C++-ization. This patch avoids the crash.
The PR also points out another weird behavior in this code, but that
one requires some setup that I don't have here, and it seems to date
back to the introduction of the compile feature. So, it isn't
addressed here. I will leave the PR open so this bug isn't forgotten.
gdb/ChangeLog
2021-01-09 Tom Tromey <tom@tromey.com>
PR compile/23672
* compile/compile.c (compile_to_object): Avoid crash when
osabi_triplet_regexp returns NULL.
Tom Tromey [Sat, 9 Jan 2021 17:06:25 +0000 (10:06 -0700)]
Remove a use of print_expression
The tracepoint code uses print_expression to reconstruct an expression
string. However, the original expression is already available -- it
was just parsed a bit earlier in the same function. This patch
changes this code to simply save the already-parsed expression, rather
than attempt to reconstruct it.
gdb/ChangeLog
2021-01-09 Tom Tromey <tom@tromey.com>
* tracepoint.h (class collection_list) <append_exp>: Take a
std::string.
* tracepoint.c (collection_list::append_exp): Take a std::string.
(encode_actions_1): Update.
Tom Tromey [Sat, 9 Jan 2021 17:01:30 +0000 (10:01 -0700)]
Fix erroneous agent expression test
Testing of the expression rewrite revealed a buglet in ax.exp. One
test does:
gdb_test "maint agent (unsigned char)1L" ".*ext 8.*"
However, zero extension is not actually needed in this case -- a
simple "const8 1" is also correct here.
This patch changes the test to look for a push of any width of the
constant 1.
gdb/testsuite/ChangeLog
2021-01-09 Tom Tromey <tom@tromey.com>
* gdb.trace/ax.exp: Do not require an "ext".
H.J. Lu [Sat, 9 Jan 2021 14:51:15 +0000 (06:51 -0800)]
Support the PGO build for binutils+gdb
Add the --enable-pgo-build[=lto] configure option. When binutils+gdb
is not built together with GCC, --enable-pgo-build enables the PGO build:
1. First build with -fprofile-generate.
2. Use "make maybe-check-*" to generate profiling data and pass -i to make
to ignore errors when generating profiling data.
3. Use "make clean" to remove the previous build.
4. Rebuild with -fprofile-use.
With --enable-pgo-build=lto, -flto=jobserver -ffat-lto-objects are used
together with -fprofile-generate and -fprofile-use. Add '+' to the command
line for recursive make to support -flto=jobserver -ffat-lto-objects.
NB: --enable-pgo-build=lto enables the PGO build with LTO while
--enable-lto enables LTO support in toolchain.
PR binutils/26766
* Makefile.tpl (BUILD_CFLAGS): New.
(CFLAGS): Append $(BUILD_CFLAGS).
(CXXFLAGS): Likewise.
(PGO_BUILD_GEN_FLAGS_TO_PASS): New.
(PGO_BUILD_TRAINING_CFLAGS): Likewise.
(PGO_BUILD_TRAINING_CXXFLAGS): Likewise.
(PGO_BUILD_TRAINING_FLAGS_TO_PASS): Likewise.
(PGO_BUILD_TRAINING_MFLAGS): Likewise.
(PGO_BUILD_USE_FLAGS_TO_PASS): Likewise.
(PGO-TRAINING-TARGETS): Likewise.
(PGO_BUILD_TRAINING): Likewise.
(all): Add '+' to the command line for recursive make. Support
the PGO build.
* configure.ac: Add --enable-pgo-build[=lto].
AC_SUBST PGO_BUILD_GEN_CFLAGS, PGO_BUILD_USE_CFLAGS and
PGO_BUILD_LTO_CFLAGS. Enable the PGO build in Makefile.
* Makefile.in: Regenerated.
* configure: Likewise.
H.J. Lu [Sat, 9 Jan 2021 14:47:58 +0000 (06:47 -0800)]
Binutils: Pass --plugin to AR and RANLIB
Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
build.
bfd/
* configure: Regenerated.
binutils/
* configure: Regenerated.
gas/
* configure: Regenerated.
gprof/
* configure: Regenerated.
ld/
* configure: Regenerated.
libctf/
* configure: Regenerated.
opcodes/
* configure: Regenerated.
H.J. Lu [Sat, 9 Jan 2021 14:43:11 +0000 (06:43 -0800)]
GCC: Pass --plugin to AR and RANLIB
Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
build.
* Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
* configure.ac: Include config/gcc-plugin.m4.
AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
RANLIB if possible.
* Makefile.in: Regenerated.
* configure: Likewise.
config/
* gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
libiberty/
* Makefile.in (AR): Add @AR_PLUGIN_OPTION@
(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
(configure_deps): Depend on ../config/gcc-plugin.m4.
* aclocal.m4: Include ../config/gcc-plugin.m4.
* configure.ac: AC_SUBST AR_PLUGIN_OPTION and
RANLIB_PLUGIN_OPTION.
* configure: Regenerated.
zlib/
* configure: Regenerated.
Mike Frysinger [Sat, 9 Jan 2021 09:12:35 +0000 (04:12 -0500)]
sim: replace rindex with strrchr
Mike Frysinger [Sat, 9 Jan 2021 08:10:52 +0000 (03:10 -0500)]
sim: cr16/d10v: move storage out of header
These ports declare their State variable in a header and then include
multiple times. This causes linker errors with newer gcc due to the
change in -fno-common behavior. Move the storage to a C file so we
only have one instance of it in the final program.
Mike Frysinger [Sat, 9 Jan 2021 08:04:42 +0000 (03:04 -0500)]
sim: common: clean up asprintf includes a bit
Delete stale prototypes that libiberty.h already provides, and add
missing libiberty.h includes to files that use those functions.
Mike Frysinger [Sat, 9 Jan 2021 07:40:14 +0000 (02:40 -0500)]
sim: sh64: delete port
Support for sh64 was dropped from bfd et al in 2018. Without
that, the sim port is useless. So clean up this code too.
Mike Frysinger [Sat, 9 Jan 2021 07:12:27 +0000 (02:12 -0500)]
sim: clean up stale AC_PREREQ refs
This was purged from the tree when we upgraded to autoconf-2.69,
but a few references in the sim tree were missed.
Mike Frysinger [Sat, 9 Jan 2021 06:16:11 +0000 (01:16 -0500)]
sim: enable -Werror by default for some arches
We've had this off for a long time because the sim code was way too
full of warnings for it to be feasible. However, I've cleaned things
up significantly from when this was first merged, and we can start to
turn this around.
Change the macro to enable -Werror by default, and allow ports to opt
out. New ports will get it automatically (and we can push back on
them if they try to turn it off).
Also turn it off for the few ports that still hit warnings for me.
All the rest will get the new default, and we'll wait for feedback
if/when new issues come up.
H.J. Lu [Sat, 9 Jan 2021 14:11:06 +0000 (06:11 -0800)]
ld/x86-64: Properly Handle -z lam-u48/lam-u57
Properly merge GNU properties for LAM_U48 and LAM_U57.
bfd/
PR ld/27166
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Handle
-z lam-u48 and -z lam-u57.
ld/
PR ld/27166
* testsuite/ld-x86-64/lam-u48.rd: New file.
* testsuite/ld-x86-64/lam-u57.rd: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Add PR ld/27166 tests.
Mike Frysinger [Sat, 9 Jan 2021 08:01:05 +0000 (03:01 -0500)]
sim: pru: fix include ordering with sim-main.h
Make sure config.h is included before C library headers otherwise the
later libiberty.h include gets confused about asprintf state leading
to warnings like:
common/sim-utils.c:330:9:
warning: implicit declaration of function 'vasprintf';
did you mean 'xvasprintf'? [-Wimplicit-function-declaration]
Mike Frysinger [Sat, 9 Jan 2021 05:54:57 +0000 (00:54 -0500)]
sim: hw: rework code to avoid gcc warnings
Newer gcc thinks we might return a pointer to a stack buffer, but
we don't -- we strdup it before returning. Rework the code to just
malloc the buffer from the start and avoid the stack+strdup.
Nick Clifton [Sat, 9 Jan 2021 11:53:33 +0000 (11:53 +0000)]
Update release howto with 2.37 numbers
Nick Clifton [Sat, 9 Jan 2021 11:01:01 +0000 (11:01 +0000)]
Change version number to 2.36.50 and regenerate files
Nick Clifton [Sat, 9 Jan 2021 10:40:28 +0000 (10:40 +0000)]
Add Changelog entries and NEWS entries for 2.36 branch
Mike Frysinger [Sat, 9 Jan 2021 07:43:54 +0000 (02:43 -0500)]
sim: common: add missing stdlib.h for abort()
H.J. Lu [Sat, 9 Jan 2021 05:51:38 +0000 (21:51 -0800)]
ld/x86-64: Also set LAM_U57 when setting LAM_U48
Since LAM_U48 implies LAM_U57, also set LAM_U57 when setting LAM_U48.
bfd/
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Also set
LAM_U57 when setting LAM_U48.
ld/
* ld-x86-64/property-x86-lam-u48-4.d: Updated.
* ld-x86-64/property-x86-lam-u48-5.d: Likewise.
H.J. Lu [Sat, 9 Jan 2021 05:38:39 +0000 (21:38 -0800)]
elf: Verify section size for mixed ordered/unordered inputs
When fixing up SHF_LINK_ORDER, issue a fatal error if the output section
size is increased. Otherwise, bfd_set_section_contents will fail later
when attempting to write contents past the end of the output section.
PR ld/26256
PR ld/27160
* elflink.c (elf_fixup_link_order): Verify that fixing up
SHF_LINK_ORDER doesn't increase the output section size.
Peter Bergner [Fri, 8 Jan 2021 22:07:12 +0000 (16:07 -0600)]
POWER10: Add Return-Oriented Programming instructions
POWER10 adds some return-oriented programming (ROP) instructions and
this patch adds support for them. You will notice that they are enabled
for POWER8 and later, not just POWER10 and later. This is on purpose.
This allows the instructions to be added to POWER8 binaries that can be
run on POWER8, POWER9 and POWER10 cpus. On POWER8 and POWER9, these
instructions just act as nop's.
opcodes/
* ppc-opc.c (insert_dw, (extract_dw): New functions.
(DW, (XRC_MASK): Define.
(powerpc_opcodes) <hashchk, hashchkp, hashst, haststp>: New mnemonics.
gas/
* testsuite/gas/ppc/rop-checks.d,
* testsuite/gas/ppc/rop-checks.l,
* testsuite/gas/ppc/rop-checks.s,
* testsuite/gas/ppc/rop.d,
* testsuite/gas/ppc/rop.s: New tests.
* testsuite/gas/ppc/ppc.exp: Run them.
Alan Modra [Sat, 9 Jan 2021 00:33:29 +0000 (11:03 +1030)]
configure regen
commit
f478212851 did the regen by hand, missed a change in
ld/configure and didn't update line numbers. Fix that, and an old
regen of ld/Makefile.in with the wrong automake.
bfd/
* configure: Regenerate.
binutils/
* configure: Regenerate.
gas/
* configure: Regenerate.
gprof/
* configure: Regenerate.
ld/
* Makefile.in: Regenerate.
* configure: Regenerate.
libctf/
* configure: Regenerate.
opcodes/
* configure: Regenerate.
zlib/
* configure: Regenerate.
GDB Administrator [Sat, 9 Jan 2021 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Fri, 8 Jan 2021 07:24:51 +0000 (02:24 -0500)]
sim: require a C11 compiler
With GDB requiring a C++11 compiler now, this hopefully shouldn't
be a big deal. It's been 10 years since C11 came out, so should
be plenty of time to upgrade.
This will allow us to start cleaning up random header logic and
many of our non-standard custom types.
Tom Tromey [Fri, 8 Jan 2021 19:20:12 +0000 (12:20 -0700)]
Pass void_context_p to parse_expression
An earlier patch pointed out that nothing in GDB sets void_context_p
when parsing an expression. This patch fixes this omission.
"print" and "call" differ in that the former will print a value that
has void type, while the latter will not. AdaCore has had a patch for
a long time that uses this distinction to help with overload
resolution. In particular, in a "call" context, a procedure will be
chosen, while in a "print" context, a zero-argument function will be
chosen instead.
Regression tested on x86-64 Fedora 32.
gdb/ChangeLog
2021-01-08 Tom Tromey <tromey@adacore.com>
* parse.c (parse_expression): Add void_context_p parameter. Use
parse_exp_in_context.
* printcmd.c (print_command_1): Change voidprint to bool. Pass to
parse_expression.
(print_command, call_command): Update.
* expression.h (parse_expression): Add void_context_p parameter.
gdb/testsuite/ChangeLog
2021-01-08 Tom Tromey <tromey@adacore.com>
* gdb.ada/voidctx/pck.adb: New file.
* gdb.ada/voidctx/pck.ads: New file.
* gdb.ada/voidctx/voidctx.adb: New file.
* gdb.ada/voidctx.exp: New file.
Simon Marchi [Fri, 8 Jan 2021 18:46:56 +0000 (13:46 -0500)]
gdb: check for empty strings in get_standard_cache_dir/get_standard_config_dir
As reported in PR 27157, if some environment variables read at startup
by GDB are defined but empty, we hit the assert in gdb_abspath:
$ XDG_CACHE_HOME= ./gdb -nx --data-directory=data-directory -q
AddressSanitizer:DEADLYSIGNAL
=================================================================
==
2007040==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000001b0 (pc 0x5639d4aa4127 bp 0x7ffdac232c00 sp 0x7ffdac232bf0 T0)
==
2007040==The signal is caused by a READ memory access.
==
2007040==Hint: address points to the zero page.
#0 0x5639d4aa4126 in target_stack::top() const /home/smarchi/src/binutils-gdb/gdb/target.h:1334
#1 0x5639d4aa41f1 in inferior::top_target() /home/smarchi/src/binutils-gdb/gdb/inferior.h:369
#2 0x5639d4a70b1f in current_top_target() /home/smarchi/src/binutils-gdb/gdb/target.c:120
#3 0x5639d4b00591 in gdb_readline_wrapper_cleanup::gdb_readline_wrapper_cleanup() /home/smarchi/src/binutils-gdb/gdb/top.c:1046
#4 0x5639d4afab31 in gdb_readline_wrapper(char const*) /home/smarchi/src/binutils-gdb/gdb/top.c:1104
#5 0x5639d4ccce2c in defaulted_query /home/smarchi/src/binutils-gdb/gdb/utils.c:893
#6 0x5639d4ccd6af in query(char const*, ...) /home/smarchi/src/binutils-gdb/gdb/utils.c:985
#7 0x5639d4ccaec1 in internal_vproblem /home/smarchi/src/binutils-gdb/gdb/utils.c:373
#8 0x5639d4ccb3d1 in internal_verror(char const*, int, char const*, __va_list_tag*) /home/smarchi/src/binutils-gdb/gdb/utils.c:439
#9 0x5639d5151a92 in internal_error(char const*, int, char const*, ...) /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:55
#10 0x5639d5162ab4 in gdb_abspath(char const*) /home/smarchi/src/binutils-gdb/gdbsupport/pathstuff.cc:132
#11 0x5639d5162fac in get_standard_cache_dir[abi:cxx11]() /home/smarchi/src/binutils-gdb/gdbsupport/pathstuff.cc:228
#12 0x5639d3e76a81 in _initialize_index_cache() /home/smarchi/src/binutils-gdb/gdb/dwarf2/index-cache.c:325
#13 0x5639d4dbbe92 in initialize_all_files() /home/smarchi/build/binutils-gdb/gdb/init.c:321
#14 0x5639d4b00259 in gdb_init(char*) /home/smarchi/src/binutils-gdb/gdb/top.c:2344
#15 0x5639d4440715 in captured_main_1 /home/smarchi/src/binutils-gdb/gdb/main.c:950
#16 0x5639d444252e in captured_main /home/smarchi/src/binutils-gdb/gdb/main.c:1229
#17 0x5639d44425cf in gdb_main(captured_main_args*) /home/smarchi/src/binutils-gdb/gdb/main.c:1254
#18 0x5639d3923371 in main /home/smarchi/src/binutils-gdb/gdb/gdb.c:32
#19 0x7fa002d3f0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#20 0x5639d392314d in _start (/home/smarchi/build/binutils-gdb/gdb/gdb+0x4d414d)
gdb_abspath doesn't handle empty strings, so handle this case in the
callers. If a variable is defined but empty, I think it's reasonable in
this case to just ignore it, as if it was not defined.
Note that this sometimes also lead to a segfault, because the failed
assertion happens very early during startup, before things are fully
initialized.
gdbsupport/ChangeLog:
PR gdb/27157
* pathstuff.cc (get_standard_cache_dir, get_standard_config_dir,
find_gdb_home_config_file): Add empty string check.
gdb/testsuite/ChangeLog:
PR gdb/27157
* gdb.base/empty-host-env-vars.exp: New test.
Change-Id: I8654d8e97e74e1dff6d308c111ae4b1bbf07bef9
Andrew Burgess [Fri, 8 Jan 2021 10:27:58 +0000 (10:27 +0000)]
gdb: add missing test for completion of invalid /FMT strings
This commit:
commit
3df8c6afdd6d38a7622ff5f4b1a64aff80334ab9
Date: Fri Nov 27 10:46:07 2020 +0000
gdb: fix potentially uninitialised variable
Was pushed with no test. Naughty!
The new test checks how GDB behaves when completing an invalid /FMT
string.
Currently GDB does no validation of the /FMT string during tab
completion, and just assumes that any /FMT string is valid and
complete when the user hits TAB. So:
(gdb) p/@@<TAB>
Will give:
(gdb) p/@@ <CURSOR IS HERE>
We already had a test in place for completion on a valid /FMT string,
but the above commit fixed a bug in the logic for completing invalid
/FMT strings. Now we have a test for this too.
gdb/testsuite/ChangeLog:
* gdb.base/completion.exp: Add a new test.
Nick Clifton [Fri, 8 Jan 2021 11:55:44 +0000 (11:55 +0000)]
Updated Swedish translation for the opcodes/ subdirectory
Andrew Burgess [Thu, 22 Oct 2020 10:34:52 +0000 (11:34 +0100)]
gdb: user variables with components of dynamic type
Consider this Fortran type:
type :: some_type
integer, allocatable :: array_one (:,:)
integer :: a_field
integer, allocatable :: array_two (:,:)
end type some_type
And a variable declared:
type(some_type) :: some_var
Now within GDB we try this:
(gdb) set $a = some_var
(gdb) p $a
$1 = ( array_one =
../../src/gdb/value.c:3968: internal-error: Unexpected lazy value type.
Normally, when an internalvar ($a in this case) is created, it is
non-lazy, the value is immediately copied out of the inferior into
GDB's memory.
When printing the internalvar ($a) GDB will extract each field in
turn, so in this case `array_one`. As the original internalvar is
non-lazy then the extracted field will also be non-lazy, with its
contents immediately copied from the parent internalvar.
However, when the field has a dynamic type this is not the case, in
value_primitive_field we see that any field with dynamic type is
always created lazy. Further, the content of this field will usually
not have been captured in the contents buffer of the original value, a
field with dynamic location is effectively a pointer value contained
within the parent value, with rules in the DWARF for how to
dereference the pointer.
So, we end up with a lazy lval_internalvar_component representing a
field within an lval_internalvar. This eventually ends up in
value_fetch_lazy, which currently does not support
lval_internalvar_component, and we see the error above.
My original plan for how to handle this involved extending
value_fetch_lazy to handle lval_internalvar_component. However, when
I did this I ran into another error:
(gdb) set $a = some_var
(gdb) p $a
$1 = ( array_one = ((1, 1) (1, 1) (1, 1)), a_field = 5, array_two = ((0, 0, 0) (0, 0, 0)) )
(gdb) p $a%array_one
$2 = ((1, 1) (1, 1) (1, 1))
(gdb) p $a%array_one(1,1)
../../src/gdb/value.c:1547: internal-error: void set_value_address(value*, CORE_ADDR): Assertion `value->lval == lval_memory' failed.
The problem now is inside set_value_component_location, where we
attempt to set the address for a component if the original parent
value has a dynamic location. GDB does not expect to ever set the
address on anything other than an lval_memory value (which seems
reasonable).
In order to resolve this issue I initially thought about how an
internalvar should "capture" the value of a program variable at the
moment the var is created. In an ideal world (I think) GDB would be
able to do this even for values with dynamic type. So in our above
example doing `set $a = some_var` would capture the content of
'some_var', but also the content of 'array_one', and also 'array_two',
even though these content regions are not contained within the region
of 'some_var'.
Supporting this would require GDB values to be able to carry around
multiple non-contiguous regions of memory as content in some way,
which sounds like a pretty huge change to a core part of GDB.
So, I wondered if there was some other solution that wouldn't require
such a huge change.
What if values with a dynamic location were though of like points with
automatic dereferencing? Given this C structure:
struct foo_t {
int *val;
}
struct foo_t my_foo;
Then in GDB:
(gdb) $a = my_foo
We would expect GDB to capture the pointer value in '$a', but not the
value pointed at by the pointer. So maybe it's not that unreasonable
to think that given a dynamically typed field GDB will capture the
address of the content, but not the actual content itself.
That's what this patch does.
The approach is to catch this case in set_value_component_location.
When we create a component location (of an lval_internalvar) that has
a dynamic data location, the lval_internalvar_component is changed
into an lval_memory. After this, both of the above issues are
resolved. In the first case, the lval_memory is still lazy, but
value_fetch_lazy knows how to handle that. In the second case, when
we access an element of the array we are now accessing an element of
an lval_memory, not an lval_internalvar_component, and calling
set_value_address on an lval_memory is fine.
gdb/ChangeLog:
* value.c (set_value_component_location): Adjust the VALUE_LVAL
for internalvar components that have a dynamic location.
gdb/testsuite/ChangeLog:
* gdb.fortran/intvar-dynamic-types.exp: New file.
* gdb.fortran/intvar-dynamic-types.f90: New file.
Nick Clifton [Fri, 8 Jan 2021 11:51:50 +0000 (11:51 +0000)]
Fix places in the AArch64 opcodes library code where a call to assert() has side effects.
PR 27129
* aarch64-dis.c (determine_disassembling_preference): Move call to
aarch64_match_operands_constraint outside of the assertion.
* aarch64-asm.c (aarch64_ins_limm_1): Remove call to assert.
Replace with a return of FALSE.
Nick Clifton [Fri, 8 Jan 2021 11:29:43 +0000 (11:29 +0000)]
Treat the AArch64 register id_aa64mmfr2_el1 as a core system register.
PR 27139
* aarch64-opc.c (aarch64_sys_regs): Treat id_aa64mmfr2_el1 as a
core system register.
Tom de Vries [Fri, 8 Jan 2021 10:11:16 +0000 (11:11 +0100)]
[gdb] Fix internal-error in process_event_stop_test
The function create_exception_master_breakpoint in gdb/breakpoint.c attempts
to set a master exception breakpoint in each objfile. It tries this using
a libgcc/unwind probe, and if that fails then using the
_Unwind_DebugHook symbol:
...
for (objfile *objfile : current_program_space->objfiles ())
{
/* Try using probes. */
if (/* successful */)
continue;
/* Try using _Unwind_DebugHook */
}
...
The preference scheme works ok both if the objfile has debug info, and if it's
stripped.
But it doesn't work when the objfile has a .gnu_debuglink to a .debug file
(and the .debug file is present). What happens is that:
- we first encounter objfile libgcc.debug
- we try using probes, and this fails
- so we try _Unwind_DebugHook, which succeeds
- next we encounter objfile libgcc
- we try using probes, and this succeeds.
So, we end up with a master exception breakpoint in both libgcc (using probes)
and libgcc.debug (using _Unwind_DebugHook).
This eventually causes:
...
(gdb) PASS: gdb.cp/nextoverthrow.exp: post-check - next over a throw 3
next^M
src/gdb/infrun.c:6384: internal-error: \
void process_event_stop_test(execution_control_state*): \
Assertion `ecs->event_thread->control.exception_resume_breakpoint != NULL' \
failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.cp/nextoverthrow.exp: next
past catch (GDB internal error)
...
To trigger this internal-error, we need to use gcc-10 or later to compile the
test-case, such that it contains the fix for gcc PR97774 - "Incorrect line
info for try/catch".
Fix this by only trying to install the master exception breakpoint in
libgcc.debug using the _Unwind_DebugHook method, if the install using probes
in libgcc failed.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-01-08 Tom de Vries <tdevries@suse.de>
PR gdb/26881
* breakpoint.c (create_exception_master_breakpoint_probe)
(create_exception_master_breakpoint_hook): Factor out
of ...
(create_exception_master_breakpoint): ... here. Only try to install
the master exception breakpoint in objfile.debug using the
_Unwind_DebugHook method, if the install using probes in objfile
failed.
Andrew Burgess [Thu, 7 Jan 2021 17:13:21 +0000 (17:13 +0000)]
gdb/fortran: Correct the lval type for array elements of internal vars
Since this commit:
commit
a5c641b57b0b5e245b8a011cccc93a4120c8bd63
Date: Thu Oct 8 16:45:59 2020 +0100
gdb/fortran: Add support for Fortran array slices at the GDB prompt
A bug was introduced into GDB. Consider this Fortan array:
integer, dimension (1:10) :: array
array = 1
Now inside GDB:
(gdb) set $var = array
(gdb) set $var(1) = 2
Left operand of assignment is not an lvalue.
The problem is that the new code for slicing Fortran arrays now does
not set the lval type correctly for arrays that are not in memory.
This is easily fixed by making use of value_from_component.
After this the above example behaves as you'd expect.
gdb/ChangeLog:
* f-lang.c (fortran_value_subarray): Call value_from_component.
gdb/testsuite/ChangeLog:
* gdb.fortran/intvar-array.exp: New file.
* gdb.fortran/intvar-array.f90: New file.
Mike Frysinger [Fri, 8 Jan 2021 06:03:10 +0000 (01:03 -0500)]
sim: ppc: stub out sim_memory_map
Not clear how to implement this in the ppc-specific sim, so just
stub it out. This is as good as it was previously.
GDB Administrator [Fri, 8 Jan 2021 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Thu, 7 Jan 2021 08:07:42 +0000 (03:07 -0500)]
sim: ChangeLog: move arch-specific entries into the arch dir
We don't want arch-specific entries in the common ChangeLog files.
Most arches do this already, so clean up the recent additions, and
move some older entries down to help avoid confusing newcomers.
Mike Frysinger [Thu, 7 Jan 2021 06:57:35 +0000 (01:57 -0500)]
sim: cris: disable test that crashes the linker
PR ld/13900
Linking this test crashes the linker, so disable it. The crash
was reported about 9 years ago but haven't made progress, so lets
avoid the failures in test runs.
Mike Frysinger [Thu, 7 Jan 2021 06:27:46 +0000 (01:27 -0500)]
sim: cris: use -sim with C tests for cris-elf targets
Building the C tests with a cris-elf toolchain (gcc-10.2 &
newlib-4.1.0) currently fail due to warnings it emits:
cris-elf-ld: libc.a(lib_a-closer.o): in function `_close_r':
newlib/libc/reent/closer.c:47: warning: _close is not implemented and will always fail
This is because the default target for cris-elf is bare metal, not
the simulator. For that, we need -sim. So add it for elf targets.
We don't add it for all targets as the simulator (and testsuite)
run both libgloss programs as well as Linux userspace programs.
Mike Frysinger [Wed, 30 Dec 2015 06:52:01 +0000 (01:52 -0500)]
sim: h8300: delete opcode caching
This is in preparation for converting h8300 over to the common memory
framework. It's not clear how much of a speed gain this was providing
in the first place -- a naive test of ~400k insns (using shlr.s) shows
that this code actually slowed things down a bit.
If anyone really cares about h8300 anymore, they can migrate to the
common insn caching logic.
Mike Frysinger [Wed, 30 Dec 2015 04:52:57 +0000 (23:52 -0500)]
gdb/sim: add support for exporting memory map
This allows gdb to quickly dump & process the memory map that the sim
knows about. This isn't fully accurate, but is largely limited by the
gdb memory map format. While the sim supports RWX bits, gdb can only
handle RW or RO regions.
Samuel Thibault [Thu, 7 Jan 2021 16:47:36 +0000 (16:47 +0000)]
libtool.m4: update GNU/Hurd test from upstream. In upstream libtool,
47a889a4ca20 ("Improve GNU/Hurd support.") fixed detection of shlibpath_overrides_runpath, thus avoiding unnecessary relink. This backports it.
. * libtool.m4: Match gnu* along other GNU systems.
*/ChangeLog:
* configure: Re-generate.
Nick Clifton [Thu, 7 Jan 2021 14:47:20 +0000 (14:47 +0000)]
Updated French translation for the opcodes/ subdirectory.
H.J. Lu [Thu, 7 Jan 2021 14:42:00 +0000 (06:42 -0800)]
ELF: Don't generate unused section symbols
For ELF targets, section symbols are required only for relocations.
With -ffunction-sections -fdata-sections, there can be many unused
section symbols. Sizes of libstdc++.a on Linux/x86-64 in GCC 11 are
With unused section symbols :
39411698 bytes
Without unused section symbols:
39227002 bytes
The unused section symbols in libstdc++.a occupy more than 180 KB.
Add BSF_SECTION_SYM_USED to indicate if a section symbol should be
included in the symbol table. The BSF_SECTION_SYM_USED should be set
if the section symbol is used for relocation or the section symbol is
always included in the symbol table.
Add keep_unused_section_symbols to bfd_target to indicate if unused
section symbols should be kept. If TARGET_KEEP_UNUSED_SECTION_SYMBOLS
is defined as FALSE, unused ection symbols will be removed.
Tested on Linux/x86. Other ELF backends need to:
1. Define TARGET_KEEP_UNUSED_SECTION_SYMBOLS to FALSE.
2. Mark used section symbols in assembler backend.
3. Remove unused section symbols from expected assembler and linker
outputs.
bfd/
PR 27109
* aix386-core.c (core_aix386_vec): Initialize
keep_unused_section_symbol to TARGET_KEEP_UNUSED_SECTION_SYMBOLS.
* aout-target.h (MY (vec)): Likewise.
* binary.c (binary_vec): Likewise.
* cisco-core.c (core_cisco_be_vec): Likewise.
(core_cisco_le_vec): Likewise.
* coff-alpha.c (alpha_ecoff_le_vec): Likewise.
* coff-i386.c (TARGET_SYM): Likewise.
(TARGET_SYM_BIG): Likewise.
* coff-ia64.c (TARGET_SYM): Likewise.
* coff-mips.c (mips_ecoff_le_vec): Likewise.
(mips_ecoff_be_vec): Likewise.
(mips_ecoff_bele_vec): Likewise.
* coff-rs6000.c (rs6000_xcoff_vec): Likewise.
(powerpc_xcoff_vec): Likewise.
* coff-sh.c (sh_coff_small_vec): Likewise.
(sh_coff_small_le_vec): Likewise.
* coff-tic30.c (tic30_coff_vec): Likewise.
* coff-tic54x.c (tic54x_coff0_vec): Likewise.
(tic54x_coff0_beh_vec): Likewise.
(tic54x_coff1_vec): Likewise.
(tic54x_coff1_beh_vec): Likewise.
(tic54x_coff2_vec): Likewise.
(tic54x_coff2_beh_vec): Likewise.
* coff-x86_64.c (TARGET_SYM): Likewise.
(TARGET_SYM_BIG): Likewise.
* coff64-rs6000.c (rs6000_xcoff64_vec): Likewise.
(rs6000_xcoff64_aix_vec): Likewise.
* coffcode.h (CREATE_BIG_COFF_TARGET_VEC): Likewise.
(CREATE_BIGHDR_COFF_TARGET_VEC): Likewise.
(CREATE_LITTLE_COFF_TARGET_VEC): Likewise.
* elfxx-target.h (TARGET_BIG_SYM): Likewise.
(TARGET_LITTLE_SYM): Likewise.
* hppabsd-core.c (core_hppabsd_vec): Likewise.
* hpux-core.c (core_hpux_vec): Likewise.
* i386msdos.c (i386_msdos_vec): Likewise.
* ihex.c (ihex_vec): Likewise.
* irix-core.c (core_irix_vec): Likewise.
* mach-o-target.c (TARGET_NAME): Likewise.
* mmo.c (mmix_mmo_vec): Likewise.
* netbsd-core.c (core_netbsd_vec): Likewise.
* osf-core.c (core_osf_vec): Likewise.
* pdp11.c (MY (vec)): Likewise.
* pef.c (pef_vec): Likewise.
(pef_xlib_vec): Likewise.
* plugin.c (plugin_vec): Likewise.
* ppcboot.c (powerpc_boot_vec): Likewise.
* ptrace-core.c (core_ptrace_vec): Likewise.
* sco5-core.c (core_sco5_vec): Likewise.
* som.c (hppa_som_vec): Likewise.
* srec.c (srec_vec): Likewise.
(symbolsrec_vec): Likewise.
* tekhex.c (tekhex_vec): Likewise.
* trad-core.c (core_trad_vec): Likewise.
* verilog.c (verilog_vec): Likewise.
* vms-alpha.c (alpha_vms_vec): Likewise.
* vms-lib.c (alpha_vms_lib_txt_vec): Likewise.
* wasm-module.c (wasm_vec): Likewise.
* xsym.c (sym_vec): Likewise.
* elf.c (ignore_section_sym): Return TRUE if BSF_SECTION_SYM_USED
isn't set.
(elf_map_symbols): Don't include ignored section symbols.
* elfcode.h (elf_slurp_symbol_table): Also set
BSF_SECTION_SYM_USED on STT_SECTION symbols.
* elflink.c (bfd_elf_final_link): Generated section symbols only
when emitting relocations or reqired.
* elfxx-x86.h (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): New.
* syms.c (BSF_SECTION_SYM_USED): New.
* targets.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): New.
(bfd_target): Add keep_unused_section_symbols.
(bfd_keep_unused_section_symbols): New.
* bfd-in2.h: Regenerated.
binutils/
PR 27109
* objcopy.c (copy_object): Handle section symbols for
non-relocatable inputs.
* testsuite/binutils-all/readelf.exp (readelf_test): Check
is_elf_unused_section_symbols.
* testsuite/binutils-all/readelf.s-64: Updated.
* testsuite/binutils-all/readelf.ss: Likewise.
* testsuite/binutils-all/readelf.ss-64: Likewise.
* testsuite/binutils-all/readelf.s-64-unused: New file.
* testsuite/binutils-all/readelf.ss-64-unused: Likewise.
* testsuite/binutils-all/readelf.ss-unused: Likewise.
* testsuite/lib/binutils-common.exp
(is_elf_unused_section_symbols): New proc.
gas/ChangeLog:
PR 27109
* read.c (s_reloc): Call symbol_mark_used_in_reloc on the
section symbol.
* subsegs.c (subseg_set_rest): Set BSF_SECTION_SYM_USED if needed.
* write.c (adjust_reloc_syms): Call symbol_mark_used_in_reloc
on the section symbol.
(set_symtab): Don't generate unused section symbols.
(maybe_generate_build_notes): Call symbol_mark_used_in_reloc
on the section symbol.
* config/obj-elf.c (elf_adjust_symtab): Call
symbol_mark_used_in_reloc on the group signature symbol.
* testsuite/gas/cfi/cfi-label.d: Remove unused section symbols
from expected output.
* testsuite/gas/elf/elf.exp (run_elf_list_test): Check
is_elf_unused_section_symbols.
* testsuite/gas/elf/section2.e: Updated.
* testsuite/gas/elf/section2.e-unused: New file.
* testsuite/gas/elf/symver.d: Remove unused section symbols.
* testsuite/gas/i386/ilp32/elf/symver.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-1.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-3.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-size-5.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-unwind.d: Likewise.
* testsuite/gas/i386/size-1.d: Likewise.
* testsuite/gas/i386/size-3.d: Likewise.
* testsuite/gas/i386/svr4.d: Likewise.
* testsuite/gas/i386/x86-64-size-1.d: Likewise.
* testsuite/gas/i386/x86-64-size-3.d: Likewise.
* testsuite/gas/i386/x86-64-size-5.d: Likewise.
* testsuite/gas/i386/x86-64-unwind.d: Likewise.
ld/
PR 27109
* testsuite/ld-elf/export-class.sd: Adjust the expected output.
* testsuite/ld-elf/loadaddr3b.d: Likewise.
* testsuite/ld-i386/ibt-plt-1.d: Likewise.
* testsuite/ld-i386/ibt-plt-2a.d: Likewise.
* testsuite/ld-i386/ibt-plt-2c.d: Likewise.
* testsuite/ld-i386/ibt-plt-3a.d: Likewise.
* testsuite/ld-i386/ibt-plt-3c.d: Likewise.
* testsuite/ld-i386/pr19636-1d.d: Likewise.
* testsuite/ld-i386/pr19636-1l.d: Likewise.
* testsuite/ld-i386/pr19636-2c.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise.
* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise.
* testsuite/ld-x86-64/bnd-plt-1.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-1.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3c.d: Likewise.
* testsuite/ld-x86-64/pr19609-4e.d: Likewise.
* testsuite/ld-x86-64/pr19609-6a.d: Likewise.
* testsuite/ld-x86-64/pr19609-6b.d: Likewise.
* testsuite/ld-x86-64/pr19609-7b.d: Likewise.
* testsuite/ld-x86-64/pr19609-7d.d: Likewise.
* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
* testsuite/ld-x86-64/pr20253-1d.d: Likewise.
* testsuite/ld-x86-64/pr20253-1h.d: Likewise.
* testsuite/ld-x86-64/pr21038b-now.d: Likewise.
* testsuite/ld-x86-64/pr21038b.d: Likewise.
* testsuite/ld-x86-64/pr21038c-now.d: Likewise.
* testsuite/ld-x86-64/pr21038c.d: Likewise.
* testsuite/ld-x86-64/pr23854.d: Likewise.
* testsuite/ld-x86-64/pr25416-3.d: Likewise.
* testsuite/ld-x86-64/pr25416-4.d: Likewise.
* testsuite/ld-i386/plt-pic.pd: Likewise.
* testsuite/ld-i386/plt-pic2.dd: Likewise.
* testsuite/ld-i386/plt.pd: Likewise.
* testsuite/ld-i386/plt2.dd: Likewise.
* testsuite/ld-i386/tlsbin.rd: Likewise.
* testsuite/ld-i386/tlsbin2.rd: Likewise.
* testsuite/ld-i386/tlsbindesc.rd: Likewise.
* testsuite/ld-i386/tlsdesc.rd: Likewise.
* testsuite/ld-i386/tlsgdesc.rd: Likewise.
* testsuite/ld-i386/tlsnopic.rd: Likewise.
* testsuite/ld-i386/tlspic.rd: Likewise.
* testsuite/ld-i386/tlspic2.rd: Likewise.
* testsuite/ld-x86-64/mpx3.dd: Likewise.
* testsuite/ld-x86-64/mpx3n.dd: Likewise.
* testsuite/ld-x86-64/mpx4.dd: Likewise.
* testsuite/ld-x86-64/mpx4n.dd: Likewise.
* testsuite/ld-x86-64/pe-x86-64-1.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-2.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-3.od: Likewise.
* testsuite/ld-x86-64/pe-x86-64-4.od: Likewise.
* testsuite/ld-x86-64/plt.pd: Likewise.
* testsuite/ld-x86-64/plt2.dd: Likewise.
* testsuite/ld-x86-64/tlsbin.rd: Likewise.
* testsuite/ld-x86-64/tlsbin2.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc.rd: Likewise.
* testsuite/ld-x86-64/tlspic.rd: Likewise.
* testsuite/ld-x86-64/tlspic2.rd: Likewise.
* testsuite/ld-elf/sec64k.exp: Check
is_elf_unused_section_symbols.
Fredrik Noring [Thu, 7 Jan 2021 14:44:27 +0000 (14:44 +0000)]
m68k: Require m68020up rather than m68000up for CHK.L instruction.
* m68k-opc.c (chkl): Change minimum architecture requirement to
m68020.
Tom Tromey [Thu, 7 Jan 2021 14:02:46 +0000 (07:02 -0700)]
Fix regression in Ada do_full_match
An earlier patch to ada-lang.c:do_full_match introduced a subtle
change to the semantics. The previous code did:
- if (strncmp (sym_name, search_name, search_name_len) == 0
- && is_name_suffix (sym_name + search_name_len))
- return true;
-
- if (startswith (sym_name, "_ada_")
whereas the new code unconditionally skips a leading "_ada_".
The difference occurs if the lookup name itself starts with "_ada_".
In this case, the symbol won't match.
Normally this doesn't seem to be a problem. However, it caused a
regression on one particular (internal) test case on one particular
platform.
This patch changes the code to handle this case. I don't know how to
write a reliable test case for this, so no test is included.
2021-01-07 Tom Tromey <tromey@adacore.com>
* ada-lang.c (do_full_match): Conditionally skip "_ada_" prefix.
Alan Modra [Thu, 7 Jan 2021 13:59:31 +0000 (00:29 +1030)]
sh-pe ld XPASSes
* testsuite/ld-scripts/fill.d: Skip sh-*-pe rather than xfail.
* testsuite/ld-scripts/fill16.d: Don't xfail sh-*-pe.
* testsuite/ld-scripts/segment-start.d: Likewise.