aboutsummaryrefslogtreecommitdiff
path: root/ld
AgeCommit message (Collapse)AuthorFilesLines
2014-04-07Fix spurious failures in ld-plugin/lto.expAndreas Schwab2-4/+10
* ld-plugin/lto.exp: Make "-Wp," prefix optional when filtering out _FORTIFY_SOURCE. ("Build libdummy.a 9", "PR ld/12696"): Mark as c++.
2014-04-04Document optional comma in linker script.Cary Coutant2-2/+13
The linker script documentation does not mention the optional comma that may follow an output section command or an overlay command. In some cases, where a fill expression is used, and the next output section command begins with an operator (e.g., "/DISCARD/"), the comma may be required to separate the two commands. Currently, GNU ld doesn't require the comma, but gold does. ld/ PR gold/16804 * ld.texinfo: Document optional comma following output section command and overlay command.
2014-04-04Pad sections according to current script FILL.Alan Modra9-1/+71
When aligning input sections, we are supposed to take the fill pattern from a FILL statement, if there is one in the output section statement. ld/ * ldlang.c (lang_size_sections_1 <lang_input_section_enum>): Use current "fill", not "output_section_statement->fill". ld/testsuite/ * ld-scripts/fill.d, * ld-scripts/fill.t, * ld-scripts/fill_0.s, * ld-scripts/fill_1.s, * ld-scripts/fill_2.s: New test. * ld-scripts/data.exp: Run it.
2014-03-31This is a fix for PR ld/16744 which showed that an object file linked with ↵Nick Clifton2-1/+21
-r and -z [no]execstack would not honour the [no]execstack. Fully linked binaries use a special segment to indicate the state of the stack, but relocatable object files only have sections, and .note.GNU-stack was not being created. * emultempl/elf32.em (_after_open): Create a .note.GNU-stack section when performing a relocatable link with -z [no]execstack specified.
2014-03-31[AArch64] Fixup ld-aarch64/eh-frame.d expected PC range.Marcus Shawcroft2-2/+6
Fix the expected output for ld-aarch64/eh-frame.d. This issue was exposed by the recent fix to the output of objdump -Wf here: https://sourceware.org/ml/binutils/2014-03/msg00251.html
2014-03-29* ChangeLog: Fix duplicate entry. Set date on entry correctly.Chris Faylor1-11/+1
2014-03-27Scan all input files for symbol reference warningH.J. Lu4-48/+70
This patch scans all input files for symbol reference warning if the symbol reference doesn't exist in the current input file. ld/ PR ld/16756 * ldmain.c (symbol_warning): New function. (warning_callback): Use it. Scan all input files for a reference to SYMBOL. ld/testsuite/ PR ld/16756 * ld-plugin/lto.exp: Expect filename and line number for PR ld/12760 test.
2014-03-27Add support for limited pretty-printing of ARM PLT entries on eabi and nacl ↵Yury Gribov29-384/+483
targets. * elf32-arm.c (elf32_arm_get_synthetic_symtab): Add new callback. (elf32_arm_nacl_plt_sym_val): Likewise. (elf32_arm_plt0_size): Add helper function. (elf32_arm_plt_size): Likewise. * ld-arm/arm-app-abs32.d: Updated test. * ld-arm/arm-app.d: Likewise. * ld-arm/arm-lib-plt32.d: Likewise. * ld-arm/arm-lib.d: Likewise. * ld-arm/armthumb-lib.d: Likewise. * ld-arm/cortex-a8-fix-b-plt.d: Likewise. * ld-arm/cortex-a8-fix-bcc-plt.d: Likewise. * ld-arm/cortex-a8-fix-bl-plt.d: Likewise. * ld-arm/cortex-a8-fix-bl-rel-plt.d: Likewise. * ld-arm/cortex-a8-fix-blx-plt.d: Likewise. * ld-arm/farcall-mixed-app-v5.d: Likewise. * ld-arm/farcall-mixed-app.d: Likewise. * ld-arm/farcall-mixed-lib-v4t.d: Likewise. * ld-arm/farcall-mixed-lib.d: Likewise. * ld-arm/ifunc-10.dd: Likewise. * ld-arm/ifunc-14.dd: Likewise. * ld-arm/ifunc-15.dd: Likewise. * ld-arm/ifunc-3.dd: Likewise. * ld-arm/ifunc-4.dd: Likewise. * ld-arm/ifunc-7.dd: Likewise. * ld-arm/ifunc-8.dd: Likewise. * ld-arm/ifunc-9.dd: Likewise. * ld-arm/long-plt-format.d: Likewise. * ld-arm/mixed-app-v5.d: Likewise. * ld-arm/mixed-app.d: Likewise. * ld-arm/mixed-lib.d: Likewise. * ld-arm/thumb2-bl-undefweak.d: Likewise. * ld-arm/thumb2-bl-undefweak1.d: Likewise.
2014-03-27Referencing a function's address on PowerPC64 ELFv2Alan Modra9-0/+68
ELFv2 needs to create plt entries in a non-PIC executable for an address reference to a function defined in a shared object. It's possible that an object file has no features that distinguish it as ELFv1 or ELFv2, eg. an object only containing data. Such files need to be handled like those that are known to be ELFv2. However, this unnecessarily creates plt entries for the analogous ELFv1 case, so arrange to set output abi version earlier, and use the output abi version to further distinguish ambiguous input files. bfd/ * elf64-ppc.c (ppc64_elf_check_relocs): Account for possibly needed plt entries when taking the address of functions for abiversion == 0 (ie. unknown) as well as abiversion == 2. Move opd setup and abiversion checks to.. (ppc64_elf_before_check_relocs): ..here. Renamed from ppc64_elf_process_dot_syms. Set output abiversion from input and input abiversion from output, if either is not set. (ppc64_elf_merge_private_bfd_data): Don't merge flags here. (elf_backend_check_directives): Update. ld/testsuite/ * ld-powerpc/startv1.s, * ld-powerpc/startv2.s, * ld-powerpc/funref.s, * ld-powerpc/funv1.s, * ld-powerpc/funv2.s, * ld-powerpc/ambiguousv1.d, * ld-powerpc/ambiguousv2.d: New test files. * ld-powerpc/powerpc.exp: Run new tests.
2014-03-25bfd/elfnn-aarch64.c: Fix calculation of DT_RELASZWill Newton4-0/+35
The current code subtracts the size of the output section containing relplt from RELASZ. In some cases this will be the same output section as the dynamic relocs causing a value of zero to be output. Calculating the size from input sections seems to make more sense. bfd/ChangeLog: 2014-03-25 Will Newton <will.newton@linaro.org> * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_sections): Set value of DT_PLTRELSZ and DT_RELASZ based on the size of input sections rather than output sections. ld/testsuite/ChangeLog: 2014-03-25 Will Newton <will.newton@linaro.org> * ld-aarch64/aarch64-elf.exp: Add relasz dump test. * ld-aarch64/relasz.d: New file. * ld-aarch64/relasz.s: Likewise.
2014-03-212014-03-21 Christopher Faylor <me.binutils2014@cgf.cx>Chris Faylor3-10/+29
* ld.texinfo: Document change in handling of --enable-auto-image-base. * emultempl/pe.em (pe_auto_image_base): Set to default base. (gld_${EMULATION_NAME}_list_options): Change usage message to reflect optional --enable-auto-image-base argument. (gld${EMULATION_NAME}_handle_option): Handle optional --enable-auto-image-base argument. (compute_dll_image_base): Eliminate constant. Use pe_auto_image_base.
2014-03-20gas/Richard Sandiford2-1/+5
* config/tc-mips.h (DIFF_EXPR_OK, CFI_DIFF_EXPR_OK): Define. * config/tc-mips.c (md_pcrel_from): Remove error message. (md_apply_fix): Convert PC-relative BFD_RELOC_32s to BFD_RELOC_32_PCREL. Report a specific error message for unhandled PC-relative expressions. Handle BFD_RELOC_8. gas/testsuite/ * gas/all/gas.exp: Remove XFAIL of forward.d for MIPS. * gas/mips/pcrel-1.s, gas/mips/pcrel-1.d, gas/mips/pcrel-2.s, gas/mips/pcrel-2.d, gas/mips/pcrel-3.s, gas/mips/pcrel-3.l, gas/mips/pcrel-4.s, gas/mips/pcrel-4-32.d, gas/mips/pcrel-4-n32.d, gas/mips/pcrel-4-64.d: New tests. * gas/mips/mips.exp: Run them. * gas/mips/lui-2.l: Tweak error message for line 7. ld/testsuite/ * ld-elf/merge.d: Remove MIPS XFAIL.
2014-03-20bfd/elf32-arm.c: Set st_value to zero for undefined symbolsWill Newton2-2/+6
Unless pointer_equality_needed is set then set st_value to be zero for undefined symbols. bfd/ChangeLog: 2014-03-20 Will Newton <will.newton@linaro.org> PR ld/16715 * elf32-arm.c (elf32_arm_check_relocs): Set pointer_equality_needed for absolute references within executable links. (elf32_arm_finish_dynamic_symbol): Set st_value to zero unless pointer_equality_needed is set. ld/testsuite/ChangeLog: 2014-03-20 Will Newton <will.newton@linaro.org> * ld-arm/ifunc-14.rd: Update symbol values.
2014-03-19Improve .rsrc section merging again. This time with an algorithm thatNick Clifton3-7/+13
should work for all types of input .rsrc section. * peXXigen.c (rsrc_process_section): Add code to scan input sections and record their lengths. Use these lengths to find the start of each merged .rsrc section. * scripttempl/pe.sc (R_RSRC): Fix default-manifest exclusion. (.rsrc): Add SUBALIGN(4). Remove SORT. * scripttempl/pep.sc: Likewise.
2014-03-19Fix RX linker testsuite failures by making the assembler use conventional ↵Nick Clifton2-0/+10
section names. * config/default.exp (ASFLAGS): For the RX target add: -muse-conventional-section-names.
2014-03-19Improve .rsrc section merging with better handling of the alignment adjustmentsNick Clifton6-7/+16
made between merged .rsrc sections. * peXXigen.c (rsrc_align): New function. Attempts to cope with alignment variances when .rsrc sections are merged. (rsrc_process_section): Use rsrc_align. * Makefile.am (default-manifest.o): Use WINDRES_FOR_TARGET. * Makefile.in: Regenerate. * emultempl/default-manifest.rc: Fix typo. * scripttempl/pe.sc (R_RSRC): Fix default-manifest exclusion. (.rsrc): Add SUBALIGN(4). * scripttempl/pep.sc: Likewise.
2014-03-172014-03-17 Christopher Faylor <me.cygwin2014@cgf.cx>Chris Faylor3-2/+17
* Makefile.am: Use host version of windres. * Makefile.in: Regenerate.
2014-03-15Correct ld-powerpc/vle-reloc-2 testAlan Modra2-4/+8
* ld-powerpc/vle-reloc-3.d: Remove addresses.
2014-03-14Fix overflow handling of VLE_SDA21Alan Modra3-2/+8
bfd/ * elf32-ppc.c (ppc_elf_relocate_section): Correct overflow handling for VLE_SDA21 relocs. ld/testsuite/ * ld-powerpc/vle.ld: Place .PPC.EMB.sdata0 within 32k of 0. * ld-powerpc/vle-reloc-3.d: Update.
2014-03-14Remove search path from -l:namespec DT_NEEDEDAlan Modra10-36/+68
For libraries without a soname, -l:libfoo.so set DT_NEEDED to the search dir plus filename, while gold and -lfoo just use the filename. This patch fixes the inconsistency. * ldlang.h (full_name_provided): New input flag. * ldlang.c (new_afile): Don't use lang_input_file_is_search_file_enum for -l:namespec. Instead use lang_input_file_is_l_enum with full_name_provided flag. * ldlfile.c (ldfile_open_file_search): Don't complete lib name if full_name_provided flag is set. * emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive): Handle full_name_provided libraries. Tidy EXTRA_SHLIB_EXTENSION support. Set DT_NEEDED for -l:namespec as namespec. * emultempl/aix.em (ppc_after_open_output): Handle full_name_provided. * emultempl/linux.em (gld${EMULATION_NAME}_open_dynamic_archive): Don't handle full_name_provided libraries. * emultempl/pe.em (gld${EMULATION_NAME}_open_dynamic_archive): Ditto. * emultempl/pep.em (gld${EMULATION_NAME}_open_dynamic_archive): Ditto. * emultempl/vms.em (gld${EMULATION_NAME}_open_dynamic_archive): Ditto.
2014-03-12autoreconfAlan Modra2-4/+6
Regenerate Makefile.in in bfd, binutils, gas, gold, gprof, ld, opcodes. Regenerate gas/config.in.
2014-03-06Apply ld-arm/gc-hidden-1 to all ELF targets, not just *eabi* targetsRoland McGrath2-8/+15
ld/testsuite/ * ld-arm/gc-hidden-1.d: Remove target, add not-target to match other ELF-only tests in this directory. Loosen regexps so they don't care what the exact addresses are.
2014-03-06Disable --long-plt test for arm-nacl targets.Roland McGrath2-4/+9
ld/testsuite/ * ld-arm/arm-elf.exp (armelftests_common): Move long-plt case ... (armelftests_nonacl): ... here.
2014-03-05Update copyright yearsAlan Modra248-363/+257
2014-03-05Support R_PPC64_ADDR64_LOCALAlan Modra6-0/+98
This adds support for "func@localentry", an expression that returns the ELFv2 local entry point address of function "func". I've excluded dynamic relocation support because that obviously would require glibc changes. include/elf/ * ppc64.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define. bfd/ * elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_ADDR64_LOCAL entry. (ppc64_elf_reloc_type_lookup): Support R_PPC64_ADDR64_LOCAL. (ppc64_elf_check_relocs): Likewise. (ppc64_elf_relocate_section): Likewise. * Add BFD_RELOC_PPC64_ADDR64_LOCAL. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-ppc.c (ppc_elf_suffix): Support @localentry. (md_apply_fix): Support R_PPC64_ADDR64_LOCAL. ld/testsuite/ * ld-powerpc/elfv2-2a.s, ld-powerpc/elfv2-2b.s: New files. * ld-powerpc/elfv2-2exe.d, ld-powerpc/elfv2-2so.d: New files. * ld-powerpc/powerpc.exp: Run new test. elfcpp/ * powerpc.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define. gold/ * powerpc.cc (Target_powerpc::Scan::local, global): Support R_PPC64_ADDR64_LOCAL. (Target_powerpc::Relocate::relocate): Likewise.
2014-03-04Remove default-manifest from ALL_EMUL_EXTRA_BINARIES so that it is not ↵Nick Clifton3-4/+7
mistakenly built when constructing a toolchain configued from all targets. * Makefile.am (ALL_EMUL_EXTRA_BINARIES): Remove default-manifest. * Makefile.in: Regenerate.
2014-03-03Fix various copyright issuesAlan Modra3-2/+7
binutils/ * README: Add "Copyright Notices" paragraph. gas/ * config/bfin-lex-wrapper.c: Correct copyright date. * config/tc-frv.c: Correct copyright punctuation. * config/tc-ip2k.c: Likewise. * config/tc-iq2000.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-tic4x.c: Likewise. * config/tc-tic4x.h: Likewise. ld/testsuite/ * ld-scripts/phdrs2.exp: Correct copyright punctuation. * ld-v850/v850.exp: Correct copyright typo. opcodes/ * i386-gen.c (process_copyright): Emit copyright notice on one line. gold/ * dwp.cc (print_version): Update copyright year to current.
2014-03-01ld-arm/long-plt-format.d, ld-arm/arm-elf.exp: Adjust for arm-eabi.Yuri Gribov3-11/+15
2014-02-27This patch adds support for ARM PLT entries that support a full 32-bit ↵Yuri Gribov7-18/+73
offset range. Enabled via the use of a new linker command line option: --long-plt. * bfd-in.h: Add export of bfd_elf32_arm_use_long_plt. * bfd-in2.h: Regenerate. * elf32-arm.c (elf32_arm_plt_entry_long): New array. (elf32_arm_link_hash_table_create): Set plt_entry_size to 16 if using long PLT entries. (bfd_elf32_arm_use_long_plt): New function. (elf32_arm_populate_plt_entry): Add support for long PLT entries. * emultempl/armelf.em (OPTION_LONG_PLT): Define. (PARSE_AND_LIST_LONGOPTS): Add long-plt. (PARSE_AND_LIST_OPTIONS): Likewise. (PARSE_AND_LIST_ARGS_CASES): Handle long-plt. * ld.texinfo: Document --long-plt. * ld-arm/long-plt-format.s: New test case. * ld-arm/long-plt-format.d: Expected disassembly. * ld-arm/arm-elf.exp: Run the new test.
2014-02-27This patch adds a default manifest in to the final links performed by the ↵Nick Clifton17-34/+184
Cygwin and MinGW targets. The manifest is necessary in order for the linked binaries to be executed in a Windows 8 environment. The manifest is added using a linker script so that this feature will be compiler-neutral. The resource merging code in the linker means that if an application provides its own manifest then the default manifest will be ignored. * configure.in (all_emul_extra_binaries): New variable. Populated by invoking configure.tgt. (EMUL_EXTRA_BINARIES): New substitution. * configure: Regenerate. * configure.tgt (target_extra_binaries): New variable. Set to default-manifest.o for Cygwin and MinGW targets. * Makefile.am (EMUL_EXTRA_BINARIES): New variable. Initialised by the configure script. (ALL_EMUL_EXTRA_BINARIES): New variable. (default-manifest.o): New rule to build the default manifest. (ld_new_DEPENDENCIES): Add EMUL_EXTRA_BINARIES. (install-data-local): Add EMUL_EXTRA_BINARIES. * Makefile.in: Regenerate. * ld.texinfo: Document default manifest support. * emulparams/i386pe.sh (DEFAULT_MANIFEST): Define. * emulparams/i386pep.sh (DEFAULT_MANIFEST): Define. * emultempl/default-manifest.rc: New file. * scripttempl/pe.sc (R_RSRC): Include DEFAULT_MANIFEST, if defined. * scripttempl/pep.sc (R_RSRC): Likewise. * ld-pe/longsecn-1.d: Allow for extra sections. * ld-pe/longsecn-2.d: Likewise. * ld-pe/longsecn.d: Likewise. * ld-pe/secrel.d: Likewise.
2014-02-27Fix ELF ppc32 targets that don't use ppc32elf.emAlan Modra3-7/+36
5446cbdf82892a800ed7eef563a795e75223ec52 broke powerpc-lynxos, powerpc-netware, powerpc-windiss and powerpc-vxworks. bfd/ * elf32-ppc.c (ppc_elf_link_hash_table_create): Provide default params for targets that don't use ppc32elf.em. ld/ * emulparams/elf32ppcvxworks.sh: Source plt_unwind.sh and use ppc32elf.em. * emultempl/ppc32elf.em (ppc_after_open): Don't compile for vxworks. (LDEMUL_AFTER_OPEN): Don't set for vxworks. (PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Exclude -secure-plt, -bss-plt and -sdata-got when vxworks.
2014-02-26Resolve PR ld/16569 by emitting (and comparing) unmangled names, unlessDan Mick2-9/+31
demangling has specifically been requested.
2014-02-21Add file missed from last commit.Alan Modra1-0/+7
2014-02-21Add ppc476 workaround bootstrap testAlan Modra2-2/+15
I was running this by hand to test out --ppc476-workaround. Another bootstrap test doesn't take all that long, so let's add it to the testsuite. * ld-bootstrap/bootstrap.exp: Add ppc476 workaround test. * ld-bootstrap/ppc476.t: New file.
2014-02-19Create the second PLT for BND relocationsH.J. Lu7-0/+95
Intel MPX introduces 4 bound registers, which will be used for parameter passing in x86-64. Bound registers are cleared by branch instructions. Branch instructions with BND prefix will keep bound register contents. This leads to 2 requirements to 64-bit MPX run-time: 1. Dynamic linker (ld.so) should save and restore bound registers during symbol lookup. 2. Change the current 16-byte PLT0: ff 35 08 00 00 00 pushq GOT+8(%rip) ff 25 00 10 00 jmpq *GOT+16(%rip) 0f 1f 40 00 nopl 0x0(%rax) and 16-byte PLT1: ff 25 00 00 00 00 jmpq *name@GOTPCREL(%rip) 68 00 00 00 00 pushq $index e9 00 00 00 00 jmpq PLT0 which clear bound registers, to preserve bound registers. We use 2 new relocations: to mark branch instructions with BND prefix. When linker sees any R_X86_64_PC32_BND or R_X86_64_PLT32_BND relocations, it switches to a different PLT0: ff 35 08 00 00 00 pushq GOT+8(%rip) f2 ff 25 00 10 00 bnd jmpq *GOT+16(%rip) 0f 1f 00 nopl (%rax) to preserve bound registers for symbol lookup and it also creates an external PLT section, .pl.bnd. Linker will create a BND PLT1 entry in .plt: 68 00 00 00 00 pushq $index f2 e9 00 00 00 00 bnd jmpq PLT0 0f 1f 44 00 00 nopl 0(%rax,%rax,1) and a 8-byte BND PLT entry in .plt.bnd: f2 ff 25 00 00 00 00 bnd jmpq *name@GOTPCREL(%rip) 90 nop Otherwise, linker will create a legacy PLT1 entry in .plt: 68 00 00 00 00 pushq $index e9 00 00 00 00 jmpq PLT0 66 0f 1f 44 00 00 nopw 0(%rax,%rax,1) and a 8-byte legacy PLT in .plt.bnd: ff 25 00 00 00 00 jmpq *name@GOTPCREL(%rip) 66 90 xchg %ax,%ax The initial value of the GOT entry for "name" will be set to the the "pushq" instruction in the corresponding entry in .plt. Linker will resolve reference of symbol "name" to the entry in the second PLT, .plt.bnd. Prelink stores the offset of pushq of PLT1 (plt_base + 0x10) in GOT[1] and GOT[1] is stored in GOT[3]. We can undo prelink in GOT by computing the corresponding the pushq offset with GOT[1] + (GOT offset - &GOT[3]) * 2 Since for each entry in .plt except for PLT0 we create a 8-byte entry in .plt.bnd, there is extra 8-byte per PLT symbol. We also investigated the 16-byte entry for .plt.bnd. We compared the 8-byte entry vs the the 16-byte entry for .plt.bnd on Sandy Bridge. There are no performance differences in SPEC CPU 2000/2006 as well as micro benchmarks. Pros: No change to undo prelink in dynamic linker. Only 8-byte memory overhead for each PLT symbol. Cons: Extra .plt.bnd section is needed. Extra 8 byte for legacy branches to PLT. GDB is unware of the new layout of .plt and .plt.bnd. bfd/ * elf64-x86-64.c (elf_x86_64_bnd_plt0_entry): New. (elf_x86_64_legacy_plt_entry): Likewise. (elf_x86_64_bnd_plt_entry): Likewise. (elf_x86_64_legacy_plt2_entry): Likewise. (elf_x86_64_bnd_plt2_entry): Likewise. (elf_x86_64_bnd_arch_bed): Likewise. (elf_x86_64_link_hash_entry): Add has_bnd_reloc and plt_bnd. (elf_x86_64_link_hash_table): Add plt_bnd. (elf_x86_64_link_hash_newfunc): Initialize has_bnd_reloc and plt_bnd. (elf_x86_64_copy_indirect_symbol): Also copy has_bnd_reloc. (elf_x86_64_check_relocs): Create the second PLT for Intel MPX in 64-bit mode. (elf_x86_64_allocate_dynrelocs): Handle the second PLT for IFUNC symbols. Resolve call to the second PLT if it is created. (elf_x86_64_size_dynamic_sections): Keep the second PLT section. (elf_x86_64_relocate_section): Resolve PLT references to the second PLT if it is created. (elf_x86_64_finish_dynamic_symbol): Use BND PLT0 and fill the second PLT entry for BND relocation. (elf_x86_64_finish_dynamic_sections): Use MPX backend data if the second PLT is created. (elf_x86_64_get_synthetic_symtab): New. (bfd_elf64_get_synthetic_symtab): Likewise. Undefine for NaCl. ld/ * emulparams/elf_x86_64.sh (TINY_READONLY_SECTION): New. ld/testsuite/ * ld-x86-64/mpx.exp: Run bnd-ifunc-1 and bnd-plt-1. * ld-x86-64/bnd-ifunc-1.d: New file. * ld-x86-64/bnd-ifunc-1.s: Likewise. * ld-x86-64/bnd-plt-1.d: Likewise.
2014-02-19Control powerpc64-ld provision of register save/restoreAlan Modra2-2/+32
This patch allows the user to override powerpc64-ld's default for providing linker generated register save and restore functions as used by gcc -Os code. Normally these are not provided by ld -r, so Linux kernel modules have needed to include their own copies. bfd/ * elf64-ppc.h (struct ppc64_elf_params): Add save_restore_funcs. * elf64-ppc.c (ppc64_elf_func_desc_adjust): Use it to control provision of out-of-line register save/restore routines. ld/ * emultempl/ppc64elf.em (params): Init new field. (ppc_create_output_section_statements): Set params.save_restore_funcs default. (PARSE_AND_LIST_*): Add support for --save-restore-funcs and --no-save-restore-funcs.
2014-02-18The PT_DYNAMIC segment was being hard coded to have read, write, andJack Carter2-1/+5
execute permission regardless of the underlying PT_LOAD segment permissions. Deleting this code allows the default linker behavior which is to set the dynamic segment to the same permissions as the sections that make it up. This change alters one existing test case to check the segment flags for PT_DYNAMIC. bfd/ChangeLog * elfxx-mips.c(_bfd_mips_elf_modify_segment_map): Deleted hard coding of PT_DYNAMIC segment flags. ld/testsuite/ChangeLog * ld-mips-elf/pic-and-nonpic-3a.sd: Check DYNAMIC segment flags.
2014-02-17Consolidate ppc64 ld/bfd communicationAlan Modra2-50/+39
Moves assorted variables used to communicate between ld and bfd into a struct, hooks it into the bfd link_hash_table early, and removes all other places where such variables were passed piecemeal. bfd/ * elf64-ppc.h (struct ppc64_elf_params): Define. (ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup, ppc64_elf_setup_section_lists, ppc64_elf_size_stubs, ppc64_elf_build_stubs): Update prototype. * elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other fields now in params. Adjust code throughout file. (ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params". Save params pointer in htab. (ppc64_elf_edit_opd, ppc64_elf_tls_setup, ppc64_elf_setup_section_lists, ppc64_elf_size_stubs, ppc64_elf_build_stubs): Remove parameters now in "params". ld/ * emultemps/ppc64elf.em (params): New static struct replacing various other static vars. Adjust code throughout file.
2014-02-17ppc476 workaround for ld -r fixesAlan Modra2-2/+5
This fixes the glaring error that the ppc476 workaround wasn't actually enabled for ld -r, and adjusts relocations to match moved code. bfd/ * elf32-ppc.c (ppc_elf_relocate_section): Move relocs on insns patched for ppc476 workaround. Reapply branch taken/not taken relocs. ld/ * emultempl/ppc32elf.em (ppc_after_open_output): Really enable ppc476 workaround for ld -r.
2014-02-16Missing ChangeLog entry from commit 60ef20e28534cf093d5bd799b3830c68381bb27f.Thomas Schwinge1-0/+5
2014-02-16ld: Remove Hurd-specific XFAILs related to weak symbols.Thomas Schwinge1-17/+0
This has been fixed properly, in glibc. ld/testsuite/ * ld-elfweak/elfweak.exp (setup_xfail_gnu_hurd): Remove function and all usage of it.
2014-02-12Enable ppc476 workaround for ld -r.Alan Modra2-5/+14
The Linux kernel builds modules using ld -r. These might need the ppc476 workaround, so enable it for ld -r if sections have sufficient alignment to tell location within a page. bfd/ * elf32-ppc.c (ppc_elf_relax_section): Enable ppc476 workaround for ld -r, when code sections are sufficiently aligned. * elf32-ppc.h (struct ppc_elf_params): Delete pagesize. Add pagesize_p2. ld/ * emultempl/ppc32elf.em (pagesize): New static var. (ppc_after_open_output): Set params.pagesize_p2 from pagesize. (PARSE_AND_LIST_ARGS_CASES): Adjust to use pagesize.
2014-02-112014-02-11 Andrew Pinski <apinski@cavium.com>Andrew Pinski3-1/+10
* emulparams/aarch64linux32.sh (LIBPATH_SUFFIX): Change to ilp32. (ELF_INTERPRETER_NAME): Define. * emulparams/aarch64linux32b.sh (ELF_INTERPRETER_NAME): Define.
2014-02-10Mark symbol in executables if it matches dynamic_listH.J. Lu5-0/+30
bfd/ PR gold/16530 * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark symbol in executables if it matches dynamic_list. ld/testsuite/ PR gold/16530 * ld-elf/dynamic-1.c: New file. * ld-elf/dynamic-1.rd: Likewise. * ld-elf/dynamic-1.syms: Likewise. * ld-elf/shared.exp (build_tests): Add dynamic-1.
2014-02-10binutils potfiles regenAlan Modra2-497/+543
Adds nds32 files to POTFILES.in
2014-02-03ppc476 icache bug workaroundAlan Modra2-21/+70
This implements a work-around for an icache bug on 476 that can cause execution of stale instructions when control falls through from one page to the next. The idea is to prevent such fall-through by replacing the last instruction on a page with a branch to a patch area containing the instruction, then branch to the next page. The patch also fixes a number of bugs in the existing support for long branch trampolines. bfd/ * elf32-ppc.c (struct ppc_elf_link_hash_table): Add params. Delete emit_stub_syms, no_tls_get_addr_opt. Update all uses. (ppc_elf_link_params): New function. (ppc_elf_create_glink): Align .glink to 64 bytes for ppc476 workaround. (ppc_elf_select_plt_layout): Remove plt_style and emit_stub_syms parameters. Use htab->params instead. (ppc_elf_tls_setup): Remove no_tls_get_addr_opt parameter. (ppc_elf_size_dynamic_sections): Align __glink_PLTresolve to 64 bytes for ppc476 workaround. (struct ppc_elf_relax_info): New. (ppc_elf_relax_section): Exclude linker created sections and those too small to hold one instruction. Don't add another branch around trampolines on later relax passes. Don't generate trampolines for undefined symbols when !relocatable, nor for plugin symbols. Allocate space for ppc476 workaround patch area. Free fixups on error return path. (ppc_elf_relocate_section): Handle ppc476 workaround patching. * elf32-ppc.h (struct ppc_elf_params): New. (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Update prototype. (ppc_elf_link_params): Declare. * section.c (SEC_INFO_TYPE_TARGET): Define. * bfd-in2.h: Regenerate. ld/ * emultempl/ppc32elf.em (no_tls_get_addr_opt, emit_stub_syms) plt_style): Delete. Adjust all refs to instead use.. (params): ..this. New variable. (ppc_after_open_output): New function. Tweak params and pass to ppc_elf_link_params. (ppc_after_open): Adjust ppc_elf_select_plt_layout call. (ppc_before_allocation): Adjust ppc_elf_tls_setup call. Enable relaxation for ppc476 workaround. (PARSE_AND_LIST_*): Add --{no-,}ppc476-workaround support. (LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Define.
2014-02-02Fix ALIGN_WITH_INPUTSebastian Huber11-20/+127
ld/ 2014-02-02 Sebastian Huber <sebastian.huber@embedded-brains.de> * ld/ld.texinfo: Change ALIGN_WITH_INPUT documentation. * ld/ldlang.c (lang_size_sections_1): Add dotdelta variable which reflects the VMA change due to alignment requirements. Use dotdelta do change the LMA if ALIGN_WITH_INPUT is requested. ld/testsuite/ChangeLog 2014-02-02 Sebastian Huber <sebastian.huber@embedded-brains.de> * ld-scripts/rgn-at9.d: New file. * ld-scripts/rgn-at9.t: Likewise. * ld-scripts/rgn-at10.d: Likewise. * ld-scripts/rgn-at10.s: Likewise. * ld-scripts/rgn-at10.t: Likewise. * ld-scripts/rgn-at11.d: Likewise. * ld-scripts/rgn-at11.t: Likewise.
2014-02-01Fix MMIX build breakage from bfd_set_section_vma change.Hans-Peter Nilsson2-1/+7
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): Fix typo in call to bfd_set_section_vma exposed by recent bfd_set_section_vma change.
2014-01-30Nios II CALL26 linker relaxationSandra Loosemore30-6/+715
2014-01-30 Sandra Loosemore <sandra@codesourcery.com> bfd/ * bfd-in2.h: Update from reloc.c. * elf32-nios2.c: Include elf32-nios2.h. (elf_nios2_howto_table_rel): Add entry for R_NIOS2_CALL26_NOAT. (nios2_reloc_map): Likewise. (enum elf32_nios2_stub_type): Declare. (struct elf32_nios2_stub_hash_entry): Declare. (nios2_stub_hash_entry, nios2_stub_hash_lookup): New macros. (struct elf32_nios2_link_hash_entry): Add hsh_cache field. (struct elf32_nios2_link_hash_table): Add new fields bstab, stub_bfd, add_stub_section, layout_sections_again, stub_group, bfd_count, top_index, input_list, all_local_syms. (nios2_call26_stub_entry): New. (nios2_elf32_install_imm16): Move up in file. (nios2_elf32_install_data): Move up in file. (hiadj): Move up in file. (stub_hash_newfunc): New. (link_hash_newfunc): Initialize hsh_cache field. (STUB_SUFFIX): New. (nios2_stub_name): New. (nios2_get_stub_entry): New. (nios2_add_stub): New. (nios2_elf32_setup_section_lists): New. (nios2_elf32_next_input_section): New. (CALL26_SEGMENT): New. (MAX_STUB_SECTION_SIZE): New. (group_sections): New. (nios2_type_of_stub): New. (nios2_build_one_stub): New. (nios2_size_one_stub): New. (get_local_syms): New. (nios2_elf32_size_stubs): New. (nios2_elf32_build_stubs): New. (nios2_elf32_do_call26_relocate): Correct CALL26 overflow test. (nios2_elf32_relocate_section): Handle R_NIOS2_CALL26_NOAT. Add trampolines for R_NIOS2_CALL26 stubs. (nios2_elf32_check_relocs): Handle R_NIOS2_CALL26_NOAT. (nios2_elf32_gc_sweep_hook): Likewise. (nios2_elf32_link_hash_table_create): Initialize the stub hash table. (nios2_elf32_link_hash_table_free): New. (bfd_elf32_bfd_link_hash_table_free): Define. * elf32-nios2.h: New file. * libbfd.h: Update from reloc.c. * reloc.c (BFD_RELOC_NIOS2_CALL26_NOAT): New. gas/ * config/tc-nios2.c (md_apply_fix): Handle BFD_RELOC_NIOS2_CALL26_NOAT. (nios2_assemble_args_m): Likewise. (md_assemble): Likewise. gas/testsuite/ * gas/nios2/call26_noat.d: New. * gas/nios2/call26_noat.s: New. * gas/nios2/call_noat.d: New. * gas/nios2/call_noat.s: New. include/elf/ * nios2.h (elf_nios2_reloc_type): Add R_NIOS2_CALL26_NOAT. ld/ * Makefile.am (enios2elf.c, enios2linux.c): Update dependencies. * Makefile.in: Regenerated. * emulparams/nios2elf.sh (EXTRA_EM_FILE): Set. * emulparams/nios2linux.sh (EXTRA_EM_FILE): Set. * emultempl/nios2elf.em: New file. * gen-doc.texi (NIOSII): Set. * ld.texinfo (NIOSII): Set. ld/testsuite/ * ld-nios2/relax_call26.s: New. * ld-nios2/relax_call26_boundary.ld: New. * ld-nios2/relax_call26_boundary.s: New. * ld-nios2/relax_call26_boundary_c8.d: New. * ld-nios2/relax_call26_boundary_cc.d: New. * ld-nios2/relax_call26_boundary_d0.d: New. * ld-nios2/relax_call26_boundary_d4.d: New. * ld-nios2/relax_call26_boundary_d8.d: New. * ld-nios2/relax_call26_boundary_dc.d: New. * ld-nios2/relax_call26_boundary_f0.d: New. * ld-nios2/relax_call26_boundary_f4.d: New. * ld-nios2/relax_call26_boundary_f8.d: New. * ld-nios2/relax_call26_boundary_fc.d: New. * ld-nios2/relax_call26_cache.d: New. * ld-nios2/relax_call26_cache.ld: New. * ld-nios2/relax_call26_cache.s: New. * ld-nios2/relax_call26_multi.d: New. * ld-nios2/relax_call26_multi.ld: New. * ld-nios2/relax_call26_norelax.d: New. * ld-nios2/relax_call26_shared.d: New. * ld-nios2/relax_call26_shared.ld: New.
2014-01-29Add rdynamic-1 testH.J. Lu4-0/+25
It is added for commit 409ff343a402799563f71f938138b29f8baf7a1c Author: Alan Modra <amodra@gmail.com> Date: Tue Nov 8 13:49:11 2011 +0000 * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark syms in executables when export_dynamic. * ld-elf/rdynamic-1.c: New file. * ld-elf/rdynamic-1.rd: Likewise. * ld-elf/shared.exp (build_tests): Add rdynamic-1.