From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83140 invoked by alias); 5 Apr 2017 16:17:03 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 83095 invoked by uid 9674); 5 Apr 2017 16:17:01 -0000 Date: Wed, 05 Apr 2017 16:17:00 -0000 Message-ID: <20170405161700.83032.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] users/jkratoch/indexcxx: Merge remote-tracking branch 'gdb/master' into indexcxx X-Git-Refname: refs/heads/users/jkratoch/indexcxx X-Git-Reftype: branch X-Git-Oldrev: 590d37ae8d079e541cf184782899ef84b2b3f569 X-Git-Newrev: 828d7c2b97ad76c73c1a718d1bbaf434d045b937 X-SW-Source: 2017-q2/txt/msg00002.txt.bz2 List-Id: The branch, users/jkratoch/indexcxx has been updated via 828d7c2b97ad76c73c1a718d1bbaf434d045b937 (commit) via 2cad08ea7dbc96103da9957da6973f9d0dbc33a8 (commit) via 55a98976756cb2df83ac8f8e9799331fbcc4f669 (commit) via 8dea77f0254d6a76d71092c922e9409ef1b67df4 (commit) via 4ac40124eef08045bf99ad9f4fcc277961953109 (commit) via 4d5efb852be6554305dfaf17c1e4f07bb9514273 (commit) via c053b65441eb70ac78a514fabc3431b857a30d2e (commit) via f3b8f8ee35bd62a2ae7d21561f5d23f00dad004f (commit) via 80070c0d3491347f11283c5791b9dd040fedbd4f (commit) via 4c7bf4f91b7dd3ccbd12be55316fca8817059a24 (commit) via 1e1a8bef60db2f524c5eb1d27be22cfa9ff82a84 (commit) via 499079343549348e270047ffa2687a8a76523700 (commit) via 6f77053d2ae56f16c10a8817732ed9fb43893507 (commit) via 9c5417255690af00751c7d506172459afe856894 (commit) via ecfb656c37b982479d8eb07f240b434772d98fd6 (commit) via d194f1fe51cb85b8a919b7ee9e3a7715b0ec9744 (commit) via fff8551cf549f4047c9276a836408d802db6ce6d (commit) via 477bdd393c8145ad44899cb4681d57a61c82aad3 (commit) via a91e1603afb6704545793e967a1a3dfe96b389de (commit) via b52920324fabbcad93042f2e17de52696d0dab42 (commit) via 65dd1e590e519eba10bc29fb6e952271e0604c9b (commit) via d62a8ae2dd0fbb6235f4e8f2fb61b83fe4ba1d90 (commit) via ad32986fdf9da1c8748e47b8b45100398223dba8 (commit) via db3a1dc7c9404e203c54576db3335e69d995e83e (commit) via 4c220b4625df0b08cbb22e5c7ca04dc7a629de1b (commit) via c41cf6fdf514fce6b69f8f875b6903b2a3910f89 (commit) via 2f5f29cada3c06c9c26f4da5994951effee7d6f7 (commit) via 2514e33e01890ad28023359b110d1c9c1ad201d4 (commit) via 46bed6796d5821832e8ba373ddb2e7fdc45a109d (commit) via 82156ab704b08b124d319c0decdbd48b3ca2dac5 (commit) via 75ec1fdbb797a389e4fe4aaf2e15358a070dcc19 (commit) via f32ba72991d2406b21ab17edc234a2f3fa7fb23d (commit) via 12bfb8fec326e847f6300874ca656e47ee027f5d (commit) via 450b68da0169dcfa1c36987ec80e2655abb3f8e6 (commit) via 5e6a0e73317915b0685249606538ea739acc3a23 (commit) from 590d37ae8d079e541cf184782899ef84b2b3f569 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 828d7c2b97ad76c73c1a718d1bbaf434d045b937 Merge: 590d37a 2cad08e Author: Jan Kratochvil Date: Wed Apr 5 18:08:31 2017 +0200 Merge remote-tracking branch 'gdb/master' into indexcxx commit 2cad08ea7dbc96103da9957da6973f9d0dbc33a8 Author: Yao Qi Date: Wed Apr 5 14:55:43 2017 +0100 Use frame_unwind_register_value in frame_unwind_register_unsigned gdb: 2017-04-05 Yao Qi * frame.c (frame_unwind_register_unsigned): Call frame_unwind_register_value. commit 55a98976756cb2df83ac8f8e9799331fbcc4f669 Author: Yao Qi Date: Wed Apr 5 14:46:13 2017 +0100 Fix racy test in gdb.threads/thread-specific-bp.exp I see the following test fail from time to time, due to the racy test in gdb.threads/thread-specific-bp.exp. continue -a^M Continuing.^M ^M Thread 1 "thread-specific" hit Breakpoint 4, end () at binutils-gdb/gdb/testsuite/gdb.threads/thread-specific-bp.c:29^M 29 }^M (gdb) [Thread 0x40322460 (LWP 12950) exited]^M Thread-specific breakpoint 3 deleted - thread 2 no longer in the thread list.^M FAIL: gdb.threads/thread-specific-bp.exp: non-stop: continue to end (timeout) This patch changes gdb_test to gdb_test_multiple to match prompt only instead of both prompt and anchor. gdb/testsuite: 2017-04-05 Yao Qi * gdb.threads/thread-specific-bp.exp (check_thread_specific_breakpoint): Use gdb_test_multiple, and don't match anchor. commit 8dea77f0254d6a76d71092c922e9409ef1b67df4 Author: Alan Modra Date: Wed Apr 5 12:47:41 2017 +0930 PowerPC64le PLT reference counting A fix for ELFv2 ABI garbage-collection. * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT reference counting. commit 4ac40124eef08045bf99ad9f4fcc277961953109 Author: Pedro Alves Date: Wed Apr 5 09:39:49 2017 +0100 New global maintainer - Simon Marchi gdb/ChangeLog: 2017-04-05 Pedro Alves * MAINTAINERS (Global Maintainers): Add Simon Marchi. (Write After Approval): Remove Simon Marchi. commit 4d5efb852be6554305dfaf17c1e4f07bb9514273 Author: Hans-Peter Nilsson Date: Wed Apr 5 03:00:40 2017 +0200 PR ld/21233: xfail failing test-parts for cris*-*-* commit c053b65441eb70ac78a514fabc3431b857a30d2e Author: Pedro Alves Date: Tue Apr 4 23:49:27 2017 +0100 Initialize gdb::optional empty payload to quiet false -Wmaybe-uninitialized warnings Commit ecfb656c37b982 ("dwarf2read.c: Make dir_index and file_name_index strong typedefs") added a use of gdb::optional that triggers bogus -Wmaybe-uninitialized warnings: GCC trunk is complaining like this: ../../binutils-gdb/gdb/dwarf2read.c: In function void read_formatted_entries(bfd*, const gdb_byte**, line_header*, const comp_unit_head*, void (*)(line_header*, const char*, dir_index, unsigned int, unsigned int)): ../../binutils-gdb/gdb/dwarf2read.c:17779:65: error: fe.file_entry::length may be used uninitialized in this function [-Werror=maybe-uninitialized] callback (lh, fe.name, fe.d_index, fe.mod_time, fe.length); ^ ../../binutils-gdb/gdb/dwarf2read.c:17779:65: error: *((void*)& fe +8) may be used uninitialized in this function [-Werror=maybe-uninitialized] ../../binutils-gdb/gdb/dwarf2read.c:17779:65: error: fe.file_entry::mod_time may be used uninitialized in this function [-Werror=maybe-uninitialized] ../../binutils-gdb/gdb/dwarf2read.c:17779:65: error: fe.file_entry::name may be used uninitialized in this function [-Werror=maybe-uninitialized] While some older GCCs are complaining like this: ../../binutils-gdb/gdb/dwarf2read.c: In function void read_formatted_entries(bfd*, const gdb_byte**, line_header*, const comp_unit_head*, void (*)(line_header*, const char*, dir_index, unsigned int, unsigned int)): ../../binutils-gdb/gdb/dwarf2read.c:17779:65: error: uint may be used uninitialized in this function [-Werror=maybe-uninitialized] callback (lh, fe.name, fe.d_index, fe.mod_time, fe.length); Looking around the web, I see that boost's optional implementation triggers this kind of issue often too. See: http://www.boost.org/doc/libs/1_63_0/libs/optional/doc/html/boost_optional/tutorial/gotchas/false_positive_with__wmaybe_uninitialized.html I noticed that replacing the gdb::optional uses with real C++17 std::optional uses against GCC 7/trunk makes the warnings go away. Looking at the implementation, AFAICS, libstdc++ always initializes its "empty" union payload member (_M_empty, which is defined as an empty class, like ours). I.e., all payload types have this ctor: struct _Optional_payload..... { constexpr _Optional_payload() : _M_empty() {} The constexpr makes a diference too. Without it, GCC7 still warns. So I'm applying the same treatment to our gdb::optional. gdb/ChangeLog: 2017-04-05 Pedro Alves * common/gdb_optional.h (optional::optional): Make constexpr and initialize m_dummy. commit f3b8f8ee35bd62a2ae7d21561f5d23f00dad004f Author: GDB Administrator Date: Wed Apr 5 00:00:36 2017 +0000 Automatic date update in version.in commit 80070c0d3491347f11283c5791b9dd040fedbd4f Author: Maciej W. Rozycki Date: Mon Mar 27 12:39:07 2017 +0100 PR ld/21233: Avoid sweeping forced-undefined symbols in section GC Complement commit 902e9fc76a0e ("PR ld/20828: Move symbol version processing ahead of GC symbol sweep"), commit b531344c34b0 ("PR ld/20828: Reorder the symbol sweep stage of section GC") and commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC"), and prevent symbols forcibly entered in the output file with the use of the `--undefined=' or `--require-defined=' linker command line options or the EXTERN linker script command from being swept in section garbage collection and consequently recorded in the dynamic symbol table as local entries. This happens in certain circumstances, where a symbol reference also exists in one of the static input files, however only in a section which is garbage-collected and does not make it to the output file, and the symbol is defined in a dynamic object present in the link. For example with the `i386-linux' target and the `pr21233.s' and `pr21233-l.s' sources, and the `pr21233.ld' linker script included with this change we get: $ as -o pr21233-l.o pr21233-l.s $ ld -shared -T pr21233.ld -o libpr21233.so pr21233-l.o $ as -o pr21233.o pr21233.s $ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233 pr21233.o libpr21233.so $ readelf --dyn-syms pr21233 Symbol table '.dynsym' contains 2 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 OBJECT LOCAL DEFAULT UND bar $ which makes the run-time `bar' dependency of the `pr21233' executable different from its corresponding link-time dependency, i.e. the presence of `libpr21233.so' and its `bar' symbol is required at the link time, however at the run time a copy of `libpr21233.so' without `bar' will do. Similarly with `--undefined=' and EXTERN which do not actually require the reference to the symbol requested to be satisfied with a definition at the link time, however once the definition has been pulled at the link time, so it should at the dynamic load time. Additionally with the `mips-linux' target we get: $ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233 pr21233.o libpr21233.so ld: BFD (GNU Binutils) 2.28.51.20170324 assertion fail .../bfd/elfxx-mips.c:3861 $ as the target is not prepared to handle such a local dynamic symbol. With this change in effect we get: $ readelf --dyn-syms pr21233 Symbol table '.dynsym' contains 2 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 OBJECT GLOBAL DEFAULT UND bar $ instead, for both targets. ld/ PR ld/21233 * ldlang.c (insert_undefined): Set `mark' for ELF symbols. * testsuite/ld-elf/pr21233.sd: New test. * testsuite/ld-elf/pr21233-l.sd: New test. * testsuite/ld-elf/pr21233.ld: New test linker script. * testsuite/ld-elf/pr21233-e.ld: New test linker script. * testsuite/ld-elf/pr21233.s: New test source. * testsuite/ld-elf/pr21233-l.s: New test source. * testsuite/ld-elf/shared.exp: Run the new tests. commit 4c7bf4f91b7dd3ccbd12be55316fca8817059a24 Author: John Baldwin Date: Tue Apr 4 14:28:07 2017 -0700 Remove support for using the bsd-uthread target on FreeBSD. The bsd-uthread target supports an old thread library ("libc_r") that was last included in FreeBSD release 6.4 released in 2008. However, this library has not been used as the default library since FreeBSD 5.0 (2003) and 4.11 (2005). Thread support for modern FreeBSD binaries is provided via "normal" LWP support in core files and the native FreeBSD target. gdb/ChangeLog: * amd64-fbsd-tdep.c: Remove "bsd-uthread.h" include. (amd64fbsd_jmp_buf_reg_offset): Remove. (amd64fbsd_supply_uthread): Remove function. (amd64fbsd_collect_uthread): Remove function. (amd64fbsd_init_abi): Don't set bsd-uthread callbacks. * configure.tgt (i[34567]86-*-freebsd*): Remove bsd-uthread.o. (x86_64-*-freebsd*): Remove bsd-uthread.o. (fbsd-nat.c): Update comment. * i386-fbsd-tdep.c: Remove "bsd-uthread.h" include. (i386fbsd_jmp_buf_reg_offset): Remove. (i386fbsd_supply_uthread): Remove function. (i386fbsd_collect_uthread): Remove function. (i386fbsd_init_abi): Don't set bsd-uthread callbacks. commit 1e1a8bef60db2f524c5eb1d27be22cfa9ff82a84 Author: John Baldwin Date: Tue Apr 4 14:20:37 2017 -0700 Remove support for FreeBSD/alpha. FreeBSD last shipped a release for Alpha (6.3) in 2008. This also removes support for GNU/kFreeBSD on Alpha. gdb/ChangeLog: * Makefile.in (ALL_64_TARGET_OBS): Remove alpha-fbsd-tdep.o. (ALLDEPFILES): Remove alpha-fbsd-tdep.c * NEWS: Mention that support for FreeBSD/alpha was removed. * alpha-fbsd-tdep.c: Delete file. * config/alpha/fbsd.mh: Delete file. * configure.host: Delete alpha*-*-freebsd* and alpha*-*-kfreebsd*-gnu. * configure.tgt: Delete alpha*-*-freebsd* and alpha*-*-kfreebsd*-gnu. commit 499079343549348e270047ffa2687a8a76523700 Author: John Baldwin Date: Tue Apr 4 13:57:47 2017 -0700 Use ptid from regcache instead of inferior_ptid. gdb/ChangeLog: * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers, amd64bsd_store_inferior_registers): Use ptid from regcache. commit 6f77053d2ae56f16c10a8817732ed9fb43893507 Author: Pedro Alves Date: Tue Apr 4 20:03:26 2017 +0100 dwarf2read.c: C++fy lnp_state_machine While I was looking at the file, I noticed that this struct could be nicely converted to a class. As I was progressing, I ended up moving all state machine actual internal state manipulation to methods of lnp_state_machine, essentially decoupling DWARF parsing from state tracking. I also noticed that the lnp_reader_state doesn't really serve any good use, so that's eliminated in the process. gdb/ChangeLog: 2017-04-04 Pedro Alves * dwarf2read.c (lnp_state_machine): Now a class. Initialize all data fields, make them private and add "m_" prefixes. (lnp_state_machine::lnp_state_machine): New ctor. (record_line, check_line_address, handle_set_discriminator) (handle_set_address, handle_advance_pc, handle_special_opcode) (handle_advance_line, handle_set_file, handle_negate_stmt) (handle_const_add_pc, handle_fixed_advance_pc, handle_copy) (end_sequence, advance_line): New methods. (m_gdbarch, m_record_lines_p): New fields. (lnp_reader_state): Delete. (dwarf_record_line): Rename to ... (lnp_state_machine::record_line): ... adjust. (init_lnp_state_machine): Delete. (lnp_state_machine::lnp_state_machine): New. (check_line_address): Rename to ... (lnp_state_machine::check_line_address): This. (dwarf_decode_lines_1): Remove reference to "reader_state". Adjust lnp_state_machine having a non-default ctor. Use bool. State machine internal state manipulation moved to lnp_state_machine methods. commit 9c5417255690af00751c7d506172459afe856894 Author: Pedro Alves Date: Tue Apr 4 20:03:26 2017 +0100 Make sect_offset and cu_offset strong typedefs instead of structs A while ago, back when GDB was a C program, the sect_offset and cu_offset types were made structs in order to prevent incorrect mixing of those offsets. Now that we require C++11, we can make them integers again, while keeping the safety, by exploiting "enum class". We can add a bit more safety, even, by defining operators that the types _should_ support, helping making the suspicious uses stand out more. Getting at the underlying type is done with the new to_underlying function added by the previous patch, which also helps better spot where do we need to step out of the safety net. Mostly, that's around parsing the DWARF, and when we print the offset for complaint/debug purposes. But there are other occasional uses. Since we have to define the sect_offset/cu_offset types in a header anyway, I went ahead and generalized/library-fied the idea of "offset" types, making it trivial to add more such types if we find a use. See common/offset-type.h and the DEFINE_OFFSET_TYPE macro. I needed a couple generaly-useful preprocessor bits (e.g., yet another CONCAT implementation), so I started a new common/preprocessor.h file. I included units tests covering the "offset" types API. These are mostly compile-time tests, using SFINAE to check that expressions that shouldn't compile (e.g., comparing unrelated offset types) really are invalid and would fail to compile. This same idea appeared in my pending enum-flags revamp from a few months ago (though this version is a bit further modernized compared to what I had posted), and I plan on reusing the "check valid expression" bits added here in that series, so I went ahead and defined the CHECK_VALID_EXPR macro in its own header -- common/valid-expr.h. I think that's nicer regardless. I was borderline between calling the new types "offset" types, or "index" types, BTW. I stuck with "offset" simply because that's what we're already calling them, mostly. gdb/ChangeLog: 2017-04-04 Pedro Alves * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add unittests/offset-type-selftests.c. (SUBDIR_UNITTESTS_OBS): Add offset-type-selftests.o. * common/offset-type.h: New file. * common/preprocessor.h: New file. * common/traits.h: New file. * common/valid-expr.h: New file. * dwarf2expr.c: Include "common/underlying.h". Adjust to use sect_offset and cu_offset strong typedefs throughout. * dwarf2expr.h: Adjust to use sect_offset and cu_offset strong typedefs throughout. * dwarf2loc.c: Include "common/underlying.h". Adjust to use sect_offset and cu_offset strong typedefs throughout. * dwarf2read.c: Adjust to use sect_offset and cu_offset strong typedefs throughout. * gdbtypes.h: Include "common/offset-type.h". (cu_offset): Now an offset type (strong typedef) instead of a struct. (sect_offset): Likewise. (union call_site_parameter_u): Rename "param_offset" field to "param_cu_off". * unittests/offset-type-selftests.c: New file. commit ecfb656c37b982479d8eb07f240b434772d98fd6 Author: Pedro Alves Date: Tue Apr 4 20:03:25 2017 +0100 dwarf2read.c: Make dir_index and file_name_index strong typedefs This should help catch mistakes related to mixing the 1-based DWARF indexes with 0-based std::vector indexes, since the new types do not implicitly convert to anything. The change in read_formatted_entries relates to the fact that doing the seemingly simpler: - uintp = &fe.dir_index; + uintp = (unsigned int *) &fe.dir_index; would be undefined C/C++. So to address that, I made the function extract the form before assigning to the file_entry. It felt natural to use gdb::optional for "do I have this value", and this is what motivated the previous patch that added the missing observer methods to gdb::optional. gdb/ChangeLog: 2017-04-04 Pedro Alves * common/underlying.h: New file. * dwarf2read.c: Include "common/gdb_optional.h" and "common/underlying.h". (dir_index, file_name_index): New types. (file_entry): Use them. (file_entry::include): Use to_underlying. (line_header::add_file_name): Use dir_index. (read_formatted_entries): Use gdb::optional. Read form before writting to file_entry. (dwarf_decode_line_header): Use dir_index. (lnp_state_machine::current_file): Use to_underlying. (lnp_state_machine::file): Change type to file_name_index. (dwarf_record_line): Use to_underlying. (init_lnp_state_machine): Use file_name_index. (dwarf_decode_lines_1): Use dir_index and file_name_index. commit d194f1fe51cb85b8a919b7ee9e3a7715b0ec9744 Author: Pedro Alves Date: Tue Apr 4 20:03:25 2017 +0100 gdb::optional: Add observers Currently, gdb::optional is really minimal and can only be used for lazy initialization. There's no way to get at the value contained inside the optinal. This commit corrects that, by adding observer methods, mostly copied from libstdc++'s implementation of C++17 std::optional. This will be used in the following patch. gdb/ChangeLog: 2017-04-04 Pedro Alves * common/gdb_optional.h (gdb::optiona): Add operator->, operator*, operator bool, has_value and get methods. commit fff8551cf549f4047c9276a836408d802db6ce6d Author: Pedro Alves Date: Tue Apr 4 20:03:25 2017 +0100 dwarf2read.c: Some C++fycation, use std::vector, std::unique_ptr This starts off as replacing a couple custom open coded vector implementations in the file with std::vector, and then the rest falls off of that. I.e., use new/delete instead of XCNEW/xfree, add ctors/dtors/initializers where appropriate. And then use std::unique_ptr instead of cleanups. Some functions became methods, and in a couple spots, some single-use callback functions that would have to be tweaked anyway are converted to lambdas instead. gdb/ChangeLog: 2017-04-04 Pedro Alves * dwarf2read.c (struct file_entry): Add ctors, and initialize all fields. (line_header): Initialize all data fields. Change type of standard_opcode_lengths to std::unique_ptr. Change type of include_dirs to std::vector. Remove num_include_dirs, include_dirs_size. Change type of file_names to std::vector. Remove num_file_names, file_names_size. (line_header::line_header): New. (line_header::add_include_dir, line_header::add_file_name): New methods. (line_header::include_dir_at): Remove NULL check. (line_header::file_name_at): Add const overload. (line_header_up): New unique_ptr typedef. (dw2_get_file_names_reader): Use line_header_up. Adjust to use std::vector. Remove free_line_header call. (dwarf2_build_include_psymtabs): Use line_header_up. Remove free_line_header call. (free_cu_line_header): Delete. (handle_DW_AT_stmt_list, handle_DW_AT_stmt_list) (setup_type_unit_groups): Use line_header_up instead of cleanups. Adjust to use std::vector. (free_line_header): Delete. (free_line_header_voidp): Use delete. (add_include_dir): Replace with ... (line_header::add_include_dir): ... this method. Use std::vector. (add_file_name): Replace with ... (line_header::add_file_name): ... this method. Use std::vector. (add_include_dir_stub): Delete. (read_formatted_entries): Remove memset. (dwarf_decode_line_header): Return a line_header_up instead of a raw pointer. Remove cleanup handling. Pass lambdas to read_formatted_entries. Adjust to use line_header methods. (dwarf_decode_lines_1): Adjust to use line_header methods. (dwarf_decode_lines, file_file_name, file_full_name): Adjust to use std::vector. commit 477bdd393c8145ad44899cb4681d57a61c82aad3 Author: Jon Turney Date: Thu Jun 2 13:46:58 2016 +0000 Use symbolic constants instead of magic numbers with add_data_entry() Use symbolic constants from include/coff/internal.h instead of magic numbers with add_data_entry() bfd/ChangeLog: 2017-04-02 Jon Turney (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than numbers for DataDirectory entry indicies passed to add_data_entry(). commit a91e1603afb6704545793e967a1a3dfe96b389de Author: H.J. Lu Date: Tue Apr 4 09:05:48 2017 -0700 Support ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX Mark an ALLOC section, which should be placed in special memory area, with SHF_GNU_MBIND. Its sh_info field indicates the special memory type. GNU_MBIND section names start with ".mbind" so that they are placed as orphan sections by linker. All input GNU_MBIND sections with the same sh_type, sh_flags and sh_info are placed in one output GNU_MBIND section. In executable and shared object, create a GNU_MBIND segment for each GNU_MBIND section and its segment type is PT_GNU_MBIND_LO plus the sh_info value. Each GNU_MBIND segment is aligned at page boundary. The assembler syntax: .section .mbind.foo,"adx",%progbits ^ 0: Special memory type. | 'd' for SHF_GNU_MBIND. .section .mbind.foo,"adx",%progbits,0x1 ^ 1: Special memory type. | 'd' for SHF_GNU_MBIND. .section .mbind.bar,"adG",%progbits,.foo_group,comdat,0x2 ^ 2: Special memory type. | 'd' for SHF_GNU_MBIND. bfd/ * elf.c (get_program_header_size): Add a GNU_MBIND segment for each GNU_MBIND section and align GNU_MBIND section to page size. (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND segment for each GNU_MBIND section. (_bfd_elf_init_private_section_data): Copy sh_info from input for GNU_MBIND section. binutils/ * NEWS: Mention support for ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX. * readelf.c (get_segment_type): Handle PT_GNU_MBIND_XXX. (get_elf_section_flags): Handle SHF_GNU_MBIND. (process_section_headers): Likewise. * testsuite/binutils-all/mbind1.s: New file. * testsuite/binutils-all/objcopy.exp: Run readelf test on mbind1.s. gas/ * NEWS: Mention support for ELF SHF_GNU_MBIND. * config/obj-elf.c (section_match): New. (get_section): Match both sh_info and group name. (obj_elf_change_section): Add argument for sh_info. Pass both sh_info and group name to get_section. Issue an error for SHF_GNU_MBIND section without SHF_ALLOC. Set sh_info. (obj_elf_parse_section_letters): Set SHF_GNU_MBIND for 'd'. (obj_elf_section): Support SHF_GNU_MBIND section info. * config/obj-elf.h (obj_elf_change_section): Add argument for sh_info. * config/tc-arm.c (start_unwind_section): Pass 0 as sh_info to obj_elf_change_section. * config/tc-ia64.c (obj_elf_vms_common): Likewise. * config/tc-microblaze.c (microblaze_s_data): Likewise. (microblaze_s_sdata): Likewise. (microblaze_s_rdata): Likewise. (microblaze_s_bss): Likewise. * config/tc-mips.c (s_change_section): Likewise. * config/tc-msp430.c (msp430_profiler): Likewise. * config/tc-rx.c (parse_rx_section): Likewise. * config/tc-tic6x.c (tic6x_start_unwind_section): Likewise. * doc/as.texinfo: Document 'd' for SHF_GNU_MBIND. * testsuite/gas/elf/elf.exp: Run section12a, section12b and section13. * testsuite/gas/elf/section10.d: Updated. * testsuite/gas/elf/section10.s: Likewise. * testsuite/gas/elf/section12.s: New file. * testsuite/gas/elf/section12a.d: Likewise. * testsuite/gas/elf/section12b.d: Likewise. * testsuite/gas/elf/section13.l: Likewise. * testsuite/gas/elf/section13.d: Likewise. * testsuite/gas/elf/section13.s: Likewise. include/ * elf/common.h (PT_GNU_MBIND_NUM): New. (PT_GNU_MBIND_LO): Likewise. (PT_GNU_MBIND_HI): Likewise. (SHF_GNU_MBIND): Likewise. ld/ * NEWS: Mention support for ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX. * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Place input GNU_MBIND sections with the same type, attributes and sh_info field into a single output GNU_MBIND section. * testsuite/ld-elf/elf.exp: Run mbind2a and mbind2b. * testsuite/ld-elf/mbind1.s: New file. * testsuite/ld-elf/mbind1a.d: Likewise. * testsuite/ld-elf/mbind1b.d: Likewise. * testsuite/ld-elf/mbind1c.d: Likewise. * testsuite/ld-elf/mbind2a.s: Likewise. * testsuite/ld-elf/mbind2b.c: Likewise. commit b52920324fabbcad93042f2e17de52696d0dab42 Author: Palmer Dabbelt Date: Mon Apr 3 10:08:29 2017 -0700 RISC-V: Resurrect GP-relative disassembly hints We missed a "_gp" when changing the GP symbol. To make sure that doesn't happen again, we now use the same definition everywhere (thanks, Nick). include/ChangeLog: 2017-04-03 Palmer Dabbelt * elf/riscv.h (RISCV_GP_SYMBOL): New define. bfd/ChangeLog: 2017-04-03 Palmer Dabbelt * elfnn-riscv.c (GP_NAME): Delete. (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL. (_bfd_riscv_relax_lui): Likewise. opcodes/ChangeLog: 2017-04-03 Palmer Dabbelt * riscv-dis.c (riscv_disassemble_insn): Change "_gp" to RISCV_GP_SYMBOL. commit 65dd1e590e519eba10bc29fb6e952271e0604c9b Author: Simon Marchi Date: Tue Apr 4 10:48:24 2017 -0400 gdbserver: Clear .deps on clean In some situations, the dependency tracking files in .deps can refer to source files that were removed or renamed, leading to errors like: make: *** No rule to make target `version.c', needed by `version.o'. Stop. This patch makes the clean target clear the .deps directory, which gives the user a chance to recover from the error wihtout knowing about the internals of the build system. It is already done for GDB. See here for more details: https://sourceware.org/ml/gdb-patches/2009-03/msg00000.html gdb/gdbserver/ChangeLog: * Makefile.in (clean): Clear .deps. commit d62a8ae2dd0fbb6235f4e8f2fb61b83fe4ba1d90 Author: Simon Marchi Date: Tue Apr 4 10:31:50 2017 -0400 remote.c: Use ptid_t instead of struct ptid It's the only place in the codebase that uses "struct ptid", so change it to ptid_t for consistency. gdb/ChangeLog: * remote.c (set_general_thread, set_continue_thread): Use ptid_t instead of struct ptid. commit ad32986fdf9da1c8748e47b8b45100398223dba8 Author: Nick Clifton Date: Tue Apr 4 11:23:36 2017 +0100 Fix null pointer dereferences when using a link built with clang. PR binutils/21342 * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer dereference. (bfd_elf_final_link): Only initialize the extended symbol index section if there are extended symbol tables to list. commit db3a1dc7c9404e203c54576db3335e69d995e83e Author: Alan Hayward Date: Tue Apr 4 08:42:30 2017 +0100 Remove MAX_REGISTER_SIZE from frame.c gdb/ * frame.c (get_frame_register_bytes): Unwind using value. (put_frame_register_bytes): Likewise. commit 4c220b4625df0b08cbb22e5c7ca04dc7a629de1b Author: GDB Administrator Date: Tue Apr 4 00:00:42 2017 +0000 Automatic date update in version.in commit c41cf6fdf514fce6b69f8f875b6903b2a3910f89 Author: Palmer Dabbelt Date: Mon Apr 3 09:03:57 2017 -0700 RISC-V: Avoid a const warning 2017-04-03 Palmer Dabbelt * config/tc-riscv.c (riscv_clear_subsets): Cast argument to free to avoid const warnings. commit 2f5f29cada3c06c9c26f4da5994951effee7d6f7 Author: Andrew Jenner Date: Mon Apr 3 09:13:19 2017 -0700 IA16 support * config.sub: Handle ia16 in $basic_machine. bfd/ * config.bfd: Handle ia16. gas/ * configure.tgt: Handle ia16. ld/ * configure.tgt: Handle ia16. commit 2514e33e01890ad28023359b110d1c9c1ad201d4 Author: H.J. Lu Date: Mon Apr 3 08:25:36 2017 -0700 Correct the ChangeLog entry commit 46bed6796d5821832e8ba373ddb2e7fdc45a109d Author: H.J. Lu Date: Mon Apr 3 08:03:14 2017 -0700 ld: Support ELF GNU program properties From .note.gnu.property section in each ELF input, we build a list of GNU properties if .note.gnu.property section isn't corrupt. The unknown properties are ignored. All property lists in relocatable inputs are merged into an output property list. When -z stack-size=N is used and N isn't 0, the GNU_PROPERTY_STACK_SIZE property will be merged with or added to the output property list. .note.gnu.property section is generated in output from the output property list. bfd/ * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo. (BFD32_BACKENDS_CFILES): Add elf-properties.c. * configure.ac (elf): Add elf-properties.lo. * Makefile.in: Regenerated. * configure: Likewise. * elf-bfd.h (elf_property_kind): New. (elf_property): Likewise. (elf_property_list): Likewise. (elf_properties): Likewise. (_bfd_elf_parse_gnu_properties): Likewise. (_bfd_elf_get_property): Likewise. (_bfd_elf_link_setup_gnu_properties): Likewise. (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties and setup_gnu_properties. (elf_obj_tdata): Add properties. * elf-properties.c: New file. * elf32-i386.c (elf_i386_parse_gnu_properties): New. (elf_i386_merge_gnu_properties): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise. (elf_x86_64_merge_gnu_properties): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_merge_gnu_properties): Likewise. * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise. (elf_backend_parse_gnu_properties): Likewise. (elf_backend_setup_gnu_properties): Likewise. (elfNN_bed): Add elf_backend_parse_gnu_properties, elf_backend_merge_gnu_properties and elf_backend_setup_gnu_properties. ld/ * ld/NEWS: Mention support for ELF GNU program properties. * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Call ELF setup_gnu_properties. * testsuite/ld-i386/i386.exp: Run property tests for Linux/i386. * testsuite/ld-i386/pass.c: New file. * testsuite/ld-i386/property-1.r: Likewise. * testsuite/ld-i386/property-2.r: Likewise. * testsuite/ld-i386/property-3.r: Likewise. * testsuite/ld-i386/property-4.r: Likewise. * testsuite/ld-i386/property-5.r: Likewise. * testsuite/ld-i386/property-6.r: Likewise. * testsuite/ld-i386/property-6a.c: Likewise. * testsuite/ld-i386/property-6b.c: Likewise. * testsuite/ld-i386/property-6c.S: Likewise. * testsuite/ld-i386/property-7.r: Likewise. * testsuite/ld-i386/property-no-copy.S: Likewise. * testsuite/ld-i386/property-stack.S: Likewise. * testsuite/ld-i386/property-unsorted-1.S: Likewise. * testsuite/ld-i386/property-unsorted-2.S: Likewise. * testsuite/ld-i386/property-x86-1.S: Likewise. * testsuite/ld-i386/property-x86-2.S: Likewise. * testsuite/ld-x86-64/pass.c: Likewise. * testsuite/ld-x86-64/property-1.r: Likewise. * testsuite/ld-x86-64/property-2.r: Likewise. * testsuite/ld-x86-64/property-3.r: Likewise. * testsuite/ld-x86-64/property-4.r: Likewise. * testsuite/ld-x86-64/property-5.r: Likewise. * testsuite/ld-x86-64/property-6.r: Likewise. * testsuite/ld-x86-64/property-6a.c: Likewise. * testsuite/ld-x86-64/property-6b.c: Likewise. * testsuite/ld-x86-64/property-6c.S: Likewise. * testsuite/ld-x86-64/property-7.r: Likewise. * testsuite/ld-x86-64/property-no-copy.S: Likewise. * testsuite/ld-x86-64/property-stack.S: Likewise. * testsuite/ld-x86-64/property-unsorted-1.S: Likewise. * testsuite/ld-x86-64/property-unsorted-2.S: Likewise. * testsuite/ld-x86-64/property-x86-1.S: Likewise. * testsuite/ld-x86-64/property-x86-2.S: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run property tests for Linux/x86-64. commit 82156ab704b08b124d319c0decdbd48b3ca2dac5 Author: Nick Clifton Date: Mon Apr 3 12:14:06 2017 +0100 readelf: Fix overlarge memory allocation when reading a binary with an excessive number of program headers. PR binutils/21345 * readelf.c (get_program_headers): Check for there being too many program headers before attempting to allocate space for them. commit 75ec1fdbb797a389e4fe4aaf2e15358a070dcc19 Author: Nick Clifton Date: Mon Apr 3 11:13:21 2017 +0100 Fix runtime seg-fault in readelf when parsing a corrupt MIPS binary. PR binutils/21344 * readelf.c (process_mips_specific): Check for an out of range GOT entry before reading the module pointer. commit f32ba72991d2406b21ab17edc234a2f3fa7fb23d Author: Nick Clifton Date: Mon Apr 3 11:01:45 2017 +0100 readelf: Update check for invalid word offsets in ARM unwind information. PR binutils/21343 * readelf.c (get_unwind_section_word): Fix snafu checking for invalid word offsets in ARM unwind information. commit 12bfb8fec326e847f6300874ca656e47ee027f5d Author: GDB Administrator Date: Mon Apr 3 00:00:37 2017 +0000 Automatic date update in version.in commit 450b68da0169dcfa1c36987ec80e2655abb3f8e6 Author: GDB Administrator Date: Sun Apr 2 00:00:36 2017 +0000 Automatic date update in version.in commit 5e6a0e73317915b0685249606538ea739acc3a23 Author: GDB Administrator Date: Sat Apr 1 00:00:39 2017 +0000 Automatic date update in version.in ----------------------------------------------------------------------- Summary of changes: ChangeLog | 13 + bfd/ChangeLog | 67 + bfd/Makefile.am | 2 + bfd/Makefile.in | 3 + bfd/config.bfd | 6 + bfd/configure | 2 +- bfd/configure.ac | 2 +- bfd/elf-bfd.h | 58 + bfd/elf-properties.c | 483 +++++++ bfd/elf.c | 69 +- bfd/elf32-i386.c | 74 ++ bfd/elf64-ppc.c | 41 +- bfd/elf64-x86-64.c | 78 ++- bfd/elflink.c | 35 +- bfd/elfnn-riscv.c | 9 +- bfd/elfxx-target.h | 12 + bfd/peXXigen.c | 10 +- bfd/version.h | 2 +- binutils/ChangeLog | 29 + binutils/NEWS | 2 + binutils/readelf.c | 64 +- binutils/testsuite/binutils-all/mbind1.s | 33 + binutils/testsuite/binutils-all/objcopy.exp | 1 + config.sub | 2 +- gas/ChangeLog | 40 + gas/NEWS | 2 + gas/config/obj-elf.c | 54 +- gas/config/obj-elf.h | 3 +- gas/config/tc-arm.c | 3 +- gas/config/tc-ia64.c | 2 +- gas/config/tc-microblaze.c | 18 +- gas/config/tc-mips.c | 2 +- gas/config/tc-msp430.c | 2 +- gas/config/tc-riscv.c | 2 +- gas/config/tc-rx.c | 4 +- gas/config/tc-tic6x.c | 3 +- gas/configure.tgt | 3 + gas/doc/as.texinfo | 2 + gas/testsuite/gas/elf/elf.exp | 3 + gas/testsuite/gas/elf/section10.d | 4 +- gas/testsuite/gas/elf/section10.s | 4 +- gas/testsuite/gas/elf/section12.s | 33 + gas/testsuite/gas/elf/section12a.d | 35 + gas/testsuite/gas/elf/section12b.d | 32 + gas/testsuite/gas/elf/section13.d | 2 + gas/testsuite/gas/elf/section13.l | 2 + gas/testsuite/gas/elf/section13.s | 2 + gdb/ChangeLog | 172 +++ gdb/MAINTAINERS | 2 +- gdb/Makefile.in | 8 +- gdb/NEWS | 5 + gdb/alpha-fbsd-tdep.c | 132 -- gdb/amd64-bsd-nat.c | 32 +- gdb/amd64-fbsd-tdep.c | 67 - gdb/common/gdb_optional.h | 34 +- gdb/common/offset-type.h | 149 +++ gdb/common/preprocessor.h | 31 + gdb/common/traits.h | 34 + gdb/common/underlying.h | 32 + gdb/common/valid-expr.h | 108 ++ gdb/config/alpha/fbsd.mh | 6 - gdb/configure.host | 4 +- gdb/configure.tgt | 11 +- gdb/dwarf2expr.c | 45 +- gdb/dwarf2expr.h | 16 +- gdb/dwarf2loc.c | 37 +- gdb/dwarf2read.c | 1523 +++++++++++----------- gdb/fbsd-nat.c | 2 +- gdb/frame.c | 58 +- gdb/gdbserver/ChangeLog | 4 + gdb/gdbserver/Makefile.in | 1 + gdb/gdbtypes.h | 14 +- gdb/i386-fbsd-tdep.c | 59 - gdb/remote.c | 10 +- gdb/testsuite/gdb.threads/thread-specific-bp.exp | 9 +- gdb/unittests/offset-type-selftests.c | 178 +++ include/ChangeLog | 11 + include/elf/common.h | 7 + include/elf/riscv.h | 3 + ld/ChangeLog | 76 ++ ld/NEWS | 4 + ld/configure.tgt | 1 + ld/emultempl/elf32.em | 48 +- ld/ldlang.c | 2 + ld/testsuite/ld-elf/elf.exp | 21 + ld/testsuite/ld-elf/mbind1.s | 43 + ld/testsuite/ld-elf/mbind1a.d | 44 + ld/testsuite/ld-elf/mbind1b.d | 44 + ld/testsuite/ld-elf/mbind1c.d | 44 + ld/testsuite/ld-elf/mbind2a.s | 15 + ld/testsuite/ld-elf/mbind2b.c | 17 + ld/testsuite/ld-elf/pr21233-e.ld | 2 + ld/testsuite/ld-elf/pr21233-l.s | 6 + ld/testsuite/ld-elf/pr21233-l.sd | 6 + ld/testsuite/ld-elf/pr21233.ld | 17 + ld/testsuite/ld-elf/pr21233.s | 8 + ld/testsuite/ld-elf/pr21233.sd | 9 + ld/testsuite/ld-elf/shared.exp | 40 + ld/testsuite/ld-i386/i386.exp | 273 ++++ ld/testsuite/ld-i386/pass.c | 8 + ld/testsuite/ld-i386/property-1.r | 7 + ld/testsuite/ld-i386/property-2.r | 7 + ld/testsuite/ld-i386/property-3.r | 8 + ld/testsuite/ld-i386/property-4.r | 8 + ld/testsuite/ld-i386/property-5.r | 8 + ld/testsuite/ld-i386/property-6.r | 7 + ld/testsuite/ld-i386/property-6a.c | 7 + ld/testsuite/ld-i386/property-6b.c | 8 + ld/testsuite/ld-i386/property-6c.S | 18 + ld/testsuite/ld-i386/property-7.r | 6 + ld/testsuite/ld-i386/property-no-copy.S | 15 + ld/testsuite/ld-i386/property-stack.S | 18 + ld/testsuite/ld-i386/property-unsorted-1.S | 34 + ld/testsuite/ld-i386/property-unsorted-2.S | 22 + ld/testsuite/ld-i386/property-x86-1.S | 32 + ld/testsuite/ld-i386/property-x86-2.S | 25 + ld/testsuite/ld-x86-64/pass.c | 8 + ld/testsuite/ld-x86-64/property-1.r | 7 + ld/testsuite/ld-x86-64/property-2.r | 7 + ld/testsuite/ld-x86-64/property-3.r | 8 + ld/testsuite/ld-x86-64/property-4.r | 8 + ld/testsuite/ld-x86-64/property-5.r | 8 + ld/testsuite/ld-x86-64/property-6.r | 7 + ld/testsuite/ld-x86-64/property-6a.c | 7 + ld/testsuite/ld-x86-64/property-6b.c | 8 + ld/testsuite/ld-x86-64/property-6c.S | 23 + ld/testsuite/ld-x86-64/property-7.r | 6 + ld/testsuite/ld-x86-64/property-no-copy.S | 20 + ld/testsuite/ld-x86-64/property-stack.S | 23 + ld/testsuite/ld-x86-64/property-unsorted-1.S | 39 + ld/testsuite/ld-x86-64/property-unsorted-2.S | 27 + ld/testsuite/ld-x86-64/property-x86-1.S | 37 + ld/testsuite/ld-x86-64/property-x86-2.S | 30 + ld/testsuite/ld-x86-64/x86-64.exp | 273 ++++ opcodes/ChangeLog | 5 + opcodes/riscv-dis.c | 2 +- 136 files changed, 4447 insertions(+), 1222 deletions(-) create mode 100644 bfd/elf-properties.c create mode 100644 binutils/testsuite/binutils-all/mbind1.s create mode 100644 gas/testsuite/gas/elf/section12.s create mode 100644 gas/testsuite/gas/elf/section12a.d create mode 100644 gas/testsuite/gas/elf/section12b.d create mode 100644 gas/testsuite/gas/elf/section13.d create mode 100644 gas/testsuite/gas/elf/section13.l create mode 100644 gas/testsuite/gas/elf/section13.s delete mode 100644 gdb/alpha-fbsd-tdep.c create mode 100644 gdb/common/offset-type.h create mode 100644 gdb/common/preprocessor.h create mode 100644 gdb/common/traits.h create mode 100644 gdb/common/underlying.h create mode 100644 gdb/common/valid-expr.h delete mode 100644 gdb/config/alpha/fbsd.mh create mode 100644 gdb/unittests/offset-type-selftests.c create mode 100644 ld/testsuite/ld-elf/mbind1.s create mode 100644 ld/testsuite/ld-elf/mbind1a.d create mode 100644 ld/testsuite/ld-elf/mbind1b.d create mode 100644 ld/testsuite/ld-elf/mbind1c.d create mode 100644 ld/testsuite/ld-elf/mbind2a.s create mode 100644 ld/testsuite/ld-elf/mbind2b.c create mode 100644 ld/testsuite/ld-elf/pr21233-e.ld create mode 100644 ld/testsuite/ld-elf/pr21233-l.s create mode 100644 ld/testsuite/ld-elf/pr21233-l.sd create mode 100644 ld/testsuite/ld-elf/pr21233.ld create mode 100644 ld/testsuite/ld-elf/pr21233.s create mode 100644 ld/testsuite/ld-elf/pr21233.sd create mode 100644 ld/testsuite/ld-i386/pass.c create mode 100644 ld/testsuite/ld-i386/property-1.r create mode 100644 ld/testsuite/ld-i386/property-2.r create mode 100644 ld/testsuite/ld-i386/property-3.r create mode 100644 ld/testsuite/ld-i386/property-4.r create mode 100644 ld/testsuite/ld-i386/property-5.r create mode 100644 ld/testsuite/ld-i386/property-6.r create mode 100644 ld/testsuite/ld-i386/property-6a.c create mode 100644 ld/testsuite/ld-i386/property-6b.c create mode 100644 ld/testsuite/ld-i386/property-6c.S create mode 100644 ld/testsuite/ld-i386/property-7.r create mode 100644 ld/testsuite/ld-i386/property-no-copy.S create mode 100644 ld/testsuite/ld-i386/property-stack.S create mode 100644 ld/testsuite/ld-i386/property-unsorted-1.S create mode 100644 ld/testsuite/ld-i386/property-unsorted-2.S create mode 100644 ld/testsuite/ld-i386/property-x86-1.S create mode 100644 ld/testsuite/ld-i386/property-x86-2.S create mode 100644 ld/testsuite/ld-x86-64/pass.c create mode 100644 ld/testsuite/ld-x86-64/property-1.r create mode 100644 ld/testsuite/ld-x86-64/property-2.r create mode 100644 ld/testsuite/ld-x86-64/property-3.r create mode 100644 ld/testsuite/ld-x86-64/property-4.r create mode 100644 ld/testsuite/ld-x86-64/property-5.r create mode 100644 ld/testsuite/ld-x86-64/property-6.r create mode 100644 ld/testsuite/ld-x86-64/property-6a.c create mode 100644 ld/testsuite/ld-x86-64/property-6b.c create mode 100644 ld/testsuite/ld-x86-64/property-6c.S create mode 100644 ld/testsuite/ld-x86-64/property-7.r create mode 100644 ld/testsuite/ld-x86-64/property-no-copy.S create mode 100644 ld/testsuite/ld-x86-64/property-stack.S create mode 100644 ld/testsuite/ld-x86-64/property-unsorted-1.S create mode 100644 ld/testsuite/ld-x86-64/property-unsorted-2.S create mode 100644 ld/testsuite/ld-x86-64/property-x86-1.S create mode 100644 ld/testsuite/ld-x86-64/property-x86-2.S First 500 lines of diff: diff --git a/ChangeLog b/ChangeLog index 8565325..bb87497 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-04-03 Andrew Jenner + + * config.sub: Handle ia16 in $basic_machine. + + bfd/ + * config.bfd: Handle ia16. + + gas/ + * configure.tgt: Handle ia16. + + ld/ + * configure.tgt: Handle ia16. + 2017-03-22 Nick Clifton * config.sub: Sync with master version in config project. diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bb851c7..0e4ad30 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,70 @@ +2017-04-05 Alan Modra + + * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT + reference counting. + +2017-04-02 Jon Turney + + (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than + numbers for DataDirectory entry indicies passed to + add_data_entry(). + +2017-04-04 H.J. Lu + + * elf.c (get_program_header_size): Add a GNU_MBIND segment for + each GNU_MBIND section and align GNU_MBIND section to page size. + (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND + segment for each GNU_MBIND section. + (_bfd_elf_init_private_section_data): Copy sh_info from input + for GNU_MBIND section. + +2017-04-03 Palmer Dabbelt + + * elfnn-riscv.c (GP_NAME): Delete. + (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL. + (_bfd_riscv_relax_lui): Likewise. + +2017-04-04 Nick Clifton + + PR binutils/21342 + * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer + dereference. + (bfd_elf_final_link): Only initialize the extended symbol index + section if there are extended symbol tables to list. + +2017-04-03 H.J. Lu + + * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo. + (BFD32_BACKENDS_CFILES): Add elf-properties.c. + * configure.ac (elf): Add elf-properties.lo. + * Makefile.in: Regenerated. + * configure: Likewise. + * elf-bfd.h (elf_property_kind): New. + (elf_property): Likewise. + (elf_property_list): Likewise. + (elf_properties): Likewise. + (_bfd_elf_parse_gnu_properties): Likewise. + (_bfd_elf_get_property): Likewise. + (_bfd_elf_link_setup_gnu_properties): Likewise. + (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties + and setup_gnu_properties. + (elf_obj_tdata): Add properties. + * elf-properties.c: New file. + * elf32-i386.c (elf_i386_parse_gnu_properties): New. + (elf_i386_merge_gnu_properties): Likewise. + (elf_backend_parse_gnu_properties): Likewise. + (elf_backend_merge_gnu_properties): Likewise. + * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise. + (elf_x86_64_merge_gnu_properties): Likewise. + (elf_backend_parse_gnu_properties): Likewise. + (elf_backend_merge_gnu_properties): Likewise. + * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise. + (elf_backend_parse_gnu_properties): Likewise. + (elf_backend_setup_gnu_properties): Likewise. + (elfNN_bed): Add elf_backend_parse_gnu_properties, + elf_backend_merge_gnu_properties and + elf_backend_setup_gnu_properties. + 2017-03-30 Pip Cet * elf32-wasm32.c: Add relocation code, two relocs. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 49ab092..97b608c 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -321,6 +321,7 @@ BFD32_BACKENDS = \ elf-m10200.lo \ elf-m10300.lo \ elf-nacl.lo \ + elf-properties.lo \ elf-strtab.lo \ elf-vxworks.lo \ elf.lo \ @@ -516,6 +517,7 @@ BFD32_BACKENDS_CFILES = \ elf-m10200.c \ elf-m10300.c \ elf-nacl.c \ + elf-properties.c \ elf-strtab.c \ elf-vxworks.c \ elf.c \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index fed5117..e48abaf 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -655,6 +655,7 @@ BFD32_BACKENDS = \ elf-m10200.lo \ elf-m10300.lo \ elf-nacl.lo \ + elf-properties.lo \ elf-strtab.lo \ elf-vxworks.lo \ elf.lo \ @@ -850,6 +851,7 @@ BFD32_BACKENDS_CFILES = \ elf-m10200.c \ elf-m10300.c \ elf-nacl.c \ + elf-properties.c \ elf-strtab.c \ elf-vxworks.c \ elf.c \ @@ -1471,6 +1473,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-m10200.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-m10300.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-nacl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-properties.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-strtab.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-vxworks.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf.Plo@am__quote@ diff --git a/bfd/config.bfd b/bfd/config.bfd index 1235c2c..b00958d 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -173,6 +173,7 @@ fido*) targ_archs=bfd_m68k_arch ;; hppa*) targ_archs=bfd_hppa_arch ;; i[3-7]86) targ_archs=bfd_i386_arch ;; i370) targ_archs=bfd_i370_arch ;; +ia16) targ_archs=bfd_i386_arch ;; lm32) targ_archs=bfd_lm32_arch ;; m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;; m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;; @@ -906,6 +907,11 @@ case "${targ}" in targ_selvecs="icoff_le_vec icoff_be_vec" ;; + ia16-*-elf) + targ_defvec=i386_elf32_vec + targ_selvecs="i386_msdos_vec i386_aout_vec" + ;; + ip2k-*-elf) targ_defvec=ip2k_elf32_vec ;; diff --git a/bfd/configure b/bfd/configure index 7cae4ae..24e3e2f 100755 --- a/bfd/configure +++ b/bfd/configure @@ -14234,7 +14234,7 @@ selarchs="$f" # Target backend .o files. tb= -elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo +elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-properties.lo elf-eh-frame.lo dwarf1.lo dwarf2.lo" coffgen="coffgen.lo dwarf2.lo" coff="cofflink.lo $coffgen" diff --git a/bfd/configure.ac b/bfd/configure.ac index feb1231..e568847 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -365,7 +365,7 @@ selarchs="$f" # Target backend .o files. tb= -elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo +elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-properties.lo elf-eh-frame.lo dwarf1.lo dwarf2.lo" coffgen="coffgen.lo dwarf2.lo" coff="cofflink.lo $coffgen" diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 9e3d6f5..af377ee 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -766,6 +766,39 @@ typedef asection * (*elf_gc_mark_hook_fn) (asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *); +enum elf_property_kind + { + /* A new property. */ + property_unknown = 0, + /* A property ignored by backend. */ + property_ignored, + /* A corrupt property reported by backend. */ + property_corrupt, + /* A property should be removed due to property merge. */ + property_remove, + /* A property which is a number. */ + property_number + }; + +typedef struct elf_property +{ + unsigned int pr_type; + unsigned int pr_datasz; + union + { + /* For property_number, this is a number. */ + bfd_vma number; + /* Add a new one if elf_property_kind is updated. */ + } u; + enum elf_property_kind pr_kind; +} elf_property; + +typedef struct elf_property_list +{ + struct elf_property_list *next; + struct elf_property property; +} elf_property_list; + struct bfd_elf_section_reloc_data; struct elf_backend_data @@ -1389,6 +1422,19 @@ struct elf_backend_data or give an error and return FALSE. */ bfd_boolean (*obj_attrs_handle_unknown) (bfd *, int); + /* Parse GNU properties. Return the property kind. If the property + is corrupt, issue an error message and return property_corrupt. */ + enum elf_property_kind (*parse_gnu_properties) (bfd *, unsigned int, + bfd_byte *, + unsigned int); + + /* Merge GNU properties. Return TRUE if property is updated. */ + bfd_boolean (*merge_gnu_properties) (bfd *, elf_property *, + elf_property *); + + /* Set up GNU properties. */ + void (*setup_gnu_properties) (struct bfd_link_info *); + /* Encoding used for compact EH tables. */ int (*compact_eh_encoding) (struct bfd_link_info *); @@ -1798,6 +1844,10 @@ struct elf_obj_tdata /* Symbol buffer. */ void *symbuf; + /* List of GNU properties. Will be updated by setup_gnu_properties + after all input GNU properties are merged for output. */ + elf_property_list *properties; + obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES]; obj_attribute_list *other_obj_attributes[2]; @@ -1882,6 +1932,7 @@ struct elf_obj_tdata (elf_known_obj_attributes (bfd) [OBJ_ATTR_PROC]) #define elf_other_obj_attributes_proc(bfd) \ (elf_other_obj_attributes (bfd) [OBJ_ATTR_PROC]) +#define elf_properties(bfd) (elf_tdata (bfd) -> properties) extern void _bfd_elf_swap_verdef_in (bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *); @@ -2538,6 +2589,13 @@ extern bfd_boolean _bfd_elf_merge_unknown_attribute_low (bfd *, bfd *, int); extern bfd_boolean _bfd_elf_merge_unknown_attribute_list (bfd *, bfd *); extern Elf_Internal_Shdr *_bfd_elf_single_rel_hdr (asection *sec); +extern bfd_boolean _bfd_elf_parse_gnu_properties + (bfd *, Elf_Internal_Note *); +extern elf_property * _bfd_elf_get_property + (bfd *, unsigned int, unsigned int); +extern void _bfd_elf_link_setup_gnu_properties + (struct bfd_link_info *); + /* The linker may need to keep track of the number of relocs that it decides to copy as dynamic relocs in check_relocs for each symbol. This is so that it can later discard them if they are found to be diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c new file mode 100644 index 0000000..a0456f8 --- /dev/null +++ b/bfd/elf-properties.c @@ -0,0 +1,483 @@ +/* ELF program property support. + Copyright (C) 2017 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* GNU program property draft is at: + + https://github.com/hjl-tools/linux-abi/wiki/property-draft.pdf + */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" +#include "elf-bfd.h" + +/* Get a property, allocate a new one if needed. */ + +elf_property * +_bfd_elf_get_property (bfd *abfd, unsigned int type, unsigned int datasz) +{ + elf_property_list *p, **lastp; + + if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) + { + /* Never should happen. */ + abort (); + } + + /* Keep the property list in order of type. */ + lastp = &elf_properties (abfd); + for (p = *lastp; p; p = p->next) + { + /* Reuse the existing entry. */ + if (type == p->property.pr_type) + { + if (datasz > p->property.pr_datasz) + { + /* This can happen when mixing 32-bit and 64-bit objects. */ + p->property.pr_datasz = datasz; + } + return &p->property; + } + else if (type < p->property.pr_type) + break; + lastp = &p->next; + } + p = (elf_property_list *) bfd_alloc (abfd, sizeof (*p)); + if (p == NULL) + { + _bfd_error_handler (_("%B: out of memory in _bfd_elf_get_property"), + abfd); + _exit (EXIT_FAILURE); + } + memset (p, 0, sizeof (*p)); + p->property.pr_type = type; + p->property.pr_datasz = datasz; + p->next = *lastp; + *lastp = p; + return &p->property; +} + +/* Parse GNU properties. */ + +bfd_boolean +_bfd_elf_parse_gnu_properties (bfd *abfd, Elf_Internal_Note *note) +{ + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + unsigned int align_size = bed->s->elfclass == ELFCLASS64 ? 8 : 4; + bfd_byte *ptr = (bfd_byte *) note->descdata; + bfd_byte *ptr_end = ptr + note->descsz; + + if (note->descsz < 8 || (note->descsz % align_size) != 0) + { +bad_size: + _bfd_error_handler + (_("warning: %B: corrupt GNU_PROPERTY_TYPE (%ld) size: %#lx\n"), + abfd, note->type, note->descsz); + return FALSE; + } + + while (1) + { + unsigned int type = bfd_h_get_32 (abfd, ptr); + unsigned int datasz = bfd_h_get_32 (abfd, ptr + 4); + elf_property *prop; + + ptr += 8; + + if ((ptr + datasz) > ptr_end) + { + _bfd_error_handler + (_("warning: %B: corrupt GNU_PROPERTY_TYPE (%ld) type (0x%x) datasz: 0x%x\n"), + abfd, note->type, type, datasz); + /* Clear all properties. */ + elf_properties (abfd) = NULL; + return FALSE; + } + + if (type >= GNU_PROPERTY_LOPROC) + { + if (type < GNU_PROPERTY_LOUSER && bed->parse_gnu_properties) + { + enum elf_property_kind kind + = bed->parse_gnu_properties (abfd, type, ptr, datasz); + if (kind == property_corrupt) + { + /* Clear all properties. */ + elf_properties (abfd) = NULL; + return FALSE; + } + else if (kind != property_ignored) + goto next; + } + } + else + { + switch (type) + { + case GNU_PROPERTY_STACK_SIZE: + if (datasz != align_size) + { + _bfd_error_handler + (_("warning: %B: corrupt stack size: 0x%x\n"), + abfd, datasz); + /* Clear all properties. */ + elf_properties (abfd) = NULL; + return FALSE; + } + prop = _bfd_elf_get_property (abfd, type, datasz); + if (datasz == 8) + prop->u.number = bfd_h_get_64 (abfd, ptr); + else + prop->u.number = bfd_h_get_32 (abfd, ptr); + prop->pr_kind = property_number; + goto next; + + case GNU_PROPERTY_NO_COPY_ON_PROTECTED: + if (datasz != 0) + { + _bfd_error_handler + (_("warning: %B: corrupt no copy on protected size: 0x%x\n"), + abfd, datasz); + /* Clear all properties. */ + elf_properties (abfd) = NULL; + return FALSE; + } + prop = _bfd_elf_get_property (abfd, type, datasz); + prop->pr_kind = property_number; + goto next; + + default: + break; + } + } + + _bfd_error_handler + (_("warning: %B: unsupported GNU_PROPERTY_TYPE (%ld) type: 0x%x\n"), + abfd, note->type, type); + +next: + ptr += (datasz + (align_size - 1)) & ~ (align_size - 1); + if (ptr == ptr_end) + break; + + if (ptr > (ptr_end - 8)) + goto bad_size; + } + + return TRUE; +} + +/* Merge GNU property BPROP with APROP. If APROP isn't NULL, return TRUE + if APROP is updated. Otherwise, return TRUE if BPROP should be merged + with ABFD. */ + +static bfd_boolean +elf_merge_gnu_properties (bfd *abfd, elf_property *aprop, + elf_property *bprop) +{ + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type; + + if (bed->merge_gnu_properties != NULL + && pr_type >= GNU_PROPERTY_LOPROC + && pr_type < GNU_PROPERTY_LOUSER) + return bed->merge_gnu_properties (abfd, aprop, bprop); + + switch (pr_type) hooks/post-receive -- Repository for Project Archer.