From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119140 invoked by alias); 22 Jun 2017 18:34:52 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 118595 invoked by uid 9674); 22 Jun 2017 18:34:51 -0000 Date: Thu, 22 Jun 2017 18:34:00 -0000 Message-ID: <20170622183450.118086.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] users/jkratoch/index: DWARF-5: .debug_names index consumer X-Git-Refname: refs/heads/users/jkratoch/index X-Git-Reftype: branch X-Git-Oldrev: b137841b37b6247aa63d8270e5820c8c605d9093 X-Git-Newrev: 2b5a46380bbd3241b12049f79e3eb20a880d0eaa X-SW-Source: 2017-q2/txt/msg00042.txt.bz2 List-Id: The branch, users/jkratoch/index has been updated discards b137841b37b6247aa63d8270e5820c8c605d9093 (commit) discards 5229437ae3de0f997b264835433697889d9c94b6 (commit) discards 14f14266282cc676c6424a78d8f84d82a8502773 (commit) discards 4be4f2b35cd1d2313268c1cb77687d4e1968c231 (commit) discards e39de6c1d1c9ede6e08c98e99e0db418a7ce974b (commit) discards 426b46fa0c561ae485b9b09c4972f269a0632103 (commit) discards 16c6cfce5fe4f039e3dfe7829bfe8686bd6d4f14 (commit) via 2b5a46380bbd3241b12049f79e3eb20a880d0eaa (commit) via 8f65b17a537789c51eaf56c933377159fb99f038 (commit) via dd8677e1f7b751b0bf808840dbcc0fa00ddcef49 (commit) via b647fdee7e9f43d10d25e6b341cd45f9da90ff90 (commit) via 157966fcdc971d7686a57d8ee81fd51f9da9668e (commit) via b1ba635f9cb13a3655e633b1e3728d6b3b9bd78f (commit) via 8349711e0442dffafc803193e71cfd96683324b0 (commit) via e652757bad63e4cf8c0c72df6e95c0c826f8e29d (commit) via 329b5ba137687c4cf00413534a08ec33c8acb556 (commit) via 9d1c54ed7f3a4a70f35f85658c311697c17a95f5 (commit) via 16892a0323ce6cf41ca80e384dfba12524247902 (commit) via d7dcbefc724e59aa49e4ac2ac2337c8e1b8c367a (commit) via b30ff123fbff63d6c8be1115320efd0158e49a7f (commit) via 4fa847d78edd4a3901414655bd4b31234b91ba2a (commit) via 48580982ef41907a45cda259a63d9e6878cbbea3 (commit) via ee2fdd6f36c10ceb84e05c7234983bcfbe6146d5 (commit) via f4906a9a7441ef9c2758513420568994a1e7fed3 (commit) via d269dfc64fb5307dbbaecbc5d55861a705b729ab (commit) via b45a120833d862aeeba6803b2cc131724ef89dda (commit) via d19237d98d5c227bc33693057eb466702386cdfb (commit) via e7d39ed3e0ca36d0dbd6ddd4cb955aa73b0974e6 (commit) via a765d0724259ec77ab69c3dbb1cc2e16e2e038e1 (commit) via 194747873fbe037e923eac3a61481ba16e50e322 (commit) via 6b7373708821500a7388a8248b6c19fa1826c514 (commit) via e5c89b096d9cb9e5956e98cd5863519c87c6890b (commit) via 127d08c03f8bdb515389359ab605b6ee548996fd (commit) via 68193357e8d0fb53a229114713db9f0385f60ed8 (commit) via 75312ae3ab577c3a72ada54512533fec8bfae7bb (commit) via 7f2c8a1d37af46c46828909b7b748c79aa4b7ff0 (commit) via 2c6b98ea6fcc1358639253d4e96c9b55a672fb0c (commit) via 6879f5a99e25c068fec34126b6b0fe4325223aa0 (commit) via 2234eee61c42ad3f4d17894236873e04b633e969 (commit) via c2f7640243bdab93cafb3bf516e17a72fcc2f051 (commit) via 9fef80d683d79934bacd3221f5252ce8c14ff5c0 (commit) via 7adc0a8174f1233f6d92edd0671c18c9870e64e7 (commit) via 3d030cdb4a8d338c87e48b249338a4870fdcd322 (commit) via 54bab2816dfd025fc53618e46be140573d5bc02e (commit) via bdab445c82ba93bc9aaad1ae974a3cf5c4aa8a26 (commit) via 6e1816be66892d06e1a983f08407135fa7f7fc17 (commit) via 81209eff905bf76a01bbc3dc07b8973d1d0cdaad (commit) via 6c290d5387f770a6b098162f0a0f9ea420de540d (commit) via c168ce07e5b4a2a0258c796748899e1ba2e6dc7c (commit) via 996b5569bf24fe29dcd832a068d9f42b2903f48b (commit) via 20bd1b6ba53491e4979c03a4f679d0d17b9b9046 (commit) via e4da2c61669d199c75b96a1be25e13e3b8254e89 (commit) via 3de58d950c984bce176d883a8e7bcf3415be8c84 (commit) via cb06d03ad92ffcfaa09c3f065837cb39e9e1486d (commit) via c458d0079cc5e8ff29256355e6532ad2f96a8aa6 (commit) via ce49701009db42a9a53e5dcf172a6a211b1025b3 (commit) via 1e29262747bed568c673b8765d214a4a16772da1 (commit) via eb83230b4d5c0129174937846ded9eaa9f78ff28 (commit) via eceb74ca646e78adab1fa9f5c3b7cce51e894bc3 (commit) via 69431babfb54b26000fdcc016323cf811d48e862 (commit) via a206891ad10040bdee41999019af3cbf45abb5d6 (commit) via 96160d605128658378af73bb62732d1cbfa73d8a (commit) via 9a6c7d9c021cfeb290d76584db7a01e57e7c3d4e (commit) via 75c554cf9c375432af6e93653880d5498cd5f918 (commit) via 72ddacb77e3301a0481003a23b2d8dced7116de5 (commit) via 94de2a2c57b7f6b2870f72ecdcacc6d909c6421a (commit) via abfa390dac6ffcfc6de9659c0b78cfe524347450 (commit) via a6cab9afd2c81465265c8d09569e3e6ef43d2954 (commit) via 325c9fd4aa054118b80c621262f10fc6ffe98e25 (commit) via 66953522c9061874047d2e9832c206af783c971c (commit) via d16fdddb4e96e9e7bcfce6fe487b321c54b2c7c7 (commit) via bc21b167eb0106eb31d946a0eb5acfb7e4d5d8a1 (commit) via 0f6d864de2469af4223391993b430b0d45573dcb (commit) via acb56a83016611bcb5f0a32368fddc8c213f7dd0 (commit) via 80053e466b3a8055334b9be9bac7d99e0d617cbe (commit) via 16b7a7199881fa26fc863279bbf08741e5674b5d (commit) via 72e84f969481f52daf6741c6bb4d0e92f9668389 (commit) via 875ffa3edc5f27f0ad5e3d95d96782832edad00e (commit) via 1c8e01c96054973c50ec1dec2f220af4734e1de5 (commit) via 65ce7763dfbca7f74c951767050ad2da0739869b (commit) via ffce45d2243e5f52f411e314fc4e1a69f431a81f (commit) from b137841b37b6247aa63d8270e5820c8c605d9093 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 2b5a46380bbd3241b12049f79e3eb20a880d0eaa Author: Jan Kratochvil Date: Thu Jun 22 20:18:21 2017 +0200 DWARF-5: .debug_names index consumer Hi, it is not regression-free against no-index but it is regression-free against .gdb_index. That is because .gdb_index is not regression-free against no-index. Some testcases needed to be updated as they were missing .debug_aranges. While that does not matter for no-index (as GDB builds the mapping internally during dwarf2_build_psymtabs_hard) and neither for .gdb_index (as GDB uses that internally built mapping which it stores into .gdb_index) it does matter for .debug_names as that simply assumes existing .debug_aranges from GCC. I tried some performance checking but the index handling speed is negligible compared to the CU expansion associated with it. .debug_names looked even as a bit faster to me than .gdb_index which rather surprised me but I did not investigate it more. Jan gdb/ChangeLog 2017-05-26 Jan Kratochvil * defs.h (elf_sym_fns_debug_names): New declaration. * dwarf2read.c (mapped_debug_names): New. (struct dwarf2_per_objfile): Add debug_names, debug_aranges and debug_names_table. (dwarf2_elf_names): Add debug_names and debug_aranges. (struct dwz_file): Add debug_names. (dwarf2_locate_sections): Add debug_names and debug_aranges. (locate_dwz_sections): Add debug_names. (create_signatured_type_table_from_debug_names) (create_addrmap_from_aranges): New. (dwarf2_read_index): Update function comment. (read_debug_names_from_section, create_cus_from_debug_names_list) (create_cus_from_debug_names, dwarf2_read_debug_names): New. (dwarf5_djb_hash): Function renamed from DebugNamesNameTable::djb_hash. (dw2_debug_names_iterator): New. (read_indirect_string_at_offset): New declaration. (mapped_debug_names::namei_to_name) (dw2_debug_names_iterator::find_vec_in_debug_names) (dw2_debug_names_iterator::find_vec_in_debug_names) (dw2_debug_names_iterator::next, dw2_debug_names_lookup_symbol) (dw2_debug_names_dump, dw2_debug_names_expand_symtabs_for_function) (dw2_debug_names_expand_symtabs_matching, dwarf2_debug_names_functions): New. (dwarf2_initialize_objfile): Return also elf_sym_fns_debug_names. (dwarf2_free_objfile): Delete also debug_names_table; (debug_names::djb_hash): Rename it to dwarf5_djb_hash. (debug_names::build): Update djb_hash caller. * elfread.c (elf_sym_fns_debug_names): New. * psymtab.h (dwarf2_debug_names_functions): New declaration. * symfile.h (struct dwarf2_debug_sections): Add debug_names and debug_aranges. * xcoffread.c (dwarf2_xcoff_names): Add debug_names and debug_aranges. gdb/testsuite/ChangeLog 2017-05-26 Jan Kratochvil * gdb.base/maint.exp (check for .gdb_index): Check also for .debug_names. * gdb.dlang/watch-loc.c (.debug_aranges): New. * gdb.dwarf2/dw2-case-insensitive-debug.S: Likewise. * gdb.dwarf2/gdb-index.exp (check if index present, .gdb_index used) (.gdb_index used after symbol reloading): Support also .debug_names. * gdb.mi/dw2-ref-missing-frame-func.c (.debug_aranges): New. commit 8f65b17a537789c51eaf56c933377159fb99f038 Author: Jan Kratochvil Date: Thu Jun 22 20:18:21 2017 +0200 Refactor: Move some generic code out of .gdb_index code Hi, just for the next patch. Jan gdb/ChangeLog 2017-05-26 Jan Kratochvil * dwarf2read.c (create_cu_from_index_list): New from ... (create_cus_from_index_list): ... this function, use it. (dw_expand_symtabs_matching_file_matcher) (dw2_expand_symtabs_matching_one): New from ... (dw2_expand_symtabs_matching): ... this function, use them. commit dd8677e1f7b751b0bf808840dbcc0fa00ddcef49 Author: Jan Kratochvil Date: Thu Jun 22 20:18:20 2017 +0200 Code cleanup: dwarf2_initialize_objfile return value Hi, dwarf2_initialize_objfile was returning boolean whether it is psymtabs or .gdb_index while now it needs to return also whether it is .debug_names. Jan gdb/ChangeLog 2017-05-26 Jan Kratochvil * defs.h (elf_sym_fns_lazy_psyms, elf_sym_fns_gdb_index): Move here declarations from elfread.c. (dwarf2_initialize_objfile): Change return value. * elfread.c (elf_sym_fns_lazy_psyms, elf_sym_fns_gdb_index): Move these declarations to defs.h. (elf_symfile_read): Adjust dwarf2_initialize_objfile caller. * symfile.h (dwarf2_initialize_objfile): Change return type. commit b647fdee7e9f43d10d25e6b341cd45f9da90ff90 Author: Jan Kratochvil Date: Thu Jun 22 20:18:20 2017 +0200 DWARF-5: .debug_names index producer Hi, there are two FIXME lines I do not have a real answer for. Also I am not sure if the -dwarf-4 option for former .gdb_index should be named that way. And contrib/gdb-add-index.sh (incl. cc-with-tweaks.sh) has no commandline option for that -dwarf-4 GDB option. Jan gdb/ChangeLog 2017-05-26 Jan Kratochvil * contrib/gdb-add-index.sh (index): Rename to ... (index4): ... here. (index5, debugstr, debugstrmerge, debugstrerr): New variables. Support also .debug_names and .debug_str. * dwarf2read.c: Include cmath, locale, set, list. (INDEX_SUFFIX): Rename to ... (INDEX4_SUFFIX): ... here. (INDEX5_SUFFIX, DEBUG_STR_SUFFIX): New. (file_write, file_write, file_write): New. (data_buf::append_unsigned_leb128, data_buf::empty): New. (data_buf::file_write): Use ::file_write. (data_buf::operator const char *, debug_names, check_dwarf64_offsets): New. (psyms_seen_size, write_gdbindex): New from write_psymtabs_to_index code. (write_debug_names): New. (write_psymtabs_to_index): New parameter is_dwarf5. Support filename_str and out_file_str. Move code to write_gdbindex, possibly call write_debug_names. (save_gdb_index_command): New parameter -dwarf-4. (_initialize_dwarf2_read): Document the new parameter -dwarf-4. gdb/doc/ChangeLog 2017-05-26 Jan Kratochvil * gdb.texinfo (Index Files): Document .debug_names and -dwarf-4. (Index Section Format): Mention .debug_names. commit 157966fcdc971d7686a57d8ee81fd51f9da9668e Author: Jan Kratochvil Date: Thu Jun 22 20:18:19 2017 +0200 cc-with-tweaks.sh: Use gdb-add-index.sh Hi, currently contrib/cc-with-tweaks.sh is calling for its -i option objcopy itself instead of using contrib/gdb-add-index.sh which does the same. With DWARF-5 .debug_names the commands are more complicated (as now also .debug_str needs to be modified) and so I have decided to rather reuse contrib/gdb-add-index.sh instead of duplicating its code in contrib/cc-with-tweaks.sh. The problem is when no index is produced whether contrib/cc-with-tweaks.sh should fail or not. As originally contrib/cc-with-tweaks.sh was more quiet (=successful) than contrib/gdb-add-index.sh and so after this patch the testsuite runs with an index would "regress". I have tried to keep the behavior unchanged. Some cases still error with: Ada is not currently supported by the index But some cases (such as some trivial gdb.dwarf2/ testcases with no DWARF data to index) produce no index while the testcases still PASS now instead of: -PASS: gdb.arch/i386-bp_permanent.exp: stack pointer value matches +gdb compile failed, gdb-add-index.sh: No index was created for /quadgdb/testsuite.unix.-m64/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent +gdb-add-index.sh: [Was there no debuginfo? Was there already an index?] +UNTESTED: gdb.arch/i386-bp_permanent.exp: failed to compile Jan gdb/ChangeLog 2017-05-26 Jan Kratochvil * contrib/cc-with-tweaks.sh (t, GDB_ADD_INDEX): New variables. <$want_index>: Call $GDB_ADD_INDEX. commit b1ba635f9cb13a3655e633b1e3728d6b3b9bd78f Author: Jan Kratochvil Date: Thu Jun 22 20:18:19 2017 +0200 binutils commit 8349711e0442dffafc803193e71cfd96683324b0 Author: Jan Kratochvil Date: Thu Jun 22 20:18:18 2017 +0200 gccidx commit e652757bad63e4cf8c0c72df6e95c0c826f8e29d Author: Eric Christopher Date: Thu Jun 22 10:57:52 2017 -0700 2017-06-22 Eric Christopher * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than abs to fix a truncation warning. commit 329b5ba137687c4cf00413534a08ec33c8acb556 Author: H.J. Lu Date: Thu Jun 22 10:07:53 2017 -0700 Pass $NOPIE_CFLAGS/$NOPIE_LDFLAGS to "Run pr19031" PR ld/21090 * testsuite/ld-i386/i386.exp: Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to "Run pr19031". commit 9d1c54ed7f3a4a70f35f85658c311697c17a95f5 Author: H.J. Lu Date: Thu Jun 22 09:53:33 2017 -0700 Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to more ELF tests PR ld/21090 * testsuite/ld-gc/gc.ex: Compile tmpdir/pr14265.o with $NOPIE_CFLAGS. * testsuite/ld-i386/i386.exp: Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required. * testsuite/ld-i386/no-plt.exp (NOPIE_CFLAGS): New. (NOPIE_LDFLAGS): Likewise. Pass $NOPIE_LDFLAGS if non-PIE is required. * testsuite/ld-shared/shared.exp: Compile tmpdir/sh1np.o with $NOPIE_CFLAGS. commit 16892a0323ce6cf41ca80e384dfba12524247902 Author: Alan Hayward Date: Thu Jun 22 16:30:15 2017 +0100 Fix cached_frame allocation in py-unwind gdb/ * python/py-unwind.c (pyuw_sniffer): Allocate space for registers. commit d7dcbefc724e59aa49e4ac2ac2337c8e1b8c367a Author: Alan Hayward Date: Thu Jun 22 15:33:18 2017 +0100 Remove an instance of MAX_REGISTER_SIZE from record-full.c gdb/ * record-full.c (record_full_exec_insn): Use byte_vector. commit b30ff123fbff63d6c8be1115320efd0158e49a7f Author: Yao Qi Date: Thu Jun 22 13:41:27 2017 +0100 Regenerate two regformats/i386/.dat files The self tests which compare pre-generated target descriptions and dynamically created target descriptions fail, and it turns out that two pre-generated target descriptions are wrong, so regenerate them. gdb: 2017-06-22 Yao Qi * regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat: Regenerated. * regformats/i386/amd64-avx-mpx-avx512-pku.dat: Regenerated. commit 4fa847d78edd4a3901414655bd4b31234b91ba2a Author: Alan Hayward Date: Thu Jun 22 14:09:52 2017 +0100 Remove MAX_REGISTER_SIZE from py-unwind.c gdb/ * remote.c (cached_reg): Move from here... * regcache.h (cached_reg): ...to here. * python/py-unwind.c (struct reg_info): Remove. (cached_frame_info): Use cached_reg_t. (pyuw_prev_register): Likewise. (pyuw_sniffer): Use cached_reg_t and allocate registers. (pyuw_dealloc_cache): Free all registers. commit 48580982ef41907a45cda259a63d9e6878cbbea3 Author: H.J. Lu Date: Thu Jun 22 05:50:20 2017 -0700 x86: Support Intel Shadow Stack with SHSTK property To support Intel Shadow Stack (SHSTK) in Intel Control-flow Enforcement Technology (CET) instructions: https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf #define GNU_PROPERTY_X86_FEATURE_1_SHSTK (1U << 1) is added to GNU program properties to indicate that all executable sections are compatible with SHSTK where return address popped from shadow stack always matches return address popped from normal stack. GNU_PROPERTY_X86_FEATURE_1_SHSTK is set on output only if it is set on all relocatable inputs. bfd/ * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK. (elf_i386_link_setup_gnu_properties): If info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_IBT. * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK. (elf_x86_64_link_setup_gnu_properties): If info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_IBT. binutils/ * readelf.c (decode_x86_feature): Decode GNU_PROPERTY_X86_FEATURE_1_SHSTK. * testsuite/binutils-all/i386/shstk.d: New file. * testsuite/binutils-all/i386/shstk.s: Likewise. * testsuite/binutils-all/x86-64/shstk-x32.d: Likewise. * testsuite/binutils-all/x86-64/shstk.d: Likewise. * testsuite/binutils-all/x86-64/shstk.s: Likewise. include/ * bfdlink.h (bfd_link_info): Add shstk. * elf/common.h (GNU_PROPERTY_X86_FEATURE_1_SHSTK): New. ld/ * NEWS: Mention -z shstk and GNU_PROPERTY_X86_FEATURE_1_SHSTK. * emulparams/cet.sh (PARSE_AND_LIST_OPTIONS_CET): Add "-z shstk". (PARSE_AND_LIST_ARGS_CASE_Z_CET): Support "-z shstk". * ld.texinfo: Document -z shstk. * testsuite/ld-i386/i386.exp: Run SHSTK tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/property-x86-shstk.s: New file. * testsuite/ld-i386/property-x86-shstk1a.d: Likewise. * testsuite/ld-i386/property-x86-shstk1b.d: Likewise. * testsuite/ld-i386/property-x86-shstk2.d: Likewise. * testsuite/ld-i386/property-x86-shstk3a.d: Likewise. * testsuite/ld-i386/property-x86-shstk3b.d: Likewise. * testsuite/ld-i386/property-x86-shstk4.d: Likewise. * testsuite/ld-i386/property-x86-shstk5.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk.s: Likewise. * testsuite/ld-x86-64/property-x86-shstk1a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk1a.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk1b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk1b.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk2-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk2.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk4-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk4.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk5-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk5.d: Likewise. commit ee2fdd6f36c10ceb84e05c7234983bcfbe6146d5 Author: H.J. Lu Date: Thu Jun 22 05:44:37 2017 -0700 x86: Support Intel IBT with IBT property and IBT-enable PLT To support IBT in Intel Control-flow Enforcement Technology (CET) instructions: https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf #define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002 #define GNU_PROPERTY_X86_FEATURE_1_IBT (1U << 0) are added to GNU program properties to indicate that all executable sections are compatible with IBT when ENDBR instruction starts each valid target where an indirect branch instruction can land. GNU_PROPERTY_X86_FEATURE_1_IBT is set on output only if it is set on all relocatable inputs. The followings changes are made to the Procedure Linkage Table (PLT): 1. For 64-bit x86-64, PLT is changed to PLT0: push GOT[1] bnd jmp *GOT[2] nop ... PLTn: endbr64 push namen_reloc_index bnd jmp PLT0 together with the second PLT section: PLTn: endbr64 bnd jmp *GOT[namen_index] nop BND prefix is also added so that IBT-enabled PLT is compatible with MPX. 2. For 32-bit x86-64 (x32) and i386, PLT is changed to PLT0: push GOT[1] jmp *GOT[2] nop ... PLTn: endbr64 # endbr32 for i386. push namen_reloc_index jmp PLT0 together with the second PLT section: PLTn: endbr64 # endbr32 for i386. jmp *GOT[namen_index] nop BND prefix isn't used since MPX isn't supported on x32 and BND registers aren't used in parameter passing on i386. GOT is an array of addresses. Initially, GOT[namen_index] is filled with the address of the ENDBR instruction of the corresponding entry in the first PLT section. The function, namen, is called via the ENDBR instruction in the second PLT entry. GOT[namen_index] is updated to the actual address of the function, namen, at run-time. 2 linker command line options are added: 1. -z ibtplt: Generate IBT-enabled PLT. 2. -z ibt: Generate GNU_PROPERTY_X86_FEATURE_1_IBT in GNU program properties as well as IBT-enabled PLT. bfd/ * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New. (elf_i386_lazy_ibt_plt_entry): Likewise. (elf_i386_pic_lazy_ibt_plt0_entry): Likewise. (elf_i386_non_lazy_ibt_plt_entry): Likewise. (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise. (elf_i386_eh_frame_lazy_ibt_plt): Likewise. (elf_i386_lazy_plt_layout): Likewise. (elf_i386_non_lazy_plt_layout): Likewise. (elf_i386_link_hash_entry): Add plt_second. (elf_i386_link_hash_table): Add plt_second and plt_second_eh_frame. (elf_i386_allocate_dynrelocs): Use the second PLT if needed. (elf_i386_size_dynamic_sections): Use .plt.got unwind info for the second PLT. Check the second PLT. (elf_i386_relocate_section): Use the second PLT to resolve PLT reference if needed. (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if needed. (elf_i386_finish_dynamic_sections): Set sh_entsize on the second PLT. Generate unwind info for the second PLT. (elf_i386_plt_type): Add plt_second. (elf_i386_get_synthetic_symtab): Support the second PLT. (elf_i386_parse_gnu_properties): Support GNU_PROPERTY_X86_FEATURE_1_AND. (elf_i386_merge_gnu_properties): Support GNU_PROPERTY_X86_FEATURE_1_AND. If info->ibt is set, turn on GNU_PROPERTY_X86_FEATURE_1_IBT (elf_i386_link_setup_gnu_properties): If info->ibt is set, turn on GNU_PROPERTY_X86_FEATURE_1_IBT. Use IBT-enabled PLT for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT is set on all relocatable inputs. * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New. (elf_x32_lazy_ibt_plt_entry): Likewise. (elf_x86_64_non_lazy_ibt_plt_entry): Likewise. (elf_x32_non_lazy_ibt_plt_entry): Likewise. (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise. (elf_x32_eh_frame_lazy_ibt_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_get_synthetic_symtab): Support the second PLT. (elf_x86_64_parse_gnu_properties): Support GNU_PROPERTY_X86_FEATURE_1_AND. (elf_x86_64_merge_gnu_properties): Support GNU_PROPERTY_X86_FEATURE_1_AND. If info->ibt is set, turn on GNU_PROPERTY_X86_FEATURE_1_IBT (elf_x86_64_link_setup_gnu_properties): If info->ibt is set, turn on GNU_PROPERTY_X86_FEATURE_1_IBT. Use IBT-enabled PLT for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT is set on all relocatable inputs. binutils/ * readelf.c (decode_x86_feature): New. (print_gnu_property_note): Call decode_x86_feature on GNU_PROPERTY_X86_FEATURE_1_AND. * testsuite/binutils-all/i386/empty.d: New file. * testsuite/binutils-all/i386/empty.s: Likewise. * testsuite/binutils-all/i386/ibt.d: Likewise. * testsuite/binutils-all/i386/ibt.s: Likewise. * testsuite/binutils-all/x86-64/empty-x32.d: Likewise. * testsuite/binutils-all/x86-64/empty.d: Likewise. * testsuite/binutils-all/x86-64/empty.s: Likewise. * testsuite/binutils-all/x86-64/ibt-x32.d: Likewise. * testsuite/binutils-all/x86-64/ibt.d: Likewise. * testsuite/binutils-all/x86-64/ibt.s: Likewise. include/ * bfdlink.h (bfd_link_info): Add ibtplt and ibt. * elf/common.h (GNU_PROPERTY_X86_FEATURE_1_AND): New. (GNU_PROPERTY_X86_FEATURE_1_IBT): Likewise. ld/ * Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emulparams/cet.sh. * Makefile.in: Regenerated. * NEWS: Mention GNU_PROPERTY_X86_FEATURE_1_IBT, -z ibtplt and -z ibt. * emulparams/cet.sh: New file. * testsuite/ld-i386/ibt-plt-1.d: Likewise. * testsuite/ld-i386/ibt-plt-1.s: Likewise. * testsuite/ld-i386/ibt-plt-2.s: Likewise. * testsuite/ld-i386/ibt-plt-2a.d: Likewise. * testsuite/ld-i386/ibt-plt-2b.d: Likewise. * testsuite/ld-i386/ibt-plt-2c.d: Likewise. * testsuite/ld-i386/ibt-plt-2d.d: Likewise. * testsuite/ld-i386/ibt-plt-3.s: Likewise. * testsuite/ld-i386/ibt-plt-3a.d: Likewise. * testsuite/ld-i386/ibt-plt-3b.d: Likewise. * testsuite/ld-i386/ibt-plt-3c.d: Likewise. * testsuite/ld-i386/ibt-plt-3d.d: Likewise. * testsuite/ld-i386/plt-main-ibt.dd: Likewise. * testsuite/ld-i386/plt-pie-ibt.dd: Likewise. * testsuite/ld-i386/property-x86-empty.s: Likewise. * testsuite/ld-i386/property-x86-ibt.s: Likewise. * testsuite/ld-i386/property-x86-ibt1a.d: Likewise. * testsuite/ld-i386/property-x86-ibt1b.d: Likewise. * testsuite/ld-i386/property-x86-ibt2.d: Likewise. * testsuite/ld-i386/property-x86-ibt3a.d: Likewise. * testsuite/ld-i386/property-x86-ibt3b.d: Likewise. * testsuite/ld-i386/property-x86-ibt4.d: Likewise. * testsuite/ld-i386/property-x86-ibt5.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1.s: Likewise. * testsuite/ld-x86-64/ibt-plt-2.s: Likewise. * testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2b-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2b.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2d.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3.s: Likewise. * testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3b-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3b.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d.d: Likewise. * testsuite/ld-x86-64/plt-main-ibt-now.rd: Likewise. * testsuite/ld-x86-64/plt-main-ibt-x32.dd: Likewise. * testsuite/ld-x86-64/plt-main-ibt.dd: Likewise. * testsuite/ld-x86-64/property-x86-empty.s: Likewise. * testsuite/ld-x86-64/property-x86-ibt.s: Likewise. * testsuite/ld-x86-64/property-x86-ibt1a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt1a.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt1b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt1b.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt2-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt2.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt4-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt4.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt5-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt5.d: Likewise. * emulparams/elf32_x86_64.sh: Source emulparams/cet.sh. (TINY_READONLY_SECTION): Add .plt.sec. * emulparams/elf_i386.sh: Likewise. * emulparams/elf_x86_64.sh: Source emulparams/cet.sh. * ld.texinfo: Document -z ibtplt and -z ibt. * testsuite/ld-i386/i386.exp: Run IBT and IBT PLT tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/pr21481b.S (check): Updated for x32. commit f4906a9a7441ef9c2758513420568994a1e7fed3 Author: Pedro Alves Date: Thu Jun 22 10:31:20 2017 +0200 environ-selftests: Ignore -Wself-move warning clang gives this warning: ..../gdb/unittests/environ-selftests.c:139:7: error: explicitly moving variable of type 'gdb_environ' to itself [-Werror,-Wself-move] env = std::move (env); ~~~ ^ ~~~ Ignoring the warning locally is the right thing to do, since it warns about behavior we want to unit test, while an explicit self-move in real code would likely be a mistake that we'd want to catch. To avoid cluttering the code with preprocessor conditionals, this commit adds the file common/diagnostics.h, in which we can put macros used to control compiler diagnostics. GCC enhancement request here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81159 gdb/ChangeLog: 2017-06-22 Pedro Alves Simon Marchi * unittests/environ-selftests.c (run_tests): Ignore -Wself-move warning. * common/diagnostics.h: New file. commit d269dfc64fb5307dbbaecbc5d55861a705b729ab Author: Pedro Alves Date: Thu Jun 22 10:23:30 2017 +0100 Add STRINGIFY to gdb/common/preprocessor.h We have several copies of this common idiom under gdb/ currently. This commit moves them / factors them out to gdb/common/preprocessor.h. gdb/ChangeLog: 2017-06-22 Pedro Alves * common/agent.h: Include "common/preprocessor.h". (STRINGIZE_1, STRINGIZE): Delete. (IPA_SYM): Use STRINGIFY instead. * common/preprocessor.h (STRINGIFY_1, STRINGIFY): New. * compile/compile-c-support.c: Include "common/preprocessor.h". (STR, STRINGIFY): Delete. * ia64-libunwind-tdep.c: Include "common/preprocessor.h". (STRINGIFY2, STRINGIFY): Delete. commit b45a120833d862aeeba6803b2cc131724ef89dda Author: Pedro Alves Date: Thu Jun 22 10:57:13 2017 +0100 common/agent.h: Add missing include guards gdb/ChangeLog: 2017-06-22 Pedro Alves * common/agent.h: Add include guards. commit d19237d98d5c227bc33693057eb466702386cdfb Author: Nick Clifton Date: Thu Jun 22 10:33:56 2017 +0100 Fix address violation parsing a corrupt SOM binary. PR binutils/21649 * som.c (setup_sections): NUL terminate the space_strings buffer. Check that the space.name field does not index beyond the end of the space_strings buffer. commit e7d39ed3e0ca36d0dbd6ddd4cb955aa73b0974e6 Author: Nick Clifton Date: Thu Jun 22 09:34:12 2017 +0100 Fix compile time warning about unused static variable. * config/tc-arm.c (arm_ext_v7m): Add ATTRIBUTE_UNUSED. commit a765d0724259ec77ab69c3dbb1cc2e16e2e038e1 Author: GDB Administrator Date: Thu Jun 22 00:01:05 2017 +0000 Automatic date update in version.in commit 194747873fbe037e923eac3a61481ba16e50e322 Author: H.J. Lu Date: Wed Jun 21 15:29:38 2017 -0700 Use DWARF_VMA_FMT to report error Use DWARF_VMA_FMT to report error to work for both 32-bit and 64-bit builds. * dwarf.c (READ_ULEB): Use DWARF_VMA_FMT to report error. (READ_SLEB): Likewise. commit 6b7373708821500a7388a8248b6c19fa1826c514 Author: H.J. Lu Date: Wed Jun 21 15:22:05 2017 -0700 Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to some ELF tests Some ELF tests will fail when PIE is used. PR ld/21090 * testsuite/ld-elf/shared.exp: Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required. commit e5c89b096d9cb9e5956e98cd5863519c87c6890b Author: H.J. Lu Date: Wed Jun 21 14:57:53 2017 -0700 Pass $NOPIE_CFLAGS to NOCROSSREFS tests PR ld/21090 * testsuite/ld-scripts/crossref.exp: Also pass $NOPIE_CFLAGS to CC. commit 127d08c03f8bdb515389359ab605b6ee548996fd Author: H.J. Lu Date: Wed Jun 21 14:49:30 2017 -0700 Add missing ChangeLog entries commit 68193357e8d0fb53a229114713db9f0385f60ed8 Author: H.J. Lu Date: Wed Jun 21 14:45:16 2017 -0700 Pass $NOPIE_LDFLAGS size tests PR ld/21090 * testsuite/ld-size/size.exp: Pass $NOPIE_LDFLAGS to size-4a, size-4b, size-5a, size-5b, size-6 and size-8 tests. commit 75312ae3ab577c3a72ada54512533fec8bfae7bb Author: Kevin Buettner Date: Fri Jun 2 17:58:12 2017 -0700 Use noncapturing subpattern/parens in gdb_test implementation This is the portion of gdb_test which performs the match against the RE (regular expression) passed to it: return [gdb_test_multiple $command $message { -re "\[\r\n\]*($pattern)\[\r\n\]+$gdb_prompt $" { if ![string match "" $message] then { pass "$message" } } In a test that I've been working on recently, I wanted to use a backreference - that's the \1 in the the RE below: gdb_test "info threads" \ {.*[\r\n]+\* +([0-9]+) +Thread[^\r\n]* do_something \(n=\1\) at.*} Put into English, I wanted to make sure that the value of n passed to do_something() is the same as the thread number shown in the "info threads" Id column. (I've structured the test case so that this *should* be the case.) It didn't work though. It turned out that ($pattern) in the RE noted above is capturing the attempted backreference. So, in this case, the backreference does not refer to ([0-9]+) as intended, but instead refers to ($pattern). This is wrong because it's not what I intended, but is also wrong because, if allowed, it could only match a string of infinite length. This problem can be fixed by using parens for a "noncapturing subpattern". The way that this is done, syntactically, is to use (?:$pattern) instead of ($pattern). My research shows that this feature has been present since tcl8.1 which was released in 1999. The current tcl version is 8.6 - at least that's what I have on my machine. It appears to me that mingw uses some subversion of tcl8.4 which will also have this feature (since 8.4 > 8.1). So it seems to me that any platform upon which we might wish to test GDB will have a version of tcl which has this feature. That being the case, my hope is that there won't be any objections to its use. When I looked at the implementation of gdb_test, I wondered whether the parens were needed at all. I've concluded that they are. In the event that $pattern is an RE which uses alternation at the top level, e.g. a|b, we need to make $pattern a subpattern (via parens) to limit the extend of the alternation. I.e, we don't want the alternation to extend to the other portions of the RE which gdb_test uses to match potential blank lines at the beginning of the pattern or the gdb prompt at the end. gdb/testsuite/ChangeLog: * gdb.exp (gdb_test): Using noncapturing parens for the $pattern subpattern. commit 7f2c8a1d37af46c46828909b7b748c79aa4b7ff0 Author: Nick Clifton Date: Wed Jun 21 18:05:44 2017 +0100 Fix address violation when reading corrupt DWARF data. PR binutils/21648 * dwarf.c (LEB): Rename to SKIP_ULEB and READ_ULEB. Add check for reading a value that is too big for the containing variable. (SLEB): Rename to SKIP_SLEB and READ_SLEB. Add similar check. Replace uses of LEB and SLEB with appropriate new macro. (display_debug_frames): Use an unsigned int for the 'reg' variable. Use a signed long for the 'l' variable. commit 2c6b98ea6fcc1358639253d4e96c9b55a672fb0c Author: Thomas Preud'homme Date: Wed Jun 21 16:32:40 2017 +0100 [ARM] Rework Tag_CPU_arch build attribute value selection === Context === This patch is part of a patch series to add support for ARMv8-R architecture. Its purpose is to rework the Tag_CPU_arch build attribute value selection to (i) match architecture or CPU if specified by user without any need for hack and (ii) match an architecture with all the features used if in autodetection mode or return an error. === Motivation === Currently, Tag_CPU_arch build attribute value selection assumes that an architecture is always a superset of architectures released earlier. As such, the logic is to browse architectures in chronological order of release and selecting the Tag_CPU_arch value of the last one to contribute a feature used[1]/requested[2] not contributed by earlier architectures. [1] in case of autodetection mode [2] otherwise, ie. in case of -mcpu/-march or associated directives This logic fails the two objectives mentionned in the Context section. First, due to the assumption it does an architecture can be selected while not having all the features used/requested which fails the second objective. Second, not doing an exact match when an architecture or CPU is selected by the user means the wrong value is chosen when a later architecture provides a subset of the feature bits of an earlier architecture. This is the case for the implementation of ARMv8-R (see later patch). An added benefit of this patch is that it is possible to easily generate more consistent build attribute by setting the feature bits from the architecture matched in aeabi_set_public_attributes in autodetection mode. This is better done as a separate patch because lots of testcase' expected results must then be updated accordingly. === Patch description === The patch changes the main logic for Tag_CPU_arch and Tag_CPU_arch_profile values selection to: - look for an exact match in case an architecture or CPU was specified on the command line or in a directive - select the first released architecture that provides a superset of the feature used in the autodetection case - select the most featureful architecture in case of -march=all The array cpu_arch_ver is updated to include all architectures in order to make the first point work. Note that when looking for an exact match, the architecture with selected extension is tried first and then only the architecture. This is because some architectures are exactly equivalent to an earlier architecture with its extensions selected. ARMv6S-M (= ARMv6-M + OS extension) and ARMv6KZ (ARMv6K + security extension) are two such examples. Other adjustments are also necessary in aeabi_set_public_attributes to make this change work. 1) The logic to set Tag_ARM_ISA_use and Tag_THUMB_ISA_use must check the absence of feature bit used/requested to decide whether to give the default value for empty files (see EABI attribute defaults test). It was previously checking that arch == 0 which would only happen if no feature bit could be matched by any architecture, ie there is no feature bit to match. 2) A fallback to a superset match must exist when no_cpu_selected () returns true. This is because aeabi_set_public_attributes is called again after relaxation and at this point selected_cpu is set from the previous execution of that function. There is therefore no way to check whether the user specified an architecture or CPU. 3) Tag_CPU_arch lines are removed from expected output when the detected architecture should be pre-ARMv4, since 0 is the Tag_CPU_arch value for pre-ARMv4 architectures and default value for an absent entry is 0. 2017-06-21 Thomas Preud'homme gas/ * config/tc-arm.c (fpu_any): Defined from FPU_ANY. (cpu_arch_ver): Add all architectures and sort by release date. (have_ext_for_needed_feat_p): New. (get_aeabi_cpu_arch_from_fset): New. (aeabi_set_public_attributes): Call above function to determine Tag_CPU_arch and Tag_CPU_arch_profile values. Adapt Tag_ARM_ISA_use and Tag_THUMB_ISA_use selection logic to check absence of feature bit accordingly. * testsuite/gas/arm/attr-march-armv1.d: Fix expected Tag_CPU_arch build attribute value. * testsuite/gas/arm/attr-march-armv2.d: Likewise. * testsuite/gas/arm/attr-march-armv2a.d: Likewise. * testsuite/gas/arm/attr-march-armv2s.d: Likewise. * testsuite/gas/arm/attr-march-armv3.d: Likewise. * testsuite/gas/arm/attr-march-armv3m.d: Likewise. * testsuite/gas/arm/pr12198-2.d: Likewise. include/ * opcode/arm.h (FPU_ANY): New macro. commit 6879f5a99e25c068fec34126b6b0fe4325223aa0 Author: Nick Clifton Date: Wed Jun 21 16:36:44 2017 +0100 Fix addrss violation when processing a corrupt SH COFF binary. PR binutils/21646 * coff-sh.c (sh_reloc): Check for an out of range reloc. commit 2234eee61c42ad3f4d17894236873e04b633e969 Author: H.J. Lu Date: Wed Jun 21 08:32:38 2017 -0700 x86: CET v2.0: Update incssp and setssbsy Update x86 assembler and disassembler for CET v2.0: https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf 1. incsspd and incsspq are changed to take a register opeand with a different opcode. 2. setssbsy is changed to take no opeand with a different opcode. gas/ * testsuite/gas/i386/cet-intel.d: Updated. * testsuite/gas/i386/cet.d: Likewise. * testsuite/gas/i386/x86-64-cet-intel.d: Likewise. * testsuite/gas/i386/x86-64-cet.d: Likewise. * testsuite/gas/i386/cet.s: Update incsspd and setssbsy tests. * testsuite/gas/i386/x86-64-cet.s: Likewise. opcodes/ * i386-dis.c (RM_0FAE_REG_5): Removed. (PREFIX_MOD_3_0F01_REG_5_RM_1): Likewise. (PREFIX_MOD_3_0F01_REG_5_RM_0): New. (PREFIX_MOD_3_0FAE_REG_5): Likewise. (prefix_table): Remove PREFIX_MOD_3_0F01_REG_5_RM_1. Add PREFIX_MOD_3_0F01_REG_5_RM_0. (prefix_table): Update PREFIX_MOD_0_0FAE_REG_5. Add PREFIX_MOD_3_0FAE_REG_5. (mod_table): Update MOD_0FAE_REG_5. (rm_table): Update RM_0F01_REG_5. Remove RM_0FAE_REG_5. * i386-opc.tbl: Update incsspd, incsspq and setssbsy. * i386-tbl.h: Regenerated. commit c2f7640243bdab93cafb3bf516e17a72fcc2f051 Author: H.J. Lu Date: Wed Jun 21 08:30:01 2017 -0700 x86: CET v2.0: Rename savessp to saveprevssp Replace savessp with saveprevssp for CET v2.0: https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf gas/ * testsuite/gas/i386/cet-intel.d: Updated. * testsuite/gas/i386/cet.d: Likewise. * testsuite/gas/i386/x86-64-cet-intel.d: Likewise. * testsuite/gas/i386/x86-64-cet.d: Likewise. * testsuite/gas/i386/cet.s: Replace savessp with saveprevssp. * testsuite/gas/i386/x86-64-cet.s: Likewise. opcodes/ * i386-dis.c (prefix_table): Replace savessp with saveprevssp. * i386-opc.tbl: Likewise. * i386-tbl.h: Regenerated. commit 9fef80d683d79934bacd3221f5252ce8c14ff5c0 Author: H.J. Lu Date: Wed Jun 21 08:28:30 2017 -0700 x86: CET v2.0: Update NOTRACK prefix Update NOTRACK prefix handling to support memory indirect branch for CET v2.0: https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf gas/ * config/tc-i386.c (md_assemble): Update NOTRACK prefix check. * testsuite/gas/i386/notrack-intel.d: Updated. * testsuite/gas/i386/notrack.d: Likewise. * testsuite/gas/i386/notrackbad.l: Likewise. * testsuite/gas/i386/x86-64-notrack-intel.d: Likewise. * testsuite/gas/i386/x86-64-notrack.d: Likewise. * testsuite/gas/i386/x86-64-notrackbad.l: Likewise. * testsuite/gas/i386/notrack.s: Add NOTRACK prefix tests with memory indirect branch. * testsuite/gas/i386/x86-64-notrack.s: Likewise. * testsuite/gas/i386/notrackbad.s: Remove memory indirect branch with NOTRACK prefix. * testsuite/gas/i386/x86-64-notrackbad.s: Likewise. opcodes/ * i386-dis.c (reg_table): Swap indirEv with NOTRACK on "call{&|}" and "jmp{&|}". (NOTRACK_Fixup): Support memory indirect branch with NOTRACK prefix. commit 7adc0a8174f1233f6d92edd0671c18c9870e64e7 Author: Nick Clifton Date: Wed Jun 21 15:21:11 2017 +0100 Fix address violation parsing a corrupt Alpha VMS binary file. PR binutils/21639 * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as type of the size parameter. (_bfd_vms_save_counted_string): Add second parameter - the maximum length of the counted string. * vms.h (_bfd_vms_save_sized_string): Update prototype. (_bfd_vms_save_counted_string): Likewise. * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to _bfd_vms_save_counted_string. (_bfd_vms_slurp_ehdr): Likewise. (_bfd_vms_slurp_egsd): Likewise. (Parse_module): Likewise. commit 3d030cdb4a8d338c87e48b249338a4870fdcd322 Author: Thomas Preud'homme Date: Wed Jun 21 15:06:51 2017 +0100 [ARM] Allow Thumb division as an extension for ARMv7 === Context === This patch is part of a patch series to add support for ARMv8-R architecture. Its purpose is to allow ARMv7 to be selected in automatic architecture selection in presence of Thumb division instructions. === Motivation === any-idiv.d and automatic-sdiv.d testcases in GAS testsuite expect autodetection code to select ARMv7 in presence of Thumb integer division. However, the definition of ARM_AEXT_V7 and thus ARM_ARCH_V7 do not contain these instructions and the idiv extension is only available for ARMv7-A and ARMv7-R. Therefore, under the stricter automatic detection code proposed in the subsequent patch of the series ARMv7 is refused if a Thumb division instruction is present. === Patch description === This patch adds a new "idiv" extension after the existing one that is available to all ARMv7 targets. This new entry is ignored by all current code parsing arm_extensions such that it would be unavailable on the command-line and remain a purely internal hack, easily removed in favor of a better solution later. This is considered though by the subsequent patch reworking automatic detection of build attributes such that ARMv7 is allowed to match in present of Thumb division instructions. For good measure, comments are added in all instances of code browsing arm_extensions to mention the expected behavior in case of duplicate entries as well as a new testcase. 2017-06-20 Thomas Preud'homme gas/ * config/tc-arm.c (arm_extensions): New duplicate idiv entry to enable Thumb division for ARMv7 architecture. (arm_parse_extension): Document expected behavior for duplicate entries. (s_arm_arch_extension): Likewise. * testsuite/gas/arm/forbid-armv7-idiv-ext.d: New test. * testsuite/gas/arm/forbid-armv7-idiv-ext.l: New expected output for above test. commit 54bab2816dfd025fc53618e46be140573d5bc02e Author: Thomas Preud'homme Date: Wed Jun 21 14:57:53 2017 +0100 [ARM] Rework selection of feature bits to base build attributes on === Context === This patch is part of a patch series to add support for ARMv8-R architecture. Its purpose is to set the feature bits on which to decide what the build attributes should be according to the mode (autodetection, user specified architecture or CPU, or -march/-mcpu=all). === Motivation === Currently, the flags variable which is used to determine the build attribute is constructed from the instruction used (arm_arch_used and thumb_arch_used) as well as the user specified architecture or CPU (selected_cpu). This means when several .arch are specified the resulting feature bits can be such that no architecture provide them all and can thus result in incorrect Tag_CPU_arch. See for instance what having both .arch armv8-a and .arch armv8-m.base would result in. This is not caught by the testsuite because of further bugs in the Tag_CPU_arch build attribute value selection logic (see next patch in the series). === Patch description === As one would expect, this patch solves the problem by setting flags from feature bits used if in autodetection mode [1] and from selected_cpu otherwise. The logic to set arm_ext_v1, arm_ext_v4t and arm_ext_os feature bits is also moved to only run in autodetection mode since otherwise the architecture or CPU would have a consistent set of feature bits already. [1] No architecture or CPU was specified by the user 2017-06-21 Thomas Preud'homme gas/ * config/tc-arm.c (aeabi_set_public_attributes): Populate flags from feature bits used or selected_cpu depending on whether a CPU was selected by the user. commit bdab445c82ba93bc9aaad1ae974a3cf5c4aa8a26 Author: Alan Modra Date: Wed Jun 21 10:10:00 2017 +0930 [GOLD] PowerPC move plt indx_ out of unordered map key I was lazy when adding indx_ to Plt_stub_ent. The field isn't part of the key, so ought to be part of the mapped type. Make it so. * powerpc.cc (Plt_stub_key): Rename from Plt_stub_ent. Remove indx_. (Plt_stub_key_hash): Rename from Plt_stub_ent_hash. (struct Plt_stub_ent): New. (Plt_stub_entries): Map from Plt_stub_key to Plt_stub_ent. Adjust use throughout file. commit 6e1816be66892d06e1a983f08407135fa7f7fc17 Author: Alan Modra Date: Wed Jun 21 15:03:25 2017 +0930 PowerPC64 localentry:0 plt calls These don't need a following nop. Also, a localentry:0 plt call marked with an R_PPC64_TOCSAVE reloc should ignore the tocsave. There's no need to save r2 in the prologue for such calls. * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt calls before tocsave calls. (ppc64_elf_relocate_section): Allow localentry:0 plt calls without following nop. commit 81209eff905bf76a01bbc3dc07b8973d1d0cdaad Author: Alan Modra Date: Tue Jun 20 09:30:23 2017 +0930 PowerPC64 tocsave testcases * testsuite/ld-powerpc/powerpc.exp: Run TOCSAVE tests. * testsuite/ld-powerpc/tocsave1.s, * testsuite/ld-powerpc/tocsave1a.d, * testsuite/ld-powerpc/tocsave1s.d, * testsuite/ld-powerpc/tocsave2.s, * testsuite/ld-powerpc/tocsave2a.d, * testsuite/ld-powerpc/tocsave2s.d, * testsuite/ld-powerpc/tocsavelib.s: New files. commit 6c290d5387f770a6b098162f0a0f9ea420de540d Author: Thomas Preud'homme Date: Wed Jun 21 14:09:38 2017 +0100 [ARM] Simplify Tag_DSP_extension selection logic === Context === This patch is part of a patch series to add support for ARMv8-R architecture. Its purpose is to simplify the logic to decide whether to set Tag_DSP_extension. === Motivation === To decide whether to set Tag_DSP_extension, the current code was checking whether the flags had DSP instruction but the architecture selected for Tag_CPU_arch did not have any. This was necessary because extension feature bit were not available separately. This is no longer necessary and can be simplified. === Patch description === The patch change the logic to set Tag_DSP_extension to check whether any DSP feature bit is set in the extension feature bit, as per the definition of that build attribute. The patch also removes all definitions of arm_arch which is now unneeded. 2017-06-21 Thomas Preud'homme gas/ * config/tc-arm.c (aeabi_set_public_attributes): Test *mcpu_ext_opt to decide whether to set Tag_DSP_extension build attribute value. Remove now useless arm_arch variable. commit c168ce07e5b4a2a0258c796748899e1ba2e6dc7c Author: Thomas Preud'homme Date: Wed Jun 21 14:08:08 2017 +0100 [ARM] Keep separation between extensions and architecture bits throughout execution === Context === This patch is part of a patch series to add support for ARMv8-R architecture. Its purpose is to keep the distinction between architecture feature bits and extension ones after parsing has occured. === Motivation === This distinction is necessary to allow the Tag_CPU_arch build attribute value to be exactly as per the architecture of the selected CPU. With mixed architecture and extension feature bit, it is impossible to find an architecture with an exact match of feature bit and the build attribute value logic must then select the closest match which might not be the right architecture. The previous patch in the patch series makes the distinction possible when parsing -mcpu and .cpu directives but the distinction gets lost after. Similarly feature bits contributed by extensions in -march or .arch_extensions directive are mixed together with architecture extensions. === Patch description === The patch adds new feature bit pointer for extension feature bits. Information from the parsing regarding extensions can then be kept separate in those. This requires adapting arm_parse_extension to deal with two feature bits, allowing the architecture bits to be marked as const. It also requires extra care when setting cpu_variant and selected_cpu because the extension bits are optional since there might not be any extension in use. Note that contrary to cpu feature bits, the extension feature bits are made read/write and are always dynamically allocated. This allows to unconditionally free them in arm_md_post_relax added for this occasion, thereby fixing a longstanding memory leak when arm_parse_extension was invoked (XNEW of ext_fset without corresponding XDELETE). Introduction of arm_md_post_relax is necessary to only free the extension feature bits after aeabi_set_attribute_string has been called for the last time. 2017-06-21 Thomas Preud'homme gas/ * config/tc-arm.c (dyn_mcpu_ext_opt): New static variable. (dyn_march_ext_opt): Likewise. (md_begin): Copy extension feature bits alongside architecture ones. Merge extensions feature bits in selected_cpu and cpu_variant if there is some. (arm_parse_extension): Pass architecture and extension feature bits in separate parameters, with architecture bits being read only. Update **opt_p directly rather than *ext_set and initialize it if needed. (arm_parse_cpu): Stop merging architecture and extension feature bits and instead use mcpu_cpu_opt and dyn_mcpu_ext_opt to memorize them respectively. Adapt to change in parameters of arm_parse_extension. (arm_parse_arch): Adapt to change in parameters of arm_parse_extension. (aeabi_set_attribute_string): Make function static. (arm_md_post_relax): New function. (s_arm_cpu): Stop merging architecture and extension feature bits and instead use mcpu_cpu_opt and dyn_mcpu_ext_opt to memorize them respectively. Merge extension feature bits in cpu_variant if there is any. (s_arm_arch): Reset extension feature bit. Set selected_cpu from *mcpu_cpu_opt and cpu_variant from selected_cpu and *mfpu_opt for consistency with s_arm_cpu. (s_arm_arch_extension): Update *dyn_mcpu_ext_opt rather than selected_cpu, allocating it before hand if needed. Set selected_cpu from it and then cpu_variant. (s_arm_fpu): Merge *mcpu_ext_opt feature bits if any in cpu_variant. * config/tc-arm.h (md_post_relax_hook): Set to arm_md_post_relax. (aeabi_set_public_attributes): Delete external declaration. (arm_md_post_relax): Declare externally. commit 996b5569bf24fe29dcd832a068d9f42b2903f48b Author: Thomas Preud'homme Date: Wed Jun 21 13:16:56 2017 +0100 [ARM] Separate extensions from architectures in arm_cpus === Context === This patch is part of a patch series to add support for ARMv8-R architecture. Its purpose is to distinguish for a CPU the feature bits coming from its architecture from the feature bits coming from extension(s) available in this CPU. === Motivation === This distinction is necessary to allow the Tag_CPU_arch build attribute value to be exactly as per the architecture of the selected CPU. With mixed architecture and extension feature bit, it is impossible to find an architecture with an exact match of feature bit and the build attribute value logic must then select the closest match which might not be the right architecture. === Patch description === The patch creates a new field in the arm_cpus table to hold the feature set for the extensions available in each CPU. The existing architecture feature set is then updated to remove those feature bit. The patch also takes advantage of all the lines being changed to reindent the whole table. Note: This patch *adds* a memory leak due to mcpu_cpu_opt sometimes pointing to dynamically allocated feature bits which is never freeed. The subsequent patch in the series solves this issue as well as a preexisting identical issue in arm_parse_extension. The patches are kept separate for ease of review since they are both big enough already. 2017-06-21 Thomas Preud'homme gas/ * config/tc-arm.c (struct arm_cpu_option_table): New ext field. (ARM_CPU_OPT): Add parameter to set new ext field and reorder canonical name field just after the name field. (arm_cpus): Move extension feature bit from value field to ext field, reorder parameter according to changes in ARM_CPU_OPT and reindent. (arm_parse_cpu): Point mcpu_cpu_opt to a bitfield merging the value and ext field from the selected arm_cpus entry. (s_arm_cpu): Likewise. commit 20bd1b6ba53491e4979c03a4f679d0d17b9b9046 Author: Nick Clifton Date: Wed Jun 21 13:18:46 2017 +0100 Fix seg-fault in the BFD parsing a corrupt input binary. PR binutils/21645 * reloc.c (bfd_generic_get_relocated_section_contents): Fail if bfd_get_full_section_contents returns no contents. commit e4da2c61669d199c75b96a1be25e13e3b8254e89 Author: Simon Marchi Date: Wed Jun 21 12:28:03 2017 +0200 Change to_xfer_partial doc to use addressable memory units The commit d309493 target: consider addressable unit size when reading/writing memory introduced the possibility of reading memory of targets with non-8-bit-bytes (e.g. memories that store 16 bits at each address). The documentation of target_read and target_write was updated accordingly, but to_xfer_partial, which is very related, wasn't updated. This commit fixes that. gdb/ChangeLog: * target.h (struct target_ops) : Update doc to talk about addressable units instead of bytes. commit 3de58d950c984bce176d883a8e7bcf3415be8c84 Author: Nick Clifton Date: Wed Jun 21 12:04:07 2017 +0100 Fix potential address violation parsing a corrupt Alpha VMS file. PR binutils/21638 * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized record. commit cb06d03ad92ffcfaa09c3f065837cb39e9e1486d Author: Nick Clifton Date: Wed Jun 21 11:13:49 2017 +0100 Fix address violation parsing a corrupt IEEE Alpha binary. PR binutils/21637 * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section list. (image_set_ptr): Likewise. (alpha_vms_fix_sec_rel): Likewise. (alpha_vms_slurp_relocs): Likewise. commit c458d0079cc5e8ff29256355e6532ad2f96a8aa6 Author: Nick Clifton Date: Wed Jun 21 10:54:04 2017 +0100 Fix address violation when parsing a corrupt IEEE binary. PR binutils/21633 * ieee.c (ieee_slurp_sections): Check for a NULL return from read_id. (ieee_archive_p): Likewise. (ieee_object_p): Likewise. commit ce49701009db42a9a53e5dcf172a6a211b1025b3 Author: Nick Clifton Date: Wed Jun 21 10:36:58 2017 +0100 Fix seg-fault reading a corrupt ELF binary. PR binutils/21640 * elf.c (setup_group): Zero the group section pointer list after allocation so that loops can be caught. Check for NULL pointers when processing a group list. commit 1e29262747bed568c673b8765d214a4a16772da1 Author: James Greenhalgh Date: Wed Jun 21 09:13:25 2017 +0100 Add support for the Cortex-A55 and Cortex-A75 versions of the AArch64 architecture. * config/tc-aarch64.c (aarch64_cpus): Add cortex-a55 and cortex-a75. * doc/c-aarch64.texi (-mcpu): Document cortex-a55 and cortex-a75. commit eb83230b4d5c0129174937846ded9eaa9f78ff28 Author: Sergio Durigan Junior Date: Tue Jun 20 21:30:11 2017 -0400 Fix PR gdb/21606: SYMBOL_FUNCTIONS_DOMAIN misspelled in documentation Both Python and Guile documentations misspelled SYMBOL_FUNCTIONS_DOMAIN, writing SYMBOL_FUNCTION_DOMAIN instead. This obvious commit fixes it. gdb/doc/ChangeLog: 2017-06-20 Sergio Durigan Junior PR gdb/21606 * python.texi (Python representation of Symbols.): Replace SYMBOL_FUNCTION_DOMAIN by SYMBOL_FUNCTIONS_DOMAIN, fixing typo. * guile.texi (Guile representation of Symbols.): Likewise. commit eceb74ca646e78adab1fa9f5c3b7cce51e894bc3 Author: GDB Administrator Date: Wed Jun 21 00:00:36 2017 +0000 Automatic date update in version.in commit 69431babfb54b26000fdcc016323cf811d48e862 Author: Eric Christopher Date: Tue Jun 20 16:18:58 2017 -0700 2017-06-20 Eric Christopher * aarch64.cc (scan_reloc_for_stub): Use plt_address_for_global to calculate the symbol value. (scan_reloc_section_for_stubs): Allow stubs to be created for section symbols. (maybe_apply_stub): Handle creating stubs for weak symbols to match the code in scan_reloc_for_stub. commit a206891ad10040bdee41999019af3cbf45abb5d6 Author: Simon Marchi Date: Tue Jun 20 16:59:03 2017 +0200 gdbserver/Makefile.in: Sort IPA_OBJS gdb/gdbserver/ChangeLog: * Makefile.in (IPA_OBJS): Sort and format one item per line. commit 96160d605128658378af73bb62732d1cbfa73d8a Author: Sergio Durigan Junior Date: Tue Jun 20 09:33:53 2017 -0400 Use '::iterator' instead of '::const_iterator' on environ.c (and fix breakage on early versions of libstdc++) Even though C++11 supports modifying containers using a const_iterator (e.g., calling the 'erase' method of a std::vector), early versions of libstdc++ did not implement that. Some of our buildslaves are using these versions (e.g., the AArch64 buildslave uses gcc 4.8.8), and my previous commit causes a breakage on them. The solution is simple: just use a normal iterator, without const. gdb/ChangeLog: 2017-06-20 Sergio Durigan Junior * common/environ.c (gdb_environ::unset): Use '::iterator' instead of '::const_iterator'. commit 9a6c7d9c021cfeb290d76584db7a01e57e7c3d4e Author: Sergio Durigan Junior Date: Fri Feb 10 21:19:44 2017 -0500 C++ify gdb/common/environ.c As part of the preparation necessary for my upcoming task, I'd like to propose that we turn gdb_environ into a class. The approach taken here is simple: the class gdb_environ contains everything that is needed to manipulate the environment variables. These variables are stored in an std::vector, which can be converted to a 'char **' and passed as argument to functions that need it. The usage has not changed much. As per Pedro's suggestion, this class uses a static factory method initialization. This means that when an instance is created, it is initially empty. When needed, it has to be initialized using the static method 'from_host_environ'. As mentioned before, this is a preparation for an upcoming work that I will be posting in the next few weeks or so. For that work, I'll probably create another data structure that will contain all the environment variables that were set by the user using the 'set environment' command, because I'll need access to them. This will be much easier with the class-ification of gdb_environ. As noted, this has been regression-tested with the new version of environ.exp and no regressions were found. gdb/ChangeLog: 2017-06-20 Sergio Durigan Junior * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add 'unittests/environ-selftests.c'. (SUBDIR_UNITTESTS_OBS): Add 'environ-selftests.o'. * charset.c (find_charset_names): Declare object 'iconv_env'. Update code to use 'iconv_env' object. Remove call to 'free_environ'. * common/environ.c: Include . (make_environ): Delete function. (free_environ): Delete function. (gdb_environ::clear): New function. (gdb_environ::operator=): New function. (gdb_environ::get): Likewise. (environ_vector): Delete function. (set_in_environ): Delete function. (gdb_environ::set): New function. (unset_in_environ): Delete function. (gdb_environ::unset): New function. (gdb_environ::envp): Likewise. * common/environ.h: Include . (struct gdb_environ): Delete; transform into... (class gdb_environ): ... this class. (free_environ): Delete prototype. (init_environ, get_in_environ, set_in_environ, unset_in_environ, environ_vector): Likewise. * infcmd.c (run_command_1): Update code to call 'envp' from 'gdb_environ' class. (environment_info): Update code to call methods from 'gdb_environ' class. (unset_environment_command): Likewise. (path_info): Likewise. (path_command): Likewise. * inferior.c (inferior::~inferior): Delete call to 'free_environ'. (inferior::inferior): Initialize 'environment' using the host's information. * inferior.h: Remove forward declaration of 'struct gdb_environ'. Include "environ.h". (class inferior) : Change type from 'struct gdb_environ' to 'gdb_environ'. * mi/mi-cmd-env.c (mi_cmd_env_path): Update code to call methods from 'gdb_environ' class. * solib.c (solib_find_1): Likewise * unittests/environ-selftests.c: New file. gdb/gdbserver/ChangeLog: 2017-06-20 Sergio Durigan Junior * linux-low.c (linux_create_inferior): Adjust code to access the environment information via 'gdb_environ' class. * lynx-low.c (lynx_create_inferior): Likewise. * server.c (our_environ): Make it an instance of 'gdb_environ'. (get_environ): Return a pointer to 'our_environ'. (captured_main): Initialize 'our_environ'. * server.h (get_environ): Adjust prototype. * spu-low.c (spu_create_inferior): Adjust code to access the environment information via 'gdb_environ' class. commit 75c554cf9c375432af6e93653880d5498cd5f918 Author: Yao Qi Date: Tue Jun 20 12:08:33 2017 +0100 Adjust the order of 32bit-linux.xml and 32bit-sse.xml in i386/i386-linux.xml Exchange the order of 32bit-linux.xml and 32bit-sse.xml in i386/i386-linux.xml, to align with other i386 linux .xml files. gdb: 2017-06-20 Yao Qi * features/i386/i386-linux.xml: Exchange the order of including 32bit-linux.xml and 32bit-sse.xml. * features/i386/i386-linux.c: Regenerated. commit 72ddacb77e3301a0481003a23b2d8dced7116de5 Author: Yao Qi Date: Tue Jun 20 11:29:17 2017 +0100 Class-fy tdesc_reg tdesc_type and tdesc_feature This patch class-fies them, adding ctor, dtor, and deleting copy ctor and assignment operator. gdb: 2017-06-20 Yao Qi * target-descriptions.c (tdesc_reg): Add ctor, dtor. Delete copy ctor and assignment operator. (tdesc_type): Likewise. (tdesc_feature): Likewise. (tdesc_free_reg): Remove. (tdesc_create_reg): Use new. (tdesc_free_type): Remove. (tdesc_create_vector): Use new. (tdesc_create_union): Likewise. (tdesc_create_flags): Likewise. (tdesc_create_enum): Likewise. (tdesc_free_feature): Delete. (free_target_description): Use delete. commit 94de2a2c57b7f6b2870f72ecdcacc6d909c6421a Author: James Clarke Date: Tue Jun 20 18:01:52 2017 +0930 [GOLD] Avoid duplicate PLT stub symbols on ppc32 If two objects are compiled with -fPIC or -fPIE and call the same function, two different PLT entries are created, one for each object, but the same stub symbol name is used for both. * powerpc.cc (Stub_table::define_stub_syms): Always include object's uniq_ value. commit abfa390dac6ffcfc6de9659c0b78cfe524347450 Author: H.J. Lu Date: Mon Jun 19 20:30:20 2017 -0700 Check the DYNAMIC bit for input shared objects Since the BFD section count may not be cleared for shared objects during linking, we should check the DYNAMIC bit for input shared objects. bfd/ PR ld/21626 * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check the DYNAMIC bit instead of bfd_count_sections. ld/ PR ld/21626 * testsuite/ld-i386/i386.exp: Run ld/21626 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. commit a6cab9afd2c81465265c8d09569e3e6ef43d2954 Author: GDB Administrator Date: Tue Jun 20 00:00:38 2017 +0000 Automatic date update in version.in commit 325c9fd4aa054118b80c621262f10fc6ffe98e25 Author: John Baldwin Date: Mon Jun 19 14:30:24 2017 -0700 Don't throw an error in 'info registers' for unavailable MIPS registers. 'info registers' for MIPS throws an error and when it first encounters an unavailable register. This does not match other architectures which annotate unavailable registers and continue to print out the values of subsequent registers. Replace the error by displaying an aligned "". This string is truncated to "" when displaying a 32-bit register. gdb/ChangeLog: * mips-tdep.c (print_gp_register_row): Don't error for unavailable registers. commit 66953522c9061874047d2e9832c206af783c971c Author: Peter Bergner Date: Mon Jun 19 13:04:13 2017 -0500 Update GDB test case for new lnia extended mnemonic. When I added the new lnia extended mnemonic for addpcis, I updated the assembler/disassembler test cases, but overlooked the GDB test cases. This patch fixes that oversight and associated test case failure. * gdb.arch/powerpc-power9.exp: Update test case for new lnia extended mnemonic. * gdb.arch/powerpc-power9.s: Likewise. commit d16fdddb4e96e9e7bcfce6fe487b321c54b2c7c7 Author: Nick Clifton Date: Mon Jun 19 15:57:19 2017 +0100 Fix address violation when attempting to display disassembled data. PR binutils/21619 * objdump.c (disassemble_bytes): Check that there is sufficient data available before attempting to display it. commit bc21b167eb0106eb31d946a0eb5acfb7e4d5d8a1 Author: Nick Clifton Date: Mon Jun 19 14:52:36 2017 +0100 Fix address violations when reading corrupt VMS records. PR binutils/21618 * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record length. (evax_bfd_print_eeom): Likewise. (evax_bfd_print_egsd): Check for an overlarge record length. (evax_bfd_print_etir): Likewise. commit 0f6d864de2469af4223391993b430b0d45573dcb Author: Nick Clifton Date: Mon Jun 19 14:15:57 2017 +0100 Prevent address violation when attempting to disassemble a corrupt score binary. PR binutils/21614 * score-dis.c (score_opcodes): Add sentinel. commit acb56a83016611bcb5f0a32368fddc8c213f7dd0 Author: Nick Clifton Date: Mon Jun 19 14:06:53 2017 +0100 Fix access violation when parsing a corrupt IEEE binary. PR binutils/21612 * libieee.h (struct common_header_type): Add end_p field. * ieee.c (this_byte_and_next): Do not advance input_p beyond end_p. (read_id): Check for a length that exceeds the remaining bytes in the input buffer. (ieee_seek): Initialise end_p. (ieee_archive_p): Likewise. (ieee_object_p): Likewise. commit 80053e466b3a8055334b9be9bac7d99e0d617cbe Author: Nick Clifton Date: Mon Jun 19 13:01:57 2017 +0100 Fix access violation disassembling a corrupt VMS binary. PR binutils/21611 * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset before reading the EIHS structure entries. commit 16b7a7199881fa26fc863279bbf08741e5674b5d Author: Pedro Alves Date: Mon Jun 19 12:46:47 2017 +0100 .gdb_index writer: close the file before unlinking it We should close the file before unlinking because on MS-Windows one cannot delete a file that is still open. I considered making 'gdb::unlinker::unlinker(const char *)' 'noexcept(true)' and then adding static_assert (noexcept (gdb::unlinker (filename.c_str ())), ""); but that doesn't really work because gdb::unlinker has a gdb_assert, which can throw a QUIT if/when the assertion fails. 'noexcept(true)' would cause GDB to abruptly terminate if/when the assertion fails. gdb/ChangeLog: 2017-06-19 Pedro Alves * dwarf2read.c (write_psymtabs_to_index): Construct file_closer after gdb::unlinker. commit 72e84f969481f52daf6741c6bb4d0e92f9668389 Author: Nick Clifton Date: Mon Jun 19 12:31:07 2017 +0100 Fix access violation when disassembling a corrupt VMS binary. PR 21615 * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for gsd_size. Check that there are enough bytes remaining to read the type and size of the next egsd. Check that the size of the egsd does not exceed the size of the record. commit 875ffa3edc5f27f0ad5e3d95d96782832edad00e Author: Alan Modra Date: Mon Jun 19 16:04:16 2017 +0930 Correct target_underscore for cris * config.bfd: Correct targ_underscore for cris. commit 1c8e01c96054973c50ec1dec2f220af4734e1de5 Author: Sergio Durigan Junior Date: Fri Jun 16 18:10:27 2017 -0400 Use getenv instead of gdb_environ on mi-cmd-env.c This is a spinoff of . mi-cmd-env.c is using the whole gdb_environ machinery in order to access just one variable, which can be easily replaced by a simple call to getenv. This patch does that, and doesn't cause regressions. gdb/ChangeLog: 2017-06-18 Sergio Durigan Junior * mi/mi-cm-env.c (_initialize_mi_cmd_env): Use getenv instead of gdb_environ to access an environment variable. commit 65ce7763dfbca7f74c951767050ad2da0739869b Author: GDB Administrator Date: Mon Jun 19 00:00:23 2017 +0000 Automatic date update in version.in commit ffce45d2243e5f52f411e314fc4e1a69f431a81f Author: Thomas Petazzoni Date: Sun Jun 18 23:28:56 2017 +0200 nat/linux-ptrace.c: add missing gdb_byte* cast On noMMU platforms, the following code gets compiled: child_stack = xmalloc (STACK_SIZE * 4); Where child_stack is a gdb_byte*, and xmalloc() returns a void*. While the lack of cast is valid in C, it is not in C++, causing the following build failure: ../nat/linux-ptrace.c: In function 'int linux_fork_to_function(gdb_byte*, int (*)(void*))': ../nat/linux-ptrace.c:273:29: error: invalid conversion from 'void*' to 'gdb_byte* {aka unsigned char*}' [-fpermissive] child_stack = xmalloc (STACK_SIZE * 4); Therefore, this commit adds the appropriate cast. gdb/ChangeLog: * nat/linux-ptrace.c (linux_fork_to_function): Add cast to gdb_byte*. Signed-off-by: Thomas Petazzoni ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 185 ++++ bfd/coff-sh.c | 3 + bfd/config.bfd | 12 +- bfd/elf-properties.c | 4 +- bfd/elf.c | 14 +- bfd/elf32-arm.c | 2 +- bfd/elf32-i386.c | 566 +++++++++++- bfd/elf64-ppc.c | 33 +- bfd/elf64-x86-64.c | 466 +++++++++- bfd/ieee.c | 31 +- bfd/libieee.h | 1 + bfd/reloc.c | 3 + bfd/som.c | 9 +- bfd/version.h | 2 +- bfd/vms-alpha.c | 159 +++- bfd/vms-misc.c | 8 +- bfd/vms.h | 4 +- binutils/ChangeLog | 47 + binutils/dwarf.c | 154 ++-- binutils/objdump.c | 27 +- binutils/readelf.c | 49 + binutils/testsuite/binutils-all/i386/empty.d | 9 + binutils/testsuite/binutils-all/i386/empty.s | 27 + binutils/testsuite/binutils-all/i386/ibt.d | 9 + binutils/testsuite/binutils-all/i386/ibt.s | 27 + binutils/testsuite/binutils-all/i386/shstk.d | 9 + binutils/testsuite/binutils-all/i386/shstk.s | 27 + binutils/testsuite/binutils-all/x86-64/empty-x32.d | 10 + binutils/testsuite/binutils-all/x86-64/empty.d | 9 + binutils/testsuite/binutils-all/x86-64/empty.s | 27 + binutils/testsuite/binutils-all/x86-64/ibt-x32.d | 10 + binutils/testsuite/binutils-all/x86-64/ibt.d | 9 + binutils/testsuite/binutils-all/x86-64/ibt.s | 27 + binutils/testsuite/binutils-all/x86-64/shstk-x32.d | 10 + binutils/testsuite/binutils-all/x86-64/shstk.d | 9 + binutils/testsuite/binutils-all/x86-64/shstk.s | 27 + gas/ChangeLog | 127 +++ gas/config/tc-aarch64.c | 6 + gas/config/tc-arm.c | 953 ++++++++++++++------ gas/config/tc-arm.h | 4 +- gas/config/tc-i386.c | 9 +- gas/doc/c-aarch64.texi | 2 + gas/testsuite/gas/arm/attr-march-armv1.d | 1 - gas/testsuite/gas/arm/attr-march-armv2.d | 1 - gas/testsuite/gas/arm/attr-march-armv2a.d | 1 - gas/testsuite/gas/arm/attr-march-armv2s.d | 1 - gas/testsuite/gas/arm/attr-march-armv3.d | 1 - gas/testsuite/gas/arm/attr-march-armv3m.d | 1 - gas/testsuite/gas/arm/forbid-armv7-idiv-ext.d | 4 + gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l | 3 + gas/testsuite/gas/i386/cet-intel.d | 12 +- gas/testsuite/gas/i386/cet.d | 12 +- gas/testsuite/gas/i386/cet.s | 12 +- gas/testsuite/gas/i386/notrack-intel.d | 16 + gas/testsuite/gas/i386/notrack.d | 16 + gas/testsuite/gas/i386/notrack.s | 22 + gas/testsuite/gas/i386/notrackbad.l | 54 +- gas/testsuite/gas/i386/notrackbad.s | 4 - gas/testsuite/gas/i386/x86-64-cet-intel.d | 16 +- gas/testsuite/gas/i386/x86-64-cet.d | 16 +- gas/testsuite/gas/i386/x86-64-cet.s | 16 +- gas/testsuite/gas/i386/x86-64-notrack-intel.d | 32 + gas/testsuite/gas/i386/x86-64-notrack.d | 32 + gas/testsuite/gas/i386/x86-64-notrack.s | 43 + gas/testsuite/gas/i386/x86-64-notrackbad.l | 54 +- gas/testsuite/gas/i386/x86-64-notrackbad.s | 4 - gdb/ChangeLog | 132 +++ gdb/Makefile.in | 2 + gdb/charset.c | 11 +- gdb/common/agent.h | 11 +- gdb/common/{preprocessor.h => diagnostics.h} | 37 +- gdb/common/environ.c | 202 ++--- gdb/common/environ.h | 70 +- gdb/common/preprocessor.h | 4 + gdb/compile/compile-c-support.c | 4 +- gdb/doc/ChangeLog | 7 + gdb/doc/gdb.texinfo | 14 +- gdb/doc/guile.texi | 2 +- gdb/doc/python.texi | 2 +- gdb/dwarf2read.c | 104 ++- gdb/features/i386/i386-linux.c | 6 +- gdb/features/i386/i386-linux.xml | 2 +- gdb/gdbserver/ChangeLog | 16 + gdb/gdbserver/Makefile.in | 15 +- gdb/gdbserver/linux-low.c | 2 +- gdb/gdbserver/lynx-low.c | 2 +- gdb/gdbserver/server.c | 9 +- gdb/gdbserver/server.h | 6 +- gdb/gdbserver/spu-low.c | 2 +- gdb/ia64-libunwind-tdep.c | 3 +- gdb/infcmd.c | 28 +- gdb/inferior.c | 4 +- gdb/inferior.h | 6 +- gdb/mi/mi-cmd-env.c | 18 +- gdb/mips-tdep.c | 10 +- gdb/nat/linux-ptrace.c | 2 +- gdb/python/py-unwind.c | 25 +- gdb/record-full.c | 7 +- gdb/regcache.h | 8 + .../i386/amd64-avx-mpx-avx512-pku-linux.dat | 1 + gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat | 3 - gdb/remote.c | 6 - gdb/solib.c | 7 +- gdb/target-descriptions.c | 197 ++-- gdb/target.h | 13 +- gdb/testsuite/ChangeLog | 11 + gdb/testsuite/gdb.arch/powerpc-power9.exp | 4 +- gdb/testsuite/gdb.arch/powerpc-power9.s | 2 +- gdb/testsuite/lib/gdb.exp | 2 +- gdb/unittests/environ-selftests.c | 159 ++++ gold/ChangeLog | 22 + gold/aarch64.cc | 21 +- gold/powerpc.cc | 113 ++- include/ChangeLog | 15 + include/bfdlink.h | 9 + include/elf/common.h | 4 + include/opcode/arm.h | 1 + ld/ChangeLog | 175 ++++ ld/Makefile.am | 3 +- ld/Makefile.in | 3 +- ld/NEWS | 16 + ld/emulparams/cet.sh | 17 + ld/emulparams/elf32_x86_64.sh | 2 + ld/emulparams/elf_i386.sh | 2 + ld/emulparams/elf_x86_64.sh | 1 + ld/ld.texinfo | 14 + ld/testsuite/ld-elf/shared.exp | 19 +- ld/testsuite/ld-gc/gc.exp | 5 +- ld/testsuite/ld-i386/i386.exp | 116 +++- ld/testsuite/ld-i386/ibt-plt-1.d | 51 + ld/testsuite/ld-i386/ibt-plt-1.s | 54 ++ ld/testsuite/ld-i386/ibt-plt-2.s | 54 ++ ld/testsuite/ld-i386/ibt-plt-2a.d | 52 ++ ld/testsuite/ld-i386/ibt-plt-2b.d | 9 + ld/testsuite/ld-i386/ibt-plt-2c.d | 52 ++ ld/testsuite/ld-i386/ibt-plt-2d.d | 9 + ld/testsuite/ld-i386/ibt-plt-3.s | 38 + ld/testsuite/ld-i386/ibt-plt-3a.d | 52 ++ ld/testsuite/ld-i386/ibt-plt-3b.d | 5 + ld/testsuite/ld-i386/ibt-plt-3c.d | 52 ++ ld/testsuite/ld-i386/ibt-plt-3d.d | 9 + ld/testsuite/ld-i386/no-plt.exp | 23 +- ld/testsuite/ld-i386/plt-main-ibt.dd | 7 + ld/testsuite/ld-i386/plt-pie-ibt.dd | 7 + ld/testsuite/ld-i386/property-x86-empty.s | 27 + ld/testsuite/ld-i386/property-x86-ibt.s | 27 + ld/testsuite/ld-i386/property-x86-ibt1a.d | 6 + ld/testsuite/ld-i386/property-x86-ibt1b.d | 6 + ld/testsuite/ld-i386/property-x86-ibt2.d | 9 + ld/testsuite/ld-i386/property-x86-ibt3a.d | 11 + ld/testsuite/ld-i386/property-x86-ibt3b.d | 11 + ld/testsuite/ld-i386/property-x86-ibt4.d | 9 + ld/testsuite/ld-i386/property-x86-ibt5.d | 9 + ld/testsuite/ld-i386/property-x86-shstk.s | 27 + ld/testsuite/ld-i386/property-x86-shstk1a.d | 6 + ld/testsuite/ld-i386/property-x86-shstk1b.d | 6 + ld/testsuite/ld-i386/property-x86-shstk2.d | 9 + ld/testsuite/ld-i386/property-x86-shstk3a.d | 11 + ld/testsuite/ld-i386/property-x86-shstk3b.d | 11 + ld/testsuite/ld-i386/property-x86-shstk4.d | 9 + ld/testsuite/ld-i386/property-x86-shstk5.d | 9 + ld/testsuite/ld-powerpc/powerpc.exp | 10 + ld/testsuite/ld-powerpc/tocsave1.s | 24 + ld/testsuite/ld-powerpc/tocsave1a.d | 15 + ld/testsuite/ld-powerpc/tocsave1s.d | 9 + ld/testsuite/ld-powerpc/tocsave2.s | 24 + ld/testsuite/ld-powerpc/tocsave2a.d | 18 + ld/testsuite/ld-powerpc/tocsave2s.d | 13 + ld/testsuite/ld-powerpc/tocsavelib.s | 5 + ld/testsuite/ld-scripts/crossref.exp | 5 +- ld/testsuite/ld-shared/shared.exp | 4 +- ld/testsuite/ld-size/size.exp | 13 +- ld/testsuite/ld-srec/srec.exp | 9 +- ld/testsuite/ld-x86-64/ibt-plt-1-x32.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-1.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-1.s | 45 + ld/testsuite/ld-x86-64/ibt-plt-2.s | 45 + ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-2a.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d | 9 + ld/testsuite/ld-x86-64/ibt-plt-2b.d | 9 + ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-2c.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d | 9 + ld/testsuite/ld-x86-64/ibt-plt-2d.d | 9 + ld/testsuite/ld-x86-64/ibt-plt-3.s | 17 + ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-3a.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d | 5 + ld/testsuite/ld-x86-64/ibt-plt-3b.d | 5 + ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-3c.d | 43 + ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d | 10 + ld/testsuite/ld-x86-64/ibt-plt-3d.d | 10 + ld/testsuite/ld-x86-64/no-plt.exp | 9 +- ld/testsuite/ld-x86-64/plt-main-ibt-now.rd | 3 + ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd | 7 + ld/testsuite/ld-x86-64/plt-main-ibt.dd | 7 + ld/testsuite/ld-x86-64/pr21481b.S | 4 + ld/testsuite/ld-x86-64/property-x86-empty.s | 27 + ld/testsuite/ld-x86-64/property-x86-ibt.s | 27 + ld/testsuite/ld-x86-64/property-x86-ibt1a-x32.d | 6 + ld/testsuite/ld-x86-64/property-x86-ibt1a.d | 6 + ld/testsuite/ld-x86-64/property-x86-ibt1b-x32.d | 6 + ld/testsuite/ld-x86-64/property-x86-ibt1b.d | 6 + ld/testsuite/ld-x86-64/property-x86-ibt2-x32.d | 9 + ld/testsuite/ld-x86-64/property-x86-ibt2.d | 9 + ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d | 11 + ld/testsuite/ld-x86-64/property-x86-ibt3a.d | 11 + ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d | 11 + ld/testsuite/ld-x86-64/property-x86-ibt3b.d | 11 + ld/testsuite/ld-x86-64/property-x86-ibt4-x32.d | 9 + ld/testsuite/ld-x86-64/property-x86-ibt4.d | 9 + ld/testsuite/ld-x86-64/property-x86-ibt5-x32.d | 9 + ld/testsuite/ld-x86-64/property-x86-ibt5.d | 9 + ld/testsuite/ld-x86-64/property-x86-shstk.s | 27 + ld/testsuite/ld-x86-64/property-x86-shstk1a-x32.d | 6 + ld/testsuite/ld-x86-64/property-x86-shstk1a.d | 6 + ld/testsuite/ld-x86-64/property-x86-shstk1b-x32.d | 6 + ld/testsuite/ld-x86-64/property-x86-shstk1b.d | 6 + ld/testsuite/ld-x86-64/property-x86-shstk2-x32.d | 9 + ld/testsuite/ld-x86-64/property-x86-shstk2.d | 9 + ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d | 11 + ld/testsuite/ld-x86-64/property-x86-shstk3a.d | 11 + ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d | 11 + ld/testsuite/ld-x86-64/property-x86-shstk3b.d | 11 + ld/testsuite/ld-x86-64/property-x86-shstk4-x32.d | 9 + ld/testsuite/ld-x86-64/property-x86-shstk4.d | 9 + ld/testsuite/ld-x86-64/property-x86-shstk5-x32.d | 9 + ld/testsuite/ld-x86-64/property-x86-shstk5.d | 9 + ld/testsuite/ld-x86-64/x86-64.exp | 221 +++++- opcodes/ChangeLog | 33 + opcodes/i386-dis.c | 39 +- opcodes/i386-opc.tbl | 8 +- opcodes/i386-tbl.h | 24 +- opcodes/score-dis.c | 1 + 236 files changed, 6180 insertions(+), 1166 deletions(-) create mode 100644 binutils/testsuite/binutils-all/i386/empty.d create mode 100644 binutils/testsuite/binutils-all/i386/empty.s create mode 100644 binutils/testsuite/binutils-all/i386/ibt.d create mode 100644 binutils/testsuite/binutils-all/i386/ibt.s create mode 100644 binutils/testsuite/binutils-all/i386/shstk.d create mode 100644 binutils/testsuite/binutils-all/i386/shstk.s create mode 100644 binutils/testsuite/binutils-all/x86-64/empty-x32.d create mode 100644 binutils/testsuite/binutils-all/x86-64/empty.d create mode 100644 binutils/testsuite/binutils-all/x86-64/empty.s create mode 100644 binutils/testsuite/binutils-all/x86-64/ibt-x32.d create mode 100644 binutils/testsuite/binutils-all/x86-64/ibt.d create mode 100644 binutils/testsuite/binutils-all/x86-64/ibt.s create mode 100644 binutils/testsuite/binutils-all/x86-64/shstk-x32.d create mode 100644 binutils/testsuite/binutils-all/x86-64/shstk.d create mode 100644 binutils/testsuite/binutils-all/x86-64/shstk.s create mode 100644 gas/testsuite/gas/arm/forbid-armv7-idiv-ext.d create mode 100644 gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l copy gdb/common/{preprocessor.h => diagnostics.h} (55%) create mode 100644 gdb/unittests/environ-selftests.c create mode 100644 ld/emulparams/cet.sh create mode 100644 ld/testsuite/ld-i386/ibt-plt-1.d create mode 100644 ld/testsuite/ld-i386/ibt-plt-1.s create mode 100644 ld/testsuite/ld-i386/ibt-plt-2.s create mode 100644 ld/testsuite/ld-i386/ibt-plt-2a.d create mode 100644 ld/testsuite/ld-i386/ibt-plt-2b.d create mode 100644 ld/testsuite/ld-i386/ibt-plt-2c.d create mode 100644 ld/testsuite/ld-i386/ibt-plt-2d.d create mode 100644 ld/testsuite/ld-i386/ibt-plt-3.s create mode 100644 ld/testsuite/ld-i386/ibt-plt-3a.d create mode 100644 ld/testsuite/ld-i386/ibt-plt-3b.d create mode 100644 ld/testsuite/ld-i386/ibt-plt-3c.d create mode 100644 ld/testsuite/ld-i386/ibt-plt-3d.d create mode 100644 ld/testsuite/ld-i386/plt-main-ibt.dd create mode 100644 ld/testsuite/ld-i386/plt-pie-ibt.dd create mode 100644 ld/testsuite/ld-i386/property-x86-empty.s create mode 100644 ld/testsuite/ld-i386/property-x86-ibt.s create mode 100644 ld/testsuite/ld-i386/property-x86-ibt1a.d create mode 100644 ld/testsuite/ld-i386/property-x86-ibt1b.d create mode 100644 ld/testsuite/ld-i386/property-x86-ibt2.d create mode 100644 ld/testsuite/ld-i386/property-x86-ibt3a.d create mode 100644 ld/testsuite/ld-i386/property-x86-ibt3b.d create mode 100644 ld/testsuite/ld-i386/property-x86-ibt4.d create mode 100644 ld/testsuite/ld-i386/property-x86-ibt5.d create mode 100644 ld/testsuite/ld-i386/property-x86-shstk.s create mode 100644 ld/testsuite/ld-i386/property-x86-shstk1a.d create mode 100644 ld/testsuite/ld-i386/property-x86-shstk1b.d create mode 100644 ld/testsuite/ld-i386/property-x86-shstk2.d create mode 100644 ld/testsuite/ld-i386/property-x86-shstk3a.d create mode 100644 ld/testsuite/ld-i386/property-x86-shstk3b.d create mode 100644 ld/testsuite/ld-i386/property-x86-shstk4.d create mode 100644 ld/testsuite/ld-i386/property-x86-shstk5.d create mode 100644 ld/testsuite/ld-powerpc/tocsave1.s create mode 100644 ld/testsuite/ld-powerpc/tocsave1a.d create mode 100644 ld/testsuite/ld-powerpc/tocsave1s.d create mode 100644 ld/testsuite/ld-powerpc/tocsave2.s create mode 100644 ld/testsuite/ld-powerpc/tocsave2a.d create mode 100644 ld/testsuite/ld-powerpc/tocsave2s.d create mode 100644 ld/testsuite/ld-powerpc/tocsavelib.s create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-1-x32.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-1.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-1.s create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-2.s create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-2a.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-2b.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-2c.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-2d.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-3.s create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-3a.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-3b.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-3c.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d create mode 100644 ld/testsuite/ld-x86-64/ibt-plt-3d.d create mode 100644 ld/testsuite/ld-x86-64/plt-main-ibt-now.rd create mode 100644 ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd create mode 100644 ld/testsuite/ld-x86-64/plt-main-ibt.dd create mode 100644 ld/testsuite/ld-x86-64/property-x86-empty.s create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt.s create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt1a-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt1a.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt1b-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt1b.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt2-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt2.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt3a.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt3b.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt4-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt4.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt5-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-ibt5.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk.s create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk1a-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk1a.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk1b-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk1b.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk2-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk2.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk3a.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk3b.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk4-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk4.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk5-x32.d create mode 100644 ld/testsuite/ld-x86-64/property-x86-shstk5.d First 500 lines of diff: diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f2f9b45..cdd6c35 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,188 @@ +2017-06-22 Eric Christopher + + * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than + abs to fix a truncation warning. + +2017-06-22 H.J. Lu + + * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk + is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK. + (elf_i386_link_setup_gnu_properties): If info->shstk is set, + turn on GNU_PROPERTY_X86_FEATURE_1_IBT. + * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If + info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK. + (elf_x86_64_link_setup_gnu_properties): If info->shstk is set, + turn on GNU_PROPERTY_X86_FEATURE_1_IBT. + +2017-06-22 H.J. Lu + + * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New. + (elf_i386_lazy_ibt_plt_entry): Likewise. + (elf_i386_pic_lazy_ibt_plt0_entry): Likewise. + (elf_i386_non_lazy_ibt_plt_entry): Likewise. + (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise. + (elf_i386_eh_frame_lazy_ibt_plt): Likewise. + (elf_i386_lazy_plt_layout): Likewise. + (elf_i386_non_lazy_plt_layout): Likewise. + (elf_i386_link_hash_entry): Add plt_second. + (elf_i386_link_hash_table): Add plt_second and + plt_second_eh_frame. + (elf_i386_allocate_dynrelocs): Use the second PLT if needed. + (elf_i386_size_dynamic_sections): Use .plt.got unwind info for + the second PLT. Check the second PLT. + (elf_i386_relocate_section): Use the second PLT to resolve + PLT reference if needed. + (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if + needed. + (elf_i386_finish_dynamic_sections): Set sh_entsize on the + second PLT. Generate unwind info for the second PLT. + (elf_i386_plt_type): Add plt_second. + (elf_i386_get_synthetic_symtab): Support the second PLT. + (elf_i386_parse_gnu_properties): Support + GNU_PROPERTY_X86_FEATURE_1_AND. + (elf_i386_merge_gnu_properties): Support + GNU_PROPERTY_X86_FEATURE_1_AND. If info->ibt is set, turn + on GNU_PROPERTY_X86_FEATURE_1_IBT + (elf_i386_link_setup_gnu_properties): If info->ibt is set, + turn on GNU_PROPERTY_X86_FEATURE_1_IBT. Use IBT-enabled PLT + for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT + is set on all relocatable inputs. + * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New. + (elf_x32_lazy_ibt_plt_entry): Likewise. + (elf_x86_64_non_lazy_ibt_plt_entry): Likewise. + (elf_x32_non_lazy_ibt_plt_entry): Likewise. + (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise. + (elf_x32_eh_frame_lazy_ibt_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_get_synthetic_symtab): Support the second PLT. + (elf_x86_64_parse_gnu_properties): Support + GNU_PROPERTY_X86_FEATURE_1_AND. + (elf_x86_64_merge_gnu_properties): Support + GNU_PROPERTY_X86_FEATURE_1_AND. If info->ibt is set, turn + on GNU_PROPERTY_X86_FEATURE_1_IBT + (elf_x86_64_link_setup_gnu_properties): If info->ibt is set, + turn on GNU_PROPERTY_X86_FEATURE_1_IBT. Use IBT-enabled PLT + for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT + is set on all relocatable inputs. + +2017-06-22 Nick Clifton + + PR binutils/21649 + * som.c (setup_sections): NUL terminate the space_strings buffer. + Check that the space.name field does not index beyond the end of + the space_strings buffer. + +2017-06-21 Nick Clifton + + PR binutils/21646 + * coff-sh.c (sh_reloc): Check for an out of range reloc. + +2017-06-21 Nick Clifton + + PR binutils/21639 + * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as + type of the size parameter. + (_bfd_vms_save_counted_string): Add second parameter - the maximum + length of the counted string. + * vms.h (_bfd_vms_save_sized_string): Update prototype. + (_bfd_vms_save_counted_string): Likewise. + * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to + _bfd_vms_save_counted_string. + (_bfd_vms_slurp_ehdr): Likewise. + (_bfd_vms_slurp_egsd): Likewise. + (Parse_module): Likewise. + +2017-06-21 Alan Modra + + * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt + calls before tocsave calls. + (ppc64_elf_relocate_section): Allow localentry:0 plt calls without + following nop. + +2017-06-21 Nick Clifton + + PR binutils/21645 + * reloc.c (bfd_generic_get_relocated_section_contents): Fail if + bfd_get_full_section_contents returns no contents. + +2017-06-21 Nick Clifton + + PR binutils/21638 + * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized + record. + +2017-06-21 Nick Clifton + + PR binutils/21637 + * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section + list. + (image_set_ptr): Likewise. + (alpha_vms_fix_sec_rel): Likewise. + (alpha_vms_slurp_relocs): Likewise. + +2017-06-21 Nick Clifton + + PR binutils/21633 + * ieee.c (ieee_slurp_sections): Check for a NULL return from + read_id. + (ieee_archive_p): Likewise. + (ieee_object_p): Likewise. + +2017-06-21 Nick Clifton + + PR binutils/21640 + * elf.c (setup_group): Zero the group section pointer list after + allocation so that loops can be caught. Check for NULL pointers + when processing a group list. + +2017-06-19 H.J. Lu + + PR ld/21626 + * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check + the DYNAMIC bit instead of bfd_count_sections. + +2017-06-19 Nick Clifton + + PR binutils/21618 + * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record + length. + (evax_bfd_print_eeom): Likewise. + (evax_bfd_print_egsd): Check for an overlarge record length. + (evax_bfd_print_etir): Likewise. + +2017-06-19 Nick Clifton + + PR binutils/21612 + * libieee.h (struct common_header_type): Add end_p field. + * ieee.c (this_byte_and_next): Do not advance input_p beyond + end_p. + (read_id): Check for a length that exceeds the remaining bytes in + the input buffer. + (ieee_seek): Initialise end_p. + (ieee_archive_p): Likewise. + (ieee_object_p): Likewise. + +2017-06-19 Nick Clifton + + PR binutils/21611 + * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset + before reading the EIHS structure entries. + +2017-06-19 Nick Clifton + + PR binutils/21615 + * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for + gsd_size. Check that there are enough bytes remaining to read the + type and size of the next egsd. Check that the size of the egsd + does not exceed the size of the record. + +2017-06-19 Alan Modra + + * config.bfd: Correct targ_underscore for cris. + 2017-06-18 Alan Modra * config.bfd: Correct targ_underscore for epiphany, ip2k, diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index dd8090c..26d296b 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -596,6 +596,9 @@ sh_reloc (bfd * abfd, && bfd_is_und_section (symbol_in->section)) return bfd_reloc_undefined; + if (addr > input_section->size) + return bfd_reloc_outofrange; + sym_value = get_symbol_value (symbol_in); switch (r_type) diff --git a/bfd/config.bfd b/bfd/config.bfd index f8a26f4..dc24aab 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -500,15 +500,13 @@ case "${targ}" in targ_underscore=yes ;; - cris-*-*) - targ_defvec=cris_aout_vec - targ_selvecs="cris_elf32_us_vec cris_elf32_vec ieee_vec" - targ_underscore=yes - ;; - - crisv32-*-*) + cris-*-* | crisv32-*-*) targ_defvec=cris_aout_vec targ_selvecs="cris_elf32_us_vec cris_elf32_vec ieee_vec" + case "${targ}" in + *-*-linux*) ;; + *) targ_underscore=yes ;; + esac ;; crx-*-elf*) diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c index 2d054dd..13d620d 100644 --- a/bfd/elf-properties.c +++ b/bfd/elf-properties.c @@ -318,7 +318,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info) /* Find the first relocatable ELF input with GNU properties. */ for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next) if (bfd_get_flavour (abfd) == bfd_target_elf_flavour - && bfd_count_sections (abfd) != 0 + && (abfd->flags & DYNAMIC) == 0 && elf_properties (abfd) != NULL) { has_properties = TRUE; @@ -342,7 +342,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info) /* Merge .note.gnu.property sections. */ for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next) - if (abfd != first_pbfd && bfd_count_sections (abfd) != 0) + if (abfd != first_pbfd && (abfd->flags & DYNAMIC) == 0) { elf_property_list *null_ptr = NULL; elf_property_list **listp = &null_ptr; diff --git a/bfd/elf.c b/bfd/elf.c index fb106e9..5f37e7f 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -613,6 +613,7 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) { num_group = (unsigned) -1; elf_tdata (abfd)->num_group = num_group; + elf_tdata (abfd)->group_sect_ptr = NULL; } else { @@ -625,8 +626,9 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) bfd_alloc2 (abfd, num_group, sizeof (Elf_Internal_Shdr *)); if (elf_tdata (abfd)->group_sect_ptr == NULL) return FALSE; - + memset (elf_tdata (abfd)->group_sect_ptr, 0, num_group * sizeof (Elf_Internal_Shdr *)); num_group = 0; + for (i = 0; i < shnum; i++) { Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i]; @@ -739,8 +741,14 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) for (i = 0; i < num_group; i++) { Elf_Internal_Shdr *shdr = elf_tdata (abfd)->group_sect_ptr[i]; - Elf_Internal_Group *idx = (Elf_Internal_Group *) shdr->contents; - unsigned int n_elt = shdr->sh_size / 4; + Elf_Internal_Group *idx; + unsigned int n_elt; + + if (shdr == NULL) + continue; + + idx = (Elf_Internal_Group *) shdr->contents; + n_elt = shdr->sh_size / 4; /* Look through this group's sections to see if current section is a member. */ diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 3bfe312..e499b0e 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -10508,7 +10508,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, /* PR 21523: Use an absolute value. The user of this reloc will have already selected an ADD or SUB insn appropriately. */ - value = abs (relocation); + value = labs (relocation); if (value >= 0x1000) return bfd_reloc_overflow; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 6636551..ee8219c 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -617,6 +617,60 @@ static const bfd_byte elf_i386_pic_non_lazy_plt_entry[NON_LAZY_PLT_ENTRY_SIZE] = 0x66, 0x90 /* xchg %ax,%ax */ }; +/* The first entry in an absolute IBT-enabled lazy procedure linkage + table looks like this. */ + +static const bfd_byte elf_i386_lazy_ibt_plt0_entry[LAZY_PLT_ENTRY_SIZE] = +{ + 0xff, 0x35, 0, 0, 0, 0, /* pushl GOT[1] */ + 0xff, 0x25, 0, 0, 0, 0, /* jmp *GOT[2] */ + 0x0f, 0x1f, 0x40, 0x00 /* nopl 0(%rax) */ +}; + +/* Subsequent entries for an absolute IBT-enabled lazy procedure linkage + table look like this. Subsequent entries for a PIC IBT-enabled lazy + procedure linkage table are the same. */ + +static const bfd_byte elf_i386_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] = +{ + 0xf3, 0x0f, 0x1e, 0xfb, /* endbr32 */ + 0x68, 0, 0, 0, 0, /* pushl immediate */ + 0xe9, 0, 0, 0, 0, /* jmp relative */ + 0x66, 0x90 /* xchg %ax,%ax */ +}; + +/* The first entry in a PIC IBT-enabled lazy procedure linkage table + look like. */ + +static const bfd_byte elf_i386_pic_lazy_ibt_plt0_entry[LAZY_PLT_ENTRY_SIZE] = +{ + 0xff, 0xb3, 4, 0, 0, 0, /* pushl 4(%ebx) */ + 0xff, 0xa3, 8, 0, 0, 0, /* jmp *8(%ebx) */ + 0x0f, 0x1f, 0x40, 0x00 /* nopl 0(%rax) */ +}; + +/* Entries for branches with IBT-enabled in the absolute non-lazey + procedure linkage table look like this. They have the same size + as the lazy PLT entry. */ + +static const bfd_byte elf_i386_non_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] = +{ + 0xf3, 0x0f, 0x1e, 0xfb, /* endbr32 */ + 0xff, 0x25, 0, 0, 0, 0, /* jmp *name@GOT */ + 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nopw 0x0(%rax,%rax,1) */ +}; + +/* Entries for branches with IBT-enabled in the PIC non-lazey procedure + linkage table look like this. They have the same size as the lazy + PLT entry. */ + +static const bfd_byte elf_i386_pic_non_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] = +{ + 0xf3, 0x0f, 0x1e, 0xfb, /* endbr32 */ + 0xff, 0xa3, 0, 0, 0, 0, /* jmp *name@GOT(%ebx) */ + 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nopw 0x0(%rax,%rax,1) */ +}; + /* .eh_frame covering the lazy .plt section. */ static const bfd_byte elf_i386_eh_frame_lazy_plt[] = @@ -656,6 +710,41 @@ static const bfd_byte elf_i386_eh_frame_lazy_plt[] = DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop }; +/* .eh_frame covering the lazy .plt section with IBT-enabled. */ + +static const bfd_byte elf_i386_eh_frame_lazy_ibt_plt[] = +{ + PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */ + 0, 0, 0, 0, /* CIE ID */ + 1, /* CIE version */ + 'z', 'R', 0, /* Augmentation string */ + 1, /* Code alignment factor */ + 0x7c, /* Data alignment factor */ + 8, /* Return address column */ + 1, /* Augmentation size */ + DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */ + DW_CFA_def_cfa, 4, 4, /* DW_CFA_def_cfa: r4 (esp) ofs 4 */ + DW_CFA_offset + 8, 1, /* DW_CFA_offset: r8 (eip) at cfa-4 */ + DW_CFA_nop, DW_CFA_nop, + + PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */ + PLT_CIE_LENGTH + 8, 0, 0, 0, /* CIE pointer */ + 0, 0, 0, 0, /* R_386_PC32 .plt goes here */ + 0, 0, 0, 0, /* .plt size goes here */ + 0, /* Augmentation size */ + DW_CFA_def_cfa_offset, 8, /* DW_CFA_def_cfa_offset: 8 */ + DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */ + DW_CFA_def_cfa_offset, 12, /* DW_CFA_def_cfa_offset: 12 */ + DW_CFA_advance_loc + 10, /* DW_CFA_advance_loc: 10 to __PLT__+16 */ + DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */ + 11, /* Block length */ + DW_OP_breg4, 4, /* DW_OP_breg4 (esp): 4 */ + DW_OP_breg8, 0, /* DW_OP_breg8 (eip): 0 */ + DW_OP_lit15, DW_OP_and, DW_OP_lit9, DW_OP_ge, + DW_OP_lit2, DW_OP_shl, DW_OP_plus, + DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop +}; + /* .eh_frame covering the non-lazy .plt section. */ static const bfd_byte elf_i386_eh_frame_non_lazy_plt[] = @@ -786,6 +875,34 @@ static const struct elf_i386_non_lazy_plt_layout elf_i386_non_lazy_plt = elf_i386_eh_frame_non_lazy_plt, /* eh_frame_plt */ sizeof (elf_i386_eh_frame_non_lazy_plt) /* eh_frame_plt_size */ }; + +static const struct elf_i386_lazy_plt_layout elf_i386_lazy_ibt_plt = + { + elf_i386_lazy_ibt_plt0_entry, /* plt0_entry */ + sizeof (elf_i386_lazy_ibt_plt0_entry), /* plt0_entry_size */ + 2, /* plt0_got1_offset */ + 8, /* plt0_got2_offset */ + elf_i386_lazy_ibt_plt_entry, /* plt_entry */ + LAZY_PLT_ENTRY_SIZE, /* plt_entry_size */ + 4+2, /* plt_got_offset */ + 4+1, /* plt_reloc_offset */ + 4+6, /* plt_plt_offset */ + 0, /* plt_lazy_offset */ + elf_i386_pic_lazy_ibt_plt0_entry, /* pic_plt0_entry */ + elf_i386_lazy_ibt_plt_entry, /* pic_plt_entry */ + elf_i386_eh_frame_lazy_ibt_plt, /* eh_frame_plt */ + sizeof (elf_i386_eh_frame_lazy_ibt_plt) /* eh_frame_plt_size */ + }; + +static const struct elf_i386_non_lazy_plt_layout elf_i386_non_lazy_ibt_plt = + { + elf_i386_non_lazy_ibt_plt_entry, /* plt_entry */ + elf_i386_pic_non_lazy_ibt_plt_entry,/* pic_plt_entry */ + LAZY_PLT_ENTRY_SIZE, /* plt_entry_size */ + 4+2, /* plt_got_offset */ + elf_i386_eh_frame_non_lazy_plt, /* eh_frame_plt */ + sizeof (elf_i386_eh_frame_non_lazy_plt) /* eh_frame_plt_size */ + }; /* On VxWorks, the .rel.plt.unloaded section has absolute relocations @@ -889,6 +1006,9 @@ struct elf_i386_link_hash_entry GOT and PLT relocations against the same function. */ union gotplt_union plt_got; + /* Information about the second PLT entry. */ + union gotplt_union plt_second; + /* Offset of the GOTPLT entry reserved for the TLS descriptor, starting at the end of the jump table. */ bfd_vma tlsdesc_got; @@ -937,6 +1057,8 @@ struct elf_i386_link_hash_table /* Short-cuts to get to dynamic linker sections. */ asection *interp; asection *plt_eh_frame; + asection *plt_second; + asection *plt_second_eh_frame; asection *plt_got; asection *plt_got_eh_frame; @@ -2644,12 +2766,29 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) here if it is defined and referenced in a non-shared object. */ if (h->type == STT_GNU_IFUNC && h->def_regular) - return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs, - &htab->readonly_dynrelocs_against_ifunc, - plt_entry_size, - (htab->plt.has_plt0 * + { + if (_bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs, + &htab->readonly_dynrelocs_against_ifunc, + plt_entry_size, + (htab->plt.has_plt0 * plt_entry_size), - 4, TRUE); + 4, TRUE)) + { + asection *s = htab->plt_second; + if (h->plt.offset != (bfd_vma) -1 && s != NULL) + { + /* Use the second PLT section if it is created. */ + eh->plt_second.offset = s->size; + + /* Make room for this entry in the second PLT section. */ + s->size += htab->non_lazy_plt->plt_entry_size; + } + + return TRUE; + } + else + return FALSE; + } hooks/post-receive -- Repository for Project Archer.