aboutsummaryrefslogtreecommitdiff
path: root/ld/emulparams
AgeCommit message (Collapse)AuthorFilesLines
2018-03-07xtensa: ld: support -z relroMax Filippov1-0/+1
ld/ 2018-03-07 Max Filippov <jcmvbkbc@gmail.com> * emulparams/elf32xtensa.sh (COMMONPAGESIZE): Define.
2018-03-02Ensure 8-byte alignment for AArch64 stubs.Jim Wilson6-6/+6
PR 22903 bfd * elfnn-aarch64.c (_bfd_aarch64_resize_stubs): Add 8 bytes for branch and nop instead of 4. (elfNN_arch64_build_stubs): Add nop after branch. Increase size by 8 instead of 4. ld * emultempl/aarch64elf.em (elf${ELFSIZE}_aarch64_add_stub_section): Give stub_sec 8 byte alignment. * emulparams/aarch64cloudabi.sh (NOP): Set to 0x1f2003d5. * emulparams/aarch64elf.sh (NOP): Likewise. * emulparams/aarch64elf32.sh (NOP): Likewise. * emulparams/aarch64fbsd.sh (NOP): Likewise. * emulparams/aarch64linux.sh (NOP): Likewise. * emulparams/aarch64linux32.sh (NOP): Likewise. * testsuite/ld-aarch64/erratum835769.d: Adjust for added nop. * testsuite/ld-aarch64/erratum843419.d: Likewise. * testsuite/ld-aarch64/farcall-b-defsym.d: Likewise. * testsuite/ld-aarch64/farcall-b-none-function.d: Likewise. * testsuite/ld-aarch64/farcall-b-plt.d: Likewise. * testsuite/ld-aarch64/farcall-b-section.d: Likewise. * testsuite/ld-aarch64/farcall-b.d: Likewise. * testsuite/ld-aarch64/farcall-back.d: Likewise. * testsuite/ld-aarch64/farcall-bl-defsym.d: Likewise. * testsuite/ld-aarch64/farcall-bl-none-function.d: Likewise. * testsuite/ld-aarch64/farcall-bl-plt.d: Likewise. * testsuite/ld-aarch64/farcall-bl-section.d: Likewise. * testsuite/ld-aarch64/farcall-bl.d: Likewise.
2018-02-26ld error/warning messagesAlan Modra3-7/+8
This patch standardizes messages in ld, to better conform to the GNU coding standard. Besides issues of capitalization and full-stops, I've - Split up help messages for target options, so that adding a new option does not mean loss of translation for all the others. - Embedded tabs have been removed, since a user might have tab stops set at other than 8 char intervals. - Added missing program name (%P). ld isn't the compiler. - Put %F and %X first (and removed %X if %F was present). These can go anywhere, but look silly in the m%Fiddle of a message, and choosing "%P%F:" in some messages but "%F%P:" in others leads to the likelihood of duplication in ld.pot. Besides, the colon belongs with %P. * emulparams/call_nop.sh, * emulparams/cet.sh, * emulparams/elf32mcore.sh, * emultempl/aarch64elf.em * emultempl/aix.em, * emultempl/alphaelf.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/avrelf.em, * emultempl/beos.em, * emultempl/bfin.em, * emultempl/cr16elf.em, * emultempl/elf32.em, * emultempl/elf-generic.em, * emultempl/hppaelf.em, * emultempl/linux.em, * emultempl/lnk960.em, * emultempl/m68hc1xelf.em, * emultempl/m68kcoff.em, * emultempl/m68kelf.em, * emultempl/metagelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nds32elf.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc32elf.em, * emultempl/ppc64elf.em, * emultempl/scoreelf.em, * emultempl/sh64elf.em, * emultempl/spuelf.em, * emultempl/sunos.em, * emultempl/tic6xdsbt.em, * emultempl/ticoff.em, * emultempl/v850elf.em, * emultempl/vms.em, * emultempl/vxworks.em, * emultempl/xtensaelf.em, * ldcref.c, * ldctor.c, * ldexp.c, * ldfile.c, * ldgram.y, * ldlang.c, * ldmain.c, * ldmisc.c, * ldwrite.c, * lexsup.c, * mri.c, * pe-dll.c, * plugin.c: Standardize error/warning messages. * testsuite/ld-arc/jli-overflow.err, * testsuite/ld-arm/cmse-implib-errors.out, * testsuite/ld-arm/cmse-new-earlier-later-implib.out, * testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out, * testsuite/ld-arm/cmse-new-wrong-implib.out, * testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out, * testsuite/ld-arm/cmse-veneers-wrong-entryfct.out, * testsuite/ld-arm/vxworks1-static.d, * testsuite/ld-cris/tls-err-20x.d, * testsuite/ld-cris/tls-err-29.d, * testsuite/ld-cris/tls-err-31.d, * testsuite/ld-cris/tls-err-33.d, * testsuite/ld-cris/tls-err-35.d, * testsuite/ld-cris/tls-err-37.d, * testsuite/ld-cris/tls-err-39.d, * testsuite/ld-cris/tls-err-41.d, * testsuite/ld-cris/tls-err-43.d, * testsuite/ld-cris/tls-err-45.d, * testsuite/ld-cris/tls-err-47.d, * testsuite/ld-cris/tls-err-49.d, * testsuite/ld-cris/tls-err-51.d, * testsuite/ld-cris/tls-err-67.d, * testsuite/ld-elf/dwarf2.err, * testsuite/ld-elf/dwarf3.err, * testsuite/ld-elf/orphan-5.l, * testsuite/ld-elf/orphan-6.l, * testsuite/ld-i386/vxworks1-static.d, * testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d, * testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d, * testsuite/ld-mips-elf/bal-jalx-pic-micromips.d, * testsuite/ld-mips-elf/bal-jalx-pic-n32.d, * testsuite/ld-mips-elf/bal-jalx-pic-n64.d, * testsuite/ld-mips-elf/bal-jalx-pic.d, * testsuite/ld-mips-elf/jal-global-overflow-1.d, * testsuite/ld-mips-elf/jal-local-overflow-1.d, * testsuite/ld-mips-elf/mode-change-error-1.d, * testsuite/ld-mips-elf/unaligned-branch-2.d, * testsuite/ld-mips-elf/unaligned-branch-ignore-2.d, * testsuite/ld-mips-elf/unaligned-branch-ignore-micromips.d, * testsuite/ld-mips-elf/unaligned-branch-ignore-mips16.d, * testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1.d, * testsuite/ld-mips-elf/unaligned-branch-micromips.d, * testsuite/ld-mips-elf/unaligned-branch-mips16.d, * testsuite/ld-mips-elf/unaligned-branch-r6-1.d, * testsuite/ld-mips-elf/unaligned-branch-r6-2.d, * testsuite/ld-mips-elf/unaligned-branch.d, * testsuite/ld-mips-elf/unaligned-jalx-1.d, * testsuite/ld-mips-elf/unaligned-jalx-3.d, * testsuite/ld-mips-elf/unaligned-jalx-addend-1.d, * testsuite/ld-mips-elf/unaligned-jalx-addend-3.d, * testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d, * testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d, * testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d, * testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d, * testsuite/ld-mips-elf/unaligned-jump-micromips.d, * testsuite/ld-mips-elf/unaligned-jump-mips16.d, * testsuite/ld-mips-elf/unaligned-jump.d, * testsuite/ld-mips-elf/unaligned-ldpc-1.d, * testsuite/ld-mips-elf/unaligned-lwpc-1.d, * testsuite/ld-mips-elf/undefined.d, * testsuite/ld-mips-elf/vxworks1-static.d, * testsuite/ld-mmix/bpo-20.d, * testsuite/ld-mmix/bpo-20m.d, * testsuite/ld-mmix/bpo-7.d, * testsuite/ld-mmix/bpo-7m.d, * testsuite/ld-mmix/bpo-8.d, * testsuite/ld-mmix/bpo-8m.d, * testsuite/ld-mmix/greg-17.d, * testsuite/ld-mmix/greg-18.d, * testsuite/ld-mmix/greg-8.d, * testsuite/ld-mmix/greg-9.d, * testsuite/ld-plugin/plugin-14.d, * testsuite/ld-plugin/plugin-15.d, * testsuite/ld-plugin/plugin-16.d, * testsuite/ld-plugin/plugin-20.d, * testsuite/ld-plugin/plugin-21.d, * testsuite/ld-plugin/plugin-22.d, * testsuite/ld-plugin/plugin-23.d, * testsuite/ld-plugin/plugin-6.d, * testsuite/ld-plugin/plugin-7.d, * testsuite/ld-plugin/plugin-8.d, * testsuite/ld-powerpc/aix-weak-3-32.d, * testsuite/ld-powerpc/aix-weak-3-64.d, * testsuite/ld-powerpc/vxworks1-static.d, * testsuite/ld-sh/vxworks1-static.d, * testsuite/ld-sparc/vxworks1-static.d, * testsuite/ld-undefined/undefined.exp, * testsuite/ld-x86-64/pie1.d: Update for changed errors and warnings. * testsuite/ld-elf/warn1.d, * testsuite/ld-elf/warn2.d: Correct regex.
2018-02-02Disable -shared support in nios2-elf-ld.Sandra Loosemore1-1/+0
2018-02-03 Sandra Loosemore <sandra@codesourcery.com> * emulparams/nios2elf.sh (GENERATE_SHLIB_SCRIPT): Don't set.
2018-01-26MIPS/LD: Correct `mips-*-windiss' target emulation configurationMaciej W. Rozycki1-0/+1
Fix an issue with commit 73934d319dae ("Disable .gnu.hash on MIPS targets"), <https://sourceware.org/ml/binutils/2006-07/msg00341.html>, which in turn caused a regression with commit 861fb55ab50a ("Defer allocation of R_MIPS_REL32 GOT slots"), <https://sourceware.org/ml/binutils/2008-08/msg00096.html>, and use `mipself.em' as the extra emulation file for `mips-*-windiss' targets, removing a segmentation fault triggered as `_bfd_mips_elf_final_link' calls `htab_traverse' to process LA25 stubs with `htab->la25_stubs' being NULL. This is in turn due to `_bfd_mips_elf_init_stubs' not having been called, which is only done by `mipself.em'. No LA25 stubs are supposed to be produced for `mips-*-windiss' targets, however the internal data structures have to be initialized. ld/ * emulparams/elf32mipswindiss.sh (EXTRA_EM_FILE): Set to `mipself'.
2018-01-05RISC-V: Disable shared library support for embedded elf.Jim Wilson1-2/+9
ld/ * emulparams/elf32lriscv-defs.sh (GENERATE_SHLIB_SCRIPT): Move inside case on $target, and don't set for riscv*-elf targets. (GENERATE_PIE_SCRIPT): Likewise.
2018-01-03Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2017-12-07mcore-elf lacks shared lib supportAlan Modra1-1/+0
elf32-mcore.c has no backend create_dynamic_sections function so can't support shared libs. * emulparams/elf32mcore.sh (GENERATE_SHLIB_SCRIPT): Don't define.
2017-12-05Really fix riscv shared library __global_pointer$ problem.Jim Wilson1-1/+2
ld/ * emulparams/elf32lriscv-defs.sh (SDATA_START_SYMBOLS): Remove HIDDEN. Don't define __global_pointer$ when CREATE_SHLIB. * testsuite/ld-riscv-elf/gp-hidden-64.rd, * testsuite/ld-riscv-elf/gp-hidden-lib.rd, * testsuite/ld-riscv-elf/gp-hidden-lib.s, * testsuite/ld-riscv-elf/gp-hidden-ver-64.rd, * testsuite/ld-riscv-elf/gp-hidden-ver.rd, * testsuite/ld-riscv-elf/gp-hidden-ver.s, * testsuite/ld-riscv-elf/gp-hidden-ver.ver, * testsuite/ld-riscv-elf/gp-hidden.rd, * testsuite/ld-riscv-elf/gp-hidden.s, * testsuite/ld-riscv-elf/gp-hidden.sd: Delete. * testsuite/ld-riscv-elf/gp-test-lib.sd, * testsuite/ld-riscv-elf/gp-test.s, * testsuite/ld-riscv-elf/gp-test.sd: New. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Rewrite gp tests.
2017-12-04Riscv shared libraries should not export __global_pointer$.Jim Wilson1-1/+1
ld/ * emulparams/elf32lriscv-defs.sh (SDATA_START_SYMBOLS): Mark __global_pointer$ as HIDDEN. * testsuite/ld-riscv-elf/gp-hidden-64.rd: New. * testsuite/ld-riscv-elf/gp-hidden-lib.rd: New. * testsuite/ld-riscv-elf/gp-hidden-lib.s: New. * testsuite/ld-riscv-elf/gp-hidden-ver-64.rd: New. * testsuite/ld-riscv-elf/gp-hidden-ver.rd: New. * testsuite/ld-riscv-elf/gp-hidden-ver.s: New. * testsuite/ld-riscv-elf/gp-hidder-ver.ver: New. * testsuite/ld-riscv-elf/gp-hidden.rd: New. * testsuite/ld-riscv-elf/gp-hidden.s: New. * testsuite/ld-riscv-elf/gp-hidden.sd: New. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Change riscv to riscv*. Run the new tests with run_ld_link_tests.
2017-11-12ld: Add OTHER_PLT_SECTIONSH.J. Lu4-8/+8
OTHER_PLT_SECTIONS contains sections which should be placed right after .plt section. * emulparams/elf32_x86_64.sh (TINY_READONLY_SECTION): Renamed to ... (OTHER_PLT_SECTIONS): This. * emulparams/elf_i386.sh: Likewise. * emulparams/elf_iamcu.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * scripttempl/elf.sc: Place ${OTHER_PLT_SECTIONS} just after .plt.
2017-10-16ELF: Call check_relocs after opening all inputsH.J. Lu21-36/+0
For all ELF targers, call check_relocs after opening all inputs and garbage collection. Since the symbol resolution is known, check_relocs can be simplified. Also garbage collection doesn't need to undo what check_relocs has done for symbols which have been garbage collected. Since ELF targets never see the removed sections, gc_sweep_hook can be removed from elf_backend_data and we can avoid GOT/PLT with garbage collection now. Set link_info.check_relocs_after_open_input to TRUE for all linker targets which use ELF linker and update garbage collection tests to remove unused GOT section. ldemul_after_check_relocs is added for powerpc to support --secure-plt, --bss-plt and --sdata-got. Tested natively without regressions on i686, x86-64 and x32. Tested cross binutils on x86-64 without regressions for aarch64-linux, alpha-linux, arm-linux, bfin-elf, cr16-elf, cris-elf, crx-elf, frv-linux, hppa64-linux, hppa-linux, ia64-linux, lm32-elf, m32r-elf, m68k-linux, mcore-elf, metag-elf, microblaze-linux, mips-linux, mmix, mn10300-elf, nds32le-linux, nios2-linux, or1k-elf, powerpc64-linux, powerpc-linux, riscv32-linux, riscv64-linux, s390-linux, s390x-linux, score-elf, sh3-linux, sparc64-linux, sparc-linux, tic6x-elf, tilegx-linux, tilepro-linux, vax-linux, x86_64-mingw32 and xtensa-linux. bfd/ * elf-bfd.h (elf_backend_data): Remove gc_sweep_hook. * elf32-arm.c (elf32_arm_gc_sweep_hook): Removed. (elf_backend_gc_sweep_hook): Likewise. * elf32-bfin.c (bfin_gc_sweep_hook): Likewise. (bfinfdpic_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-cr16.c (elf32_cr16_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-cris.c (cris_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-lm32.c (lm32_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-m68k.c (elf_m68k_got_entry): Remove elf_m68k_gc_sweep_hook from comments. (elf_m68k_remove_got_entry_type): Removed. (elf_m68k_find_got_entry_ptr): Likewise. (elf_m68k_remove_got_entry): Likewise. (elf_m68k_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-mcore.c (mcore_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-metag.c (elf_metag_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-microblaze.c (elf_backend_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-mips.c (elf_backend_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-nds32.c (nds32_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-nios2.c (nios2_elf32_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-or1k.c (or1k_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-ppc.c (ppc_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-sparc.c (elf_backend_gc_sweep_hook): Likewise. * elf32-tic6x.c (elf32_tic6x_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-tilegx.c (elf_backend_gc_sweep_hook): Likewise. * elf32-tilepro.c (tilepro_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-alpha.c (elf64_alpha_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-mips.c (elf_backend_gc_sweep_hook): Likewise. * elf64-mmix.c (mmix_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-ppc.c (elf_backend_gc_sweep_hook): Likewise. (ppc64_elf_gc_sweep_hook): Likewise. * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elf64-sparc.c (elf_backend_gc_sweep_hook): Likewise. * elf64-tilegx.c (elf_backend_gc_sweep_hook): Likewise. * elflink.c (elf_link_add_object_symbols): Don't call _bfd_elf_link_check_relocs here. (gc_sweep_hook_fn): Removed. (elf_gc_sweep): Remove gc_sweep_hook. * elfnn-aarch64.c (elfNN_aarch64_gc_sweep_hook): Removed. (elf_backend_gc_sweep_hook): Likewise. * elfnn-riscv.c (riscv_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_gc_sweep_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_gc_sweep_hook): Likewise. (elf_backend_gc_sweep_hook): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_gc_sweep_hook): Likewise. * elfxx-sparc.h (_bfd_sparc_elf_gc_sweep_hook): Likewise. * elfxx-target.h (elf_backend_gc_sweep_hook): Likewise. (elfNN_bed): Remove elf_backend_gc_sweep_hook. * elfxx-tilegx.c (tilegx_elf_gc_sweep_hook): Removed. * elfxx-tilegx.h (tilegx_elf_gc_sweep_hook): Likewise. ld/ * emulparams/elf32_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Removed. * emulparams/elf_i386_be.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_chaos.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_ldso.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_vxworks.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_iamcu.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_k1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_l1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386lynx.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386moss.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386nw.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf32.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf_nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shelf_vxworks.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shlelf32_linux.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shlelf_linux.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/shlelf_nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emultempl/aarch64elf.em (gld${EMULATION_NAME}_before_parse): Set link_info.check_relocs_after_open_input to TRUE. * emultempl/armelf.em (gld${EMULATION_NAME}_before_parse): Likewise. * emultempl/scoreelf.em (gld${EMULATION_NAME}_before_parse): Likewise. * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Add after_parse_default. * emultempl/armcoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/beos.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/gld960.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/gld960c.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/lnk960.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/m68kcoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/msp430.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pe.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/pep.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/sunos.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/ticoff.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/vanilla.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Always set link_info.check_relocs_after_open_input to TRUE. (ld_${EMULATION_NAME}_emulation): Add $LDEMUL_AFTER_CHECK_RELOCS. * emultempl/linux.em (gld${EMULATION_NAME}_before_parse): Set link_info.check_relocs_after_open_input to TRUE. (ld_${EMULATION_NAME}_emulation): Add after_check_relocs_default. * emultempl/mmix-elfnmmo.em (mmix_before_parse): New function. (LDEMUL_BEFORE_PARSE): New. * emultempl/mmixelf.em (elfmmix_before_parse): Replace gld${EMULATION_NAME}_before_parse with mmix_before_parse. * emultempl/ppc32elf.em (ppc_after_open): Renamed to ... (ppc_after_check_relocs): This. Call after_check_relocs_default instead of gld${EMULATION_NAME}_after_open. (LDEMUL_AFTER_OPEN): Removed. (LDEMUL_AFTER_CHECK_RELOCS): New. * ldemul.c (ldemul_after_check_relocs): New. (after_check_relocs_default): Likewise. * ldemul.h (ldemul_after_check_relocs): Likewise. (after_check_relocs_default): Likewise. (ld_emulation_xfer_struct): Add after_check_relocs. * ldlang.c (lang_process): Call ldemul_after_check_relocs after lang_check_relocs. * testsuite/ld-aarch64/gc-got-relocs.d: Don't expect GOT section. * testsuite/ld-aarch64/gc-tls-relocs.d: Likewise. * testsuite/ld-cris/tls-gc-68.d: Likewise. * testsuite/ld-cris/tls-gc-69.d: Likewise. * testsuite/ld-cris/tls-gc-70.d: Likewise. * testsuite/ld-cris/tls-gc-75.d: Likewise. * testsuite/ld-cris/tls-gc-79.d: Likewise. * testsuite/ld-mmix/bpo-10.d: Don't expect .MMIX.reg_contents section.
2017-10-12ld whitespace fixesAlan Modra7-20/+20
* pe-dll.c: Formatting, whitespace fixes. * NEWS: Whitespace fixes. * configure.ac: Likewise. * configure.tgt: Likewise. * deffilep.y: Likewise. * genscripts.sh: Likewise. * ld.texinfo: Likewise. * ldgram.y: Likewise. * ldlang.c: Likewise. * ldlex.l: Likewise. * lexsup.c: Likewise. * plugin.c: Likewise. * emulparams/arc-endianness.sh: Likewise. * emulparams/elf32_x86_64.sh: Likewise. * emulparams/elf64mmix.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emulparams/h8300elf.sh: Likewise. * emulparams/h8300elf_linux.sh: Likewise. * emulparams/vxworks.sh: Likewise. * emultempl/aarch64elf.em: Likewise. * emultempl/aix.em: Likewise. * emultempl/armelf.em: Likewise. * emultempl/avrelf.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/hppaelf.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/m68kelf.em: Likewise. * emultempl/metagelf.em: Likewise. * emultempl/msp430.em: Likewise. * emultempl/nds32elf.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/sh64elf.em: Likewise. * emultempl/spu_ovl.S: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/tic6xdsbt.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/vms.em: Likewise. * po/Make-in: Likewise. * scripttempl/DWARF.sc: Likewise. * scripttempl/aix.sc: Likewise. * scripttempl/alpha.sc: Likewise. * scripttempl/alphavms.sc: Likewise. * scripttempl/aout.sc: Likewise. * scripttempl/arclinux.sc: Likewise. * scripttempl/armaout.sc: Likewise. * scripttempl/armbpabi.sc: Likewise. * scripttempl/armcoff.sc: Likewise. * scripttempl/avr.sc: Likewise. * scripttempl/crisaout.sc: Likewise. * scripttempl/delta68.sc: Likewise. * scripttempl/dlx.sc: Likewise. * scripttempl/elf.sc: Likewise. * scripttempl/elf32cr16.sc: Likewise. * scripttempl/elf32cr16c.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise. * scripttempl/elf32msp430_3.sc: Likewise. * scripttempl/elf32sh-symbian.sc: Likewise. * scripttempl/elf32xc16x.sc: Likewise. * scripttempl/elf32xc16xl.sc: Likewise. * scripttempl/elf32xc16xs.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfarcv2.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfi370.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/elfmicroblaze.sc: Likewise. * scripttempl/elfxgate.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/epiphany_4x4.sc: Likewise. * scripttempl/epocpe.sc: Likewise. * scripttempl/h8300.sc: Likewise. * scripttempl/h8300h.sc: Likewise. * scripttempl/h8300hn.sc: Likewise. * scripttempl/h8300s.sc: Likewise. * scripttempl/h8300sn.sc: Likewise. * scripttempl/h8300sx.sc: Likewise. * scripttempl/h8300sxn.sc: Likewise. * scripttempl/h8500.sc: Likewise. * scripttempl/h8500b.sc: Likewise. * scripttempl/h8500c.sc: Likewise. * scripttempl/h8500m.sc: Likewise. * scripttempl/h8500s.sc: Likewise. * scripttempl/hppaelf.sc: Likewise. * scripttempl/i386beos.sc: Likewise. * scripttempl/i386coff.sc: Likewise. * scripttempl/i386go32.sc: Likewise. * scripttempl/i386msdos.sc: Likewise. * scripttempl/i860coff.sc: Likewise. * scripttempl/i960.sc: Likewise. * scripttempl/ia64vms.sc: Likewise. * scripttempl/ip2k.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/m68kaux.sc: Likewise. * scripttempl/m68kcoff.sc: Likewise. * scripttempl/m88kbcs.sc: Likewise. * scripttempl/mcorepe.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/mips.sc: Likewise. * scripttempl/mipsbsd.sc: Likewise. * scripttempl/mmo.sc: Likewise. * scripttempl/moxie.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/nw.sc: Likewise. * scripttempl/pe.sc: Likewise. * scripttempl/pep.sc: Likewise. * scripttempl/pj.sc: Likewise. * scripttempl/ppcpe.sc: Likewise. * scripttempl/psos.sc: Likewise. * scripttempl/riscix.sc: Likewise. * scripttempl/sh.sc: Likewise. * scripttempl/sparccoff.sc: Likewise. * scripttempl/st2000.sc: Likewise. * scripttempl/tic30aout.sc: Likewise. * scripttempl/tic30coff.sc: Likewise. * scripttempl/tic4xcoff.sc: Likewise. * scripttempl/tic54xcoff.sc: Likewise. * scripttempl/tic80coff.sc: Likewise. * scripttempl/v850.sc: Likewise. * scripttempl/v850_rh850.sc: Likewise. * scripttempl/vanilla.sc: Likewise. * scripttempl/visium.sc: Likewise. * scripttempl/w65.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. * scripttempl/z80.sc: Likewise. * scripttempl/z8000.sc: Likewise. * configure: Regenerate.
2017-07-19[ARC] Add JLI support.John Eric Martin3-2/+5
The following relocation types were added to GCC/binutils: ARC_JLI_SECTOFF is a relocation type in Metaware that is now used by GCC as well to adjust the index of function calls to functions with attribute jli_call_always. bfd/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> John Eric Martin <John.Martin@emmicro-us.com> * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elf32-arc.c (JLI): Define. * reloc.c: Add JLI relocations. gas/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/gas/arc/jli-1.d: New file. * testsuite/gas/arc/jli-1.s: Likewise. * testsuite/gas/arc/taux.d: Update for jli_base. include/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> John Eric Martin <John.Martin@emmicro-us.com> * elf/arc-reloc.def: Add JLI relocs howto. * opcode/arc-func.h (replace_jli): New function. ld/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> John Eric Martin <John.Martin@emmicro-us.com> * emulparams/arcelf.sh (JLI_START_TABLE): Define. * scripttempl/elfarc.sc: Handle jlitab section. * scripttempl/elfarcv2.sc: Likewise. * testsuite/ld-arc/arc.exp: Add JLI test. * testsuite/ld-arc/jli-script.ld: New file. * testsuite/ld-arc/jli-simple.dd: Likewise. * testsuite/ld-arc/jli-simple.rd: Likewise. * testsuite/ld-arc/jli-simple.s: Likewise. * testsuite/ld/testsuite/ld-arc/jli-overflow.s: Likewise. * testsuite/ld/testsuite/ld-arc/jli-overflow.d: Likewise. * testsuite/ld/testsuite/ld-arc/jli-overflow.err: Likewise. opcode/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> John Eric Martin <John.Martin@emmicro-us.com> * arc-opc.c (UIMM10_6_S_JLIOFF): Define. (UIMM3_23): Adjust accordingly. * arc-regs.h: Add/correct jli_base register. * arc-tbl.h (jli_s): Likewise.
2017-06-23S/390: Add support for pgste markerAndreas Krebbel1-0/+1
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.
2017-06-22x86: Support Intel Shadow Stack with SHSTK propertyH.J. Lu1-1/+4
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.
2017-06-22x86: Support Intel IBT with IBT property and IBT-enable PLTH.J. Lu4-0/+19
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.
2017-06-13Replace multiple AVR scripts with a single, customizable linker script.Georg-Johann Lay18-2/+144
PR ld/21569 * scripttempl/avrtiny.sc: Remove file. * Makefile.am (eavrtiny.c): Depend on avr.sc, no more on avrtiny.sc. * Makefile.in: Regenerate. * emulparams/avrtiny.sh (SCRIPT_NAME): Set var to "avr". (TEXT_ORIGIN): Remove var. (FUSE_NAME, FUSE_LENGTH, LOCK_LENGTH, SIGNATURE_LENGTH) (RODATA_PM_OFFSET): Set new vars. * emulparams/avr1.sh (FUSE_NAME, EEPROM_LENGTH, FUSE_LENGTH) (LOCK_LENGTH, SIGNATURE_LENGTH, USER_SIGNATURE_LENGTH): Set new vars. * emulparams/avr2.sh: Same. * emulparams/avr25.sh: Same. * emulparams/avr3.sh: Same. * emulparams/avr31.sh: Same. * emulparams/avr35.sh: Same. * emulparams/avr4.sh: Same. * emulparams/avr5.sh: Same. * emulparams/avr51.sh: Same. * emulparams/avr6.sh: Same. * emulparams/avrxmega1.sh: Same. * emulparams/avrxmega2.sh: Same. * emulparams/avrxmega3.sh: Same. * emulparams/avrxmega4.sh: Same. * emulparams/avrxmega5.sh: Same. * emulparams/avrxmega6.sh: Same. * emulparams/avrxmega7.sh: Same. * scripttempl/avr.sc (__EEPROM_REGION_LENGTH__): Only define if EEPROM_LENGTH is set. (MEMORY) [eeprom]: Same. (SECTIONS) [.eeprom]: Same for output section. (__USER_SIGNATURE_REGION_LENGTH__): Only define if USER_SIGNATURE_LENGTH is set. (MEMORY) [user_signatures]: Same. (SECTIONS) [.fuse]: Only define output section if FUSE_NAME = fuse. (SECTIONS) [.config]: Only define output section if FUSE_NAME = config.
2017-06-02x86: Remove linker option: -z prefix-nopH.J. Lu1-5/+0
Since it is incorrect to convert bnd call *foo@GOTPCREL(%rip) to bnd nop call foo this patch removes the "-z prefix-nop" option from x86 linker. * emulparams/call_nop.sh: Remove -z prefix-nop. * ld.texinfo: Likewise. * testsuite/ld-i386/call3c.d: Check for linker error. * testsuite/ld-x86-64/call1c.d: Likewise.
2017-05-19Update avrxmega3 linker emulation to support avrxmega2 devices with flash ↵eorg-Johann Lay1-0/+1
memory visible in the SRAM address range. PR ld/21472 ld * emulparams/avrxmega3.sh (RODATA_PM_OFFSET): Set to 0x8000. * scripttempl/avr.sc (__RODATA_PM_OFFSET__) [RODATA_PM_OFFSET]: Use RODATA_PM_OFFSET as default if not already defined. (.data) [!RODATA_PM_OFFSET]: Don't include .rodata and friends. (.rodata) [RODATA_PM_OFFSET]: Put at an offset of __RODATA_PM_OFFSET__. gas * config/tc-avr.c (mcu_types): Add entries for: attiny416, attiny417, attiny816, attiny817.
2017-05-11x86-64: Rename .plt.bnd to .plt.secH.J. Lu1-1/+1
Rename .plt.bnd to .plt.sec to indicate that this is used as the second PLT section. There is no change in run-time behavior. We also scan the .plt.sec section to synthesize PLT symbols. bfd/ * elf64-x86-64.c (elf_x86_64_link_hash_entry): Rename plt_bnd to plt_second. (elf_x86_64_link_hash_table): Rename plt_bnd/plt_bnd_eh_frame to plt_second/plt_second_eh_frame. (elf_x86_64_link_hash_newfunc): Updated. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_size_dynamic_sections): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_finish_dynamic_symbol): Likewise. (elf_x86_64_finish_dynamic_sections): Likewise. (elf_x86_64_plt_type): Rename plt_bnd to plt_second. (elf_x86_64_get_synthetic_symtab): Updated. Also scan the .plt.sec section. (elf_backend_setup_gnu_properties): Updated. Create the .plt.sec section instead of the .plt.sec section. ld/ * emulparams/elf_x86_64.sh (TINY_READONLY_SECTION): Replace .plt.bnd with .plt.sec. * testsuite/ld-x86-64/bnd-ifunc-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1.d: Likewise. * testsuite/ld-x86-64/mpx3.dd: Likewise. * testsuite/ld-x86-64/mpx3n.dd: Likewise. * testsuite/ld-x86-64/mpx4.dd: Likewise. * testsuite/ld-x86-64/mpx4n.dd: Likewise. * testsuite/ld-x86-64/plt-main-bnd-now.rd: Likewise. * testsuite/ld-x86-64/pr21038b-now.d: Likewise. * testsuite/ld-x86-64/pr21038b.d: Likewise. * testsuite/ld-x86-64/pr21038c-now.d: Likewise. * testsuite/ld-x86-64/pr21038c.d: Likewise.
2017-05-10i386: Set CHECK_RELOCS_AFTER_OPEN_INPUT to yesH.J. Lu3-0/+3
All linker targets based on elf32-i386 should check relocations after opening all inputs since this is how elf32-i386 works. * emulparams/i386lynx.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Set to yes. * emulparams/i386moss.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386nw.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise.
2017-04-19Implement -z dynamic-undefined-weakAlan Modra2-5/+10
-z nodynamic-undefined-weak is only implemented for x86. (The sparc backend has some support code but doesn't enable the option by including ld/emulparams/dynamic_undefined_weak.sh, and since the support looks like it may be broken I haven't enabled it.) This patch adds the complementary -z dynamic-undefined-weak, extends both options to affect building of shared libraries as well as executables, and adds support for the option on powerpc. include/ * bfdlink.h (struct bfd_link_info <dynamic_undefined_weak>): Revise comment. bfd/ * elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak or make dynamic for info->dynamic_undefined_weak 0 and 1. * elf32-ppc.c:Formatting. (ensure_undefweak_dynamic): Don't make dynamic when info->dynamic_undefined_weak is zero. (allocate_dynrelocs): Discard undefweak dyn_relocs for info->dynamic_undefined_weak. Discard undef dyn_relocs when not default visibility. Discard undef and undefweak dyn_relocs earlier. (ppc_elf_relocate_section): Adjust to suit. * elf64-ppc.c: Formatting. (ensure_undefweak_dynamic): Don't make dynamic when info->dynamic_undefined_weak is zero. (allocate_dynrelocs): Discard undefweak dyn_relocs for info->dynamic_undefined_weak. Discard them earlier. ld/ * ld.texinfo (dynamic-undefined-weak): Document. (nodynamic-undefined-weak): Document that this option now can be used with shared libs. * emulparams/dynamic_undefined_weak.sh: Support -z dynamic-undefined-weak. * emulparams/elf32ppccommon.sh: Include dynamic_undefined_weak.sh. * testsuite/ld-undefined/weak-undef.exp (undef_weak_so), (undef_weak_exe): New. Use them. Add -z dynamic-undefined-weak and -z nodynamic-undefined-weak tests. * Makefile.am: Update powerpc dependencies. * Makefile.in: Regenerate.
2017-03-13PowerPC: incorrect library search orderAlexey Neyman1-5/+5
First, need to match against just the CPU name, not the whole triplet. Otherwise, the test picks up "*le-*" pattern from x86_64-apple-darwin triplet. Second, it should be testing for $target, not $host. Host may be little endian by default, and the sysroot directory layout shouldn't depend on whether it is built on LE or BE machine. * emulparams/elf32ppccommon.sh (LIBPATH_SUFFIX): Set from target cpu, not host.
2017-02-20Move .stack before debug sectionsAlan Modra10-100/+33
PR 20199 * emulparams/elf32m32c.sh: Define STACK_ADDR and STACK_SENTINEL rather than using OTHER_SECTIONS. * emulparams/elf32mt.sh: Likewise. * emulparams/elf32rx.sh: Likewise. * emulparams/elf32rl78.sh: Likewise. Use OTHER_SYMBOLS to define __rl78_abs__. * emulparams/shelf.sh: Define STACK_ADDR and STACK_SENTINEL rather than using OTHER_SECTIONS. * emulparams/shelf32.sh: Likewise. Use OTHER_SECTIONS for .cranges. * emulparams/shelf64.sh: Unset OTHER_SECTIONS. * emulparams/shelf_nbsd.sh: Unset STACK_ADDR not OTHER_SECTIONS. * emulparams/shelf_uclinux.sh: Likewise. * emulparams/shlsymbian.sh: Unset STACK_ADDR. Use OTHER_SYMBOLS to define _stack, not OTHER_SECTIONS. * scripttempl/elf.sc: Move STACK, TINY_DATA_SECTION, and TINY_BSS_SECTION before debug sections. Add STACK_SENTINEL. * scripttempl/arclinux.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/armbpabi.sc: Move STACK before debug sections. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Delete STACK. * scripttempl/epiphany_4x4.sc: Delete STACK. Move TINY_DATA_SECTION, TINY_BSS_SECTION, and .stack before debug sections.
2017-02-13Don't use "_gp" on RISC-V, use "_global_pointer$" insteadPalmer Dabbelt1-1/+1
"_gp" could conflict with ABI-complient code. While it's probably OK because MIPS uses this name, we figured it'd be good to clean this up before a release with RISC-V in it. ld/ChangeLog: 2017-02-13 Palmer Dabbelt <palmer@dabbelt.com> * emulparams/elf32lriscv-defs.sh (SDATA_START_SYMBOLS): Change _gp to __global_pointer$. bfd/ChangeLog: 2017-02-13 Palmer Dabbelt <palmer@dabbelt.com> * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to __global_pointer$.
2017-01-29Fix long-standing buglet and fallout from now-default initfini-array.Hans-Peter Nilsson1-2/+1
* emulparams/criself.sh (USER_LABEL_PREFIX): Define. (OTHER_READONLY_SECTIONS, ENTRY): Delete now-redunant defines.
2017-01-10X32: Place .plt.got section after .plt sectionH.J. Lu1-0/+4
This patch places .plt.got section after .plt section for x32. * emulparams/elf32_x86_64.sh (TINY_READONLY_SECTION): New. * testsuite/ld-x86-64/pr20830.d: Renamed to ... * testsuite/ld-x86-64/pr20830a.d: This. Updated. * testsuite/ld-x86-64/pr20830b.d: New file. * testsuite/ld-x86-64/x86-64.exp: Rename pr20830 to pr20830a. Run pr20830b.
2017-01-10[ARC] Add new linker emulation for npsGraham Markall2-0/+81
The arc700 nps variant uses some specific named sections to facilitate its CMEM based instructions, which operate on memory regions fixed at specific addresses. This commit adds the arclinux_nps emulation, which is based on the arclinux emulation. The new emulation uses the OTHER_SECTIONS variable in the emulation parameters script to provide symbols mapping to various locations in the CMEM space on nps. The accompanying test ensures that all symbols are provided at the correct address in the linker script. ld/ChangeLog: * Makefile.am: Add earclinux_nps.c target and add to ALL_EMULATION_SOURCES. * Makefile.in: Likewise, regenerated. * configure.tgt: Add arclinux_nps as an extra emulation for arc*-*-elf* and arc*-*-linux*. * emulparams/arc-nps.sh: New file. * emulparams/arclinux_nps.sh: New file. * testsuite/ld-arc/arclinux-nps.d, * testsuite/ld-arc/arclinux-nps.s: New test.
2017-01-09Remove some custom sections from RISC-V's default linker scriptsPalmer Dabbelt1-12/+0
This was added so compressed loads could have smaller offsets for accessing the data section, but the result was that writable sections ended up in INITIAL_READONLY_SECTIONS. This is a bad idea. The fix is to just remove this micro-optimization. Thanks to Alan Morda for finding the problem! ld/ChangeLog 2017-01-09 Palmer Dabbelt <palmer@dabbelt.com> Kito Cheng <kito.cheng@gmail.com> * emulparams/elf32lriscv-defs.sh (INITIAL_READONLY_SECTIONS): Removed. (SDATA_START_SYMBOLS): Likewise.
2017-01-02Support -z relro on metagAlan Modra1-0/+1
* emulparams/elf32metag.sh (COMMONPAGESIZE): Define.
2017-01-02Support -z relro on hppaAlan Modra1-2/+11
PR ld/21000 * emulparams/hppalinux.sh (DATA_ADDR, SHLIB_DATA_ADDR): Don't define. (DATA_SEGMENT_ALIGN, DATA_SEGMENT_END, DATA_SEGMENT_RELRO_END): Define. * scripttempl/elf.sc: Don't define the above if DATA_SEGMENT_ALIGN is already defined.
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-12-31PRU LD PortDimitar Dimitrov1-0/+19
* NEWS: Mention new PRU target. * Makefile.am: Add PRU target. * configure.tgt: Ditto. * emulparams/pruelf.sh: New file. * emultempl/pruelf.em: New file. * scripttempl/pru.sc: New file. * Makefile.in: Regenerate. * testsuite/ld-pru/emit-relocs-1.d: New PRU testcase file. * testsuite/ld-pru/emit-relocs-1.ld: Ditto. * testsuite/ld-pru/emit-relocs-1a.s: Ditto. * testsuite/ld-pru/emit-relocs-1b.s * testsuite/ld-pru/ldi32.d: Ditto. * testsuite/ld-pru/ldi32.s: Ditto. * testsuite/ld-pru/ldi32_symbol.s: Ditto. * testsuite/ld-pru/norelax_ldi32-data.d: Ditto. * testsuite/ld-pru/norelax_ldi32-dis.d: Ditto. * testsuite/ld-pru/pcrel_s10.d: Ditto. * testsuite/ld-pru/pcrel_s10.s: Ditto. * testsuite/ld-pru/pcrel_s10_label.s: Ditto. * testsuite/ld-pru/pcrel_u8-illegal.d: Ditto. * testsuite/ld-pru/pcrel_u8-illegal.s: Ditto. * testsuite/ld-pru/pcrel_u8-illegal2.d: Ditto. * testsuite/ld-pru/pcrel_u8-illegal2.s: Ditto. * testsuite/ld-pru/pcrel_u8-illegal3.d: Ditto. * testsuite/ld-pru/pcrel_u8-illegal3.s: Ditto. * testsuite/ld-pru/pcrel_u8.d: Ditto. * testsuite/ld-pru/pcrel_u8.s: Ditto. * testsuite/ld-pru/pcrel_u8_label.s: Ditto. * testsuite/ld-pru/pmem.d: Ditto. * testsuite/ld-pru/pmem.s: Ditto. * testsuite/ld-pru/pmem_symbol.s: Ditto. * testsuite/ld-pru/pru.exp: Ditto. * testsuite/ld-pru/relax_ldi32-data.d: Ditto. * testsuite/ld-pru/relax_ldi32-dis.d: Ditto. * testsuite/ld-pru/relax_ldi32.s: Ditto. * testsuite/ld-pru/relax_ldi32_symbol.s: Ditto. * testsuite/ld-pru/reloc.d: Ditto. * testsuite/ld-pru/reloc.s: Ditto. * testsuite/ld-pru/reloc_symbol.s: Ditto. * testsuite/ld-pru/u16.d: Ditto. * testsuite/ld-pru/u16.s: Ditto. * testsuite/ld-pru/u16_symbol.s: Ditto. PRU does not export __end symbol because it is ambiguous for it. Users are expected to use instead the section markers __text_end, __data_end, __bss_end or __noinit_end. * testsuite/lib/ld-lib.exp (check_shared_lib_support): No shared libraries are supported for PRU. (check_gc_sections_available): Mark PRU as not supported. * testsuite/ld-elf/eh-frame-hdr.d: Disable for PRU. * testsuite/ld-elf/endsym.d: Likewise. * testsuite/ld-elf/group8a.d: Likewise. * testsuite/ld-elf/group8b.d: Likewise. * testsuite/ld-elf/group9a.d: Likewise. * testsuite/ld-elf/group9b.d: Likewise. * testsuite/ld-elf/merge.d: Likewise. * testsuite/ld-elf/pr12851.d: Likewise. * testsuite/ld-elf/pr14926.d: Likewise. * testsuite/ld-elf/sec-to-seg.exp: Likewise. * testsuite/ld-elf/sec64k.exp: Mark sec64k case as too big for PRU. * testsuite/ld-srec/srec.exp (run_srec_test): Add setup for PRU. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2016-12-02Add support for Fushia OS.Josh Conner2-0/+34
* configure.ac: Add fuchsia to targets that use ELF. * configure: Regenerated. bfd * configure.tgt: Add support for fuchsia (OS). gas * configure.tgt: Add support for fuchsia (OS). ld * Makefile.am: Add dependency information for earmelf_fuchsia.c. * Makefile.in: Regenerate. * configure.tgt: Add support for aarch64-*-fuchsia, arm*-*-fuchsia*, and x86_64-*-fuchsia* targets. * emulparams/armelf_fuchsia.sh: New file. * emulparams/armelfb_fuchsia.sh: New file.
2016-11-28arc/ld: Remove duplicate TEMPLATE_NAME from emulparam fileAndrew Burgess1-1/+0
Remove duplicate definition of TEMPLATE_NAME, only the last of these will have any effect, so this should result in no visible changes to the user. ld/ChangeLog: * emulparams/arclinux_prof.sh: Remove duplicate TEMPLATE_NAME.
2016-11-01Add support for RISC-V architecture.Nick Clifton4-0/+59
bfd * Makefile.am: Add entries for riscv32-elf and riscv64-elf. * config.bdf: Likewise. * configure.ac: Likewise. * Makefile.in: Regenerate. * configure: Regenerate. * archures.c: Add bfd_riscv_arch. * reloc.c: Add riscv relocs. * targets.c: Add riscv_elf32_vec and riscv_elf64_vec. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elf-bfd.h: Add RISCV_ELF_DATA to enum elf_target_id. * elfnn-riscv.c: New file. * elfxx-riscv.c: New file. * elfxx-riscv.h: New file. binutils* readelf.c (guess_is_rela): Add EM_RISCV. (get_machine_name): Likewise. (dump_relocations): Add support for riscv relocations. (get_machine_flags): Add support for riscv flags. (is_32bit_abs_reloc): Add R_RISCV_32. (is_64bit_abs_reloc): Add R_RISCV_64. (is_none_reloc): Add R_RISCV_NONE. * testsuite/binutils-all/objdump.exp (cpus_expected): Add riscv. Expect the debug_ranges test to fail. gas * Makefile.am: Add riscv files. * Makefile.in: Regenerate. * NEWS: Mention the support for this architecture. * configure.in: Define a default architecture. * configure: Regenerate. * configure.tgt: Add entries for riscv. * doc/as.texinfo: Likewise. * testsuite/gas/all/gas.exp: Expect the redef tests to fail. * testsuite/gas/elf/elf.exp: Expect the groupauto tests to fail. * config/tc-riscv.c: New file. * config/tc-riscv.h: New file. * doc/c-riscv.texi: New file. * testsuite/gas/riscv: New directory. * testsuite/gas/riscv/riscv.exp: New file. * testsuite/gas/riscv/t_insns.d: New file. * testsuite/gas/riscv/t_insns.s: New file. ld * Makefile.am: Add riscv files. * Makefile.in: Regenerate. * NEWS: Mention the support for this target. * configure.tgt: Add riscv entries. * emulparams/elf32lriscv-defs.sh: New file. * emulparams/elf32lriscv.sh: New file. * emulparams/elf64lriscv-defs.sh: New file. * emulparams/elf64lriscv.sh: New file. * emultempl/riscvelf.em: New file. opcodes * configure.ac: Add entry for bfd_riscv_arch. * configure: Regenerate. * disassemble.c (disassembler): Add support for riscv. (disassembler_usage): Likewise. * riscv-dis.c: New file. * riscv-opc.c: New file. include * dis-asm.h: Add prototypes for print_insn_riscv and print_riscv_disassembler_options. * elf/riscv.h: New file. * opcode/riscv-opc.h: New file. * opcode/riscv.h: New file.
2016-10-10S/390: Move binary start to 16M.Andreas Krebbel1-1/+1
Turned out that by moving the binary start to 256M I've hit a case with potentially a lot of aliasing in the branch target buffer between binaries and shared libs. So moving on. Tested on s390x. No regressions. ld/ChangeLog: 2016-10-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * emulparams/elf64_s390.sh: Move binary start to 16M. * testsuite/ld-s390/tlsbin_64.dd: Adjust testcases accordingly. * testsuite/ld-s390/tlsbin_64.rd: Likewise.
2016-10-06Add workaround for bash 4.2 scripting problem.Ludovic Court?s1-1/+2
* emulparams/elf32bmipn32-defs.sh: Shift quote of "x$EMULATION_NAME" to the left to work around <http://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-007>.
2016-09-23S/390: Move start of 64 bit binaries from 2GB to 256MB.Andreas Krebbel1-1/+1
ld/ChangeLog: 2016-09-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * emulparams/elf64_s390.sh: Change TEXT_START_ADDR to 256MB. * testsuite/ld-s390/tlsbin_64.dd: Adjust testcase accordingly. * testsuite/ld-s390/tlsbin_64.rd: Likewise.
2016-08-09Support -pie for arm*-eabi targets.Roland McGrath1-0/+1
ld/ * emulparams/armelf.sh (GENERATE_PIE_SCRIPT): Set to yes.
2016-08-02Fix SH GOT allocation in the presence of linker garbage collection.Nick Clifton7-1/+22
PR ld/17739 ld * emulparams/shelf.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Define with valye 'yes'. * emulparams/shelf32.sh: Likewise. * emulparams/shelf32.sh: Likewise. * emulparams/shelf_nto.sh: Likewise. * emulparams/shelf_nto.sh: Likewise. * emulparams/shelf_vxworks.sh: Likewise. * emulparams/shelf_vxworks.sh: Likewise. * emulparams/shlelf32_linux.sh: Likewise. * emulparams/shlelf32_linux.sh: Likewise. * emulparams/shlelf_linux.sh: Likewise. * emulparams/shlelf_linux.sh: Likewise. * emulparams/shlelf_nto.sh: Likewise. * emulparams/shlelf_nto.sh: Likewise. bfd * elf32-sh.c (sh_elf_gc_sweep_hook): Delete. (elf_backend_sweep_hook): Delete.
2016-07-19Support -pie for aarch64*-elf targets.Roland McGrath2-0/+4
ld/ * emulparams/aarch64elf.sh (GENERATE_PIE_SCRIPT): Set to yes. * emulparams/aarch64elf32.sh: Likewise.
2016-07-14[ARC] Fix/improve small data support.Claudiu Zissulescu1-1/+1
The R_ARC_SDA32 is wrongly described as a ME relocation, fix it. Offset the __SDATA_BEGIN__ to take advantage of the signed 9-bit field of the load/store instructions. include/ 2016-07-08 Claudiu Zissulescu <claziss@synopsys.com> * elf/arc-reloc.def (ARC_SDA32): Don't use ME transformation. ld/ 2016-07-08 Claudiu Zissulescu <claziss@synopsys.com> * emulparams/arcelf.sh (SDATA_START_SYMBOLS): Add offset. * testsuite/ld-arc/sda-relocs.dd: New file. * testsuite/ld-arc/sda-relocs.ld: Likewise. * testsuite/ld-arc/sda-relocs.rd: Likewise. * testsuite/ld-arc/sda-relocs.s: Likewise. * testsuite/ld-arc/arc.exp: Add SDA tests.
2016-05-23Add support for configuring for the ARM Phoenix target.Kuba Sejdak1-0/+24
bfd * config.bfd: Add entry for arm-phoenix. gas * configuse.tgt: Add entry for arm-phoenix. ld * Makefile.am: Add earmelf_phoenix.c. * Makefile.in: Regenerate. * configure.tgt: Add entry for arm-phoenix. * emulparams/armelf_phoenix.sh: New file.
2016-05-19[ARC] Emulation and default script template changes.Claudiu Zissulescu2-7/+12
2016-05-19 Cupertino Miranda <cmiranda@synopsys.com> * emulparams/arcelf.sh: Changed. * emulparams/arclinux.sh: Likewise. * scripttempl/arclinux.sc: Moved to a more standard implementation similar to elf.sc.
2016-05-05More setting CHECK_RELOCS_AFTER_OPEN_INPUT to yesH.J. Lu3-0/+3
* emulparams/elf_iamcu.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): New. * emulparams/elf_k1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_l1om.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise.
2016-04-20Check ELF relocs after opening all input filesH.J. Lu8-0/+8
Delaying checking ELF relocations until opening all input files so that symbol information is final when relocations are checked. This is only enabled for x86 targets. bfd/ * elf-bfd.h (_bfd_elf_link_check_relocs): New. * elflink.c (_bfd_elf_link_check_relocs): New function. (elf_link_add_object_symbols): Call _bfd_elf_link_check_relocs if check_relocs_after_open_input is FALSE. include/ * bfdlink.h (bfd_link_info): Add check_relocs_after_open_input. ld/ * emulparams/elf32_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): New. * emulparams/elf_i386.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_be.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_chaos.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_ldso.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_i386_vxworks.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/elf_x86_64.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emulparams/i386nto.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set check_relocs_after_open_input to TRUE if CHECK_RELOCS_AFTER_OPEN_INPUT is yes. (gld${EMULATION_NAME}_after_open): Call _bfd_elf_link_check_relocs on all inputs if check_relocs_after_open_input is TRUE.
2016-04-09Adjust default memory size and stack base address for SH simulator.Oleg Endo1-2/+2
ld/ChangeLog: * sh/interp.c (sim_memory_size): Default init to 30. (parse_and_set_memory_size): Adjust upper bound to 31. sim/ChangeLog: * sh/interp.c (sim_memory_size): Default init to 30. (parse_and_set_memory_size): Adjust upper bound to 31.
2016-04-07ld/arc: Make little endian default choice for linker scriptsAndrew Burgess1-3/+4
When building with --enable-targets=all the target string is not set to something that matches the pattern arc*-*, and so the script used to decide if we should build big or little endian linker script currently exits with an error. This commit makes little endian linker script be the default, which will be used when building for all targets, this matches the behaviour from before I made the endianness switchable, when we only ever built little endian linker scripts anyway. ld/ChangeLog: * emulparams/arc-endianness.sh: Make little endian default choice.