H.J. Lu [Fri, 1 Sep 2017 13:11:54 +0000 (06:11 -0700)]
x86: Correct unwind information for the second PLT
For i386, generate unwind information for the second PLT. For x32,
correct alignment of .eh_frame section for the second PLT.
bfd/
PR ld/22061
* elf32-i386.c (elf_i386_link_setup_gnu_properties): Create
.eh_frame section for the second PLT.
* elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Correct
alignment of .eh_frame section for the second PLT.
ld/
PR ld/22061
* testsuite/ld-i386/ibt-plt-1.d: Updated.
* 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-x86-64/ibt-plt-1-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
* testsuite/ld-i386/ibt-plt-2b.d: Pass --hash-style=sysv to ld
and dump unwind information.
* testsuite/ld-i386/ibt-plt-2d.d: Likewise.
* testsuite/ld-i386/ibt-plt-3b.d: Likewise.
* testsuite/ld-i386/ibt-plt-3d.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2b-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2b.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2d.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3b-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3b.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
Tamar Christina [Fri, 1 Sep 2017 10:43:51 +0000 (11:43 +0100)]
Enable support for the AArch64 dot-prod instruction in the Cortex A55 and A75 cpus.
* config/tc-aarch64.c (aarch64_cpus): Enable DOTPROD for
cortex-a55 and cortx-a75.
Nick Clifton [Fri, 1 Sep 2017 10:20:51 +0000 (11:20 +0100)]
Prevent an address violation parsing corrupt DWARF information by fixing the test for an overlong debug line info structure.
PR 22059
* dwarf2.c (decode_line_info): Fix test for an overlong line info
structure.
Nick Clifton [Fri, 1 Sep 2017 09:52:53 +0000 (10:52 +0100)]
Import latest fixes to libiberty from GCC.
PR lto/81968
* simple-object-elf.c (simple_object_elf_copy_lto_debug_section):
Keep names of removed global symbols.
* simple-object-xcoff.c (simple_object_xcoff_find_sections):
Improve .go_export csect handling. Don't make assumptions
on containing section or number of auxiliary entries.
PR lto/81968
* simple-object-elf.c (simple_object_elf_copy_lto_debug_section):
Adjust field with for sh_type write, set SHF_EXCLUDE only for
removed sections.
PR lto/81925
* simple-object-elf.c (simple_object_elf_write_shdr): Adjust
type of sh_addralign and sh_entsize and properly write
sh_entsize as Elf_Addr.
(simple_object_elf_write_to_file): Read sh_entsize as Elf_Addr.
* simple-object-common.h (struct simple_object_functions): Add
copy_lto_debug_sections hook.
* simple-object.c: Include fcntl.h.
(handle_lto_debug_sections): New helper function.
(simple_object_copy_lto_debug_sections): New function copying
early LTO debug sections to regular debug sections in a new file.
(simple_object_start_write): Handle NULL segment_name.
* simple-object-coff.c (simple_object_coff_functions): Adjust
for not implemented copy_lto_debug_sections hook.
* simple-object-mach-o.c (simple_object_mach_o_functions): Likewise.
* simple-object-xcoff.c (simple_object_xcoff_functions): Likewise.
* simple-object-elf.c (SHT_NULL, SHT_SYMTAB, SHT_RELA, SHT_REL,
SHT_GROUP): Add various sectopn header types.
(SHF_EXCLUDE): Add flag.
(Elf32_External_Sym, Elf64_External_Sym): Add symbol struct.
(ELF_ST_BIND, ELF_ST_TYPE, ELF_ST_INFO): Add accessors.
(STT_OBJECT, STT_FUNC, STT_TLS, STT_GNU_IFUNC): Add Symbol types.
(STV_DEFAULT): Add symbol visibility.
(SHN_COMMON): Add special section index name.
(struct simple_object_elf_write): New.
(simple_object_elf_start_write): Adjust for new private data.
(simple_object_elf_write_shdr): Pass in values for all fields
we write.
(simple_object_elf_write_to_file): Adjust. Copy from recorded
section headers if requested.
(simple_object_elf_release_write): Release private data.
(simple_object_elf_copy_lto_debug_sections): Copy and rename sections
as denoted by PFN and all their dependences, symbols and relocations
to the empty destination file.
(simple_object_elf_functions): Adjust for copy_lto_debug_sections hook.
* simple-object-xcoff.c (simple_object_xcoff_find_sections):
Search symbol table for .go_export symbol and apply pfn if found.
Nick Clifton [Fri, 1 Sep 2017 08:57:44 +0000 (09:57 +0100)]
Fix buffer overrun when parsing an ELF attribute string that is not NUL terminated.
PR 22058
* elf-attrs.c (_bfd_elf_parse_attributes): Ensure that the
attribute buffer is NUL terminated.
Jan Kratochvil [Fri, 1 Sep 2017 04:13:40 +0000 (06:13 +0200)]
PR gdb/22046: Fix T-stopped detach regression on old Linux kernels
On <=RHEL6 hosts Fedora/RHEL GDB started to 'kill -STOP' all processes it
detached. Even those not originally T-stopped. This is a Fedora-specific
patch which is based on upstream GDB's PROC_STATE_STOPPED state.
I believe (I did not verify) this patch did regress it:
commit
d617208bb06bd461b52ce041d89f7127e3044762
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 25 12:42:17 2016 +0100
linux-procfs: Introduce enum proc_state
As originally there was strstr() but now there is strcmp() and so the missing
trailing '\n' no longer matches.
The Bug was found by Michal Kolar.
Reproducibility:
$ gdb -p $PID
(gdb) quit
$ ...
Actual results:
===
RHEL6.9 x86_64 # scl enable devtoolset-7 bash
RHEL6.9 x86_64 # which gdb
/opt/rh/devtoolset-7/root/usr/bin/gdb
RHEL6.9 x86_64 # ./testcase.sh
24737 pts/0 S+ 0:00 /bin/sleep 4
24737 pts/0 T+ 0:00 /bin/sleep 4
RHEL6.9 x86_64 #
===
Expected results:
===
RHEL6.9 x86_64 # which gdb
/usr/bin/gdb
RHEL6.9 x86_64 # ./testcase.sh
24708 pts/0 S+ 0:00 /bin/sleep 4
24708 pts/0 S+ 0:00 /bin/sleep 4
./testcase.sh: line 20: kill: (24708) - No such process
RHEL6.9 x86_64 #
===
gdb/ChangeLog
2017-09-01 Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/22046
* nat/linux-procfs.c (parse_proc_status_state): Fix PROC_STATE_STOPPED
detection.
GDB Administrator [Fri, 1 Sep 2017 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergio Durigan Junior [Thu, 29 Jun 2017 19:06:07 +0000 (15:06 -0400)]
Implement the ability to set/unset environment variables to GDBserver when starting the inferior
This patch implements the ability to set/unset environment variables
on the remote target, mimicking what GDB already offers to the user.
There are two features present here: user-set and user-unset
environment variables.
User-set environment variables are only the variables that are
explicitly set by the user, using the 'set environment' command. This
means that variables that were already present in the environment when
starting GDB/GDBserver are not transmitted/considered by this feature.
User-unset environment variables are variables that are explicitly
unset by the user, using the 'unset environment' command.
The idea behind this patch is to store user-set and user-unset
environment variables in two separate sets, both part of gdb_environ.
Then, when extended_remote_create_inferior is preparing to start the
inferior, it will iterate over the two sets and set/unset variables
accordingly. Three new packets are introduced:
- QEnvironmentHexEncoded, which is used to set environment variables,
and contains an hex-encoded string in the format "VAR=VALUE" (VALUE
can be empty if the user set a variable with a null value, by doing
'set environment VAR=').
- QEnvironmentUnset, which is used to unset environment variables, and
contains an hex-encoded string in the format "VAR".
- QEnvironmentReset, which is always the first packet to be
transmitted, and is used to reset the environment, i.e., discard any
changes made by the user on previous runs.
The QEnvironmentHexEncoded packet is inspired on LLDB's extensions to
the RSP. Details about it can be seen here:
<https://raw.githubusercontent.com/llvm-mirror/lldb/master/docs/lldb-gdb-remote.txt>
I decided not to implement the QEnvironment packet because it is
considered deprecated by LLDB. This packet, on LLDB, serves the same
purpose of QEnvironmentHexEncoded, but sends the information using a
plain text, non-hex-encoded string.
The other two packets are new.
This patch also includes updates to the documentation, testsuite, and
unit tests, without introducing regressions.
gdb/ChangeLog:
2017-08-31 Sergio Durigan Junior <sergiodj@redhat.com>
* NEWS (Changes since GDB 8.0): Add entry mentioning new support
for setting/unsetting environment variables on the remote target.
(New remote packets): Add entries for QEnvironmentHexEncoded,
QEnvironmentUnset and QEnvironmentReset.
* common/environ.c (gdb_environ::operator=): Extend method to
handle m_user_set_env_list and m_user_unset_env_list.
(gdb_environ::clear): Likewise.
(match_var_in_string): Change type of first parameter from 'char
*' to 'const char *'.
(gdb_environ::set): Extend method to handle
m_user_set_env_list and m_user_unset_env_list.
(gdb_environ::unset): Likewise.
(gdb_environ::clear_user_set_env): New method.
(gdb_environ::user_set_envp): Likewise.
(gdb_environ::user_unset_envp): Likewise.
* common/environ.h (gdb_environ): Handle m_user_set_env_list and
m_user_unset_env_list on move constructor/assignment.
(unset): Add new default parameter 'update_unset_list = true'.
(clear_user_set_env): New method.
(user_set_envp): Likewise.
(user_unset_envp): Likewise.
(m_user_set_env_list): New std::set.
(m_user_unset_env_list): Likewise.
* common/rsp-low.c (hex2str): New function.
(bin2hex): New overload for bin2hex function.
* common/rsp-low.c (hex2str): New prototype.
(str2hex): New overload prototype.
* remote.c: Include "environ.h". Add QEnvironmentHexEncoded,
QEnvironmentUnset and QEnvironmentReset.
(remote_protocol_features): Add QEnvironmentHexEncoded,
QEnvironmentUnset and QEnvironmentReset packets.
(send_environment_packet): New function.
(extended_remote_environment_support): Likewise.
(extended_remote_create_inferior): Call
extended_remote_environment_support.
(_initialize_remote): Add QEnvironmentHexEncoded,
QEnvironmentUnset and QEnvironmentReset packet configs.
* unittests/environ-selftests.c (gdb_selftest_env_var):
New variable.
(test_vector_initialization): New function.
(test_init_from_host_environ): Likewise.
(test_reinit_from_host_environ): Likewise.
(test_set_A_unset_B_unset_A_cannot_find_A_can_find_B):
Likewise.
(test_unset_set_empty_vector): Likewise.
(test_vector_clear): Likewise.
(test_std_move): Likewise.
(test_move_constructor):
(test_self_move): Likewise.
(test_set_unset_reset): Likewise.
(run_tests): Rewrite in terms of the functions above.
gdb/gdbserver/ChangeLog:
2017-08-31 Sergio Durigan Junior <sergiodj@redhat.com>
* server.c (handle_general_set): Handle QEnvironmentHexEncoded,
QEnvironmentUnset and QEnvironmentReset packets.
(handle_query): Inform remote that QEnvironmentHexEncoded,
QEnvironmentUnset and QEnvironmentReset are supported.
gdb/doc/ChangeLog:
2017-08-31 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.texinfo (set environment): Add @anchor. Explain that
environment variables set by the user are sent to GDBserver.
(unset environment): Likewise, but for unsetting variables.
(Connecting) <Remote Packet>: Add "environment-hex-encoded",
"QEnvironmentHexEncoded", "environment-unset", "QEnvironmentUnset",
"environment-reset" and "QEnvironmentReset" to the table.
(Remote Protocol) <QEnvironmentHexEncoded, QEnvironmentUnset,
QEnvironmentReset>: New item, explaining the packet.
gdb/testsuite/ChangeLog:
2017-08-31 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/share-env-with-gdbserver.c: New file.
* gdb.base/share-env-with-gdbserver.exp: Likewise.
Nick Clifton [Thu, 31 Aug 2017 16:03:23 +0000 (17:03 +0100)]
Fix buffer read overrun by ensuring that DWARF sections containing strings always end in a NUL byte.
PR 22047
* dwarf2.c (read_section): If necessary add a terminating NUL byte
to dwarf string sections.
Nick Clifton [Thu, 31 Aug 2017 13:33:56 +0000 (14:33 +0100)]
Add updated French translations for opcodes and gprof
H.J. Lu [Thu, 31 Aug 2017 10:53:44 +0000 (03:53 -0700)]
Add a test for PR ld/22048
PR ld/22048
* testsuite/ld-x86-64/pr22048.d: New file.
* testsuite/ld-x86-64/pr22048a.s: Likewise.
* testsuite/ld-x86-64/pr22048b.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr22048.
Alan Modra [Thu, 31 Aug 2017 10:37:13 +0000 (20:07 +0930)]
Regen SRC-POTFILES.in
* po/SRC-POTFILES.in: Regenerate.
Alan Modra [Thu, 31 Aug 2017 10:09:14 +0000 (19:39 +0930)]
Remove .eh_frame zero terminators
The machinery to do this was there, but not enabled if the terminator
was the only thing in the section.
bfd/
* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Don't exit early
for a section containing just a terminator. Allow multiple
terminators at end of section.
* elflink.c (bfd_elf_discard_info): Iterate over .eh_frame
sections when not adding alignment. Assert on terminator in
the middle of FDEs.
ld/
* testsuite/ld-elf/eh3.d: Update.
* testsuite/ld-elf/eh4.d: Update.
Weimin Pan [Sat, 26 Aug 2017 00:33:25 +0000 (19:33 -0500)]
Unbreak gdb build on 32-bit host with ADI support
The problem of failing to build with arm-linux-gnueabihf-g++-4.8 was
that type CORE_ADDR is of "unsigned long" on a 64-bit machine so it's
OK to use %lx but is of type "unsigned long long" on a 32 bit system.
Fixed the problem in three places - (1) use a temp variable of type
CORE_ADDR as argument 3 when calling target_auxv_search() then assign
its value to "blksize" and "nbits" in 2 calls; (2) redo
adi_normalize_address() using masks and xor operators to calculate
normalized address; (3) call paddress() to print CORE_ADDR in either
printf_filtered() or error(). Thank you, Pedro, for all your
suggestions.
gdb/ChangeLog:
2017-08-31 Weimin Pan <weimin.pan@oracle.com>
* sparc64-tdep.c (adi_stat_t): Fix comment formatting.
(adi_available): Use a temp variable of type CORE_ADDR as argument
3 when calling target_auxv_search.
(adi_normalize_address): Use masks and xor operators to calculate
normalized address.
(adi_read_versions, adi_write_versions, adi_print_versions)
(do_examine, do_assign): Use paddress.
Alan Modra [Thu, 31 Aug 2017 03:18:37 +0000 (12:48 +0930)]
PR22048, Incorrect .eh_frame section in libc.so
PR 21441
PR 22048
* elflink.c (bfd_elf_discard_info): Don't pad embedded zero
terminators.
H.J. Lu [Thu, 31 Aug 2017 02:55:45 +0000 (19:55 -0700)]
Add elf64.lo together with elfxx-x86.lo for 64-bit BFD
Since elfxx-x86.lo needs elf64.lo with 64-bit BFD, add elf64.lo together
with elfxx-x86.lo to bfd_backends for 64-bit BFD.
* configure.ac (bfd_backends): Add elf64.lo together with
elfxx-x86.lo for 64-bit BFD.
* configure: Regenerated.
James Bowman [Thu, 31 Aug 2017 02:51:49 +0000 (19:51 -0700)]
FT32: improve disassembly readability
For opcode fields that are not addresses, display as
integers instead of using print_address_func.
opcodes/ChangeLog:
2017-08-31 James Bowman <james.bowman@ftdichip.com>
* ft32-dis.c (print_insn_ft32): Correct display of non-address
fields.
James Bowman [Thu, 31 Aug 2017 02:44:58 +0000 (19:44 -0700)]
FT32: Permit R_FT32_18 overflow
The howto for R_FT32_18 was using complain_overflow_signed. But some
valid address calculations exceed the range of this reloc. Changing it
to complain_overflow_dont allows them.
bfd/ChangeLog:
* elf32-ft32.c (ft32_elf_howto_table): Use
complain_overflow_dont for R_FT32_18.
Alan Modra [Wed, 30 Aug 2017 23:16:47 +0000 (08:46 +0930)]
bfd_close_all_done calling _close_and_cleanup
elf64_vms_close_and_cleanup calls bfd_get_size, which calls
iovec->bstat. cache_bstat ends up adding the bfd to the cache lru
list, negating the bfd_cache_close call in bfd_close_all_done. So
there is a dangling pointer into the freed and then reused bfd. Thus,
bfd_cache_close must be called after _close_and_cleanup, or better,
via iovec->bclose.
PR binutils/22032
* opncls.c (bfd_close_all_done): Don't call bfd_cache_close
before _close_and_cleanup. Call iovec->bclose after.
(bfd_close): Remove code common to, and call, bfd_close_all_done.
GDB Administrator [Thu, 31 Aug 2017 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Wed, 30 Aug 2017 21:55:14 +0000 (22:55 +0100)]
LD/testsuite: Also discard `.MIPS.options' in orphan tests
Complement commit
5b5f4e6f8cd2 ("ld: Early detection of orphans we know
will be discarded") and add `.MIPS.options' to the list of sections
discarded with orphan tests, removing failures like:
./ld-new: error: unplaced orphan section `.MIPS.options' from `tmpdir/orphan-11.o'.
FAIL: ld-elf/orphan-11
and:
./ld-new: error: unplaced orphan section `.MIPS.options' from `tmpdir/orphan-12.o'.
FAIL: ld-elf/orphan-12
from n64 MIPS testing.
ld/
* testsuite/ld-elf/orphan-11.ld: Also discard `.MIPS.options'
sections.
H.J. Lu [Wed, 30 Aug 2017 19:27:17 +0000 (12:27 -0700)]
x86: Add _bfd_x86_elf_get_synthetic_symtab
Move the common codes in elf_i386_get_synthetic_symtab and
elf_x86_64_get_synthetic_symtab to _bfd_x86_elf_get_synthetic_symtab.
* elf32-i386.c (elf_i386_plt_type): Removed.
(elf_i386_plt): Likewise.
(elf_i386_get_synthetic_symtab): Updated. Call
_bfd_x86_elf_get_synthetic_symtab.
* elf64-x86-64.c (elf_x86_64_plt_type): Removed.
(elf_x86_64_plt): Likewise.
(elf_x86_64_get_synthetic_symtab): Updated. Call
_bfd_x86_elf_get_synthetic_symtab.
* elfxx-x86.c (elf_i386_get_plt_got_vma): New function.
(elf_x86_64_get_plt_got_vma): Likewise.
(elf_i386_valid_plt_reloc_p): Likewise.
(elf_x86_64_valid_plt_reloc_p): Likewise.
(_bfd_x86_elf_get_synthetic_symtab): Likewise.
* elfxx-x86.h (elf_x86_plt_type): New.
(elf_x86_plt): Likewise.
(_bfd_x86_elf_get_synthetic_symtab): Likewise.
H.J. Lu [Wed, 30 Aug 2017 18:13:32 +0000 (11:13 -0700)]
x86: Check target_id instead of elf_machine_code
Since both elf32-i386.c and elf64-x86-64.c support targets with
different ELF_MACHINE_CODEs, _bfd_x86_elf_link_hash_table_create
should check target_id instead of elf_machine_code.
* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Check
target_id instead of elf_machine_code.
H.J. Lu [Wed, 30 Aug 2017 16:10:08 +0000 (09:10 -0700)]
x86: Add _bfd_x86_elf_link_hash_table_create
Share _bfd_x86_elf_link_hash_table_create in elf32-i386.c and
elf64-x86-64.c by:
1. Replace elf_i386_lazy_plt_layout, elf_i386_non_lazy_plt_layout,
elf_i386_plt_layout, elf_x86_64_lazy_plt_layout,
elf_x86_64_non_lazy_plt_layout and elf_x86_64_plt_layout with
elf_x86_lazy_plt_layout, elf_x86_non_lazy_plt_layout and
elf_x86_plt_layout.
2. Move plt, lazy_plt, non_lazy_plt, srelplt2 and next_tls_desc_index
from elf_i386_link_hash_table to elf_x86_link_hash_table.
3. Remove elf_i386_link_hash_table and elf_x86_64_link_hash_table.
* elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed.
(elf_i386_lazy_plt_layout): Likewise.
(elf_i386_non_lazy_plt_layout): Likewise.
(elf_i386_plt_layout): Likewise.
(elf_i386_link_hash_table): Likewise.
(elf_i386_next_tls_desc_index): Likewise.
(elf_i386_srelplt2): Likewise.
(elf_i386_plt): Likewise.
(elf_i386_lazy_plt): Likewise.
(elf_i386_non_lazy_plt): Likewise.
(elf_i386_link_hash_table_create): Likewise.
(bfd_elf32_bfd_link_hash_table_create): Likewise.
(elf_i386_lazy_plt): Updated.
(elf_i386_non_lazy_plt): Likewise.
(elf_i386_lazy_ibt_plt): Likewise.
(elf_i386_non_lazy_ibt_plt): Likewise.
(elf_i386_allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(elf_i386_finish_dynamic_sections): Likewise.
(elf_i386_get_synthetic_symtab): Likewise.
(elf_i386_link_setup_gnu_properties): Likewise.
(elf_i386_nacl_plt): Likewise.
* elf64-x86-64.c (ABI_64_P): Removed.
(ELF64_DYNAMIC_INTERPRETER): Likewise.
(ELF32_DYNAMIC_INTERPRETER): Likewise.
(elf_x86_64_lazy_plt_layout): Likewise.
(elf_x86_64_non_lazy_plt_layout): Likewise.
(elf_x86_64_plt_layout): Likewise.
(elf_x86_64_link_hash_table): Likewise.
(elf_x86_64_plt): Likewise.
(elf_x86_64_lazy_plt): Likewise.
(elf_x86_64_non_lazy_plt): Likewise.
(elf_x86_64_link_hash_table_create): Likewise.
(bfd_elf64_bfd_link_hash_table_create): Likewise.
(bfd_elf32_bfd_link_hash_table_create): Likewise.
(elf_x86_64_lazy_plt): Updated.
(elf_x86_64_non_lazy_plt): Likewise.
(elf_x86_64_lazy_bnd_plt): Likewise.
(elf_x86_64_non_lazy_bnd_plt): Likewise.
(elf_x86_64_lazy_ibt_plt): Likewise.
(elf_x32_lazy_ibt_plt): Likewise.
(elf_x86_64_non_lazy_ibt_plt): Likewise.
(elf_x32_non_lazy_ibt_plt): Likewise.
(elf_x86_64_allocate_dynrelocs): Likewise.
(elf_x86_64_size_dynamic_sections): Likewise.
(elf_x86_64_relocate_section): Likewise.
(elf_x86_64_finish_dynamic_symbol): Likewise.
(elf_x86_64_finish_dynamic_sections): Likewise.
(elf_x86_64_get_synthetic_symtab): Likewise.
(elf_x86_64_link_setup_gnu_properties): Likewise.
(elf_x86_64_nacl_plt): Likewise.
* elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and
"elf/x86-64.h".
(ELF32_DYNAMIC_INTERPRETER): New.
(ELF64_DYNAMIC_INTERPRETER): Likewise.
(ELFX32_DYNAMIC_INTERPRETER): Likewise.
(_bfd_x86_elf_link_hash_table_create): Likewise.
(_bfd_x86_elf_link_hash_table_free): Renamed to ...
(elf_x86_link_hash_table_free): This. Make it static.
* elfxx-x86.h: Don't include "objalloc.h".
(ABI_64_P): New.
(elf_x86_lazy_plt_layout): Likewise.
(elf_x86_non_lazy_plt_layout): Likewise.
(elf_x86_plt_layout): Likewise.
(_bfd_x86_elf_link_hash_table_create): Likewise.
(bfd_elf64_bfd_link_hash_table_create): Likewise.
(bfd_elf32_bfd_link_hash_table_create): Likewise.
(elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt,
srelplt2 and next_tls_desc_index.
(_bfd_x86_elf_link_hash_table_free): Removed.
Maciej W. Rozycki [Wed, 30 Aug 2017 15:03:31 +0000 (16:03 +0100)]
MIPS/BFD: Correct microMIPS cross-mode BAL to JALX relaxation
Fix a bug in commit
a6ebf6169a1b ("MIPS: Convert cross-mode BAL to
JALX") and in BFD linker relaxation correct the microMIPS interpretation
of the branch offset, which is supposed to be shifted by 1 bit, rather
than 2 as in the regular MIPS case.
bfd/
* elfxx-mips.c (mips_elf_perform_relocation): Correct microMIPS
branch offset interpretation.
gas/
* testsuite/gas/mips/branch-addend-micromips.d: New test.
* testsuite/gas/mips/branch-addend-micromips-n32.d: New test.
* testsuite/gas/mips/branch-addend-micromips-n64.d: New test.
* testsuite/gas/mips/branch-addend-micromips.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
ld/
* testsuite/ld-mips-elf/bal-jalx-addend-micromips.d: New test.
* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d: New
test.
* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d: New
test.
* testsuite/ld-mips-elf/bal-jalx-local-micromips.d: New test.
* testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d: New
test.
* testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d: New
test.
* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d: New test.
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d: New test.
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d: New test.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d: New
test.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d: New
test.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d: New
test.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Maciej W. Rozycki [Wed, 30 Aug 2017 14:54:19 +0000 (15:54 +0100)]
MIPS/GAS: Also respect `-mignore-branch-isa' with MIPS16 code
Fix a bug in commit
8b10b0b3e100 ("MIPS: Add options to control branch
ISA checks") and with the `-mignore-branch-isa' command-line option also
lift a GAS check for invalid MIPS16 branches between ISA modes, which is
made separately from regular MIPS and microMIPS checks.
gas/
* config/tc-mips.c (md_convert_frag): Respect
`mips_ignore_branch_isa'.
* testsuite/gas/mips/branch-local-5.d: New test.
* testsuite/gas/mips/branch-local-n32-5.d: New test.
* testsuite/gas/mips/branch-local-n64-5.d: New test.
* testsuite/gas/mips/branch-local-6.d: New test.
* testsuite/gas/mips/branch-local-n32-6.d: New test.
* testsuite/gas/mips/branch-local-n64-6.d: New test.
* testsuite/gas/mips/branch-local-7.d: New test.
* testsuite/gas/mips/branch-local-n32-7.d: New test.
* testsuite/gas/mips/branch-local-n64-7.d: New test.
* testsuite/gas/mips/branch-local-ignore-5.d: New test.
* testsuite/gas/mips/branch-local-ignore-n32-5.d: New test.
* testsuite/gas/mips/branch-local-ignore-n64-5.d: New test.
* testsuite/gas/mips/branch-local-ignore-6.d: New test.
* testsuite/gas/mips/branch-local-ignore-n32-6.d: New test.
* testsuite/gas/mips/branch-local-ignore-n64-6.d: New test.
* testsuite/gas/mips/branch-local-5.l: New stderr output.
* testsuite/gas/mips/branch-local-6.l: New stderr output.
* testsuite/gas/mips/branch-local-5.s: New test source.
* testsuite/gas/mips/branch-local-6.s: New test source.
* testsuite/gas/mips/branch-local-7.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.
H.J. Lu [Wed, 30 Aug 2017 13:17:28 +0000 (06:17 -0700)]
Call _close_and_cleanup in bfd_close_all_done
PR binutils/22032
* opncls.c (bfd_close_all_done): Call _close_and_cleanup.
H.J. Lu [Wed, 30 Aug 2017 12:29:22 +0000 (05:29 -0700)]
Remove elf_x86_64_next_tls_desc_index/elf_x86_64_srelplt2
They are unused.
* elf64-x86-64.c (elf_x86_64_next_tls_desc_index): Removed.
(elf_x86_64_srelplt2): Likewise.
H.J. Lu [Wed, 30 Aug 2017 12:28:10 +0000 (05:28 -0700)]
Add missing ChangeLog entries
Maciej W. Rozycki [Wed, 30 Aug 2017 11:20:53 +0000 (12:20 +0100)]
MIPS/GAS/testsuite: Deduplicate error lists of branch local tests
Complement commit
7795a8f8bdde ("MIPS/GAS/testsuite: Convert branch
local list tests to dump tests") and share identical error lists among
branch local tests, removing duplicate copies.
gas/
* testsuite/gas/mips/branch-local-n32-2.d: Use `branch-local-2.l'
for `error-output'.
* testsuite/gas/mips/branch-local-n64-2.d: Likewise.
* testsuite/gas/mips/branch-local-n32-3.d: Use `branch-local-3.l'
for `error-output'.
* testsuite/gas/mips/branch-local-n64-3.d: Likewise.
* testsuite/gas/mips/branch-local-n32-2.l: Remove file.
* testsuite/gas/mips/branch-local-n64-2.l: Remove file.
* testsuite/gas/mips/branch-local-n32-3.l: Remove file.
* testsuite/gas/mips/branch-local-n64-3.l: Remove file.
Alan Modra [Wed, 30 Aug 2017 11:05:35 +0000 (20:35 +0930)]
PowerPC TPREL16_HA/LO reloc optimization
In the TLS GD/LD to LE optimization, ld replaces a sequence like
addi 3,2,x@got@tlsgd R_PPC64_GOT_TLSGD16 x
bl __tls_get_addr(x@tlsgd) R_PPC64_TLSGD x
R_PPC64_REL24 __tls_get_addr
nop
with
addis 3,13,x@tprel@ha R_PPC64_TPREL16_HA x
addi 3,3,x@tprel@l R_PPC64_TPREL16_LO x
nop
When the tprel offset is small, this can be further optimized to
nop
addi 3,13,x@tprel
nop
bfd/
* elf64-ppc.c (struct ppc_link_hash_table): Add do_tls_opt.
(ppc64_elf_tls_optimize): Set it.
(ppc64_elf_relocate_section): Nop addis on TPREL16_HA, and convert
insn on TPREL16_LO and TPREL16_LO_DS relocs to use r13 when
addis would add zero.
* elf32-ppc.c (struct ppc_elf_link_hash_table): Add do_tls_opt.
(ppc_elf_tls_optimize): Set it.
(ppc_elf_relocate_section): Nop addis on TPREL16_HA, and convert
insn on TPREL16_LO relocs to use r2 when addis would add zero.
gold/
* powerpc.cc (Target_powerpc::Relocate::relocate): Nop addis on
TPREL16_HA, and convert insn on TPREL16_LO and TPREL16_LO_DS
relocs to use r2/r13 when addis would add zero.
ld/
* testsuite/ld-powerpc/tls.s: Add calls with tls markers.
* testsuite/ld-powerpc/tls32.s: Likewise.
* testsuite/ld-powerpc/powerpc.exp: Run tls marker tests.
* testsuite/ld-powerpc/tls.d: Adjust for TPREL16_HA/LO optimization.
* testsuite/ld-powerpc/tlsexe.d: Likewise.
* testsuite/ld-powerpc/tlsexetoc.d: Likewise.
* testsuite/ld-powerpc/tlsld.d: Likewise.
* testsuite/ld-powerpc/tlsmark.d: Likewise.
* testsuite/ld-powerpc/tlsopt4.d: Likewise.
* testsuite/ld-powerpc/tlstoc.d: Likewise.
Alan Modra [Wed, 30 Aug 2017 11:05:09 +0000 (20:35 +0930)]
PowerPC64 __tls_get_addr sequence optimization
There isn't a good reason for ld.bfd to behave differently from gold
in the code generated by TLS GD/LD to LE optimization.
bfd/
* elf64-ppc.c (ppc64_elf_relocate_section): When optimizing
__tls_get_addr call sequences to LE, don't move the addi down
to the nop. Replace the bl with addi and leave the nop alone.
ld/
* testsuite/ld-powerpc/tls.d: Update.
* testsuite/ld-powerpc/tlsexe.d: Update.
* testsuite/ld-powerpc/tlsexetoc.d: Update.
* testsuite/ld-powerpc/tlsld.d: Update.
* testsuite/ld-powerpc/tlsmark.d: Update.
* testsuite/ld-powerpc/tlsopt4.d: Update.
* testsuite/ld-powerpc/tlstoc.d: Update.
Hans-Peter Nilsson [Wed, 30 Aug 2017 00:27:14 +0000 (02:27 +0200)]
testsuite/ld-cris various files: Run ld with --hash-style=sysv.
* testsuite/ld-cris/dso-pltdis1.d: Run ld with --hash-style=sysv.
* testsuite/ld-cris/dso-pltdis2.d,
testsuite/ld-cris/dso12-pltdis.d, testsuite/ld-cris/expdyn1.d,
testsuite/ld-cris/expdyn5.d, testsuite/ld-cris/expdyn6.d,
testsuite/ld-cris/expdyn7.d, testsuite/ld-cris/gotplt1.d,
testsuite/ld-cris/gotplt2.d, testsuite/ld-cris/gotplt3.d,
testsuite/ld-cris/hiddef1.d, testsuite/ld-cris/libdso-11.d,
testsuite/ld-cris/libdso-12.d, testsuite/ld-cris/libdso-12b.d,
testsuite/ld-cris/libdso-12c.d, testsuite/ld-cris/libdso-13.d,
testsuite/ld-cris/libdso-13b.d, testsuite/ld-cris/libdso-14.d,
testsuite/ld-cris/libdso-15.d, testsuite/ld-cris/libdso-15b.d,
testsuite/ld-cris/libdso-1b.d, testsuite/ld-cris/libdso-1c.d,
testsuite/ld-cris/libdso-1d.d, testsuite/ld-cris/libdso-4.d,
testsuite/ld-cris/pr16044.d, testsuite/ld-cris/pv32-1.d,
testsuite/ld-cris/tls-dso-dtpoffd2.d,
testsuite/ld-cris/tls-dso-dtpoffd4.d,
testsuite/ld-cris/tls-dso-tpoffgotcomm1.d,
testsuite/ld-cris/tls-dso-x1x2-1.d, testsuite/ld-cris/tls-gc-71.d,
testsuite/ld-cris/tls-ie-78.d, testsuite/ld-cris/tls-js1.d,
testsuite/ld-cris/tls-ldgdex-14.d,
testsuite/ld-cris/tls-ldgdex-15.d,
testsuite/ld-cris/tls-legdx-16.d,
testsuite/ld-cris/tls-legdx-17.d,
testsuite/ld-cris/tls-local-63.d,
testsuite/ld-cris/tls-local-64.d, testsuite/ld-cris/tls-ok-30.d,
testsuite/ld-cris/tls-ok-32.d, testsuite/ld-cris/tls-ok-34.d,
testsuite/ld-cris/tls-und-38.d, testsuite/ld-cris/tls-und-42.d,
testsuite/ld-cris/tls-und-46.d, testsuite/ld-cris/tls-und-50.d,
testsuite/ld-cris/weakref2.d, testsuite/ld-cris/weakref3.d,
testsuite/ld-cris/weakref4.d: Likewise.
GDB Administrator [Wed, 30 Aug 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Tue, 29 Aug 2017 22:04:09 +0000 (15:04 -0700)]
Look for FIR in the last FreeBSD/mips floating-point register.
FreeBSD/mips kernels were recently changed to include the floating
point implementation revision register in the floating point register
set exported in process cores and via ptrace() (r318067). This change
will first ship in FreeBSD 12.0 when it is eventually released. The
space used to hold FIR was previously reserved in 'struct fpreg' as a
zero-filled dummy for padding, so 'struct fpreg' has not changed in
size. Since FIR should be non-zero on all MIPS processors supported
by FreeBSD, ignore a value of 0 from 'struct fpreg' and only report
non-zero values as a valid FIR register.
gdb/ChangeLog:
* mips-fbsd-nat.c (getfpregs_supplies): Return true for FIR.
* mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Split supply of FSR
out of loop and add supply of FIR.
(mips_fbsd_collect_fpregs): Split collect of FSR out of loop and
add collect of FIR.
H.J. Lu [Tue, 29 Aug 2017 21:44:40 +0000 (14:44 -0700)]
x86: Re-indent elf32-i386.c/elf64-x86-64.c
* elf32-i386.c (elf_i386_pie_finish_undefweak_symbol):
Re-indent.
* elf64-x86-64.c (elf_x86_64_finish_local_dynamic_symbol):
Likewise.
(elf_x86_64_pie_finish_undefweak_symbol): Likewise.
H.J. Lu [Mon, 28 Aug 2017 13:23:25 +0000 (06:23 -0700)]
Add elfxx-x86.h and elfxx-x86.c
Move common codes in elf32-i386.c and elf64-x86-64.c to elfxx-x86.c.
* Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo.
(BFD64_BACKENDS): Likewise.
(BFD32_BACKENDS_CFILES): Add elfxx-x86.c.
(BFD64_BACKENDS_CFILES): Likewise.
* Makefile.in: Regenerated.
* configure.ac (bfd_backends): Add elfxx-x86.lo together with
elf32-i386.lo and elf64-x86-64.lo.
* configure: Regenerated.
* elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h",
"bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
"objalloc.h" and "hashtab.h".
(ELIMINATE_COPY_RELOCS): Removed.
(UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
(SYMBOL_NO_COPYRELOC): Likewise.
(elf_i386_link_hash_entry): Likewise.
(GOT_UNKNOWN): Likewise.
(GOT_NORMAL): Likewise.
(GOT_TLS_GD): Likewise.
(elf_i386_hash_entry): Likewise.
(elf_i386_obj_tdata): Likewise.
(elf_i386_tdata): Likewise.
(elf_i386_local_got_tls_type): Likewise.
(elf_i386_local_tlsdesc_gotent): Likewise.
(elf_i386_hash_table): Likewise.
(elf_i386_link_hash_newfunc): Likewise.
(elf_i386_local_htab_hash): Likewise.
(elf_i386_local_htab_eq): Likewise.
(elf_i386_get_local_sym_hash): Likewise.
(elf_i386_link_hash_table_free): Likewise.
(elf_i386_copy_indirect_symbol): Likewise.
(elf_i386_fixup_symbol): Likewise.
(elf_i386_readonly_dynrelocs): Likewise.
(elf_i386_always_size_sections): Likewise.
(elf_i386_set_tls_module_base): Likewise.
(elf_i386_dtpoff_base): Likewise.
(compare_relocs): Likewise.
(elf_i386_hash_symbol): Likewise.
(elf_i386_parse_gnu_properties): Likewise.
(elf_i386_merge_gnu_properties): Likewise.
(elf_i386_link_check_relocs): Likewise.
(elf_i386_merge_symbol_attribute): Likewise.
(bfd_elf32_bfd_link_check_relocs): Likewise.
(elf_backend_copy_indirect_symbol): Likewise.
(elf_backend_always_size_sections): Likewise.
(elf_backend_omit_section_dynsym): Likewise.
(elf_backend_hash_symbol): Likewise.
(elf_backend_fixup_symbol): Likewise.
(elf_backend_parse_gnu_properties): Likewise.
(elf_backend_merge_gnu_properties): Likewise.
(elf_backend_merge_symbol_attribute): Likewise.
(elf_i386_mkobject): Updated.
(elf_i386_link_hash_table_create): Likewise.
(elf_i386_check_tls_transition): Likewise.
(elf_i386_tls_transition): Likewise.
(elf_i386_convert_load_reloc): Likewise.
(elf_i386_check_relocs): Likewise.
(elf_i386_adjust_dynamic_symbol): Likewise.
(elf_i386_allocate_dynrelocs): Likewise.
(elf_i386_convert_load): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol ): Likewise.
(elf_i386_finish_dynamic_sections): Likewise.
(elf_i386_output_arch_local_syms): Likewise.
(elf_i386_get_synthetic_symtab): Likewise.
(elf_i386_link_setup_gnu_properties): Likewise.
(elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead
of elf_link_hash_table, as base.
(elf_i386_next_tls_desc_index): New.
(elf_i386_srelplt2): Likewise.
(elf_i386_plt): Likewise.
(elf_i386_lazy_plt): Likewise.
(elf_i386_non_lazy_plt): Likewise.
* elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h",
"bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
"objalloc.h" and "hashtab.h".
(ELIMINATE_COPY_RELOCS): Removed.
(UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
(SYMBOL_NO_COPYRELOC): Likewise.
(elf_x86_64_link_hash_entry): Likewise.
(GOT_UNKNOWN): Likewise.
(GOT_NORMAL): Likewise.
(GOT_TLS_GD): Likewise.
(elf_x86_64_hash_entry): Likewise.
(elf_x86_64_obj_tdata): Likewise.
(elf_x86_64_tdata): Likewise.
(elf_x86_64_local_got_tls_type): Likewise.
(elf_x86_64_local_tlsdesc_gotent): Likewise.
(elf_x86_64_hash_table): Likewise.
(elf_x86_64_link_hash_newfunc): Likewise.
(elf_x86_64_local_htab_hash): Likewise.
(elf_x86_64_local_htab_eq): Likewise.
(elf_x86_64_get_local_sym_hash): Likewise.
(elf_x86_64_link_hash_table_free): Likewise.
(elf_x86_64_copy_indirect_symbol): Likewise.
(elf_x86_64_fixup_symbol): Likewise.
(elf_x86_64_readonly_dynrelocs): Likewise.
(elf_x86_64_always_size_sections): Likewise.
(elf_x86_64_set_tls_module_base): Likewise.
(elf_x86_64_dtpoff_base): Likewise.
(compare_relocs): Likewise.
(elf_x86_64_merge_symbol_attribute): Likewise.
(elf_x86_64_hash_symbol): Likewise.
(elf_x86_64_parse_gnu_properties): Likewise.
(elf_x86_64_merge_gnu_properties): Likewise.
(elf_x86_64_link_check_relocs): Likewise.
(elf_backend_copy_indirect_symbol): Likewise.
(elf_backend_always_size_sections): Likewise.
(bfd_elf64_bfd_link_check_relocs): Likewise.
(elf_backend_merge_symbol_attribute): Likewise.
(elf_backend_hash_symbol): Likewise.
(elf_backend_omit_section_dynsym): Likewise.
(elf_backend_fixup_symbol): Likewise.
(elf_backend_parse_gnu_properties): Likewise.
(elf_backend_merge_gnu_properties): Likewise.
(bfd_elf32_bfd_link_check_relocs): Likewise.
(elf_x86_64_mkobject): Updated.
(elf_x86_64_link_hash_table_create): Likewise.
(elf_x86_64_check_tls_transition): Likewise.
(elf_x86_64_tls_transition): Likewise.
(elf_x86_64_convert_load_reloc): Likewise.
(elf_x86_64_check_relocs): Likewise.
(elf_x86_64_adjust_dynamic_symbol): Likewise.
(elf_x86_64_allocate_dynrelocs): Likewise.
(elf_x86_64_convert_load): Likewise.
(elf_x86_64_size_dynamic_sections): Likewise.
(elf_x86_64_relocate_section): Likewise.
(elf_x86_64_finish_dynamic_symbol ): Likewise.
(elf_x86_64_finish_dynamic_sections): Likewise.
(elf_x86_64_output_arch_local_syms): Likewise.
(elf_x86_64_get_synthetic_symtab): Likewise.
(elf_x86_64_link_setup_gnu_properties): Likewise.
(elf_x86_64_link_hash_table): Use elf_x86_link_hash_table,
instead of elf_link_hash_table, as base.
(elf_x86_64_next_tls_desc_index): New.
(elf_x86_64_srelplt2): Likewise.
(elf_x86_64_plt): Likewise.
(elf_x86_64_lazy_plt): Likewise.
(elf_x86_64_non_lazy_plt): Likewise.
* elfxx-x86.c: New file.
* elfxx-x86.h: Likewise.
H.J. Lu [Tue, 29 Aug 2017 18:28:10 +0000 (11:28 -0700)]
x86: Simplify bad return in get_synthetic_symtab
* elf32-i386.c (elf_i386_get_synthetic_symtab): Simplify bad
return.
* elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
H.J. Lu [Tue, 29 Aug 2017 17:40:03 +0000 (10:40 -0700)]
x86: Check valid PLT sections before checking dynamic relocations
Update x86 get_synthetic_symtab to check valid PLT sections before
checking dynamic relocations and free invalid PLT section contents.
* elf32-i386.c (elf_i386_get_synthetic_symtab): Check valid PLT
sections before checking dynamic relocations and free invalid
PLT section contents.
* elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
Jozef Lawrynowicz [Tue, 29 Aug 2017 16:18:43 +0000 (17:18 +0100)]
Improve MSP430 section placement.
ld * emultempl/msp430.em (change_output_section): New function.
(move_prefixed_section): New function.
(add_region_prefix): New function.
(msp430_elf_after_open): New function.
(gld${EMULATION_NAME}_add_options): Implement.
(gld${EMULATION_NAME}_list_options): Implement.
(gld${EMULATION_NAME}_handle_option): Implement.
* ld.texinfo: Document new options.
* testsuite/ld-msp430-elf/main-bss-lower.d: New.
* testsuite/ld-msp430-elf/main-bss-upper.d: New.
* testsuite/ld-msp430-elf/main-const-lower.d: New.
* testsuite/ld-msp430-elf/main-const-upper.d: New.
* testsuite/ld-msp430-elf/main-text-lower.d: New.
* testsuite/ld-msp430-elf/main-text-upper.d: New.
* testsuite/ld-msp430-elf/main-var-lower.d: New.
* testsuite/ld-msp430-elf/main-var-upper.d: New.
* testsuite/ld-msp430-elf/main-with-data-bss-unique-sec.s: New.
* testsuite/ld-msp430-elf/main-with-data-bss.s: New.
* testsuite/ld-msp430-elf/main-with-text-rodata-unique-sec.s: New.
* testsuite/ld-msp430-elf/main-with-text-rodata.s: New.
* testsuite/ld-msp430-elf/msp430-elf.exp: New.
* testsuite/ld-msp430-elf/msp430-no-lower.ld: New.
* testsuite/ld-msp430-elf/msp430.ld: New.
* emultempl/msp430.em (data_statement_size): New.
(eval_upper_either_sections): New.
(eval_lower_either_sections): New.
(intermediate_relax_sections): New.
(msp430_elf_after_allocation): New.
* emultempl/msp430.em (gld${EMULATION_NAME}_place_orphan): Always
place sections in the lower region.
gas * config/tc-msp430.c (md_parse_option): Define high data and high
bss symbols if -mdata-region is passed.
Define -mdata-region open.
* doc/c-msp430.texi: Document -mdata-region.
* testsuite/gas/msp430/high-data-bss-sym.d: New test.
* testsuite/gas/msp430/high-data-bss-sym.s: New.
* testsuite/gas/msp430/msp430.exp: Add -mdata-region tests.
Jozef Lawrynowicz [Tue, 29 Aug 2017 13:09:58 +0000 (14:09 +0100)]
Fix simulation of MSP430's open system call.
* sim/msp430/msp430-sim.c (maybe_perform_syscall): Fix passing of
arguments for variadic syscall "open".
Alan Modra [Tue, 29 Aug 2017 06:25:33 +0000 (15:55 +0930)]
[GOLD] PowerPC tls_get_addr_optimize
This implements the special __tls_get_addr_opt call stub for powerpc
gold that returns __thread variable addresses without actually making
a call to __tls_get_addr in most cases. Shared libraries that are
loaded at program load time (ie. dlopen is not used) have a known
layout for their __thread variables, and thus DTPMOD64/DPTREL64 pairs
describing those variables can be set up by ld.so for the
__tls_get_addr_opt call stub fast exit.
Ref https://sourceware.org/ml/libc-alpha/2015-03/msg00626.html
I really, really wish I'd used a differently versioned __tls_get_addr
symbol than the base symbol to indicate glibc support for the
optimized call, rather than having glibc export __tls_get_addr_opt. A
lot of the messing around here, flipping symbols from __tls_get_addr
to __tls_get_addr_opt, is caused by that decision. About the only
benefit is that a user can see at a glance that their disassembled
code is calling __tls_get_addr via the fancy call stub.. Anyway, we
need references to __tls_get_addr to seem like they were to
__tls_get_addr_opt, and in cases like the tsan interceptor, a
definition of __tls_get_addr to seem like one of __tls_get_addr_opt
as well. That's the reason for Symbol::clear_in_reg and
Symbol_table::clone, and why symbols are substituted in Scan::global
and other places dealing with dynamic linking.
elfcpp/
* elfcpp.h (DT_PPC_OPT): Define.
* powerpc.h (PPC_OPT_TLS): Define.
gold/
* options.h (tls_get_addr_optimize): New option.
* symtab.h (Symbol::clear_in_reg, clone): New functions.
(Sized_symbol::clone): New function.
(Symbol_table::clone): New function.
* resolve.cc (Symbol::clone, Sized_symbol::clone): New functions.
* powerpc.cc (Target_powerpc::has_tls_get_addr_opt_,
tls_get_addr_, tls_get_addr_opt_): New vars.
(Target_powerpc::tls_get_addr_opt, tls_get_addr,
is_tls_get_addr_opt, replace_tls_get_addr,
set_has_tls_get_addr_opt, stk_linker): New functions.
(Target_powerpc::Track_tls::maybe_skip_tls_get_addr_call): Add
target param. Update callers. Compare symbols rather than names.
(Target_powerpc::do_define_standard_symbols): Init tls_get_addr_
and tls_get_addr_opt_.
(Target_powerpc::Branch_info::mark_pltcall): Translate tls_get_addr
sym to tls_get_addr_opt.
(Target_powerpc::Branch_info::make_stub): Likewise.
(Stub_table::define_stub_syms): Likewise.
(Target_powerpc::Scan::global): Likewise.
(Target_powerpc::Relocate::relocate): Likewise.
(add_3_12_2, add_3_12_13, bctrl, beqlr, cmpdi_11_0, cmpwi_11_0,
ld_11_1, ld_11_3, ld_12_3, lwz_11_3, lwz_12_3, mr_0_3, mr_3_0,
mtlr_11, std_11_1): New constants.
(Stub_table::eh_frame_added_): Delete.
(Stub_table::tls_get_addr_opt_bctrl_, plt_fde_len_, plt_fde_): New vars.
(Stub_table::init_plt_fde): New functions.
(Stub_table::add_eh_frame, replace_eh_frame): Move definition out
of line. Init and use plt_fde_.
(Stub_table::plt_call_size): Return size for tls_get_addr stub.
Extract alignment code to..
(Stub_table::plt_call_align): ..this new function. Adjust all callers.
(Stub_table::add_plt_call_entry): Set has_tls_get_addr_opt and
tls_get_addr_opt_bctrl, and align after that.
(Stub_table::do_write): Write out tls_get_addr stub.
(Target_powerpc::do_finalize_sections): Emit DT_PPC_OPT
PPC_OPT_TLS/PPC64_OPT_TLS bit.
(Target_powerpc::Relocate::relocate): Don't check for or modify
nop following bl for tls_get_addr stub.
Alan Modra [Tue, 29 Aug 2017 06:22:45 +0000 (15:52 +0930)]
[GOLD] Reduce size of class Symbol
On 64-bit targets there is a 32-bit hole in symbol->u_, and another
due to symbol flags exceeding 32 bits. By splitting the union,
the total size of the class reduces by one 64-bit word.
* symtab.h (Symbol): Split u_ into u1_ and u2_. Adjust accessors
to suit. Move plt_offset_ before got_offsets_.
* symtab.cc (Symbol::init_fields): Adjust for union change.
(Symbol::init_base_output_data): Likewise.
(Symbol::init_base_output_segment): Likewise.
(Symbol::allocate_base_common): Likewise.
(Symbol::output_section): Likewise.
(Symbol::set_output_section): Likewise.
(Symbol::set_output_segment): Likewise.
* resolve.cc (Symbol::override_base): Likewise.
(Symbol::override_base_with_special): Likewise.
GDB Administrator [Tue, 29 Aug 2017 00:01:09 +0000 (00:01 +0000)]
Automatic date update in version.in
Han Shen [Mon, 28 Aug 2017 23:36:45 +0000 (16:36 -0700)]
2017-08-28 James Clarke <jrtc27@jrtc27.com>
gold/ChangeLog:
PR gold/21868
* aarch64.cc (AArch64_relobj::try_fix_erratum_843419_optimized):
Add extra view offset argument to function.
(AArch64_relobj::fix_errata_and_relocate_erratum_stubs): Add
extra view offset set to the output offset when the view has
is_input_output_view set, since it has not already been
included. Pass this to try_fix_erratum_843419_optimized.
H.J. Lu [Mon, 28 Aug 2017 22:40:00 +0000 (15:40 -0700)]
Remove unused _bfd_elf_ifunc_get_synthetic_symtab
Since _bfd_elf_ifunc_get_synthetic_symtab is no longer called by x86
get_synthetic_symtab, it is now unused. This patch removes it.
* elf-bfd.h (_bfd_elf_ifunc_get_synthetic_symtab): Removed.
* elf-ifunc.c (_bfd_elf_ifunc_get_synthetic_symtab): Likewise.
Simon Marchi [Mon, 28 Aug 2017 21:39:18 +0000 (23:39 +0200)]
gdb.base/commands.exp: Remove unused global references
There are a few unused references to the gdb_prompt global.
gdb/testsuite/ChangeLog:
* gdb.base/commands.exp (gdbvar_simple_if_test,
gdbvar_simple_if_test, gdbvar_complex_if_while_test,
progvar_simple_if_test, progvar_simple_while_test,
progvar_complex_if_while_test, user_defined_command_test,
user_defined_command_args_eval,
user_defined_command_args_stack_test,
user_defined_command_manyargs_test, bp_deleted_in_command_test,
temporary_breakpoint_commands,
gdb_test_no_prompt, redefine_hook_test,
redefine_backtrace_test): Remove "global gdb_prompt".
Simon Marchi [Mon, 28 Aug 2017 21:09:04 +0000 (23:09 +0200)]
Add missing PR number in ChangeLog
This should have been included in the previous commit.
Simon Marchi [Mon, 28 Aug 2017 21:05:04 +0000 (23:05 +0200)]
define_command: Don't convert command name to lower case
Commit
Command names: make them case sensitive
3d7b173c29900879c9a5958dd6029fd36666e57c
made command name lookup case sensitive. However, define_command, used
when creating a user-defined command, converts the command name to
lowercase, assuming that the command name lookup works in a case
insensitive way. This causes user-defined commands with capital letters
in their name to only be callable with a lowercase version:
(gdb) define Foo
Type commands for definition of "Foo".
End with a line saying just "end".
>print 1
>end
(gdb) Foo
Undefined command: "Foo". Try "help".
(gdb) foo
$1 = 1
This patch removes that conversion to lowercase, so that the user can
call the command with the same name they provided.
gdb/ChangeLog:
* cli/cli-script.c (define_command): Don't convert command name
to lower case.
gdb/testsuite/ChangeLog:
* gdb.base/commands.exp (user_defined_command_case_sensitivity):
New proc, call it from toplevel.
H.J. Lu [Mon, 28 Aug 2017 18:25:58 +0000 (11:25 -0700)]
x86: Check for valid PLT section size
Update x86 get_synthetic_symtab to check for valid PLT section size
before examining PLT section contents.
PR binutils/22018
* elf32-i386.c (elf_i386_get_synthetic_symtab): Check for valid
PLT section size.
* elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
Igor Kudrin [Mon, 28 Aug 2017 15:03:00 +0000 (08:03 -0700)]
Fix bad offset calculation for R_AARCH64_TLSDESC_* relocs.
If a custom linker script with an unexpected relative layout of .got
and .got.plt sections was used, gold might produce a wrong offset
when applying R_AARCH64_TLSDESC_* relocations.
This patch fixes the issue by calculating "got_tlsdesc_offset"
in a more direct way.
gold/
* aarch64.cc (Target_aarch64::Relocate::relocate_tls):
Make got_tlsdesc_offset signed and fix its calculation.
* testsuite/Makefile.am (aarch64_tlsdesc): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/aarch64_tlsdesc.s: New test source file.
* testsuite/aarch64_tlsdesc.sh: New test script.
* testsuite/aarch64_tlsdesc.t: New test linker script.
Alan Modra [Mon, 28 Aug 2017 06:57:33 +0000 (16:27 +0930)]
[GOLD] Symbol flag for PowerPC64 localentry:0 tracking
This patch provides a flag for PowerPC64 ELFv2 use in class Symbol,
and modifies Sized_target::resolve to return whether the symbol has
been resolved. If not, normal processing continues. I use this for
PowerPC64 ELFv2 to keep track of whether a symbol has any definition
with non-zero localentry, in order to disable --plt-localentry for
that symbol.
PR 21847
* powerpc.cc (Target_powerpc::is_elfv2_localentry0): Test
non_zero_localentry.
(Target_powerpc::resolve): New function.
(powerpc_info): Set has_resolve for 64-bit.
* target.h (Sized_target::resolve): Return bool.
* resolve.cc (Symbol_table::resolve): Continue with normal
processing when target resolve returns false.
* symtab.h (Symbol::non_zero_localentry, set_non_zero_localentry):
New accessors.
(Symbol::non_zero_localentry_): New flag bit.
* symtab.cc (Symbol::init_fields): Init non_zero_localentry_.
GDB Administrator [Mon, 28 Aug 2017 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sun, 27 Aug 2017 14:23:40 +0000 (07:23 -0700)]
x86: Initialize def_protected
* elf32-i386.c (elf_i386_link_hash_newfunc): Initialize
def_protected.
* elf64-x86-64.c (elf_x86_64_link_hash_newfunc): Likewise.
H.J. Lu [Sun, 27 Aug 2017 02:22:26 +0000 (19:22 -0700)]
Disallow copy relocation against protected data symbol
We shpouldn't generate copy relocation to resolve reference to protected
data symbol defined in shared object with the NO_COPY_ON_PROTECTED
property. This patch adds a bit to elf_obj_tdata as well as
elf_i386_link_hash_entry and elf_x86_64_link_hash_entry to track the bfd
with the NO_COPY_ON_PROTECTED property as well as protected symbol
defined in shared object. extern_protected_data is set to FALSE if any
input relocatable file contains the NO_COPY_ON_PROTECTED property.
bfd/
PR ld/21997
* elf-bfd.h (elf_obj_tdata): Use ENUM_BITFIELD on object_id,
dyn_lib_class and has_gnu_symbols. Change bad_symtab to bitfield.
Add a has_no_copy_on_protected bitfield.
(elf_has_no_copy_on_protected): New.
* elf-properties.c (_bfd_elf_parse_gnu_properties): Set
elf_has_no_copy_on_protected for GNU_PROPERTY_NO_COPY_ON_PROTECTED.
(elf_merge_gnu_property_list): Likewise.
(_bfd_elf_link_setup_gnu_properties): Set extern_protected_data
to FALSE for elf_has_no_copy_on_protected.
* elf32-i386.c (SYMBOL_NO_COPYRELOC): New.
(elf_i386_link_hash_entry): Add def_protected.
(elf_i386_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
when checking info->nocopyreloc.
(elf_i386_link_setup_gnu_properties): Don't set
extern_protected_data here.
(elf_i386_merge_symbol_attribute): New function.
(elf_backend_merge_symbol_attribute): New.
* elf64-x86-64.c (SYMBOL_NO_COPYRELOC): New.
(elf_x86_64_link_hash_entry): Add def_protected.
(elf_x86_64_need_pic): Report protected symbol for def_protected.
(elf_x86_64_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
when checking info->nocopyreloc.
(elf_x86_64_relocate_section): Also check for R_X86_64_PC32
relocation run-time overflow and unresolvable R_X86_64_32S
relocation against protected data symbol defined in shared object
with GNU_PROPERTY_NO_COPY_ON_PROTECTED.
(elf_x86_64_link_setup_gnu_properties): Don't set
extern_protected_data here.
(elf_x86_64_merge_symbol_attribute): New function.
(elf_backend_merge_symbol_attribute): New.
ld/
PR ld/21997
* testsuite/ld-i386/i386.exp: Run PR ld/21997 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr21997-1a.S: New file.
* testsuite/ld-i386/pr21997-1b.c: Likewise.
* testsuite/ld-i386/pr21997-1c.S: Likewise.
* testsuite/ld-x86-64/pr21997-1a.S: Likewise.
* testsuite/ld-x86-64/pr21997-1a.err: Likewise.
* testsuite/ld-x86-64/pr21997-1b.c: Likewise.
* testsuite/ld-x86-64/pr21997-1b.err: Likewise.
* testsuite/ld-x86-64/pr21997-1c.c: Likewise.
GDB Administrator [Sun, 27 Aug 2017 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sat, 26 Aug 2017 10:56:13 +0000 (20:26 +0930)]
PowerPC TPREL reloc handling
Tidy how these are handled in PIEs.
* elf32-ppc.c (must_be_dyn_reloc): Use bfd_link_dll. Comment.
(ppc_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
(ppc_elf_relocate_section): Comment fix.
* elf64-ppc.c (must_be_dyn_reloc): Use bfd_link_dll. Comment.
(ppc64_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
Support dynamic relocs for TPREL16 when non-pic too.
(dec_dynrel_count): Adjust TPREL16 handling as per check_relocs.
(ppc64_elf_relocate_section): Support dynamic relocs for TPREL16
when non-pic too.
Joel Brobecker [Fri, 25 Aug 2017 23:23:27 +0000 (19:23 -0400)]
remove param "dispp" from ada-lang.c::ada_lookup_struct_elt_type
The function is always called with DISPP set to NULL, so there is
no need for this parameter anymore. This patch removes it, and
eliminates some dead code associated to that.
gdb/ChangeLog:
* ada-lang.c (ada_lookup_struct_elt_type): Remove parameter "dispp".
Update all callers accordingly. Remove all code blocks handling
the case where DISPP is not NULL.
Tested on x86_64-linux, no regression.
H.J. Lu [Sat, 26 Aug 2017 00:13:58 +0000 (17:13 -0700)]
x86: Remove redundant "symbol" in comments
* elf32-i386.c (elf_i386_link_hash_entry): Remove redundant
"symbol" in comments.
* elf64-x86-64.c (elf_x86_64_link_hash_entry): Likewise.
GDB Administrator [Sat, 26 Aug 2017 00:01:04 +0000 (00:01 +0000)]
Automatic date update in version.in
Simon Marchi [Fri, 25 Aug 2017 08:45:33 +0000 (10:45 +0200)]
gdbserver: Rename some functions, thread -> inferior
These functions apply to thread, and not inferiors (in the gdbserver
sense, the abstraction for threads and processes, as in
inferior_list). Therefore, it would make more sense if these functions
were named with "thread" rather than "inferior".
gdb/gdbserver/ChangeLog:
* inferiors.h (inferior_target_data): Rename to ...
(thread_target_data): ... this.
(inferior_regcache_data): Rename to ...
(thread_regcache_data): ... this.
(set_inferior_regcache_data): Rename to ...
(set_thread_regcache_data): ... this.
* inferiors.c (inferior_target_data): Rename to ...
(thread_target_data): ... this.
(inferior_regcache_data): Rename to ...
(thread_regcache_data): ... this.
(set_inferior_regcache_data): Rename to ...
(set_thread_regcache_data): ... this.
(free_one_thread): Update.
* linux-low.h (get_thread_lwp): Update.
* regcache.c (get_thread_regcache): Update.
(regcache_invalidate_thread): Update.
(free_register_cache_thread): Update.
* win32-i386-low.c (update_debug_registers_callback): Update.
(win32_get_current_dr): Update.
* win32-low.c (thread_rec): Update.
(delete_thread_info): Update.
(continue_one_thread): Update.
(suspend_one_thread): Update.
Alan Modra [Fri, 25 Aug 2017 02:11:06 +0000 (11:41 +0930)]
PR21994, readelf looping on verdefs
PR 21994
* readelf.c (process_version_sections <SHT_GNU_verdef>): Check
vd_aux and vda_next for sanity. Delete "end". Correct overflow
checks.
(process_version_sections <SHT_GNU_verneed>): Correct overflow
check. Don't report invalid vna_next on overflow. Do report
invalid vna_next on size less than aux info.
H.J. Lu [Fri, 25 Aug 2017 00:45:24 +0000 (17:45 -0700)]
ld: Add "--" after regexp
Add "--" after regexp to support dejagnu 1.4.4.
* testsuite/ld-elf/pr21903c.d: Remove '\' before --.
* testsuite/ld-elf/pr21903d.d: Likewise.
* testsuite/ld-elf/pr21903e.d: Likewise.
* testsuite/lib/ld-lib.exp (run_dump_test): Add "--" after
regexp.
GDB Administrator [Fri, 25 Aug 2017 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 24 Aug 2017 21:34:33 +0000 (23:34 +0200)]
Remove unused function set_inferior_target_data
The inferior (thread) target data is always set through add_thread.
gdb/gdbserver/ChangeLog:
* inferiors.c (set_inferior_target_data): Remove.
* inferiors.h (set_inferior_target_data): Remove.
H.J. Lu [Thu, 24 Aug 2017 15:33:16 +0000 (08:33 -0700)]
ld: Replace regexp with string match
Replace regexp with string match to workaround dejagnu 1.4.4 which
complains:
ERROR: bad switch "-fPIE": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --
* testsuite/ld-i386/i386.exp (undefined_weak): Replace regexp
with string match.
* testsuite/ld-x86-64/x86-64.exp (undefined_weak): Likewise.
H.J. Lu [Thu, 24 Aug 2017 14:53:41 +0000 (07:53 -0700)]
x86-64: Run pr22001-1b on x32
Run pr22001-1b on x32 since R_X86_64_32S relocation can be turned into
dynamic R_X86_64_32 relocation which won't overflow on x32.
* testsuite/ld-x86-64/x86-64.exp: Run pr22001-1b on x32.
Jan Kratochvil [Thu, 24 Aug 2017 14:39:11 +0000 (16:39 +0200)]
DWARF-5 Fix DW_FORM_implicit_const
-gdwarf-4:
ptype logical
type = const char [2]
(gdb) PASS: gdb.base/constvars.exp: ptype logical
-gdwarf-5:
ptype logical
type = const char []
(gdb) FAIL: gdb.base/constvars.exp: ptype logical
<2><2fc>: Abbrev Number: 1 (DW_TAG_variable)
<2fd> DW_AT_name : (indirect string, offset: 0x2eb): logical
<301> DW_AT_decl_file : 1
1 DW_TAG_variable [no children]
DW_AT_name DW_FORM_strp
DW_AT_decl_file DW_FORM_implicit_const: 1
During symbol reading, invalid attribute class or form for
'DW_FORM_implicit_const' in '(null)'.
gdb/ChangeLog
2017-08-24 Jan Kratochvil <jan.kratochvil@redhat.com>
PR symtab/22003
* dwarf2read.c (dwarf2_const_value_attr, dump_die_shallow)
(dwarf2_get_attr_constant_value, dwarf2_fetch_constant_bytes)
(skip_form_bytes, attr_form_is_constant): Handle DW_FORM_implicit_const.
H.J. Lu [Thu, 24 Aug 2017 13:34:19 +0000 (06:34 -0700)]
x86-64: Check relocations with -z nocopyreloc
On x86-64, when -z nocopyreloc is used to build executable, relocations
may overflow at run-time or may not be resolved without PIC. This patch
checks these conditions and issues an error with suggestion for -fPIC.
bfd/
PR ld/22001
* elf64-x86-64.c (elf_x86_64_relocate_section): Check for
R_X86_64_PC32 relocation run-time overflow and unresolvable
R_X86_64_32S relocation with -z nocopyreloc.
ld/
PR ld/22001
* testsuite/ld-i386/i386.exp: Run -z nocopyreloc tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* ld/testsuite/ld-i386/pr22001-1a.c: New file.
* ld/testsuite/ld-i386/pr22001-1b.c: Likewise.
* ld/testsuite/ld-i386/pr22001-1c.S: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1a.c: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1a.err: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1b.c: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1b.err: Likewise.
* ld/testsuite/ld-x86-64/pr22001-1c.c: Likewise.
Andrew Burgess [Thu, 17 Aug 2017 10:29:04 +0000 (11:29 +0100)]
ld: Early detection of orphans we know will be discarded
When processing an orphan section we first call lang_place_orphans, this
function handles a few sections for which the behaviour is known COMMON
sections, or sections marked as SEC_EXCLUDE.
Any orphans that are not handled in lang_place_orphans are passed on to
ldlang_place_orphan, this is where we decide where to put the orphan,
and then call lang_add_section to perform the actual orphan placement.
We previously had a larger set of checks at the start of the function
lang_add_section to discard some sections that we _knew_ should not be
added into the output file, this was where .group sections (in a final
link) and .debug* sections (with --strip-debug) were dropped.
The problem with dropping these sections at the lang_add_section stage
is that a user might also be using --orphan-handling=error to prevent
orphans. If they are then they should not be get errors about sections
that we know will be discarded, and which are not mentioned in the
linker script.
The solution proposed in this patch is to move the "will this section be
discarded" check into a separate function, and use this in
lang_place_orphans to have the early discard phase discard sections that
we know should not be included in the output file.
ld/ChangeLog:
PR 21961
* ldlang.c (lang_discard_section_p): New function.
(lang_add_section): Checks moved out into new function, which is
now called.
(lang_place_orphans): Call lang_discard_section_p instead of
duplicating some of the checks from lang_add_section.
* testsuite/ld-elf/orphan-11.d: New file.
* testsuite/ld-elf/orphan-11.ld: New file.
* testsuite/ld-elf/orphan-11.s: New file.
* testsuite/ld-elf/orphan-12.d: New file.
* testsuite/ld-elf/orphan-12.s: New file.
H.J. Lu [Thu, 24 Aug 2017 10:33:42 +0000 (03:33 -0700)]
Revert commit
aab921adcb656e4eefcc7d0f14241f3d7504400e
* elf32-i386.c (elf_i386_check_relocs): Revert the last change.
Undefined symbols may not have a type.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
Jan Kratochvil [Thu, 24 Aug 2017 08:26:52 +0000 (10:26 +0200)]
DWARF-5: Fix -fdebug-types-section
GDB was now accessing as signatured_type memory allocated only by size of
dwarf2_per_cu_data.
gdb/ChangeLog
2017-08-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (build_type_psymtabs_reader): New prototype.
(process_psymtab_comp_unit): Accept IS_DEBUG_TYPES.
(read_comp_units_from_section): New parameter abbrev_section, use
read_and_check_comp_unit_head, allocate signatured_type if needed.
(create_all_comp_units): Update read_comp_units_from_section caller.
Alexander Fedotov [Wed, 23 Aug 2017 15:08:46 +0000 (18:08 +0300)]
[PowerPC VLE] Add SPE2 and EFS2 instructions support
include/
* opcode/ppc.h:
(spe2_opcodes, spe2_num_opcodes): New.
(PPC_OPCODE_SPE2): New define.
(PPC_OPCODE_EFS2): Likewise.
(SPE2_XOP): Likewise.
(SPE2_XOP_TO_SEG): Likewise.
opcodes/
* ppc-dis.c (ppc_mopt): Add PPC_OPCODE_SPE2 and
PPC_OPCODE_EFS2 flag to "e200z4" entry.
New entries efs2 and spe2.
Add PPC_OPCODE_SPE2 and PPC_OPCODE_EFS2 flag to "vle" entry.
(SPE2_OPCD_SEGS): New macro.
(spe2_opcd_indices): New.
(disassemble_init_powerpc): Handle SPE2 opcodes.
(lookup_spe2): New function.
(print_insn_powerpc): call lookup_spe2.
* ppc-opc.c (insert_evuimm1_ex0): New function.
(extract_evuimm1_ex0): Likewise.
(insert_evuimm_lt8): Likewise.
(extract_evuimm_lt8): Likewise.
(insert_off_spe2): Likewise.
(extract_off_spe2): Likewise.
(insert_Ddd): Likewise.
(extract_Ddd): Likewise.
(DD): New operand.
(EVUIMM_LT8): Likewise.
(EVUIMM_LT16): Adjust.
(MMMM): New operand.
(EVUIMM_1): Likewise.
(EVUIMM_1_EX0): Likewise.
(EVUIMM_2): Adjust.
(NNN): New operand.
(VX_OFF_SPE2): Likewise.
(BBB): Likewise.
(DDD): Likewise.
(VX_MASK_DDD): New mask.
(HH): New operand.
(VX_RA_CONST): New macro.
(VX_RA_CONST_MASK): Likewise.
(VX_RB_CONST): Likewise.
(VX_RB_CONST_MASK): Likewise.
(VX_OFF_SPE2_MASK): Likewise.
(VX_SPE_CRFD): Likewise.
(VX_SPE_CRFD_MASK VX): Likewise.
(VX_SPE2_CLR): Likewise.
(VX_SPE2_CLR_MASK): Likewise.
(VX_SPE2_SPLATB): Likewise.
(VX_SPE2_SPLATB_MASK): Likewise.
(VX_SPE2_OCTET): Likewise.
(VX_SPE2_OCTET_MASK): Likewise.
(VX_SPE2_DDHH): Likewise.
(VX_SPE2_DDHH_MASK): Likewise.
(VX_SPE2_HH): Likewise.
(VX_SPE2_HH_MASK): Likewise.
(VX_SPE2_EVMAR): Likewise.
(VX_SPE2_EVMAR_MASK): Likewise.
(PPCSPE2): Likewise.
(PPCEFS2): Likewise.
(vle_opcodes): Add EFS2 and some missing SPE opcodes.
(powerpc_macros): Map old SPE instructions have new names
with the same opcodes. Add SPE2 instructions which just are
mapped to SPE2.
(spe2_opcodes): Add SPE2 opcodes.
gas/
* config/tc-ppc.c:
(md_parse_option): Add mspe2 switch.
(md_show_usage): Document -mspe2.
(ppc_setup_opcodes): Handle spe2_opcodes.
* doc/as.texinfo: Document -mspe2.
* doc/c-ppc.texi: Likewise.
* testsuite/gas/ppc/efs.d: New file.
* testsuite/gas/ppc/efs.s: Likewise.
* testsuite/gas/ppc/efs2.d: Likewise.
* testsuite/gas/ppc/efs2.s: Likewise.
* testsuite/gas/ppc/ppc.exp: Run new tests.
* testsuite/gas/ppc/spe.d: New file.
* testsuite/gas/ppc/spe.s: Likewise.
* testsuite/gas/ppc/spe2-checks.d: Likewise.
* testsuite/gas/ppc/spe2-checks.l: Likewise.
* testsuite/gas/ppc/spe2-checks.s: Likewise.
* testsuite/gas/ppc/spe2.d: Likewise.
* testsuite/gas/ppc/spe2.s: Likewise.
* testsuite/gas/ppc/spe_ambiguous.d: Likewise.
* testsuite/gas/ppc/spe_ambiguous.s: Likewise.
Alan Modra [Wed, 23 Aug 2017 23:56:37 +0000 (09:26 +0930)]
Test undefined symbols in shared libraries
git commit
46434633f9 said
Make undefined symbols in allocate_dynrelocs dynamic
..if they have dynamic relocs. An undefined symbol in a PIC object
that finds no definition ought to become dynamic in order to support
--allow-shlib-undefined, but there is nothing in the generic ELF
linker code to do this if the reference isn't via the GOT or PLT. (An
initialized function pointer is an example.) So it falls to backend
code to ensure the symbol is made dynamic.
The above isn't true. Undefined symbols are indeed made dynamic for
shared libraries. Undefined symbols are not automatically made
dynamic in executables, and it was the PIE case that triggered an
internal consistency assertion on powerpc64. I guess I could have
jumped the other way when fixing PR21988, and not created a dynamic
reloc. Either way, it doesn't matter a great deal. We're going to
get an error on strong undefined symbols in an executable anyway, and
broken binaries if you try to use --unresolved-symbols=ignore-all to
disable the error.
* testsuite/ld-undefined/fundef.s: New test.
* testsuite/ld-undefined/undefined.exp: Test that undefined
symbols in shared libraries are made dynamic.
GDB Administrator [Thu, 24 Aug 2017 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Wed, 23 Aug 2017 23:01:22 +0000 (16:01 -0700)]
Update PR ld/21903 tests for dejagnu 1.4.4
Add '\' before -- to workaround dejagnu 1.4.4 which complains:
ERROR: bad switch "--no-define-common may not be used without -shared":...
* testsuite/ld-elf/pr21903c.d: Add '\' before --.
* testsuite/ld-elf/pr21903d.d: Likewise.
* testsuite/ld-elf/pr21903e.d: Likewise.
Sergio Durigan Junior [Tue, 22 Aug 2017 12:52:44 +0000 (08:52 -0400)]
Fix PR remote/21852: Remote run without specifying a local binary crashes GDB
There is an assertion that is triggering when we start GDB and
instruct it to debug a remote inferior, but don't provide a local
binary, like:
./gdb -nx -q --data-directory=data-directory -ex "tar ext :1234" \
-ex "set remote exec-file /bin/ls" -ex r
In this case, when calling exec_file_locate_attach to locate the
inferior, GDB is incorrectly resetting the breakpoints without a
thread/inferior even running, which causes an assertion to be
triggered:
binutils-gdb/gdb/thread.c:1609: internal-error: scoped_restore_current_thread::scoped_restore_current_thread(): Assertion `tp != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
This happens because add_current_inferior_and_thread (on remote.c) is
breaking an invariant: making inferior_ptid point to a non-existing
thread and then calling common code, which in this case is
breakpoint_re_set. The fix is to make sure that inferior_ptid points
to null_ptid if there is no thread present.
A testcase is provided. Regtested on buildbot.
gdb/ChangeLog:
2017-08-23 Pedro Alves <palves@redhat.com>
PR remote/21852
* remote.c (add_current_inferior_and_thread): Set inferior_ptid
to null_ptid and switch to thread without reading the registers
after adding the inferior.
gdb/testsuite/ChangeLog:
2017-08-23 Sergio Durigan Junior <sergiodj@redhat.com>
PR remote/21852
* gdb.server/normal.c: New file, copied from gdb.base.
* gdb.server/run-without-local-binary.exp: New file.
H.J. Lu [Wed, 23 Aug 2017 20:40:49 +0000 (13:40 -0700)]
x86-64: Properly report output type when PIC is needed
-fPIC may be needed to compile PIE or PDE objects, not just shared
object.
bfd/
* elf64-x86-64.c (elf_x86_64_need_pic): Add an argument for
bfd_link_info. Report shared, PIE or PDE object based on
bfd_link_info.
(elf_x86_64_check_relocs): Update elf_x86_64_need_pic call.
(elf_x86_64_relocate_section): Likewise.
ld/
* testsuite/ld-x86-64/pie2.d: Updated.
* testsuite/ld-x86-64/pr19719.d: Likewise.
* testsuite/ld-x86-64/pr19807-2a.d: Likewise.
* testsuite/ld-x86-64/pr19969.d: Likewise.
H.J. Lu [Wed, 23 Aug 2017 20:12:04 +0000 (13:12 -0700)]
x86: Increment PLT count only for function symbols
Since PLT entry is needed only for function symbols, increment PLT count
only for function symbols.
* elf32-i386.c (elf_i386_check_relocs): Increment PLT count only
for function symbols.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
H.J. Lu [Wed, 23 Aug 2017 17:15:39 +0000 (10:15 -0700)]
x86: Clear extern_protected_data for GNU_PROPERTY_NO_COPY_ON_PROTECTED
When GNU_PROPERTY_NO_COPY_ON_PROTECTED is set, it indicates that there
are no copy relocations against protected data symbols. When linker
sees GNU_PROPERTY_NO_COPY_ON_PROTECTED on any input relocatable file,
it sets extern_protected_data to FALSE.
bfd/
* elf32-i386.c (elf_i386_link_setup_gnu_properties): Set
extern_protected_data to FALSE if GNU_PROPERTY_NO_COPY_ON_PROTECTED
is set on any input relocatable file.
* elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
ld/
* testsuite/ld-i386/i386.exp: Run protected7.
* testsuite/ld-i386/protected7.d: New file.
* testsuite/ld-i386/protected7.s: Likewise.
* testsuite/ld-x86-64/protected8.d: Likewise.
* testsuite/ld-x86-64/protected8.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run protected8.
Jan Kratochvil [Tue, 21 Feb 2017 21:32:56 +0000 (13:32 -0800)]
compile: Add 'set compile-gcc'
As discussed in
How to use compile & execute function in GDB
https://sourceware.org/ml/gdb/2015-04/msg00026.html
GDB currently searches for compilers on /usr/bin/ARCH-OS-gcc and
chooses a match from there. However, it is not currently possible for
the user to override which compiler to use. This is what this patch
implements.
It is also a sync between GCC's and GDB's interfaces.
gdb/ChangeLog
2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (Changes since GDB 7.9): Add set compile-gcc and show
compile-gcc.
* compile/compile.c (compile_gcc, show_compile_gcc): New.
(compile_to_object): Implement compile_gcc.
(_initialize_compile): Install "set compile-gcc". Initialize
compile_gcc.
gdb/doc/ChangeLog
2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Compiling and Injecting Code): Add to subsection
"Compiler search for the compile command" descriptions of set
compile-gcc and show compile-gcc.
include/ChangeLog
2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* gcc-interface.h (enum gcc_base_api_version): Update comment for
GCC_FE_VERSION_1.
(struct gcc_base_vtable): Rename set_arguments to set_arguments_v0.
Add set_arguments, set_triplet_regexp and set_driver_filename.
Jan Kratochvil [Tue, 21 Feb 2017 21:32:55 +0000 (13:32 -0800)]
compile: set debug compile: Display GCC driver filename
As discussed in
How to use compile & execute function in GDB
https://sourceware.org/ml/gdb/2015-04/msg00026.html
GDB currently searches for compilers on /usr/bin/ARCH-OS-gcc and
chooses a match from there. However, it is not currently possible for
the user to display which compiler was selected. Up until now, GDB's
compiler interface was not up-to-date with GCC's one, which means that
it wasn't possible to obtain this information. This patch implements
the mechanisms necessary for that.
gdb/ChangeLog
2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* compile/compile.c (compile_to_object): Conditionally call
set_verbose. Conditionally call compile or compile_v0.
include/ChangeLog
2017-08-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* gcc-interface.h (enum gcc_base_api_version): Add
GCC_FE_VERSION_1.
(struct gcc_base_vtable): Rename compile to compile_v0. Update
comment for compile. New methods set_verbose and compile.
James Clarke [Wed, 23 Aug 2017 12:46:45 +0000 (05:46 -0700)]
gas: enable PC-relative diff relocations on sparc64
gas/
* config/tc-sparc.c (tc_gen_reloc): Convert BFD_RELOC_8/16/32/64
into the corresponding BFD_RELOC_8/16/32/64_PCREL relocation
when requested.
* config/tc-sparc.h (DIFF_EXPR_OK): Define to enable PC-relative
diff relocations.
(TC_FORCE_RELOCATION_SUB_LOCAL): Define to ensure only supported
relocations are made PC-relative.
(CFI_DIFF_EXPR_OK): Define to 0 to force BFD_RELOC_32_PCREL to
be used directly, since otherwise BFD_RELOC_SPARC_UA32 will be
used for .eh_frame which cannot in general be converted to a
BFD_RELOC_32_PCREL due to alignment requirements.
Alan Modra [Wed, 23 Aug 2017 10:19:29 +0000 (19:49 +0930)]
ppc-opc.c formatting
* ppc-opc.c: Formatting and comment fixes. Move insert and
extract functions earlier, deleting forward declarations.
(insert_nbi, insert_raq, insert_rbx): Expand use of RT_MASK and
RA_MASK.
Alan Modra [Wed, 23 Aug 2017 06:12:12 +0000 (15:42 +0930)]
PR21990, Integer overflow in process_version_sections
This tidies some of the overflow checking when processing verneed
and verdef sections.
PR 21990
* readelf.c (process_version_sections <SHT_GNU_verneed>): Check
for invalid vn_next field before adding to idx. Use unsigned
long for index vars. Move index checks.
<SHT_GNU_verdef>: Likewise for vd_next.
Weimin Pan [Wed, 23 Aug 2017 08:57:37 +0000 (10:57 +0200)]
gdb: SPARC ADI support
The M7 processor supports an Application Data Integrity (ADI) feature
that detects invalid data accesses. When software allocates data, it
chooses a 4-bit version number, sets the version in the upper 4 bits
of the 64-bit pointer to that data, and stores the 4-bit version in
every cacheline of the object. Hardware saves the latter in spare
bits in the cache and memory hierarchy. On each load and store, the
processor compares the upper 4 VA (virtual address) bits to the
cacheline's version. If there is a mismatch, the processor generates a
version mismatch trap which can be either precise or disrupting. The
trap is an error condition which the kernel delivers to the process as
a SIGSEGV signal.
The upper 4 bits of the VA represent a version and are not part of the
true address. The processor clears these bits and sign extends bit 59
to generate the true address.
Note that 32-bit applications cannot use ADI.
This patch adds ADI support in gdb which allows the user to examine
current version tags and assign new version tags in the program. It
also catches and reports precise or disrupting memory corruption
traps.
gdb/ChangeLog:
2017-08-07 Weimin Pan <weimin.pan@oracle.com>
* sparc64-tdep.h: (adi_normalize_address): New export.
* sparc-nat.h: (open_adi_tag_fd): New export.
* sparc64-linux-nat.c: (open_adi_tag_fd): New function.
* sparc64-linux-tdep.c:
(SEGV_ACCADI, SEGV_ADIDERR, SEGV_ADIPERR) New defines.
(sparc64_linux_handle_segmentation_fault): New function.
(sparc64_linux_init_abi): Register
sparc64_linux_handle_segmentation_fault
* sparc64-tdep.c: Include cli-utils.h,gdbcmd.h,auxv.h.
(sparc64_addr_bits_remove): New function.
(sparc64_init_abi): Register sparc64_addr_bits_remove.
(MAX_PROC_NAME_SIZE): New macro.
(AT_ADI_BLKSZ, AT_ADI_NBITS, AT_ADI_UEONADI) New defines.
(sparc64adilist): New variable.
(adi_proc_list): New variable.
(find_adi_info): New function.
(add_adi_info): New function.
(get_adi_info_proc): New function.
(get_adi_info): New function.
(info_adi_command): New function.
(read_maps_entry): New function.
(adi_available): New function.
(adi_normalize_address): New function.
(adi_align_address): New function.
(adi_convert_byte_count): New function.
(adi_tag_fd): New function.
(adi_is_addr_mapped): New function.
(adi_read_versions): New function.
(adi_write_versions): New function.
(adi_print_versions): New function.
(do_examine): New function.
(do_assign): New function.
(adi_examine_command): New function.
(adi_assign_command): New function.
(_initialize_sparc64_adi_tdep): New function.
gdb/doc/ChangeLog:
2017-08-07 Weimin Pan <weimin.pan@oracle.com>
* gdb.texinfo (Architectures): Add new Sparc64 section to document
ADI support.
* NEWS: Add "adi examine" and "adi assign" commands.
gdb/testsuite/ChangeLog:
2017-08-07 Weimin Pan <weimin.pan@oracle.com>
* gdb.arch/sparc64-adi.exp: New file.
* gdb.arch/sparc64-adi.c: New file.
GDB Administrator [Wed, 23 Aug 2017 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Tue, 22 Aug 2017 23:28:42 +0000 (08:58 +0930)]
Remove pr19161 test hppa xfail
* testsuite/ld-gc/pr19161.d: Don't xfail hppa.
Alan Modra [Tue, 22 Aug 2017 23:28:08 +0000 (08:58 +0930)]
Make undefined symbols in allocate_dynrelocs dynamic
..if they have dynamic relocs. An undefined symbol in a PIC object
that finds no definition ought to become dynamic in order to support
--allow-shlib-undefined, but there is nothing in the generic ELF
linker code to do this if the reference isn't via the GOT or PLT. (An
initialized function pointer is an example.) So it falls to backend
code to ensure the symbol is made dynamic.
PR 21988
* elf64-ppc.c (ensure_undef_dynamic): Rename from
ensure_undefweak_dynamic. Handle undefined too.
* elf32-ppc.c (ensure_undef_dynamic): Likewise.
* elf32-hppa.c (ensure_undef_dynamic): Likewise.
(allocate_dynrelocs): Discard undefined non-default visibility
relocs first. Make undefined syms dynamic. Tidy goto.
Alan Modra [Tue, 22 Aug 2017 13:00:18 +0000 (22:30 +0930)]
Assemble powerpc vle lsp tests with -a32
-mvle isn't a valid 64-bit option.
* testsuite/gas/ppc/lsp-checks.d: Assemble with -a32.
* testsuite/gas/ppc/lsp.d: Likewise.
Simon Marchi [Tue, 22 Aug 2017 20:09:55 +0000 (22:09 +0200)]
Rename some command functions
This patch renames a few functions implementing CLI commands to follow
the style <command-name>_command, so that they are easier to search for.
gdb/ChangeLog:
* breakpoint.c (breakpoints_info): Rename to ...
(info_breakpoints_command): ... this.
(watchpoints_info): Rename to ...
(info_watchpoints_command): ... this.
(tracepoints_info): Rename to ...
(info_tracepoints_command): ... this.
(_initialize_breakpoint): Adjust.
* dcache.c (dcache_info): Rename to ...
(info_display_command): ... this.
(_initialize_dcache): Adjust.
* frame.h (args_info): Rename to ...
(info_args_command): ... this.
(locals_info): Rename to ...
(info_locals_command): ... this.
* infcmd.c (nofp_registers_info): Rename to ...
(info_registers_command): ... this.
(float_info): Rename to ...
(info_float_command): ... this.
(program_info): Rename to ...
(info_program_command): ... this.
(all_registers_info): Rename to ...
(info_all_registers_command): ... this.
(vector_info): Rename to ...
(info_vector_command): ... this.
(float_info): Rename to ...
(info_float_command): ... this.
(_initialize_infcmd): Adjust.
* inferior.h (term_info): Rename to ...
(info_terminal_command): ... this.
* inflow.c (term_info): Rename to ...
(info_terminal_command): ... this.
(_initialize_inflow): Adjust.
* infrun.c (signals_info): Rename to ...
(info_signals_command): ... this.
(_initialize_infrun): Adjust.
* objc-lang.c (classes_info): Rename to ...
(info_classes_command): ... this.
(selectors_info): Rename to ...
(info_selectors_command): ... this.
(_initialize_objc_language): Adjust.
* printcmd.c (sym_info): Rename to ...
(info_symbol_command): ... this.
(address_info): Rename to ...
(info_address_command): ... this.
(display_info): Rename to ...
(info_display_command): ... this.
(_initialize_printcmd): Adjust.
* reverse.c (bookmarks_info): Rename to ...
(info_breakpoints_command): ... this.
(_initialize_reverse): Adjust.
* ser-go32.c (dos_info): Rename to ...
(info_serial_command): ... this.
(_initialize_ser_dos): Adjust.
* skip.c (skip_info): Rename to ...
(info_skip_command): ... this.
(_initialize_step_skip): Adjust.
* source.c (line_info): Rename to ...
(info_line_command): ... this.
(source_info): Rename to ...
(info_source_command)
* stack.c (frame_info): Rename to ...
(info_frame_command): ... this.
(locals_info): Rename to ...
(info_locals_command): ... this.
(args_info): Rename to ...
(info_args_command): ... this.
(_initialize_stack): Adjust.
* symtab.c (sources_info): Rename to ...
(info_sources_command): ... this.
(variables_info): Rename to ...
(info_variables_command): ... this.
(functions_info): Rename to ...
(info_functions_command): ... this.
(types_info): Rename to ...
(info_types_command): ... this.
(_initialize_symtab): Adjust.
* target.c (target_info): Rename to ...
(info_target_command): ... this.
(initialize_targets): Adjust.
* tracepoint.c (tvariables_info): Rename to ...
(info_tvariables_command): ... this.
(scope_info): Rename to ...
(info_scope_command): ... this.
(trace_dump_actions): Adjust.
(_initialize_tracepoint): Adjust.
H.J. Lu [Tue, 22 Aug 2017 16:41:21 +0000 (09:41 -0700)]
Update PR ld/21964 tests
* testsuite/ld-elf/pr21964-1a.c (foo): Renamed to ...
(foo1): This.
* testsuite/ld-elf/pr21964-1b.c: Rewrite.
* testsuite/ld-elf/pr21964-1c.c: New file.
* testsuite/ld-elf/pr21964-2c.c: Likewise.
* testsuite/ld-elf/pr21964-2a.c (foo): Renamed to ...
(foo1): This.
* testsuite/ld-elf/pr21964-2b.c: Rewrite.
* testsuite/ld-elf/shared.exp: Update PR ld/21964 tests.
Palmer Dabbelt [Tue, 1 Aug 2017 21:13:05 +0000 (14:13 -0700)]
RISC-V: Mark "c.nop" as an alias
This fixes "-M noaliases" disassembly for "c.nop", which is an alias for
"c.addi x0, 0".
opcodes/ChangeLog
2017-08-01 Palmer Dabbelt <palmer@dabbelt.com>
* riscv-opc.c (riscv_opcodes): Mark "c.nop" as an alias.
Pedro Alves [Tue, 22 Aug 2017 13:51:18 +0000 (14:51 +0100)]
Add test for "List actual code around more than one location" change
This adds a test for the "list" command change done in
0d999a6ef0f9
("List actual code around more than one location").
gdb/ChangeLog:
2017-08-22 Pedro Alves <palves@redhat.com>
* gdb.cp/overload.exp (line_range_pattern): New procedure.
(top level): Add "list all overloads" tests.
Tom Tromey [Sun, 20 Aug 2017 04:26:20 +0000 (22:26 -0600)]
Change install_breakpoint to take a std::unique_ptr
This changes install_breakpoint to take a std::unique_ptr rvalue-ref
argument. This makes it clear that install_breakpoint takes ownership
of the pointer, and prevents bugs like the one fixed by the previous
patch.
ChangeLog
2017-08-22 Tom Tromey <tom@tromey.com>
* breakpoint.h (install_breakpoint): Update.
* breakpoint.c (add_solib_catchpoint): Update.
(install_breakpoint): Change argument to a std::unique_ptr.
(create_fork_vfork_event_catchpoint): Use std::unique_ptr.
(create_breakpoint_sal, create_breakpoint): Update.
(watch_command_1, catch_exec_command_1)
(strace_marker_create_breakpoints_sal): Use std::unique_ptr.
(add_to_breakpoint_chain): Change argument to a std::unique_ptr.
Return the breakpoint.
(set_raw_breakpoint_without_location, set_raw_breakpoint)
(new_single_step_breakpoint): Update.
* break-catch-throw.c (handle_gnu_v3_exceptions): Use
std::unique_ptr.
* break-catch-syscall.c (create_syscall_event_catchpoint): Use
std::unique_ptr.
* break-catch-sig.c (create_signal_catchpoint): Use
std::unique_ptr.
* ada-lang.c (create_ada_exception_catchpoint): Use
std::unique_ptr.
Tom Tromey [Sun, 20 Aug 2017 04:15:30 +0000 (22:15 -0600)]
Fix erroneous cleanup use in add_solib_catchpoint
I happened to notice that add_solib_catchpoint allocated the new
catchpoint with "new" but installed a cleanup using "xfree". This
patch fixes the bug by changing the function to use std::unique_ptr
instead.
ChangeLog
2017-08-22 Tom Tromey <tom@tromey.com>
* breakpoint.c (add_solib_catchpoint): Use std::unique_ptr.
Tom Tromey [Sat, 5 Aug 2017 16:40:15 +0000 (10:40 -0600)]
Change psymtab_search_name to return a unique_xmalloc_ptr
This changes psymtab_search_name to return a unique_xmalloc_ptr and
fixes up its one caller. This allows the removal of some cleanups.
ChangeLog
2017-08-22 Tom Tromey <tom@tromey.com>
* psymtab.c (psymtab_search_name): Return a unique_xmalloc_ptr.
(lookup_partial_symbol): Update.
Tom Tromey [Sat, 5 Aug 2017 16:29:56 +0000 (10:29 -0600)]
Change rewrite_source_path to return a unique_xmalloc_ptr
This changes rewrite_source_path to return a unique_xmalloc_ptr and
fixes up the callers. This allows removing some cleanups.
ChangeLog
2017-08-22 Tom Tromey <tom@tromey.com>
* source.h (rewrite_source_path): Return a unique_xmalloc_ptr.
* source.c (rewrite_source_path): Return a unique_xmalloc_ptr.
(find_and_open_source, symtab_to_fullname): Update.
* psymtab.c (psymtab_to_fullname): Update.
Tom Tromey [Thu, 3 Aug 2017 22:53:22 +0000 (16:53 -0600)]
Change gdb_realpath to return a unique_xmalloc_ptr
This changes gdb_realpath to return a unique_xmalloc_ptr and fixes up
the callers. This allows removing some cleanups. This change by
itself caused xfullpath.exp to fail; and attempting to fix that ran
into various problems (like .get() being optimized out); so this patch
also rewrites xfullpath.exp to be a C++ selftest instead.
ChangeLog
2017-08-22 Tom Tromey <tom@tromey.com>
* exec.c (exec_file_attach): Update.
* linux-thread-db.c (try_thread_db_load): Update.
* guile/scm-safe-call.c (gdbscm_safe_source_script): Update.
* utils.c (gdb_realpath): Change return type.
(gdb_realpath_keepfile): Update.
(gdb_realpath_check_trailer, gdb_realpath_tests): New functions.
(_initialize_utils): Register the new self test.
* source.c (openp): Update.
(find_and_open_source): Update.
* nto-tdep.c (nto_find_and_open_solib): Update.
* main.c (set_gdb_data_directory): Update.
(captured_main_1): Update.
* dwarf2read.c (dwarf2_get_dwz_file): Update
(dw2_map_symbol_filenames): Update.
* auto-load.c (auto_load_safe_path_vec_update): Update.
(filename_is_in_auto_load_safe_path_vec): Change type of
"filename_realp".
(auto_load_objfile_script): Update.
(file_is_auto_load_safe): Update. Use std::string.
* utils.h (gdb_realpath): Return a gdb::unique_xmalloc_ptr.
testsuite/ChangeLog
2017-08-22 Tom Tromey <tom@tromey.com>
* gdb.gdb/xfullpath.exp: Remove.
Tom Tromey [Thu, 3 Aug 2017 22:34:56 +0000 (16:34 -0600)]
Change gdb_realpath_keepfile to return a unique_xmalloc_ptr
This changes gdb_realpath_keepfile to return a unique_xmalloc_ptr, and
fixes up the callers.
ChangeLog
2017-08-22 Tom Tromey <tom@tromey.com>
* utils.c (gdb_realpath_keepfile): Return a
gdb::unique_xmalloc_ptr.
* exec.c (exec_file_attach): Update.
* utils.h (gdb_realpath_keepfile): Return a
gdb::unique_xmalloc_ptr.