summaryrefslogtreecommitdiff
path: root/ld
Commit message (Collapse)AuthorAgeFilesLines
* Update PO filesAlan Modra2017-07-1218-2681/+7930
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd/ * po/es.po: Update from translationproject.org/latest/bfd/. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/ja.po: Likewise. * po/ro.po: Likewise. * po/ru.po: Likewise. * po/sr.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise. * po/hr.po: New file from translationproject.org. * configure.ac (ALL_LINGUAS): Add hr. Sort. * configure: Regenerate. binutils/ * po/bg.po: Update from translationproject.org/latest/binutils/. * po/ca.po: Likewise. * po/da.po: Likewise. * po/es.po: Likewise. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/hr.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/ja.po: Likewise. * po/ro.po: Likewise. * po/ru.po: Likewise. * po/sk.po: Likewise. * po/sr.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise. * po/zh_TW.po: Likewise. gas/ * po/es.po: Update from translationproject.org/latest/gas/. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/ja.po: Likewise. * po/ru.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/zh_CN.po: Likewise. gold/ * po/es.po: Update from translationproject.org/latest/gold/. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise. * po/ja.po: New file from translationproject.org. * po/sv.po: Likewise. * po/uk.po: Likewise. gprof/ * po/bg.po: Update from translationproject.org/latest/gprof/. * po/da.po: Likewise. * po/de.po: Likewise. * po/eo.po: Likewise. * po/es.po: Likewise. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/ga.po: Likewise. * po/hu.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/ja.po: Likewise. * po/ms.po: Likewise. * po/nl.po: Likewise. * po/pt_BR.po: Likewise. * po/ro.po: Likewise. * po/ru.po: Likewise. * po/sr.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. ld/ * po/bg.po: Update from translationproject.org/latest/ld/. * po/da.po: Likewise. * po/es.po: Likewise. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/ja.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise. * po/zh_TW.po: Likewise. * po/de.po: New file from translationproject.org. * po/ru.po: Likewise. * configure.ac (ALL_LINGUAS): Add de, ru. Sort. * configure: Regenerate. opcodes/ * po/da.po: Update from translationproject.org/latest/opcodes/. * po/de.po: Likewise. * po/es.po: Likewise. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/nl.po: Likewise. * po/pt_BR.po: Likewise. * po/ro.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise.
* rs6000 testsuite updateAlan Modra2017-07-1211-10/+22
| | | | | | | | | | | | | * testsuite/ld-scripts/align.exp: Exclude powerpc*-*-aix*. * testsuite/ld-scripts/assign-loc.d: Likewise. * testsuite/ld-scripts/defined3.d: Likewise. * testsuite/ld-scripts/defined4.d: Likewise. * testsuite/ld-scripts/defined5.d: Likewise. * testsuite/ld-scripts/expr2.d: Likewise. * testsuite/ld-scripts/provide.exp: Likewise. * testsuite/ld-scripts/sane1.d: Likewise. * testsuite/ld-scripts/size.exp: Likewise. * testsuite/ld-scripts/defined2.d: Don't xfail rs6000-*-aix*.
* bfd_error_handler bfd_vma and bfd_size_type argsAlan Modra2017-07-123-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch uses the new %L _bfd_error_handler support for printing bfd_vma arguments, and fixes a many other format and/or argument errors in error messages. bfd/ * binary.c (binary_set_section_contents): Don't print filepos in error message. (coff_write_object_contents): Cast size_t for error message. (coff_slurp_line_table): Don't use bfd_vma symndx. (coff_slurp_reloc_table): Remove unneeded cast. * dwarf2.c (read_section): Cast bfd_int64_t to long long for error message. (find_abstract_instance_name): Likewise. * elf32-arm.c (arm_type_of_stub): Correct error arg order. (bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg. (elf32_arm_check_relocs): Make r_symndx an int. * elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in format string. * elf32-metag.c (elf_metag_relocate_section): Delete extra error message arg. * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus error message. * elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise. * elf32-tilepro.c (tilepro_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise. * elfnn-riscv.c (riscv_elf_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise. * elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args and use %lu for error message. * elflink.c (elf_link_adjust_relocs): Delete extra error message arg. * mmo.c (mmo_scan): Make stab_loc a file_ptr. Cast expression for error message. * elf32-arm.c (elf32_arm_tls_relax): Correct format string and args in error message. (elf32_arm_final_link_relocate): Likewise. * coff-arm.c (bfd_arm_process_before_allocation): Likewise. * coffcode.h (styp_to_sec_flags): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise. * elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise. * elf32-bfin.c (bfinfdpic_check_relocs): Likewise. (elf32_bfin_merge_private_bfd_data): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise. * elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise. (i370_elf_relocate_section): Likewise. * elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise. * elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise. * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise. * elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise. * elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise. (_bfd_mips_elf_merge_private_bfd_data): Likewise. * ieee.c (ieee_write_id, read_id): Likewise. * mach-o.c (bfd_mach_o_write_contents): Likewise. (bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise. (bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise. (bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise. * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise. * stabs.c (_bfd_link_section_stabs): Likewise. * coff-arm.c (coff_arm_relocate_section): Use L modifier in error format. * coff-mcore.c (coff_mcore_relocate_section): Likewise. * coff-ppc.c (coff_ppc_relocate_section): Likewise. * coff-rs6000.c (xcoff_reloc_type_toc): Likewise. * coff-sh.c (sh_relax_section): Likewise. (sh_relax_delete_bytes, sh_swap_insns): Likewise. * coff-tic80.c (coff_tic80_relocate_section): Likewise. * coffcode.h (coff_slurp_reloc_table): Likewise. * coffgen.c (_bfd_coff_get_external_symbols): Likewise. (_bfd_coff_read_string_table): Likewise. * cofflink.c (_bfd_coff_generic_relocate_section): Likewise. * compress.c (bfd_get_full_section_contents): Likewise. * dwarf2.c (read_formatted_entries, decode_line_info): Likewise. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf.c (bfd_elf_string_from_elf_section): Likewise. * elf32-arc.c (arc_special_overflow_checks): Likewise. * elf32-arm.c (elf32_arm_tls_relax): Likewise. (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise. (elf32_arm_write_section): Likewise. * elf32-bfin.c (bfin_relocate_section): Likewise. (bfinfdpic_relocate_section): Likewise. * elf32-hppa.c (hppa_build_one_stub): Likewise. (final_link_relocate, elf32_hppa_relocate_section): Likewise. * elf32-i386.c (elf_i386_tls_transition): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ip2k.c (ip2k_final_link_relocate): Likewise. * elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-metag.c (elf_metag_relocate_section): Likewise. * elf32-nds32.c (unrecognized_reloc_msg): Likewise. (nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise. (nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise. (nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise. (nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise. (nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise. (nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise. (nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise. (nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise. * elf32-nios2.c (nios2_elf32_relocate_section): Likewise. * elf32-rx.c (UNSAFE_FOR_PID): Likewise. * elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise. * elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise. * elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise. * elf32-sh.c (sh_elf_relax_section): Likewise. (sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise. (sh_elf_relocate_section): Likewise. * elf32-sh64.c (shmedia_prepare_reloc): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise. * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise. * elf32-v850.c (v850_elf_relax_section): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. (extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise. (compute_text_actions, compute_ebb_proposed_actions): Likewise. (do_fix_for_relocatable_link): Likewise. * elf64-alpha.c (elf64_alpha_relax_got_load): Likewise. (elf64_alpha_relax_with_lituse): Likewise. * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise. (elf_hppa_final_link_relocate): Likewise. * elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise. (elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise. (elf64_vms_link_add_object_symbols): Likewise. * elf64-mmix.c (mmix_elf_perform_relocation): Likewise. (mmix_final_link_relocate): Likewise. * elf64-s390.c (invalid_tls_insn): Likewise. (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise. (elf_x86_64_relocate_section): Likewise. * elfcode.h (elf_slurp_symbol_table): Likewise. * elfcore.h (elf_core_file_p): Likewise. * elflink.c (elf_link_read_relocs_from_section): Likewise. * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise. (elfNN_aarch64_relocate_section): Likewise. * elfnn-ia64.c (elfNN_ia64_relax_section): Likewise. (elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise. * elfnn-riscv.c (riscv_elf_relocate_section): Likewise. * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. (_bfd_mips_elf_relocate_section): Likewise. (_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise. * ieee.c (ieee_slurp_external_symbols): Likewise. * ihex.c (ihex_write_object_content): Likewise. * mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise. * merge.c (_bfd_merged_section_offset): Likewise. * mmo.c (mmo_write_loc_chunk): Likewise. (mmo_write_object_contents): Likewise. * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise. * stabs.c (_bfd_link_section_stabs): Likewise. * xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise. ld/ * testsuite/ld-arc/nps-1b.err: Update. * testsuite/ld-x86-64/ilp32-11.d: Update.
* Support single digit GCC versionH.J. Lu2017-07-112-1/+7
| | | | | | | | | On Fedora 26, "g++ -dumpversion" displays "7", instead of "7.1.1". Update selective.exp to support single digit GCC version. Also remove duplicated [4-9] version check. * testsuite/ld-selective/selective.exp: Support single digit GCC version.
* [AArch64] Use "#pass" instead of "#..." to filter multiple linesJiong Wang2017-07-112-2/+6
| | | | | | ld/ * testsuite/ld-aarch64/dt_textrel.d: Use "#pass" instead of ".*" to filter out remaining lines.
* MIPS/LD: Fix a segfault from ELF `e_flags' access with non-ELF output BFDMaciej W. Rozycki2017-07-076-6/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a commit 861fb55ab50a ("Defer allocation of R_MIPS_REL32 GOT slots"), <https://sourceware.org/ml/binutils/2008-08/msg00096.html>, regression and a more recent: FAIL: ld-unique/pr21529 new LD test case failure, observed with all the relevant MIPS targets whenever the linker is invoked with one or more ELF inputs and the output format set to `binary'. The culprit is a segmentation fault caused in `mips_before_allocation' by a null pointer dereference, where an attempt is made to access the ELF file header's `e_flags' member, for the purpose of determining whether to produce a PLT and copy relocations, without first checking that the output BFD is ELF. The `e_flags' member is stored in BFD's private data pointed to by `tdep', which in the case of the `binary' BFD is null, causing the segmentation fault. With other non-ELF BFDs such as SREC `tdep' is not null and consequently no crash may happen and in that case random data will be interpreted as it was `e_flags'. Disable the access to `e_flags' then and all the associated checks and consequently never produce a PLT and copy relocations if output is not a MIPS ELF BFD, matching `_bfd_mips_elf_merge_private_bfd_data' that does not process `e_flags' in that case either and therefore does not let us decide here anyway if all the input objects included in the link are suitable for use with a PLT and copy relocations. ld/ * emultempl/mipself.em (mips_before_allocation): Avoid ELF processing if not MIPS ELF. * testsuite/ld-mips-elf/binary.d: New test. * testsuite/ld-mips-elf/binary.ld: New test linker script. * testsuite/ld-mips-elf/binary.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
* Make ppc476 testcases more robustAlan Modra2017-07-074-9/+15
| | | | | | * testsuite/ld-powerpc/ppc476-shared.lnk: Align .bss. * testsuite/ld-powerpc/ppc476-shared.d: Adjust. * testsuite/ld-powerpc/ppc476-shared2.d: Adjust.
* Apply ld/Makefile.in patch to the correct fileAlan Modra2017-07-072-0/+5
| | | | | | Makefile.in is generated. * Makefile.am (eelf64_s390.c): Depend on emultempl/s390.em.
* Regenerate configure.Tristan Gingold2017-07-042-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bfd/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * version.m4: Bump version to 2.29.51 * configure: Regenerate. binutils/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gas/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gprof/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. ld/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. opcodes/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate.
* Add markers.Tristan Gingold2017-07-042-0/+6
| | | | | | | | | | | | | | | | | binutils/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.29. gas/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.29. ld/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.29.
* Regenerate pot files.Tristan Gingold2017-07-032-468/+476
|
* MIPS/GAS: Use non-zero frag offset directly in PIC branch relaxationMaciej W. Rozycki2017-07-017-0/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use frag symbols with a non-zero offset directly in `fix_new_exp' calls made in PIC branch relaxation. There is no need here to make a helper symbol to hold the result of a `symbol+offset' calculation requested as only branches to local symbols are relaxed and in this case the LO16 part of the PIC address load sequence will have the offset accounted for in calculation against the local GOT entry retrieved as the GOT16 high part. Consequently actual code produed is identical whether a helper symbol is used or the original `symbol+offset' expression used directly. Verify that this is indeed the case with GAS and LD tests. gas/ * config/tc-mips.c (md_convert_frag): Don't make a helper expression symbol for `fix_new_exp' called with a non-zero offset. * testsuite/gas/mips/relax-offset.d: New test. * testsuite/gas/mips/mips1@relax-offset.d: New test. * testsuite/gas/mips/r3000@relax-offset.d: New test. * testsuite/gas/mips/r3900@relax-offset.d: New test. * testsuite/gas/mips/micromips@relax-offset.d: New test. * testsuite/gas/mips/relax-offset.l: New stderr output. * testsuite/gas/mips/relax-offset.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-mips-elf/relax-offset.dd: New test. * testsuite/ld-mips-elf/relax-offset.gd: New test. * testsuite/ld-mips-elf/relax-offset-umips.dd: New test. * testsuite/ld-mips-elf/relax-offset-umips.gd: New test. * testsuite/ld-mips-elf/relax-offset.ld: New test linker script. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests. (prune_warnings): New temporary procedure.
* MIPS: Add new Imagination interAptiv MR2 GAS and LD testsMaciej W. Rozycki2017-06-282-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add GAS tests to verify Imagination interAptiv MR2 instruction assembly, disassembly and ELF object file flags. Add LD tests to verify Imagination interAptiv MR2 ELF object file link-time compatibility and flag merging/propagation. Use the framework enhancement added with commit 7575e6a752ec ("MIPS/LD/testsuite: mips-elf-flags: Add MIPS ABI Flags handling"). gas/ * testsuite/gas/mips/elf_mach_interaptiv-mr2.d: New test. * testsuite/gas/mips/save-err.d: New test. * testsuite/gas/mips/save-sub.d: New test. * testsuite/gas/mips/interaptiv-mr2@save.d: New test. * testsuite/gas/mips/mips1@save-sub.d: New test. * testsuite/gas/mips/mips2@save-sub.d: New test. * testsuite/gas/mips/mips3@save-sub.d: New test. * testsuite/gas/mips/mips4@save-sub.d: New test. * testsuite/gas/mips/mips5@save-sub.d: New test. * testsuite/gas/mips/mips32@save-sub.d: New test. * testsuite/gas/mips/mips64@save-sub.d: New test. * testsuite/gas/mips/mips16@save-sub.d: New test. * testsuite/gas/mips/mips16e@save-sub.d: New test. * testsuite/gas/mips/r3000@save-sub.d: New test. * testsuite/gas/mips/r3900@save-sub.d: New test. * testsuite/gas/mips/r4000@save-sub.d: New test. * testsuite/gas/mips/vr5400@save-sub.d: New test. * testsuite/gas/mips/interaptiv-mr2@save-sub.d: New test. * testsuite/gas/mips/sb1@save-sub.d: New test. * testsuite/gas/mips/octeon2@save-sub.d: New test. * testsuite/gas/mips/octeon3@save-sub.d: New test. * testsuite/gas/mips/xlr@save-sub.d: New test. * testsuite/gas/mips/r5900@save-sub.d: New test. * testsuite/gas/mips/mips16e2-copy.d: New test. * testsuite/gas/mips/mips16e2-copy-err.d: New test. * testsuite/gas/mips/save.d: Remove `MIPS16e' from the `name' option. Adjust for trailing padding change. * testsuite/gas/mips/mips16e2-copy-err.l: New stderr output. * testsuite/gas/mips/save-sub.s: New test source. * testsuite/gas/mips/mips16e2-copy.s: New test source. * testsuite/gas/mips/mips16e2-copy-err.s: New test source. * testsuite/gas/mips/save.s: Update description, change trailing padding and remove trailing white space. * testsuite/gas/mips/mips.exp: Expand `save' and `save-err' tests across the regular MIPS interAptiv MR2 architecture. Run the new tests. ld/ * testsuite/ld-mips-elf/mips-elf-flags.exp: Add interAptiv MR2 tests.
* Fix PR 13402Senthil Kumar Selvaraj2017-06-273-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix incorrect adjustment of diff relocs when relaxing, and thus the resulting source line to address mismatch. Fix two issues when adjusting diff relocs to account for deleted bytes. 1. Don't adjust the difference if the end address is the shrinked insn's address i.e. use < instead of <=. The relaxation code deletes count bytes from or after shrinked_insn_address, so the difference between start_address and end_address should remain unchanged in this case. 2. Adjust the reloc addend if the difference is to be adjusted and symval + reloc addend is past the shrinked insn address. This is because for a typical sym1 - sym2 diff reloc, sym1 is .text + irel->r_addend, and the addend should be reduced to account for the shrinked insn. For example, assume the reloc value is .text + 0x8 with .text = 0, the diff value in the object file = 0x4, and shrinked_insn_address = 0x4 with count = 0x2. Then the existing code writes 0x2 into the object file to account for the deleted bytes, as shrinked_insn_address lies between 0x8 and 0x8 - 0x4 = 0x4, but leaves the addend as is. The next time the reloc is looked at, the code sees if a shrinked_insn_address lies between 0x8 and 0x8 - 0x2 = 0x6, instead of 0x6 and 0x4. If there happens to be one, then the diff value in the object file ends up getting reduced again. bfd/ 2017-06-27 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> PR ld/13402 * elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust reloc addend if necessary. Adjust diff only if shrinked_insn_address < end_address. ld/ 2017-06-27 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> PR ld/13402 * testsuite/ld-avr/pr13402.d: New test. * testsuite/ld-avr/pr13402.s: New test.
* MIPS/LD/testsuite: mips-elf-flags: Add MIPS ABI Flags handlingMaciej W. Rozycki2017-06-272-3/+56
| | | | | | | | | | | | | | | | | | | | | | | | Complement commit 351cdf24d223 ("[MIPS] Implement O32 FPXX, FP64 and FP64A ABI extensions") and add optional MIPS ABI Flags handling to `good_combination' in the `mips-elf-flags.exp' test script. This lets callers of this procedure request to examine MIPS ABI Flags in addition to the `e_flags' member of the ELF file header so as to verify that flags are merged correctly by LD. The presence of further arguments triggers this verification, in which case `readelf' is called with the `-A' option additionally specified and the ISA member, the ISA Extension member and the ASEs member will be examined as per the arguments. Unlike with `readelf -h' output consider a failure to retrieve the member requested a test case failure rather than an unresolved result. This is because unlike with the `e_flags' member of the ELF file header which is always there in any valid ELF file the MIPS ABI Flags structure is optional in LD output and the absence of this structure when expected is surely a bug in LD. ld/ * testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination): Add an `args' final argument and examination code for `readelf -A' output. Update procedure description accordingly.
* MIPS/LD/testsuite: mips-elf-flags: Use `remote_exec' to call `readelf'Maciej W. Rozycki2017-06-272-2/+12
| | | | | | | | | | | | | | | For ELF file header flag verification done in `good_combination' in the `mips-elf-flags.exp' test script the version of `readelf' built along with the rest of binutils has to be used rather than any such executable already present on the build system, so that flags recognized by the tool match those supported by LD being tested. Use `remote_exec' as elsewhere in the LD test framework and also with GAS and LD used here, getting and arranging for extra reporting of `readelf' calls included in test logs on this occasion as well. ld/ * testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination): Use `remote_exec' to call `readelf'. Log the command issued.
* MIPS/LD/testsuite: mips-elf-flags: Use `-h' only with `readelf'Maciej W. Rozycki2017-06-272-2/+7
| | | | | | | | | | | | | | For the purpose of link-time object compatibility handling verification code in the `good_combination' procedure from the `mips-elf-flags.exp' test script only examines the `e_flags' member of the ELF file header and ignores data from any ELF program or section headers present. Use `readelf -h' rather than `readelf --headers' then to obtain data for examination, avoiding unnecessary processing to extract this extraneous information. ld/ * testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination): Use `readelf -h' rather than `readelf --headers'.
* MIPS/BFD: Consistently mark the LSI CW4010 as a MIPS II processorMaciej W. Rozycki2017-06-263-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make BFD agree with GAS and mark the LSI MiniRISC CW4010 processor core (for an odd reason referred to as LSI R4010 across our code base) as a MIPS II processor in BFD as well, fixing a bug that has been there since forever and addressing linker warnings like: $ as -m4010 empty.s -o 4010.o $ ld -r 4010.o -o 4010-r.o ld: 4010.o: warning: Inconsistent ISA between e_flags and .MIPS.abiflags $ due to the ISA level being recorded as MIPS III in ELF file header's `e_flags' vs MIPS II in the MIPS ABI Flags section: $ readelf -Ah 4010.o ELF Header: Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, big endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: MIPS R3000 Version: 0x1 Entry point address: 0x0 Start of program headers: 0 (bytes into file) Start of section headers: 348 (bytes into file) Flags: 0x20821000, 4010, o32, mips3 Size of this header: 52 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 40 (bytes) Number of section headers: 11 Section header string table index: 10 Attribute Section: gnu File Attributes Tag_GNU_MIPS_ABI_FP: Hard float (double precision) MIPS ABI Flags Version: 0 ISA: MIPS2 GPR size: 32 CPR1 size: 32 CPR2 size: 0 FP ABI: Hard float (double precision) ISA Extension: LSI R4010 ASEs: None FLAGS 1: 00000000 FLAGS 2: 00000000 $ Available documentation[1][2] clearly indicates the LSI CW4010 processor is only backwards compatible with the MIPS R4000 processor as far as the latter's 32-bit instructions are concerned and consequently can only be considered a MIPS II ISA implementation (with vendor extensions). This fixes an LD testsuite failure: FAIL: MIPS incompatible objects: "-march=r4010 -32" "-march=r4650 -32" triggered for the `mips-sgi-irix5' and `mips-sgi-irix6' targets. References: [1] Paul Cobb, Bob Caulk, Joe Cesana, "The MiniRISC CW4010: A Superscalar MIPS Processor ASIC Core", LSI Logic, July 1995, presented at Hot Chips VII, Stanford University, Stanford, California, August 1995 [2] "MiniRISC MR4010 Superscalar Microprocessor Reference Device", LSI Logic, November 1996, Doc. No. DB09-000028-00, Order No. C15017 bfd/ * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit. * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'. (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending `bfd_mach_mips6000' rather than `bfd_mach_mips4000'. ld/ * testsuite/ld-mips-elf/lsi-4010-isa.d: New test. * ld/testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
* LD: Fix .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIXMaciej W. Rozycki2017-06-265-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Correct .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIX targets, complementing commit dc74becf498f ("ld: Add tests for -Ur") and commit da614360f520 ("ld: Add tests for .startof.SECNAME/.sizeof.SECNAME") with subsequent updates, and in reference to commit cbd0eecf261c ("Always define referenced __start_SECNAME/__stop_SECNAME") and commit 7dba9362c172 ("Rewrite __start and __stop symbol handling"). These targets set the STT_OBJECT type for non-function symbol references, according to `elf_frob_symbol' code in gas/config/obj-elf.c: /* The Irix 5 and 6 assemblers set the type of any common symbol and any undefined non-function symbol to STT_OBJECT. We try to be compatible, since newer Irix 5 and 6 linkers care. However, we only set undefined symbols to be STT_OBJECT if we are on Irix, because that is the only time gcc will generate the necessary .global directives to mark functions. */ if (S_IS_COMMON (symp)) symbol_get_bfdsym (symp)->flags |= BSF_OBJECT; if (strstr (TARGET_OS, "irix") != NULL && ! S_IS_DEFINED (symp) && (symbol_get_bfdsym (symp)->flags & BSF_FUNCTION) == 0) symbol_get_bfdsym (symp)->flags |= BSF_OBJECT; and consequently entries in the symbol table listing from `readelf' produced with these tests do not match the NOTYPE pattern expected, causing test suite failures: FAIL: ld-elf/sizeofa FAIL: ld-elf/sizeofc FAIL: ld-elf/startofa FAIL: ld-elf/startofc specifically with the `mips-sgi-irix5' and `mips-sgi-irix6' targets. Given that it does not matter for the feature covered by these tests whether the type of the symbols produced is STT_NOTYPE or STT_OBJECT adjust the problematic cases to accept either type, removing the failures observed. ld/ * testsuite/ld-elf/sizeofa.d: Also accept the OBJECT type for the symbols examined. * testsuite/ld-elf/sizeofc.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofc.d: Likewise.
* Add pgste marker changelogAndreas Krebbel2017-06-261-0/+8
|
* Don't attach linker created section to --just-syms bfdAlan Modra2017-06-262-4/+12
| | | | | | | | | | | | | | | | | | | | | All sections on a --just-syms bfd are discarded from the output, so attaching linker created sections to such a bfd results in errors. In other cases, like the .note.GNU-stack check, it's wrong to have a --just-syms object potentially affect the output. bfd/ * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj a --just-syms bfd. (_bfd_elf_size_group_sections): Skip --just-syms bfds. (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and .preinit_array on --just-syms bfds. (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds. (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise. (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Skip --just-syms bfds when looking for a place to attach .note.gnu.build-id and .eh_frame_hdr sections. Delete dead code.
* [ARM] Add linker support for ARMv8-RThomas Preud'homme2017-06-248-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | === Context === This patch is part of a patch series to add support for ARMv8-R architecture. Its purpose is to add support for ARMv8-R in the linker. === Patch description === This patch is composed of 3 changes: 1) The main change is the addition of the logic for merging a file whose Tag_CPU_arch build attribute is 15 (ARMv8-R). Namely, all pre-ARMv8 are merged into ARMv8-R as well as ARMv8-R itself. ARMv8-A (14) merges into ARMv8-A. ARMv8-M Baseline (16) and Mainline (17) are not allowed to merge merge with ARMv8-R. Note that merging only occurs if the two profiles are identical or one is S (Application or Realtime) and the other is R. 2) using_thumb_only, using_thumb2_bl, using_thumb2 and arch_has_arm_nop are updated according to capabilities of ARMv8-R and their BFD_ASSERT updated to reflect that the logic is valid for ARMv8-R. 3) 2 build attribute merging tests are added to test the first change. 2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * elf32-arm.c (using_thumb_only): Update list of architectures in BFD_ASSERT for which the logic is valid. (using_thumb2_bl): Likewise. (using_thumb2): Likewise and return true for ARMv8-R. (arch_has_arm_nop): Likewise. (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch merging logic. Update commentis for value 15 of v8m_baseline, v8m_mainline and v4t_plus_v6_m arrays. Use v8r array to decide merging of value 15 of Tag_CPU_arch. ld/ * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 11): New test. (EABI attribute merging 12): Likewise. * testsuite/ld-arm/attr-merge-11a.s: New file. * testsuite/ld-arm/attr-merge-11b.s: New file. * testsuite/ld-arm/attr-merge-11.attr: New file. * testsuite/ld-arm/attr-merge-12a.s: New file. * testsuite/ld-arm/attr-merge-12b.s: New file. * testsuite/ld-arm/attr-merge-12.attr: New file.
* S/390: Add support for pgste markerAndreas Krebbel2017-06-235-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new S/390 specific segment type: PT_S390_PGSTE. For binaries marked with that segment the kernel will allocate 4k page tables. The only user so far will be qemu. ld/ChangeLog: 2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * Makefile.in: Add s390.em as build dependency. * emulparams/elf64_s390.sh (EXTRA_EM_FILE): Add s390.em. * emultempl/s390.em: New file. * gen-doc.texi: Add documentation for --s390-pgste option. * ld.texinfo: Likewise. include/ChangeLog: 2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf/s390.h (PT_S390_PGSTE): Define macro. binutils/ChangeLog: 2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * readelf.c (get_s390_segment_type): Add support for the new segment type PT_S390_PGSTE. (get_segment_type): Call get_s390_segment_type. elfcpp/ChangeLog: 2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elfcpp.h (enum PT): Add PT_S390_PGSTE to enum. bfd/ChangeLog: 2017-06-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * elf-s390.h: New file. * elf64-s390.c (struct elf_s390_link_hash_table): Add params field. (elf_s390_additional_program_headers): New function. (elf_s390_modify_segment_map): New function. (bfd_elf_s390_set_options): New function. (elf_backend_additional_program_headers) (elf_backend_modify_segment_map): Add macro definitions.
* i386: Add hidden weak undefined testsH.J. Lu2017-06-223-0/+47
| | | | | * testsuite/ld-i386/i386.exp: Run weakundef1 tests. * testsuite/ld-i386/weakundef1.c: New file.
* Pass $NOPIE_CFLAGS to ELF visibility testsH.J. Lu2017-06-222-2/+9
| | | | | | PR ld/21090 * testsuite/ld-elfvsb/elfvsb.exp (visibility_run): Pass $NOPIE_CFLAGS if non-PIE is required.
* Pass $NOPIE_CFLAGS/$NOPIE_LDFLAGS to "Run pr19031"H.J. Lu2017-06-222-2/+9
| | | | | | PR ld/21090 * testsuite/ld-i386/i386.exp: Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to "Run pr19031".
* Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to more ELF testsH.J. Lu2017-06-225-19/+38
| | | | | | | | | | | | | 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.
* x86: Support Intel Shadow Stack with SHSTK propertyH.J. Lu2017-06-2229-1/+306
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* x86: Support Intel IBT with IBT property and IBT-enable PLTH.J. Lu2017-06-2275-2/+1746
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to some ELF testsH.J. Lu2017-06-212-8/+17
| | | | | | | | 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.
* Pass $NOPIE_CFLAGS to NOCROSSREFS testsH.J. Lu2017-06-212-2/+9
| | | | | | PR ld/21090 * testsuite/ld-scripts/crossref.exp: Also pass $NOPIE_CFLAGS to CC.
* Add missing ChangeLog entriesH.J. Lu2017-06-211-0/+10
|
* Pass $NOPIE_LDFLAGS size testsH.J. Lu2017-06-215-15/+29
| | | | | | 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.
* PowerPC64 tocsave testcasesAlan Modra2017-06-219-0/+129
| | | | | | | | | | | * 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.
* Check the DYNAMIC bit for input shared objectsH.J. Lu2017-06-193-0/+42
| | | | | | | | | | | | | | | | | 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.
* is_underscore_target for ld-elf testsAlan Modra2017-06-1828-95/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and correct targ_underscore in config.bfd bfd/ * config.bfd: Correct targ_underscore for epiphany, ip2k, m32c, mn10200, pru, rl78, rx, crisv32 and v850. ld/ * testsuite/lib/ld-lib.exp (is_underscore_target): New. * testsuite/ld-elf/elf.exp (ASFLAGS): Define UNDERSCORE. * testsuite/ld-elf/pr21562a.s: If UNDERSCORE defined, reference sym with prefix. * testsuite/ld-elf/pr21562b.s: Likewise. * testsuite/ld-elf/sizeof.s: Likewise. * testsuite/ld-elf/startof.s: Likewise. * testsuite/ld-elf/pr14156a.d: Adjust for extra symbols. * testsuite/ld-elf/pr21562a.d: Remove underscore target from xfails, and match prefixed symbol. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-elf/sizeofa.d: Likewise. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/sizeofc.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise. * testsuite/ld-elf/startofc.d: Likewise.
* Rewrite __start and __stop symbol handlingAlan Modra2017-06-1621-224/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This arranges for __start and __stop symbols to be defined before garbage collection, for all target formats. That should allow the COFF and PE --gc-sections to keep a singleton orphan input section, a feature lost by 2017-06-13 commit cbd0eecf26. The fancier ELF treatment of keeping all input sections associated with a __start or __stop symbol, from 2015-10-23 commit 1cce69b9dc, is retained. .startof. and .sizeof. symbols are deliberately not defined before garbage collection, so these won't affect garbage collection of sections. The patch also ensures __start, __stop, .startof. and .sizeof. symbols are defined before target size_dynamic_sections is called, albeit with a preliminary value, so that target code doesn't need to cope with a symbol changing from undefined at size_dynamic_sections to defined at relocate_section. Also, a number of problems with the testcases have been fixed. PR ld/20022 PR ld/21557 PR ld/21562 PR ld/21571 include/ * bfdlink.h (struct bfd_link_hash_entry): Delete undef.section. bfd/ * targets.c (struct bfd_target): Add _bfd_define_start_stop. (BFD_JUMP_TABLE_LINK): Likewise. * elf-bfd.h (bfd_elf_define_start_stop): Declare. * elflink.c (_bfd_elf_gc_mark_rsec): Update comment. (bfd_elf_define_start_stop): New function. * linker.c (bfd_generic_define_start_stop): New function. * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init new field. * aout-adobe.c (aout_32_bfd_define_start_stop): Define. * aout-target.h (MY_bfd_define_start_stop): Define. * aout-tic30.c (MY_bfd_define_start_stop): Define. * binary.c (binary_bfd_define_start_stop): Define. * bout.c (b_out_bfd_define_start_stop): Define. * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define. * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define. * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define. * coffcode.h (coff_bfd_define_start_stop): Define. * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define. * i386msdos.c (msdos_bfd_define_start_stop): Define. * i386os9k.c (os9k_bfd_define_start_stop): Define. * ieee.c (ieee_bfd_define_start_stop): Define. * ihex.c (ihex_bfd_define_start_stop): Define. * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define. * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define. * mmo.c (mmo_bfd_define_start_stop): Define. * nlm-target.h (nlm_bfd_define_start_stop): Define. * oasys.c (oasys_bfd_define_start_stop): Define. * pef.c (bfd_pef_bfd_define_start_stop): Define. * plugin.c (bfd_plugin_bfd_define_start_stop): Define. * ppcboot.c (ppcboot_bfd_define_start_stop): Define. * som.c (som_bfd_define_start_stop): Define. * srec.c (srec_bfd_define_start_stop): Define. * tekhex.c (tekhex_bfd_define_start_stop): Define. * versados.c (versados_bfd_define_start_stop): Define. * vms-alpha.c (vms_bfd_define_start_stop): Define. (alpha_vms_bfd_define_start_stop): Define. * xsym.c (bfd_sym_bfd_define_start_stop): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't set __start/__stop syms here. * ldlang.c (lang_set_startof): Delete. (start_stop_syms, start_stop_count, start_stop_alloc): New vars. (lang_define_start_stop, lang_init_start_stop, foreach_start_stop, undef_start_stop, lang_undef_start_stop, lang_init_startof_sizeof, set_start_stop, lang_finalize_start_stop): New functions. (lang_process): Call _start_stop functions. * testsuite/ld-elf/pr21562a.d: Use xfail rather than notarget. Correct typos and list of xfail targets. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-elf/sizeofa.d: Likewise. Adjust to pass for generic ELF. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise.
* [AArch64] Use SYMBOL_REFERENCES_LOCAL in one symbol checkJiong Wang2017-06-166-14/+35
| | | | | | | | | | | | | | | | | | | | | | For some pc-relative relocations we want to allow them under PIC mode while a normal global symbol defined in the same dynamic object can still bind externally through copy relocation. So, we should not allow pc-relative relocation against such symbol. SYMBOL_REFERENCES_LOCAL should be used and is more accurate than the original individual checks. bfd/ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOL_REFERENCES_LOCAL. ld/ * testsuite/ld-aarch64/aarch64-elf.exp: Update test name * testsuite/ld-aarch64/pcrel.s: Add new testcases. * testsuite/ld-aarch64/pcrel_pic_undefined.d: Update the expected warnings. * testsuite/ld-aarch64/pcrel_pic_defined_local.d: Rename ... * testsuite/ld-aarch64/pcrel_pic_defined.d: ... to this. Update expected warnings.
* Correct "ld --help" to display "-z stack-size=SIZE"H.J. Lu2017-06-152-1/+6
| | | | | | | | ELF Linker command line option to set stack size is "-z stack-size=SIZE", not "-z stacksize=SIZE". * exsup.c (elf_shlib_list_options): Display "-z stack-size=SIZE" instead of "-z stacksize=SIZE".
* [AArch64] Allow COPY relocation eliminationJiong Wang2017-06-157-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed at the PR, this patch tries to avoid COPY relocation generation and propagate the original relocation into runtime if it was relocating on writable section. The ELIMINATE_COPY_RELOCS has been set to true and it's underlying infrastructure has been improved so that the COPY reloc elimination at least working on absoluate relocations (ABS64) on AArch64. BFD linker copy relocation elimination framwork requires the backend to always allocate dynrelocs for all those relocation types that are possible to introduce copy relocations. This is for adjust_dynamic_symbol hook to be able to get all symbol reference information. Should one symbol is referenced by more than one relocations, if there is any of them needs copy relocation then linker should generate it. bfd/ PR ld/21532 * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1. (elfNN_aarch64_final_link_relocate): Also propagate relocations to runtime for if there needs copy relocation elimination. (need_copy_relocation_p): New function. Return true for symbol with pc-relative references and if it's against read-only sections. (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p. (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types that are related with accessing external objects. (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change in elfNN_aarch64_check_relocs. ld/ * testsuite/ld-aarch64/copy-reloc-exe-2.s: New test source file. * testsuite/ld-aarch64/copy-reloc-2.d: New test. * testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file. * testsuite/ld-aarch64/copy-reloc-eliminate.d: New test. * testsuite/ld-aarch64/copy-reloc-so.s: Define new global objects. * testsuite/ld-aarch64/aarch64-elf.exp: Run new tests.
* Fix address violation when disassembling a corrupt binary.Nick Clifton2017-06-142-3/+8
| | | | | | | | PR binutils/21580 binutils * objdump.c (disassemble_bytes): Check for buffer overrun when printing out rae insns. ld * testsuite/ld-nds32/diff.d: Adjust expected output.
* xfail pr20022.d on targets without dynamic relocs in .textH.J. Lu2017-06-142-0/+8
| | | | | | | | | ld-gc/pr20022.d requires support for dynamic relocations in .text section. PR ld/20022 * testsuite/ld-gc/pr20022.d: Skip on targets without dynamic relocations in .text section.
* Skip PR ld/21562 tests on targets with leading char or without --gc-sectionsH.J. Lu2017-06-1415-0/+105
| | | | | | | | | | | | | | | | | | | | | | | | Symbol lookup in linker will always fail on targets with leading char in symbol name since __start_SECNAME and __stop_SECNAME in C may be ___start_SECNAME and ___stop_SECNAME in assembly. Also tests with --gc-sections always fails on targets without --gc-sections support. * testsuite/ld-elf/pr21562a.d: Skip on targets with leading char in in symbol name or without --gc-sections. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-elf/pr21562e.d: Skip on targets with leading char in symbol name. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise.
* Add size to bar in ld-gc/pr20022a.sH.J. Lu2017-06-142-0/+5
| | | | | | Some linker backends require size info on dynamic symbols. * testsuite/ld-gc/pr20022a.s: Add size to bar.
* Skip sizeof/startof tests on targets with leading charH.J. Lu2017-06-145-0/+24
| | | | | | | | | | | | Symbol lookup in linker will always fail on targets with leading char in symbol name since __start_SECNAME and __stop_SECNAME in C may be ___start_SECNAME and ___stop_SECNAME in assembly. * testsuite/ld-elf/sizeofa.d: Skip on targets with leading char in symbol name. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise.
* Move location of .jumptables section and add .hightext section to AVR linker ↵Georg-Johann Lay2017-06-142-5/+18
| | | | | | | | script. PR ld/21583 * scripttempl/avr.sc (.jumptables): Move down in text section. (.hightext): New in text.
* Accept more epiphany targetsSebastian Huber2017-06-142-1/+5
| | | | | | | | | | In particular this adds support for the epiphany-rtems target. bfd/ * config.bfd (epiphany-*-elf): Accept epiphany-*-*. ld/ * configure.tgt (epiphany-*-elf): Accept epiphany-*-*.
* ld: Don't define __start_SECNAME/__stop_SECNAME for -rH.J. Lu2017-06-134-4/+41
| | | | | | | | | __start_SECNAME and __stop_SECNAME shouldn't be defined for "ld -r". * ldlang.c (lang_set_startof): Skip if config.build_constructors is FALSE. * testsuite/ld-elf/sizeofc.d: New file. * testsuite/ld-elf/startofc.d: Likewise.
* ld: Add tests for .startof.SECNAME/.sizeof.SECNAMEH.J. Lu2017-06-135-0/+37
| | | | | | | | | * testsuite/ld-elf/sizeof.d: Renamed to ... * testsuite/ld-elf/sizeofa.d: This. Updated. * testsuite/ld-elf/startof.d: Renamed to ... * testsuite/ld-elf/startofa.d: This. Updated. * testsuite/ld-elf/sizeofb.d: New file. * testsuite/ld-elf/startofb.d: Likewise.
* Always define referenced __start_SECNAME/__stop_SECNAMEH.J. Lu2017-06-1334-79/+381
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, linker will define __start_SECNAME and __stop_SECNAME symbols only for orphaned sections. However, during garbage collection, ELF linker marks all sections with references to __start_SECNAME and __stop_SECNAME symbols as used even when section SECNAME isn't an orphaned section and linker won't define __start_SECNAME nor __stop_SECNAME. And ELF linker stores the first input section whose name matches __start_SECNAME or __stop_SECNAME in u.undef.section for garbage collection. If these symbols are provided in linker script, u.undef.section is set to the section where they will defined by linker script, which leads to the incorrect output. This patch changes linker to always define referenced __start_SECNAME and __stop_SECNAME if the input section name is the same as the output section name, which is always true for orphaned sections, and SECNAME is a C identifier. Also __start_SECNAME and __stop_SECNAME symbols are marked as hidden by ELF linker so that __start_SECNAME and __stop_SECNAME symbols for section SECNAME in different modules are unique. For garbage collection, ELF linker stores the first matched input section in the unused vtable field. bfd/ PR ld/20022 PR ld/21557 PR ld/21562 PR ld/21571 * elf-bfd.h (elf_link_hash_entry): Add start_stop. Change the vtable field to a union. (_bfd_elf_is_start_stop): Removed. * elf32-i386.c (elf_i386_convert_load_reloc): Also check for __start_SECNAME and __stop_SECNAME symbols. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise. * elflink.c (_bfd_elf_is_start_stop): Removed. (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling _bfd_elf_is_start_stop. (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and __stop_SECNAME symbols. Updated. (elf_gc_smash_unused_vtentry_relocs): Likewise. (bfd_elf_gc_record_vtinherit): Likewise. (bfd_elf_gc_record_vtentry): Likewise. ld/ PR ld/20022 PR ld/21557 PR ld/21562 PR ld/21571 * ld.texinfo: Update __start_SECNAME/__stop_SECNAME symbols. * ldlang.c (lang_insert_orphan): Move handling of __start_SECNAME and __stop_SECNAME symbols to ... (lang_set_startof): Here. Also define __start_SECNAME and __stop_SECNAME for -Ur. * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Mark referenced __start_SECNAME and __stop_SECNAME symbols as hidden and set start_stop for garbage collection. * testsuite/ld-elf/pr21562a.d: New file. * testsuite/ld-elf/pr21562a.s: Likewise. * testsuite/ld-elf/pr21562a.t: Likewise. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562b.s: Likewise. * testsuite/ld-elf/pr21562b.t: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562c.t: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562d.t: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-gc/pr20022.d: Likewise. * testsuite/ld-gc/pr20022a.s: Likewise. * testsuite/ld-gc/pr20022b.s: Likewise. * testsuite/ld-gc/gc.exp: Run PR ld/20022 tests. * testsuite/ld-gc/pr19161.d: Also accept local __start_SECNAME symbol. * testsuite/ld-gc/start.d: Likewise. * testsuite/ld-x86-64/lea1a.d: Updated. * testsuite/ld-x86-64/lea1b.d: Updated. * testsuite/ld-x86-64/lea1d.d: Updated. * testsuite/ld-x86-64/lea1e.d: Likewise.