In check_relocs, bfd_link_pic true means ld is producing a shared
library or a position independent executable. !bfd_link_pic means a
fixed position (ie. static) executable since the relocatable linking
case is excluded. So it is appropriate to continue using bfd_link_pic
when testing whether non-pcrelative relocations should be dynamic, and
!bfd_link_pic for the special case of ifunc in static executables.
However, -Bsymbolic shouldn't affect PIEs (they are executables so
none of their symbols should be overridden) and PIEs can support copy
relocations, thus bfd_link_executable should be used in those cases
rather than bfd_link_pic.
I've also removed the test of ELIMINATE_COPY_RELOCS in check_relocs.
We can sort out what to do regarding copy relocs later, which allows
the code in check_relocs to be simplified.
* elf64-ppc.c (ppc64_elf_check_relocs): Use bfd_link_executable
in choosing between different actions for shared library and
non-shared library cases. Delete ELIMINATE_COPY_RELOCS test.
(dec_dynrel_count): Likewise. Account for ifunc special case.
(ppc64_elf_adjust_dynamic_symbol): Copy relocs are for executables,
not non-pic.
(allocate_dynrelocs): Comment fixes. Delete ELIMINATE_COPY_RELOCS
test.
bfd/
* bfd-in.h: Move arm declaraions..
* cpu-arm.h: ..to here, new file..
* coff-arm.h: ..and here, new file..
* elf32-arm.h: ..and here, new file.
* cpu-arm.c: Include cpu-arm.h.
* coff-arm.c: Include cpu-arm.h and coff-arm.h.
* elf32-arm.c: Include cpu-arm.h and elf32-arm.h.
* pe-arm.c: Move function rename defines later.
* pe-arm-wince.c: Likewise and include sysdep.h and bfd.h early.
* bfd-in2.h: Regenerate.
gas/
* config/tc-arm.c: Include cpu-arm.h.
ld/
* emultempl/armelf.em: Include elf32-arm.h.
* emultempl/pe.em: Move func defines later and include coff-arm.h.
Pointer comparisons after adding an offset just don't work to catch
overflow when the offset is a larger type than the pointer.
PR 25018
* dwarf.c (get_type_signedness): Delete ineffective pointer
comparison check. Properly range check uvalue offset on
recursive call.
(read_and_display_attr_value): Range check uvalue offset before
calling get_type_signedness.
gcc10 on x86_64 and powerpc64le recognises that the loop in
Foo::operator= can be turned into a call to memmove, which then
results in an undefined symbol when linking. Avoid that by making the
loop smaller.
* testsuite/ld-srec/sr3.cc (FOO_MSG_LEN): Set to 4.
We currently run into:
...
248 n = callee1 (n + l5);
(gdb) PASS: gdb.base/restore.exp: caller5 calls callee1; return callee now
print l1
$51 = <optimized out>
(gdb) FAIL: gdb.base/restore.exp: caller5 calls callee1; return restored l1 \
to 32492
...
The problem is that we try to access the value of l1 in function caller5, but
variable l1 has no DW_AT_location attribute. Since l1 is declared using the
register keyword, it's valid for gcc to emit no DW_AT_location at -O0.
Change the FAIL into an UNSUPPORTED.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-09-22 Tom de Vries <tdevries@suse.de>
* gdb.base/restore.exp: Allow register variables to be optimized out at
-O0.
These int fields have been converted to bool, so their doc should say
"true" and not "nonzero".
gdb/ChangeLog:
* breakpoint.h (bp_location) <inserted, permanent, duplicate>:
Change "nonzero" to "true" in documentation.
All implementations of either function use it for the same purpose (except
Darwin, which is a no-op): to prefer a symbol in the current objfile over
symbols with the same name in other objfiles. There does not seem to be a
reason to have both mechanisms for that purpose.
gdb/ChangeLog:
2019-09-20 Christian Biesinger <cbiesinger@google.com>
* solib-darwin.c (darwin_lookup_lib_symbol): Remove.
(_initialize_darwin_solib): Don't set
darwin_so_ops.lookup_lib_global_symbol.
* solib-svr4.c (set_solib_svr4_fetch_link_map_offsets): Call
set_gdbarch_iterate_over_objfiles_in_search_order.
(elf_lookup_lib_symbol): Rename to...
(svr4_iterate_over_objfiles_in_search_order): this, and update
to iterate semantics.
(_initialize_svr4_solib): Don't set lookup_lib_global_symbol.
* solib.c (solib_global_lookup): Remove.
* solist.h (struct target_so_ops): Remove lookup_lib_global_symbol.
(solib_global_lookup): Remove.
* symtab.c (lookup_global_or_static_symbol): Remove call to
solib_global_lookup.
Instead of declaring debug_threads and using_threads in several
.c files, declare them in debug.h.
gdb/gdbserver/ChangeLog:
2019-09-20 Christian Biesinger <cbiesinger@google.com>
* debug.c (debug_threads): Remove comment in favor of the header.
* debug.h (using_threads): Add declaration.
(debug_threads): Add comment.
* linux-aarch64-low.c: Include debug.h and remove declaration of
debug_threads.
* nto-low.c: Likewise.
* remote-utils.c: Likewise.
* thread-db.c: Likewise.
This is a followup on the following commit...
commit b4be1b0648
Date: Wed Mar 13 15:13:03 2019 -0400
Subject: Fix MI output for multi-location breakpoints
... which mistakenly added NEWS entries in the "in gdb-8.3" section,
rather than in the "since gdb-8.3" one.
gdb/ChangeLog:
* NEWS: Move entries about default MI version now being
version 3, and about the GDB/MI fix for multi-location
breakpoints to the "since GDB 8.3" section.
For the lui and auipc relaxations, since the symbol value of an undefined weak
symbol is always be zero, we can optimize the patterns into a single LI/MV/ADDI
instruction.
bfd/
* elfnn-riscv.c (riscv_pcgp_hi_reloc): Add new field undefined_weak.
(riscv_record_pcgp_hi_reloc): New parameter undefined_weak.
Set undefined_weak field from it.
(relax_func_t): New parameter undefined_weak.
(_bfd_riscv_relax_call): New ignored parameter undefined_weak.
(_bfd_riscv_relax_tls_le): Likewise.
(_bfd_riscv_relax_align): Likewise.
(_bfd_riscv_relax_delete): Likewise.
(_bfd_riscv_relax_lui): New parameter undefined_weak. If true,
allow relaxing. For LO12* relocs, set rs1 to x0 when undefined_weak.
(_bfd_riscv_relax_pc): New parameter undefined_weak. For LO12* relocs,
set undefined_weak from hi_reloc. If true, allow relaxing. For LO12*
relocs, set rs1 to x0 when undefined_weak and change to non-pcrel
reloc.
(_bfd_riscv_relax_section): New local undefined_weak. Set for
undef weak relocs that can be relaxed. Pass to relax_func call.
ld/
* testsuite/ld-riscv-elf/weakref32.s: Add relaxable undef weak code.
* testsuite/ld-riscv-elf/weakref64.s: Likewise.
* testsuite/ld-riscv-elf/weakref32.d: Updated.
* testsuite/ld-riscv-elf/weakref64.d: Updated.
The TUI window-related commands like "focus" are case insensitive.
This is not the norm in gdb, and I don't see a good reason to have it
here. This patch changes the TUI to be case sensitive, like the rest
of gdb.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* NEWS: Mention case-sensitivity of TUI commands.
* tui/tui-win.c (tui_set_focus_command): Now case-sensitive.
(tui_set_win_height_command, parse_scrolling_args): Likewise.
* tui/tui-layout.c (tui_layout_command): Now case-sensitive.
This changes a couple of spots in the TUI to use make_unique_xstrdup.
This simplifies the code slightly.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui-source.c (tui_source_window::set_contents): Use
make_unique_xstrdup.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Use
make_unique_xstrdup.
This removes various separator comments from the TUI. These aren't
used elsewhere in gdb, and they were incorrect in some cases as well.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui-data.c: Remove separator comments.
* tui/tui-layout.c: Remove separator comments.
* tui/tui-win.c: Remove separator comments.
* tui/tui-wingeneral.c: Remove separator comments.
An earlier patch in the series removed the last call to strcat_to_buf,
so this patch removes the function entirely.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui.h (strcat_to_buf): Don't declare.
* tui/tui.c (strcat_to_buf): Remove.
This renames tui_source_window::fullname to add the "m_" prefix, as it
is a private data member.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui-source.h (struct tui_source_window) <m_fullname>: Rename
from "fullname".
* tui/tui-source.c (tui_source_window::set_contents)
(tui_source_window::location_matches_p)
(tui_source_window::maybe_update): Update.
As Pedro suggested, this patch renames the private data members of
tui_data_window to use the "m_" prefix.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <get_current_group>:
Update.
<m_regs_content, m_regs_column_count, m_current_group>: Add "m_"
prefix.
* tui/tui-regs.c (tui_data_window::last_regs_line_no)
(tui_data_window::line_from_reg_element_no)
(tui_data_window::first_reg_element_no_inline)
(tui_data_window::show_registers)
(tui_data_window::show_register_group)
(tui_data_window::display_registers_from)
(tui_data_window::display_registers_from_line)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows)
(tui_data_window::erase_data_content)
(tui_data_window::do_scroll_vertical)
(tui_data_window::refresh_window)
(tui_data_window::check_register_values): Update.
This changes two members of tui_locator_window to have type
std::string. This removes a static limit.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN): Remove define.
(struct tui_locator_window) <full_name, proc_name>: Now
std::string.
* tui/tui-stack.c (tui_locator_window::make_status_line)
(tui_locator_window::set_locator_fullname)
(tui_locator_window::set_locator_info): Update.
* tui/tui-source.c (tui_source_window::set_contents)
(tui_source_window::showing_source_p): Update.
Commit e594a5d1 ("Turn two locator functions into methods") turned
set_locator_fullname into a method on tui_locator_window. I missed it
at the time, but this change allows for the removal of a call to
tui_locator_win_info_ptr.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui-stack.c (tui_locator_window::set_locator_fullname):
Don't call tui_locator_win_info_ptr.
There's no reason to call refresh in tui_resize_all. This call
flushes the curses window contents to the terminal -- but, because
we're about the resize all the windows, we're going to be sending more
data to the terminal momentarily. This patch removes the call.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_resize_all): Don't call refresh.
The TUI has long had code to resize the locator, using 2 as the
height. However the code has "1" in a comment, like:
locator->resize (2 /* 1 */ ,
This patch fixes the resizing code to set the height to 1. Doing this
revealed what was probably the reason for setting the height to 2 in
the first place: this caused the locator window to scroll. However,
this is easily handled by calling scrollok on the locator window.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use 1 as
height for locator.
* tui/tui-stack.c (tui_locator_window::rerender): Call scrollok.
* tui/tui-layout.c (show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Use 1 as height for locator.
This changes the "win_resized" global to be a bool and then updates
the uses.
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_enable): Update.
* tui/tui-win.c (tui_sigwinch_handler, tui_async_resize_screen):
Update.
* tui/tui-data.h (tui_win_resized, tui_set_win_resized_to):
Update.
* tui/tui-data.c (win_resized): Now bool.
(tui_win_resized): Return bool.
(tui_set_win_resized_to): Accept a bool.
This changes tui_data_window::show_register_group to use "bool" rather
than "int".
gdb/ChangeLog
2019-09-20 Tom Tromey <tom@tromey.com>
* tui/tui-regs.h (struct tui_data_window) <show_register_group>:
Change type of "refresh_values_only".
* tui/tui-regs.c (tui_data_window::show_register_group): Change
type of "refresh_values_only".