aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* x86: Also check x86 linker_def for non-shared definitiongentoo/binutils-2.31.1-7gentoo/binutils-2.31.1H.J. Lu2019-04-2411-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since elf_x86_linker_defined sets linker_def in elf_x86_link_hash_entry for linker defined symbols, SYMBOL_DEFINED_NON_SHARED_P should also check linker_def in elf_x86_link_hash_entry. bfd/ PR ld/24458 * elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): Also check x86 linker_def. ld/ PR ld/24458 * testsuite/ld-x86-64/x86-64.exp: Run PR ld/24458 tests. * testsuite/ld-x86-64/pr24458.s: New file. * testsuite/ld-x86-64/pr24458a-x32.d: Likewise. * testsuite/ld-x86-64/pr24458a.d: Likewise. * testsuite/ld-x86-64/pr24458b-x32.d: Likewise. * testsuite/ld-x86-64/pr24458b.d: Likewise. * testsuite/ld-x86-64/pr24458c-x32.d: Likewise. * testsuite/ld-x86-64/pr24458c.d: Likewise. (cherry picked from commit 4e84a8f8bbeab52fa7048873655e582ceb92534d) (cherry picked from commit bca6a14c568bd63080c85a6b05c90996e2bd4a34) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* PR24041, Invalid Memory Address Dereference in elf_link_add_object_symbolsgentoo/binutils-2.31.1-6Alan Modra2019-04-061-1/+1
| | | | | | | | | PR 24041 * elflink.c (elf_link_add_object_symbols): Don't segfault on crafted ET_DYN with no program headers. (cherry picked from commit 54025d5812ff100f5f0654eb7e1ffd50f2e37f5f) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Remove an abort in the bfd library and add a check for an integer overflow ↵Nick Clifton2019-04-061-1/+10
| | | | | | | | | | | | | when mapping sections to segments. PR 23932 * elf.c (IS_CONTAINED_BY_LMA): Add a check for a negative section size. (rewrite_elf_program_header): If no sections are mapped into a segment return an error. (cherry picked from commit beab453223769279cc1cef68a1622ab8978641f7) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Fix a memory exhaustion bug when attempting to allocate room for an ↵Nick Clifton2019-04-061-0/+5
| | | | | | | | | | impossible number of program headers. * elfcode.h (elf_object_p): Check for corrupt input files with more program headers than can actually fit in the file. (cherry picked from commit 5f60af5d24d181371d67534fa273dd221df20c07) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* PR23952, memory leak in _bfd_generic_read_minisymbolsAlan Modra2019-04-062-9/+13
| | | | | | | | | | | | | bfd/ PR 23952 * syms.c (_bfd_generic_read_minisymbols): Free syms before returning with zero symcount. binutils/ * nm.c (display_rel_file): Use xrealloc to increase minisyms for synthetic symbols. (cherry picked from commit c2f5dc30afa34696f2da0081c4ac50b958ecb0e9) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* PR24355, segmentation fault in function called from ppc_finish_symbolsAlan Modra2019-04-062-6/+9
| | | | | | | | | | | | | | | | | | | | | | | This one looks to be a bug going back to 2009, git commit e054468f6c "STT_GNU_IFUNC support for PowerPC". That bug was carried over with git commit 49c09209d0 "Rearrange PLT reloc output on powerpc". If the refcount for an ifunc local sym plt entry was zero, ppc_elf_size_dynamic_sections would correctly set plt.offset to -1 but leave glink_offset uninitialized. That leads to occasional segfaults (which can be made solid with MALLOC_PERTURB_=1 when using glibc). So, guard the write_glink_stub call with plt.offset != -1. Also, remove the totally ineffective attempt at writing multiple-use glink stubs only once. PR 24355 * elf32-ppc.c (ppc_finish_symbols): Don't call write_glink_stub for local iplt syms with ent->plt.offset == -1. Remove ineffective attempt at writing glink stubs only once. (cherry picked from commit 8cd1fe1bf525b59f4d07e5790d11d49eee7e8494) (cherry picked from commit dba17838ab20a814e6c8ba51afe6962d1c400227) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* gas: Pass max_bytes to TC_FRAG_INITH.J. Lu2019-03-242-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ommit 3ae729d5a4f63740ed9a778960b17c2912b0bbdd Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Mar 7 04:18:45 2018 -0800 x86: Rewrite NOP generation for fill and alignment increased MAX_MEM_FOR_RS_ALIGN_CODE to 4095 which resulted in increase of assembler time and memory usage by 5 times for inputs with many .p2align directives, which is typical for LTO output. This patch passes max_bytes to TC_FRAG_INIT so that MAX_MEM_FOR_RS_ALIGN_CODE can be set as needed and tracked by backend it so that HANDLE_ALIGN can check the maximum alignment for each rs_align_code frag. Wall time to assemble the same cc1plus.s: before: 423.78user 0.89system 7:05.71elapsed 99%CPU after: 102.35user 0.27system 1:42.89elapsed 99%CPU PR gas/24165 * config/tc-i386.h (MAX_MEM_FOR_RS_ALIGN_CODE): Set to (alignment ? ((1 << alignment) - 1) : 1) (i386_tc_frag_data): Add max_bytes. (TC_FRAG_INIT): Track max_chars in max_bytes. (HANDLE_ALIGN): Replace MAX_MEM_FOR_RS_ALIGN_CODE with fragP->tc_frag_data.max_bytes. (cherry picked from commit db22231044df03bbcb987496f3f29f0462b2e9ee) (cherry picked from commit 292144de4f26e2c6a1fa9d84da2c7758872d4725) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x86-64: Restore PIC check for PCREL reloc against protected symbolH.J. Lu2019-03-248-54/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit bd7ab16b4537788ad53521c45469a1bdae84ad4a Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Feb 13 07:34:22 2018 -0800 x86-64: Generate branch with PLT32 relocation removed check R_X86_64_PC32 relocation against protected symbols in shared objects. Since elf_x86_64_check_relocs is called after we have seen all input files, we can check for PC-relative relocations in elf_x86_64_check_relocs. We should not allow PC-relative relocations against protected symbols since address of protected function and location of protected data may not be in the shared object. bfd/ PR ld/24151 * elf64-x86-64.c (elf_x86_64_need_pic): Check SYMBOL_DEFINED_NON_SHARED_P instead of def_regular. (elf_x86_64_relocate_section): Move PIC check for PC-relative relocations to ... (elf_x86_64_check_relocs): Here. (elf_x86_64_finish_dynamic_symbol): Use SYMBOL_DEFINED_NON_SHARED_P to check if a symbol is defined in a non-shared object. * elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): New. ld/ PR ld/24151 * testsuite/ld-x86-64/pr24151a-x32.d: New file. * testsuite/ld-x86-64/pr24151a.d: Likewise. * testsuite/ld-x86-64/pr24151a.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr24151a and pr24151a-x32. (cherry picked from commit 83924b3846361f2f76f9a6e7b5afa01c0eebbd4f) (cherry picked from commit c83ac8021a7649c148cb344870d8ce711eecc3c6) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* SPARC: fix PR ld/18841Eric Botcazou2019-03-243-2/+71
| | | | | | | | | | | | | | | | | | | | This fixes the last ld failures on SPARC64/Linux: FAIL: Run pr18841 with libpr18841b.so FAIL: Run pr18841 with libpr18841c.so FAIL: Run pr18841 with libpr18841bn.so (-z now) FAIL: Run pr18841 with libpr18841cn.so (-z now) by mimicing what has been done on x86-64 and Aarch64 to fix the PR. bfd/ PR ld/18841 * elf32-sparc.c (elf32_sparc_reloc_type_class): Return reloc_class_ifunc for ifunc symbols. * elf64-sparc.c (elf64_sparc_reloc_type_class): Likewise. (cherry picked from commit 1532a937c64105681d74055389f0e846244fb830) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Visium: fix bogus overflow check on 32-bit hostsEric Botcazou2019-03-242-7/+11
| | | | | | | | | bfd/ * elf32-visium.c (visium_elf_howto_parity_reloc): Minor tweak. <R_VISIUM_PC16>: Use explicit range test to detect an overflow. (cherry picked from commit 1c92e98f548b70b08f01cf512ed755ef84e6f223) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Visium: align branch absolute instruction for the GR6Eric Botcazou2019-03-247-10/+41
| | | | | | | | | | | | | | | | This is done in order to avoid a pipeline hazard on the GR6. gas/ * config/tc-visium.c (md_assemble) <mode_cad>: Align instruction on 64-bit boundaries for the GR6. * testsuite/gas/visium/allinsn_gr6.s: Tweak. * testsuite/gas/visium/allinsn_gr6.d: Likewise. * testsuite/gas/visium/bra-1.d: New test. * testsuite/gas/visium/bra-1.s: Likewise. * testsuite/gas/visium/visium.exp: Run bra-1 test. (cherry picked from commit 262935666bb35e3434a4708262c6e5e120a5df12) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Skip ld/pr23169 on SPARC.Eric Botcazou2019-03-242-1/+7
| | | | | | | | | The test is already skipped on PowerPC and Aarch64 because it's invalid. * testsuite/ld-ifunc/ifunc.exp: Skip pr23169 on SPARC. (cherry picked from commit d43a04899779ad5b7d83ded8e0b3d124ccbac6fb) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Automatic date update in version.ingentoo/binutils-2.31.1-5GDB Administrator2018-12-151-1/+1
| | | | | (cherry picked from commit 2b05e5e2064c4aad54c0fbb3e48af41f2aa7d8dc) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* PR23788, objcopy: failed to find link sectionAlan Modra2018-12-152-9/+17
| | | | | | | | | | | | | Symbol tables can change when a number of objcopy options are used. I figure string tables are similarly changeable. PR 23788 * elf.c (section_match): Don't require a size match for SHT_SYMTAB or SHT_STRTAB. (cherry picked from commit ac85e67c053f1555def2c111962f4e68740794f9) (cherry picked from commit 2e05e3e689f25b7b866c49435417b1ded33f7ac7) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Correct gas/ChangeLog entry for PR gas/23968H.J. Lu2018-12-151-1/+1
| | | | | | (cherry picked from commit e771f7a770b07c676958247464962614266da755) (cherry picked from commit 0c362c8126bf3bc54430ce9e8d4b0a19da23bc0b) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x86: Put back BFD_RELOC_X86_64_GOTPCRELH.J. Lu2018-12-156-0/+39
| | | | | | | | | | | | | | | | | Put back BFD_RELOC_X86_64_GOTPCREL in TC_FORCE_RELOCATION_LOCAL, which was removed by commit 56ceb5b5405af23eddd12e12d8ba849010120324 Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Oct 22 04:49:20 2015 -0700 Add R_X86_64_[REX_]GOTPCRELX support to gas and ld by accident. (cherry picked from commit 9f52eab6a7a69870c7b5907a20b0305f30dbf2ae) (cherry picked from commit 66a4daef5d40076674ee4478c93bd76750114221) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Automatic date update in version.inGDB Administrator2018-12-071-1/+1
| | | | | (cherry picked from commit 384d2d7eee78c8642b29fd6583ccb0a9c45c5581) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* elf: Don't merge .note.gnu.property section in IRH.J. Lu2018-12-072-1/+8
| | | | | | | | | | | | | .note.gnu.property section in IR inputs should be ignored. Don't merge them. PR ld/23929 * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Don't merge .note.gnu.property section in IR inputs. (cherry picked from commit ffd9e4d0225d45d1603d09e06151c388589e063f) (cherry picked from commit d97f1f87b31901ccdb711ec88a0ab792c31d1f60) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Automatic date update in version.ingentoo/binutils-2.31.1-4GDB Administrator2018-11-301-1/+1
| | | | | (cherry picked from commit 081de957bc9c24c706b06b94ffd65f9b4544e62f) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* PR23937, powerpc64le local ifunc IRELATIVE relocs are wrongAlan Modra2018-11-306-1/+90
| | | | | | | | | | | | | | | | | | IFUNC resolvers must always be called via their global entry point. They will be called from ld.so rather than from the local executable. PR 23937 bfd/ * elf64-ppc.c (write_plt_relocs_for_local_syms): Don't add local entry offset for ifuncs. ld/ * testsuite/ld-powerpc/pr23937.d, * testsuite/ld-powerpc/pr23937.s: New test. * testsuite/ld-powerpc/powerpc.exp: Run it. (cherry picked from commit ba85c15dabe144e4bcee5a1b388b32bee10729e1) (cherry picked from commit 0f494b01431de53959dd72ccfed06a01d5172e3f) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* AArch64: Fix regression in Cortex A53 erratum when PIE. (PR ld/23904)Tamar Christina2018-11-306-5/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for PR ld/22263 causes TLS relocations using ADRP to be relaxed into MOVZ, however this causes issues for the erratum code. The erratum code scans the input sections looking for ADRP instructions and notes their location in the stream. It then later tries to find them again in order to generate the linker stubs. Due to the relaxation it instead finds a MOVZ and hard aborts. Since this relaxation is a valid one, and in which case the erratum no longer applies, it shouldn't abort but instead just continue. This changes the TLS relaxation code such that when it finds an ADRP and it relaxes it, it removes the erratum entry from the work list by changing the stub type into none so the stub is ignored. The entry is not actually removed as removal is a more expensive operation and we have already allocated the memory anyway. The clearing is done for IE->LE and GD->LE relaxations, and a testcase is added for the IE case. The GD case I believe to be impossible to get together with the erratum sequence due to the required BL which would break the sequence. However to cover all basis I have added the guard there as well. build on native hardware and regtested on aarch64-none-elf, aarch64-none-elf (32 bit host), aarch64-none-linux-gnu, aarch64-none-linux-gnu (32 bit host) Cross-compiled and regtested on aarch64-none-linux-gnu, aarch64_be-none-linux-gnu Testcase in PR23940 tested and works as expected now and benchmarks ran on A53 showing no regressions and no issues. bfd/ChangeLog: PR ld/23904 * elfnn-aarch64.c (_bfd_aarch64_adrp_p): Use existing constants. (_bfd_aarch64_erratum_843419_branch_to_stub): Use _bfd_aarch64_adrp_p. (struct erratum_835769_branch_to_stub_clear_data): New. (_bfd_aarch64_erratum_843419_clear_stub): New. (clear_erratum_843419_entry): New. (elfNN_aarch64_tls_relax): Use it. (elfNN_aarch64_relocate_section): Pass input_section. (aarch64_map_one_stub): Handle branch type none as valid. ld/ChangeLog: PR ld/23904 * testsuite/ld-aarch64/aarch64-elf.exp: Add erratum843419_tls_ie. * testsuite/ld-aarch64/erratum843419_tls_ie.d: New test. * testsuite/ld-aarch64/erratum843419_tls_ie.s: New test. (cherry picked from commit 9fca35fc3486283562a7fcd9eb0ff845b0152d98) (cherry picked from commit 513092d696472fc06cf7812e14160e16b2da5286) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* [ARC] More fixes for TLS.Cupertino Miranda2018-11-303-44/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added warning for static TLS reloc. Fixed issue related to TLS and partial static linking of libraries: This issue was detected when throwing exceptions in C++ while linking with -static-libstdc++. TLS relocation from the libstdc++ wasn't being patched as local now that it was static linked with the executable. Fix for TLS with static and pie. Problem introduced by earlier patch: Fixes the following glibc tests: - elf/tst-tls1-static bfd/ xxxx-xx-xx Cupertino Miranda <cmiranda@synopsys.com> * arc-got.h (arc_got_entry_type_for_reloc): Changed to correct static TLS relocs. * elf32-arc.c (elf_arc_check_relocs): Introduced warning to TLS relocs which require -fPIC. (arc_create_forced_local_got_entries_for_tls): Created. Traverses list of GOT entries to be resolved statically when needed. (elf_arc_finish_dynamic_sections): Changed. Calls arc_create_forced_local_got_entries_for_tls for each known possibly GOT symbol. (cherry picked from commit 6ce881c15fc463ffbdac55c6e7295422fd49abf9) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* [ARC] Fix local got entry list.Claudiu Zissulescu2018-11-303-19/+26
| | | | | | | | | | | | | | | | Fix a memory leak appearing when the local got entry list was constructed. bfd/ xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com> * arc-got.h (arc_get_local_got_ents): Revamp it; use elf_local_got_ents to store the local got list. (get_got_entry_list_for_symbo): Restructure it. * elf32-arc.c (elf_arc_relocate_section): Correct the call to get_got_entry_list_for_symbol. (cherry picked from commit 231c5ff116b70a68e7c3689006cec4fea0ecd575) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* [ARC] Fixed issue with DTSOFF relocs.Cupertino Miranda2018-11-304-7/+19
| | | | | | | | | | | | | | | | Inserted offset in final section in the GOT entry of type DTSOFF soon to be relocated by the dynamic loader. bfd/ 2018-09-06 Cupertino Miranda <cmiranda@synopsys.com> * arc-got.h (relocate_fix_got_relocs_for_got_info): Changed. Take TLS section alignment in consideration for this relocation. * elf32-arc.c (FINAL_SECTSTART): Added this formula macro. (ARC_TLS_DTPOFF) Updated reloc to use new created macro instead. (cherry picked from commit 7b39c09faf95961ac141960a3449c0960a43e96b) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* [ARC] Fixes TLS failures related to tls-align.Cupertino Miranda2018-11-305-3/+25
| | | | | | | | | | | | | | | | | | | This patch fixes glibc testcase in nptl/tls-align. bfd/ 2018-08-01 Cupertino Miranda <cmiranda@synopsys.com> * arc-got.h (relocate_fix_got_relocs_for_got_info): Changed, fixed TCB_SIZE offsize to include section alignment. * elf32-arc.c (arc_special_overflow_checks): Likewise. include/ 2018-08-01 Cupertino Miranda <cmiranda@synopsys.com> * arc-reloc.def (ARC_TLS_LE_32): Updated reloc formula. (cherry picked from commit b6aef10de46ead5f6028f2f2fa7d4aa275da025e) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* [ARC] PLT information was still being generated when symbol was forced_local.Cupertino Miranda2018-11-302-1/+9
| | | | | | | | | | | | A change upstream reveiled this issue, triggering an assert when linking glibc. bfd/ 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (elf_arc_check_relocs): Changed. (cherry picked from commit 06006c374b1766073fdc17704c6284232ee204d1) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* [ARC] Make sure global symbol is not an indirect or warning.Cupertino Miranda2018-11-302-2/+14
| | | | | | | | | | | | | | | Problem identified in the context of glibc with latest upstream binutils. Dynamic symbol space was being reserved but, no actual information for the symbol was being set. Data for the symbol was kept initialized with -1. No easy test case was possible to be created. bfd/ 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (elf_arc_check_relocs): Changed. (cherry picked from commit 3ee995cd6ea600693097c393493b587b3474a7d1) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* [ARC] Improved robustness. Return FALSE in case of NULL pointer.Cupertino Miranda2018-11-302-0/+10
| | | | | | | | | | | bfd/ 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> * elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case arc_htab is NULL. (cherry picked from commit 7ea48e7d9d133f262855cd4947f0cf0c610a2b17) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* [ARC] Refactored location where GOT information is collected.Cupertino Miranda2018-11-303-37/+56
| | | | | | | | | | | | | | | | | Change location where GOT information is collected for ARC target, avoiding posible use conflicts of the previous .got field in the symbols hash_entry. bfd/ 2018-03-01 Cupertino Miranda <cmiranda@synopsys.com> * arc-got.h (get_got_entry_list_for_symbol): Changed. * ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed. (elf_arc_link_hash_newfunc): Changed. (arc_elf_link_hash_table_create): Removed old initializations. (elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed. (cherry picked from commit b80393e2751e2a3a11fcdee7247034e35ec9a4f6) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x86: Disable GOT relaxation with data prefixH.J. Lu2018-11-3010-7/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since linker GOT relaxation isn't valid for 16-bit GOT access, we should disable GOT relaxation with data prefix. gas/ PR gas/23854 * config/tc-i386.c (output_disp): Disable GOT relaxation with data prefix. * testsuite/gas/i386/mixed-mode-reloc32.d: Updated. ld/ PR gas/23854 * testsuite/ld-i386/i386.exp: Run pr23854. * testsuite/ld-x86-64/x86-64.exp: Likewwise. * testsuite/ld-i386/pr23854.d: New file. * testsuite/ld-i386/pr23854.s: Likewwise. * testsuite/ld-i386/pr23854.d: Likewwise. * testsuite/ld-x86-64/pr23854.d: Likewwise. * testsuite/ld-x86-64/pr23854.s: Likewwise. (cherry picked from commit e60f4d3bdac25f02875afe36b7436bc2dfbbb978) (cherry picked from commit 1929a39655d77686385913ef63c6c4340bb2d729) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* When assigning symbol version, we should hide debug symbols defined in ↵Nick Clifton2018-11-308-1/+50
| | | | | | | | | | | | | | | | | discarded sections from IR objects so that they can be removed later. bfd PR ld/23818 * elflink.c (_bfd_elf_link_assign_sym_version): Hide symbols defined in discarded input sections. ld * testsuite/ld-plugin/lto.exp: Run PR ld/23818 test. * testsuite/ld-plugin/pr23818.d: New file. * testsuite/ld-plugin/pr23818.t: Likewise. * testsuite/ld-plugin/pr23818a.c: Likewise. * testsuite/ld-plugin/pr23818b.c: Likewise. (cherry picked from commit 84fdbf1a2c901965414eafc96e3bd15fc72ac123) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Arm: Skip new binary decode tests on pe targetsTamar Christina2018-11-303-2/+7
| | | | | | | | | | | | | | | The two new test I added require the use of the ".inst" directive which the PE targets don't support. Because of that I excluded *-unknown-pe but the mask needs to be wider. I am now excluding *-*-pe. gas/ChangeLog: * testsuite/gas/arm/undefined-insn-arm.d: Widen pe skip. * testsuite/gas/arm/undefined-insn-thumb.d: Likewise. (cherry picked from commit bacb77d0188ff37bacdbb211edd7e2419406b864) (cherry picked from commit fa6e5eabf907e4d134a9c1ce37ed06459d79eb93) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Arm: Fix disassembler crashing on -b binary when thumb file and thumb not ↵Tamar Christina2018-11-306-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | forced. The disassembler for Arm has some aborts in it in places it assumes can never be reached. Under normal circumstances they indeed cannot be reached because the right options are selected from the ARM attributes in the ELF file. However when disassembling with -b binary then if you do not get the options right the disassembler just aborts. This changes it so it just prints how it was trying to interpret the instruction and prints UNKNOWN instructions next to it. This way the user has an idea of what's going. gas/ChangeLog: * testsuite/gas/arm/undefined-insn-arm.d: New test. * testsuite/gas/arm/undefined-insn-thumb.d: New test. * testsuite/gas/arm/undefined-insn.s: New test. opcodes/ChangeLog: * arm-dis.c (UNKNOWN_INSTRUCTION_32BIT): Format specifier for arm mode. (UNKNOWN_INSTRUCTION_16BIT): Format specifier for thumb mode. (print_insn_arm, print_insn_thumb16, print_insn_thumb32): Use them. (cherry picked from commit 0b347048e7e33070212a408dc2371075ee60b556) (cherry picked from commit f9369f95fb2dbeea186b0cafb27775b92fced4b9) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* AArch64: Fix error checking for SIMD udot (by element)Matthew Malcomson2018-11-306-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Committed on behalf of Matthew Malcomson: The SIMD UDOT instruction assembly has an unusual operand that selects a single 32 bit element with the mnemonic 4B. This unusual mnemonic is handled by a special operand qualifier and associated qualifier data in `aarch64_opnd_qualifiers`. The current qualifier data describes 4 1-byte elements with the structure {1, 4, 0x0, "4b", OQK_OPD_VARIANT} This makes sense, as the instruction does work on 4 1-byte elements, however some logic in the `operand_general_constraint_met_p` makes assumptions about the range of index allowed when selecting a SIMD_ELEMENT depending on element size. That function reasons that e.g. in order to select a byte-sized element in a 16 byte V register an index must allow selection of one of the 16 elements and hence its range will be in [0,15]. This reasoning breaks with the above description of a 4 part selection of 1 byte elements and allows an index outside the valid [0,3] range, triggering an assert later on in the program in `aarch64_ins_reglane`. vshcmd: > echo 'udot v0.2s, v1.8b, v2.4b[4]' | ../src/binutils-build/gas/as-new -march=armv8.4-a as-new: ../../binutils-gdb/opcodes/aarch64-asm.c:134: aarch64_ins_reglane: Assertion `reglane_index < 4' failed. {standard input}: Assembler messages: {standard input}:1: Internal error (Aborted). Please report this bug. This patch changes the operand qualifier data so that it describes a single 32 bit element. {4, 1, 0x0, "4b", OQK_OPD_VARIANT} Hence the calculation in `operand_general_constraint_met_p` provides the correct answer and the usual error checking machinery is used. vshcmd: > echo 'udot v0.2s, v1.8b, v2.4b[4]' | ../src/binutils-build/gas/as-new -march=armv8.4-a {standard input}: Assembler messages: {standard input}:1: Error: register element index out of range 0 to 3 at operand 3 -- `udot v0.2s,v1.8b,v2.4b[4]' (cherry picked from commit 66e6f0b760c2480e4ebdac8169adcee1fc31f689) (cherry picked from commit da87a761d7071c25a382559b483a59f1fa539111) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x86: Add Intel ENCLV to assembler and disassemblerH.J. Lu2018-11-309-1/+33
| | | | | | | | | | | | | | | | | | | gas/ * testsuite/gas/i386/se1.s: Add enclv. * testsuite/gas/i386/x86-64-se1.s: Likewise. * testsuite/gas/i386/se1.d: Updated. * testsuite/gas/i386/x86-64-se1.d: Likewise. opcodes/ * i386-dis.c (rm_table): Add enclv. * i386-opc.tbl: Add enclv. * i386-tbl.h: Regenerated. (cherry picked from commit a4e78aa5fed5ba2cc343c76b78d062291a6fb659) (cherry picked from commit 1ae25bf8c2b5164e8a7e581cc4a72d692f4fd85a) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Fix Aarch64 bug in warning filtering.Tamar Christina2018-11-302-1/+6
| | | | | | | | | | | | | | | | | | | | | | This fixes a small bug with the warning filtering code, which when a line has generated a warning and a template decode error (due to the way templates are resolved) which would not have been emitted and warnings are being suppressed with -W it would erroneously emit the error. I have no testcase for this because the only places we generate warnings during encoding/decoding now is using msr/mrs and system registers. They don't have a template that would trigger this. However an upcoming patch series will have tests in it which would expose this bug. gas/ChangeLog: * config/tc-aarch64.c (output_operand_error_report): Apply filtering to current instead of head message. (cherry picked from commit af81c43b51e17c597c8eb5bfaa02fa7f5f6dbe72) (cherry picked from commit dd17be4dffc2707659194ecfd2e686a5d6b52ace) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Improve the code in the assembler to detect and reject a duplicate input and ↵Robert Yang2018-11-302-7/+27
| | | | | | | | | output file. * as.c (main): Improve check for input file matching output file. (cherry picked from commit bdfdf1717407e4857fe671f902434273a71b4fe1) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* elf: Check for corrupt symbol version infoH.J. Lu2018-11-304-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BFD linker with PR ld/23499 may generate shared libraries with corrupt symbol version info which leads to linker error when the corrupt shared library is used: /usr/bin/ld: bin/libKF5Service.so.5.49.0: _edata: invalid version 21 (max 0) /usr/bin/ld: bin/libKF5Service.so.5.49.0: error adding symbols: bad value Add check for corrupt symbol version info to objdump: 00000000000af005 g D .data 0000000000000000 <corrupt> _edata and readelf: 728: 00000000000af005 0 NOTYPE GLOBAL DEFAULT 25 _edata@<corrupt> (5) bfd/ PR ld/23499 * elf.c (_bfd_elf_get_symbol_version_string): Return _("<corrupt>") for corrupt symbol version info. binutils/ PR ld/23499 * readelf.c (get_symbol_version_string): Return _("<corrupt>") for corrupt symbol version info. (cherry picked from commit 7a815dd566f3dd32435ac73aa0a0cc948d525e06) (cherry picked from commit edd27c67f5f4d04331394d295806e697e606bbdb) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Always clear h->verinfo.verdef when overriding a dynamic definitionH.J. Lu2018-11-302-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When linker defines a symbol to override a dynamic definition, it should always clear h->verinfo.verdef so that the symbol won't be associated with the version information from the dynamic object. This happened to the symbol "_edata" when creating an unversioned dynamic object linking against: 1. libKF5ConfigCore.so.5.49.0 2. libKF5CoreAddons.so.5.49.0 3. libKF5I18n.so.5.49.0 4. libKF5DBusAddons.so.5.49.0 5. libQt5Xml.so.5.11.1 6. libQt5DBus.so.5.11.1 7. libQt5Core.so.5.11.1 Among them libQt5Xml.so.5.11.1 299: 000000000003e000 0 NOTYPE GLOBAL DEFAULT 18 _edata@@Qt_5 libQt5DBus.so.5.11.1 597: 0000000000092018 0 NOTYPE GLOBAL DEFAULT 18 _edata@@Qt_5 libQt5Core.so.5.11.1 2292: 00000000004df640 0 NOTYPE GLOBAL DEFAULT 21 _edata@Qt_5 2293: 00000000004df640 0 NOTYPE GLOBAL DEFAULT 21 _edata@Qt_5 The problem is triggered by 2 duplicated entries of _edata@Qt_5 in libQt5Core.so.5.11.1 which was created by gold. Before this commit, ld created the dynamic object with "_edata" in its dynamic symbol table which was linker defined and associated with the version information from libQt5Core.so.5.11.1. The code in question was there when the binutils source was imported to sourceware.org. When such a dynamic object was used later, we got: /usr/bin/ld: bin/libKF5Service.so.5.49.0: _edata: invalid version 21 (max 0) /usr/bin/ld: bin/libKF5Service.so.5.49.0: error adding symbols: bad value Tested with many ELF targets. PR ld/23499 * elflink.c (bfd_elf_record_link_assignment): Always clear h->verinfo.verdef when overriding a dynamic definition. (cherry picked from commit 48e30f5238c70e738f44474d595c476ef4e4ec38) (cherry picked from commit 76db6c1ac2cb4102e5551ab822afd84d88bb37aa) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* ld-x86-64/pr23486b.d: Swap pr23486a.s and pr23486a.sH.J. Lu2018-11-302-1/+5
| | | | | | | | | | Swap pr23486a.s and pr23486a.s so that pr23486b.d differs from pr23486a.d. * testsuite/ld-x86-64/pr23486b.d: Swap pr23486a.s and pr23486a.s. (cherry picked from commit 988daa317c01a610b5298bbcd80be8642ee66094) (cherry picked from commit a69de9c7cf6b9ce51eab20fc0d6499459a0e2ca8) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x86: Properly add X86_ISA_1_NEEDED propertyH.J. Lu2018-11-306-7/+66
| | | | | | | | | | | | | | | | | | | | | | | | Existing properties may be removed during property merging. We avoid adding X86_ISA_1_NEEDED property only if existing properties won't be removed. bfd/ PR ld/23428 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Don't add X86_ISA_1_NEEDED property only if existing properties won't be removed. ld/ PR ld/23428 * testsuite/ld-elf/dummy.s: New file. * testsuite/ld-elf/linux-x86.S: Add X86_FEATURE_1_AND property. * testsuite/ld-elf/linux-x86.exp: Add dummy.s to pr23428. (cherry picked from commit ab9e342807d132182892de1be1a92d6e91a5c1da) (cherry picked from commit 28a27bdbb9500797e6767f80c8128b09112aeed5) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x86: Replace evex-no-scale.s with evex-no-scale-[32|64].sH.J. Lu2018-11-305-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | .if is_64bit vmovaps -1024(%rip), %zmm0 vmovaps 64(,%rax), %zmm0 vmovaps 64(,%riz), %zmm0 .endif doesn't with i686-elf cross binutils on 64-bit hosts: evex-no-scale.s: Assembler messages: evex-no-scale.s:10: Error: bad register name `%rip)' evex-no-scale.s:11: Error: bad register name `%rax)' evex-no-scale.s:12: Error: bad register name `%riz)' This patch replaces evex-no-scale.s with evex-no-scale-32.s and evex-no-scale-64.s. * testsuite/gas/i386/evex-no-scale-32.d: Don't use evex-no-scale.s. * testsuite/gas/i386/evex-no-scale-64.d: Likewise. * testsuite/gas/i386/evex-no-scale-32.s: New file. * testsuite/gas/i386/evex-no-scale-64.s: Likewise. * testsuite/gas/i386/evex-no-scale.s: Removed. (cherry picked from commit 19449d7c67690c641b1ec9c13ff3531677a5afcc) (cherry picked from commit d6922904447698fa59bc3a7d544b82207a2451b8) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x86: Properly merge GNU_PROPERTY_X86_ISA_1_USEDH.J. Lu2018-11-3031-47/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without the GNU_PROPERTY_X86_ISA_1_USED property, all ISAs may be used. If a bit in the GNU_PROPERTY_X86_ISA_1_USED property is unset, the corresponding x86 instruction set isn’t used. When merging properties from 2 input files and one input file doesn't have the GNU_PROPERTY_X86_ISA_1_USED property, the output file shouldn't have it neither. This patch removes the GNU_PROPERTY_X86_ISA_1_USED property if an input file doesn't have it. This patch replaces the GNU_PROPERTY_X86_ISA_1_USED property with the GNU_PROPERTY_X86_ISA_1_NEEDED property which is the minimum ISA requirement. bfd/ PR ld/23486 * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove GNU_PROPERTY_X86_ISA_1_USED if an input file doesn't have it. (_bfd_x86_elf_link_setup_gnu_properties): Adding the GNU_PROPERTY_X86_ISA_1_NEEDED, instead of GNU_PROPERTY_X86_ISA_1_USED, property. ld/ PR ld/23486 * testsuite/ld-i386/i386.exp: Run PR ld/23486 tests. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr23486a.d: New file. * testsuite/ld-i386/pr23486b.d: Likewise. * testsuite/ld-x86-64/pr23486a-x32.d: Likewise. * testsuite/ld-x86-64/pr23486a.d: Likewise. * testsuite/ld-x86-64/pr23486a.s: Likewise. * testsuite/ld-x86-64/pr23486b-x32.d: Likewise. * testsuite/ld-x86-64/pr23486b.d: Likewise. * testsuite/ld-x86-64/pr23486b.s: Likewise. * testsuite/ld-i386/property-3.r: Remove "x86 ISA used". * testsuite/ld-i386/property-4.r: Likewise. * testsuite/ld-i386/property-5.r: Likewise. * testsuite/ld-i386/property-x86-ibt3a.d: Likewise. * testsuite/ld-i386/property-x86-ibt3b.d: Likewise. * testsuite/ld-i386/property-x86-shstk3a.d: Likewise. * testsuite/ld-i386/property-x86-shstk3b.d: Likewise. * testsuite/ld-x86-64/property-3.r: Likewise. * testsuite/ld-x86-64/property-4.r: Likewise. * testsuite/ld-x86-64/property-5.r: Likewise. * testsuite/ld-x86-64/property-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-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. (cherry picked from commit f7309df20c4e787041cedc4a6aced89c15259e54) (cherry picked from commit d55c3e36094f06bb1fb02f5eac19fdccf1d91f7e) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x86: Update assembler tests for non-ELF targetsH.J. Lu2018-11-302-2/+9
| | | | | | | | | | | | | evex-no-scale.s has ELF directive: .section .probe, "", @progbits * testsuite/gas/i386/i386.exp: Run evex-no-scale-32 and evex-no-scale-64 only for ELF targets. (cherry picked from commit 99c2d522f7a7259947aa84c1b385a7c8147fa46c) (cherry picked from commit 381c1eb6ec7bf11e67f30764a0e115e044564db8) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* x32: Align the .note.gnu.property section to 4 bytesH.J. Lu2018-11-302-0/+9
| | | | | | | | | | | The .note.gnu.property section should be aligned to 4 bytes for x32. * testsuite/ld-x86-64/property-x86-3.s: Use ".p2align 2" to align .note.gnu.property section if __64_bit__ is undefined. (cherry picked from commit 39aac631baa1c5c540d16e45b64c2813a14f95b0) (cherry picked from commit 9b075c7167d68d656c8197b17ccdb4e3c6fbdc5c) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* __tls_get_addr_opt stubs and tocsave optimizationAlan Modra2018-11-302-9/+17
| | | | | | | | | | | | | | | | | | | This patch fixes a bug in the handling of the __tls_get_addr_opt stub. Calls via this stub don't have a toc restoring instruction following the "bl", and the stub itself doesn't have an initial toc save instruction. Thus it is incorrect to skip over the first instruction when a __tls_get_addr call is marked with a tocsave reloc. * elf64-ppc.c (ppc64_elf_relocate_section): Don't skip first instruction of __tls_get_addr_opt stub. (plt_stub_size): Omit ALWAYS_EMIT_R2SAVE condition when dealing with __tls_get_addr_opt stub. (build_tls_get_addr_stub, ppc_size_one_stub): Likewise. (cherry picked from commit e81b4c933c1b88e29f4b27627dd9ea0bf9189944) (cherry picked from commit 4aa5eb02fd8e394e7128a78018b780fb566da81d) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Re: PowerPC64 __tls_get_addr_opt stub .eh_frame fixAlan Modra2018-11-302-1/+6
| | | | | | | | | | | | | | | | | The modified test failed on some powerpc targets due to differences in default hash style. If the default hash style is both, then more sections are created, bumping section ids. Section id is used in stub symbols and although the test is careful to not depend on id in labels, the stub hash traversal order changes when stub names change. That lead to the stubs being emitted in a different order and thus not matching expected output. * testsuite/ld-powerpc/powerpc.exp: Run tlsopt5 with hash-style specified. (cherry picked from commit a67ae9b01af7eb2b1f8e5c517338a4b12167ce40) (cherry picked from commit 95fbde6791dd4b7821a40cbbc985a257e4819fdb) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* PowerPC64 __tls_get_addr_opt stub .eh_frame fixAlan Modra2018-11-307-67/+103
| | | | | | | | | | | | | | | | | | | | | | | | | This patch sets stub_offset in ppc_size_one_stub rather than in ppc_build_one_stub. That allows the plt stub alignment to be done in just ppc_size_one_stub rather than both functions. The patch also corrects the place where the alignment was done, fixing a possible error in .eh_frame data, and tidies some offset calculations. bfd/ * elf64-ppc.c (plt_stub_pad): Delay plt_stub_size call until needed. (ppc_build_one_stub): Don't set stub_offset, instead assert that it is sane. Don't adjust stub_offset for alignment. Adjust size calculation. Use "targ" temp when calculating offsets. (ppc_size_one_stub): Set stub_offset here. Use "targ" temp when calculating offsets. Adjust for alignment before setting tls_get_addr_opt_bctrl. ld/ * testsuite/ld-powerpc/powerpc.exp: Run tlsopt5 with plt alignment. * testsuite/ld-powerpc/tlsopt5.s: Add extra call. * testsuite/ld-powerpc/tlsopt5.wf: Adjust expected output. * testsuite/ld-powerpc/tlsopt5.d: Likewise. (cherry picked from commit 079a6882b523cfd10709c6f2da89584698abd686) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Updated Bulgarian translation for the ld/ directoryNick Clifton2018-11-302-54/+58
| | | | | (cherry picked from commit 1d8f56a971396b403f2f4f42f94d4d236252c479) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
* Add --warn-drop-version option; by default, do not warn when discarding ↵Cary Coutant2018-11-303-5/+16
| | | | | | | | | | | | version info. gold/ PR gold/23455 * options.h (General_options): Add --warn-drop-version option. * symtab.cc (Symbol_table::set_dynsym_indexes): Check it. (cherry picked from commit b7991db94c9dabb42a7a0fc5b0a0fb1997d85586) Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>