aboutsummaryrefslogtreecommitdiff
path: root/ld
AgeCommit message (Collapse)AuthorFilesLines
2015-07-21Release 2.25.1, add generated filesbinutils-2_25_1Tristan Gingold2-10/+14
2015-07-10Fix an opd->adjust index in elf64-ppc.cRichard Sandiford7-0/+137
bfd/ * elf64-ppc.c (toc_adjusting_stub_needed): Use the symbol value plus addend rather than the original st_value when looking up entries in opd->adjust. ld/testsuite/ * ld-powerpc/tocopt6-inc.s, ld-powerpc/tocopt6a.s, ld-powerpc/tocopt6b.s, ld-powerpc/tocopt6c.s, ld-powerpc/tocopt6.d: New test. * ld-powerpc/powerpc.exp (ppc64elftests): Add it.
2015-07-10ppc476 linker workaround shared lib fixes againAlan Modra4-21/+54
Huh, I can't even write a binary search properly. bfd/ * elf32-ppc.c (ppc_elf_relocate_section): Correct binary search of dynamic relocs. ld/testsuite/ * ld-powerpc/ppc476-shared.s: Repeat dynamic reloc generating insns. * ld-powerpc/ppc476-shared.d: Update. * ld-powerpc/ppc476-shared2.d: Update.
2015-07-10ppc476 linker workaround shared lib fixesAlan Modra6-0/+71
When building a shared lib from non-PIC objects, we'll get dynamic text relocations. These need to move with any insns we move. Otherwise the dynamic reloc will modify the branch, resulting in crashes and other unpleasant behaviour. Also, ld -r --ppc476-workaround used with sufficiently aligned PIC objects needs a fix for emitted REL16 relocs. bfd/ * elf64-ppc.c (ppc_elf_relocate_section): Move dynamic text relocs with insns moved by --ppc476-workaround. Correct output of REL16 relocs. ld/testsuite/ * ld-powerpc/ppc476-shared.s, * ld-powerpc/ppc476-shared.lnk, * ld-powerpc/ppc476-shared.d, * ld-powerpc/ppc476-shared2.d: New tests. * ld-powerpc/powerpc.exp: Run them.
2015-07-10Non-alloc sections don't belong in PT_LOAD segmentsAlan Modra2-7/+14
Taking them out showed a bug in the powerpc64 backend with .branch_lt being removed from output_bfd but not from previously set up segment section maps. Removing the bfd sections meant their sh_flags (and practically everything else) remaining zero, ie. not SHF_ALLOC, triggering complaints about "`.branch_lt' can't be allocated in segment". include/elf/ * internal.h (ELF_SECTION_IN_SEGMENT_1): Ensure PT_LOAD and similar segments only contain alloc sections. ld/ * emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Call gld${EMULATION_NAME}_map_segments regardless of need_laying_out.
2015-07-10Align .TOC. for PowerPC64Alan Modra30-171/+185
This change, with prerequisite 0e5fabeb, provides a toc base aligned to 256 bytes rather than 8 bytes. This is necessary for a minor gcc optimisation, allowing use of d-form instructions to correctly access toc-relative items larger than 8 bytes. bfd/ * elf64-ppc.c (TOC_BASE_ALIGN): Define. (ppc64_elf_next_toc_section): Align multi-got toc base. (ppc64_elf_set_toc): Likewise initial toc base and .TOC. symbol. ld/ * emulparams/elf64ppc.sh (GOT): Align. ld/testsuite/ * ld-powerpc/ambiguousv1.d: Update for aligned .got. * ld-powerpc/ambiguousv1b.d: Likewise. * ld-powerpc/ambiguousv2.d: Likewise. * ld-powerpc/defsym.d: Likewise. * ld-powerpc/elfv2-2exe.d: Likewise. * ld-powerpc/elfv2exe.d: Likewise. * ld-powerpc/elfv2so.d: Likewise. * ld-powerpc/relbrlt.d: Likewise. * ld-powerpc/tls.g: Likewise. * ld-powerpc/tlsexe.d: Likewise. * ld-powerpc/tlsexe.g: Likewise. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsexetoc.d: Likewise. * ld-powerpc/tlsexetoc.g: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlsso.d: Likewise. * ld-powerpc/tlsso.g: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstoc.g: Likewise. * ld-powerpc/tlstocso.d: Likewise. * ld-powerpc/tlstocso.g: Likewise. * ld-powerpc/tlstocso.r: Likewise. * ld-powerpc/tocopt.d: Likewise. * ld-powerpc/tocopt2.d: Likewise. * ld-powerpc/tocopt3.d: Likewise. * ld-powerpc/tocopt4.d: Likewise. * ld-powerpc/tocopt5.d: Likewise.
2015-07-10Rewrite relro adjusting codeAlan Modra4-42/+49
The linker tries to put the end of the last section in the relro segment exactly on a page boundary, because the relro segment itself must end on a page boundary. If for any reason this can't be done, padding is inserted. Since the end of the relro segment is typically between .got and .got.plt, padding effectively increases the size of the GOT. This isn't nice for targets and code models with limited GOT addressing. The problem with the current code is that it doesn't cope very well with aligned sections in the relro segment. When making .got aligned to a 256 byte boundary for PowerPC64, I found that often the initial alignment attempt failed and the fallback attempt to be less than adequate. This is a particular problem for PowerPC64 since the distance between .got and .plt affects the size of plt call stubs, leading to "stubs don't match calculated size" errors. So this rewrite takes a direct approach to calculating a new relro base. Starting from the last section in the segment, we calculate where it must start to position its end on the boundary, or as near as possible considering alignment requirements. The new start then becomes the goal for the previous section to end, and so on for all sections. This of course ignores the possibility that user scripts will place . = ALIGN(xxx); in the relro segment, or provide section address expressions. In those cases we might fail, but the old code probably did too, and a fallback is provided. ld/ * ldexp.h (struct ldexp_control): Delete dataseg.min_base. Add data_seg.relro_offset. * ldexp.c (fold_binary <DATA_SEGMENT_ALIGN>): Don't set min_base. (fold_binary <DATA_SEGMENT_RELRO_END>): Do set relro_offset. * ldlang.c (lang_size_sections): Rewrite code adjusting relro segment base to line up last section on page boundary.
2015-06-23[AArch64][Backport] Generate DT_TEXTREL for relocation against RO sectionJiong Wang4-0/+27
2015-06-23 Jiong Wang <jiong.wang@arm.com> Apply from master: 2015-06-23 Jiong. Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (aarch64_readonly_dynrelocs): New function. (elfNN_aarch64_size_dynamic_sections): Traverse hash table to check relocations against read-only sections. ld/testsuite/ * ld-aarch64/dt_textrel.s: New testcase. * ld-aarch64/dt_textrel.d: New expectation file. * ld-aarch64/aarch64-elf.exp: Run new testcase.
2015-06-18[ARM][GAS] Backport "Positively emit symbols for alignment"Renlin Li3-3/+11
2015-06-17 Renlin Li <renlin.li@arm.com> Applied from master. 2015-04-28 Renlin Li <renlin.li@arm.com> 2015-06-03 Renlin Li <renlin.li@arm.com> gas/ * config/tc-arm.c (arm_init_frag): Always emit mapping symbols. gas/testsuite/ * gas/arm/thumb2_vpool_be.d: Adjust the desired output. * gas/arm/vldconst_be.d: Likewise. ld/testsuite/ * ld-arm/ifunc-10.dd: Adjust the desired output. * ld-arm/ifunc-2.dd: Likewise.
2015-05-05[AArch64][Backport]Improve PC-relative relocation check for shared libraryJiong Wang5-0/+50
Apply from master: 2015-04-24 Jiong. Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Reject PC-relative relocation for external symbol. ld/testsuite/ * ld-aarch64/pcrel.s: New testcase. * ld-aarch64/pcrel_pic_defiend_local.d: New expect file. * ld-aarch64/pcrel_pic_undefined.d: Ditto. * ld-aarch64/aarch64-elf.exp: Run them.
2015-04-10Revert "Add extern_protected_data and set it for x86"Alan Modra15-58/+24
This reverts commit 031994d25c8c8dc392ceb43abc2dfd9a851bc384.
2015-03-27[AArch64] Fix branch stubs for BETejas Belagod2-0/+78
2015-03-26 Tejas Belagod <tejas.belagod@arm.com> bfd/ * elfnn-aarch64.c (aarch64_build_one_stub): Replace the call to generic _bfd_final_link_relocate with aarch64_relocate. ld/testsuite * ld-aarch64/farcall-back-be.d: New.
2015-03-18Fix ppc32 synthetic symbols when __tls_get_addr_opt stub is generatedAlan Modra13-59/+138
Also update the 32-bit tls testcases to be secure plt. bfd/ * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Examine stubs in reverse order. Account for larger size of __tls_get_addr_opt stub. ld/testsuite/ * ld-powerpc/tls32.s: Add GOT pointer setup. * ld-powerpc/tls32.d: Update. * ld-powerpc/tls32.g: Update. * ld-powerpc/tls32.t: Update. * ld-powerpc/tlsexe.d: Update. * ld-powerpc/tlsexe32.d: Update. * ld-powerpc/tlsexe32.g: Update. * ld-powerpc/tlsexe32.r: Update. * ld-powerpc/tlsexetoc.d: Update. * ld-powerpc/tlsso32.d: Update. * ld-powerpc/tlsso32.g: Update. * ld-powerpc/tlsso32.r: Update.
2015-03-06Add extern_protected_data and set it for x86H.J. Lu15-4/+80
With copy relocation, address of protected data defined in the shared library may be external. This patch adds extern_protected_data and changes _bfd_elf_symbol_refs_local_p to return false for protected data if extern_protected_data is true. Backport from master: bfd/ PR ld/pr15228 PR ld/pr17709 * elf-bfd.h (elf_backend_data): Add extern_protected_data. * elf32-i386.c (elf_backend_extern_protected_data): New. Defined to 1. * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise. * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on copy relocs against protected symbols if extern_protected_data is true. (_bfd_elf_symbol_refs_local_p): Don't return true on protected non-function symbols if extern_protected_data is true. * elfxx-target.h (elf_backend_extern_protected_data): New. Default to 0. (elfNN_bed): Initialize extern_protected_data with elf_backend_extern_protected_data. ld/testsuite/ PR ld/pr15228 PR ld/pr17709 * ld-i386/i386.exp (i386tests): Add a test for PR ld/17709. * ld-i386/pr17709-nacl.rd: New file. * ld-i386/pr17709.rd: Likewise. * ld-i386/pr17709a.s: Likewise. * ld-i386/pr17709b.s: Likewise. * ld-i386/protected3.d: Updated. * ld-i386/protected3.s: Likewise. * ld-x86-64/pr17709-nacl.rd: New file. * ld-x86-64/pr17709.rd: Likewise. * ld-x86-64/pr17709a.s: Likewise. * ld-x86-64/pr17709b.s: Likewise. * ld-x86-64/protected3.d: Updated. * ld-x86-64/protected3.s: Likewise. * ld-x86-64/x86-64.exp (x86_64tests): Add a test for PR ld/17709.
2015-02-11Correct PowerPC64 local-dynamic TLS linker optimizationAlan Modra6-0/+186
The linker hardcoded r3 into a local-dynamic to local-exec TLS optimization sequence. This is normally the case since r3 is required as a parameter to (the optimized out) __tls_get_addr call. However, it is possible for a compiler, LLVM in this case, to set up the parameter value in another register then copy it to r3 before the call. When fixing this problem, I noticed that ppc32 had another bug when optimizing away one of the TLS insns to a nop. The patch also tidies a mask used by global-dynamic to initial-exec TLS optimization, to just select the fields needed. Leaving the offset in the instruction wasn't a bug since it will be overwritten anyway. bfd/ * elf64-ppc.c (ppc64_elf_relocate_section): Correct GOT_TLSLD optimization. Tidy mask for GOT_TLSGD optimization. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. Correct location of nop zapping high insn too. ld/testsuite/ * ld-powerpc/tlsld.d, * ld-powerpc/tlsld.s: New test. * ld-powerpc/tlsld32.d, * ld-powerpc/tlsld32.s: New test. * ld-powerpc/powerpc.exp: Run them.
2015-02-11ld: Update expected test results for 32-bit hosts.Andrew Burgess3-11/+15
Tests that I added in commit c05b575a8dfabab6af5d8586d1a5c0c67f819ac2 fails on 32-bit hosts due to differences in whitespace. This patch updates the expected output patterns to be more accepting of differences in whitespace, the tests should now pass. ld/testsuite/ChangeLog: * ld-scripts/provide-4-map.d: Update expected output. * ld-scripts/provide-5-map.d: Likewise.
2015-02-11ld: Don't evaluate unneeded PROVIDE expressions.Andrew Burgess11-2/+93
When creating a linker mapfile (using -Map=MAPFILE), we previously would always try to evaluate the expression from a PROVIDE statement. However, this is not always safe, consider: PROVIDE (foo = 0x10); PROVIDE (bar = foo); In this example, if neither 'foo' or 'bar' is needed, then while generating the linker mapfile evaluating the expression for 'foo' is harmless (just the value 0x10). However, evaluating the expression for 'bar' requires the symbol 'foo', which is undefined. This used to cause a fatal error. This patch changes the behaviour, so that when the destination of the PROVIDE is not defined (that is the PROVIDE is not going to provide anything) the expression is not evaluated, and instead a special string is displayed to indicate that the linker is discarding the PROVIDE statement. This change not only fixes the spurious undefined symbol error, but also means that a user can now tell if a PROVIDE statement has provided anything by inspecting the linker mapfile, something that could not be done before. ld/ChangeLog: * ldlang.c (print_assignment): Only evaluate the expression for a PROVIDE'd assignment when the destination is being defined. Display a special message for PROVIDE'd symbols that are not being provided. ld/testsuite/ChangeLog: * ld-scripts/provide-4.d: New file. * ld-scripts/provide-4-map.d: New file. * ld-scripts/provide-4.t: New file. * ld-scripts/provide-5.d: New file. * ld-scripts/provide-5.s: New file. * ld-scripts/provide-5-map.d: New file. * ld-scripts/provide-5.t: New file. * ld-scripts/provide.exp: Run the provide-4.d and provide-5.d tests.
2015-02-11ld/testing: run_dump_test can now check linker mapfiles.Andrew Burgess4-9/+41
Add a new option 'map' to the ld run_dump_test mechanism. When the 'map' option is given run_dump_test will ensure that there is a -Map=MAPFILE present in the linker command line, adding one if needed. The MAPFILE is then compared with the file passed to the new 'map' option using the regexp_diff function. This should make it slightly easier to write tests that check the linker mapfile output. The only test I found that already compares mapfile content is updated to use the new mechanism. ld/testsuite/ChangeLog: * ld-scripts/overlay-size.d: Add 'map' option. * ld-scripts/overlay-size.exp: Remove manual check of mapfile. * lib/ld-lib.exp (run_dump_test): Add support for new 'map' option, checking linker mapfile output.
2015-02-11Fix garbage collection of common symbolsAlan Modra13-34/+50
Running lang_common before garbage collection means slightly less work in garbage collection code, since common symbols should no longer appear there. It does have the side effect of keeping linker script symbols (at least those defined outside of sections) global too, hence some testsuite churn. bfd/ PR 17165 * elf-bfd.h (ELF_COMMON_DEF): Note that this might be true for linker script assignments too. * elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms. (bfd_elf_gc_mark_dynamic_ref_symbol): Similarly. ld/ PR 17165 * ldlang.c (lang_process): Run lang_common before lang_gc_sections. ld/testsuite/ * ld-gc/pr14265.d, * ld-cris/tls-gc-68.d, * ld-cris/tls-gc-69.d, * ld-cris/tls-gc-70.d, * ld-cris/tls-gc-71.d, * ld-cris/tls-gc-75.d, * ld-cris/tls-gc-76.d, * ld-cris/tls-gc-79.d, * ld-mmix/bpo-10.d, * ld-mmix/bpo-11.d: Update.
2015-02-11Don't create .eh_frame_hdr on shared lib bfdAlan Modra2-1/+9
If no object files have .eh_frame, but some shared library does, then ld creates a .eh_frame_hdr section using the shared library bfd. This is silly since shared library .eh_frame sections don't contribute to the output .eh_frame and thus no .eh_frame_hdr is needed. Also, the bfd section list and count is cleared for shared libraries, and a zero section count used as a flag in lang_check to omit a call to bfd_merge_private_bfd_data for shared libraries. If we create a section on a shared lib bfd then ld will wrongly attempt to merge the shared library private bfd data. PR 17742 * ld/emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Exclude shared libraries in loop looking for .eh_frame sections. Similarly for build-id loop.
2015-02-11Use a symbol flag bit to mark linker defined symbolsAlan Modra9-3/+55
Trying to use the SEC_LINKER_CREATED section flag to determine whether a symbol is linker defined fails to work on targets like alpha that define special SEC_COMMON sections. These might contain symbols that originated in an object file. include/ * bfdlink.h (struct bfd_link_hash_entry): Comment non_ir_ref. Add linker_def. bfd/ * elflink.c (_bfd_elf_define_linkage_sym): Set linker_def. * linker.c (_bfd_generic_link_add_one_symbol): Clear linker_def for CDEF, DEF, DEFW, COM. ld/ * ldexp.c (exp_fold_tree_1 <etree_provide>): Test linker_def. ld/testsuite/ * ld-powerpc/sdabase.s, * ld-powerpc/sdabase.t, * ld-powerpc/sdabase.d: New test. * ld-powerpc/sdabase2.t, * ld-powerpc/sdabase2.d: New test. * ld-powerpc/powerpc.exp: Run them.
2015-02-11Don't PROVIDE over top of common symbolsAlan Modra5-6/+28
This: int end[100000]; int main(void) { end[99999] = 0; return 0; } should not segfault. ld/ * ldexp.c (exp_fold_tree_1 <etree_provide>): Leave bfd_link_hash_common symbols alone. ld/testsuite/ * ld-elf/endsym.s, *ld-elf/endsym.d: New test.
2015-02-11Correct logic for "defined by object"Alan Modra2-4/+7
The old code missed testing bfd_link_hash_undefweak, and wrongly excluded bfd_link_hash_common symbols. It is also clearer to invert the set of enum bfd_link_hash_type values tested. bfd_link_hash_indirect and bfd_link_hash_warning will never appear here. * ldexp.c (update_definedness): Correct logic setting by_object.
2015-02-11Move support code for linker script DEFINED to ldexp.cAlan Modra6-93/+116
This moves support code for DEFINED to ldexp.c where it is used, losing the lang_ prefix on identifiers. Two new functions are needed to initialize and clean up to hash table, but other than that there are no functional changes here. * ldexp.c (struct definedness_hash_entry, definedness_table) (definedness_newfunc, symbol_defined, update_definedness): Move and rename from.. * ldlang.h (struct lang_definedness_hash_entry): ..here,.. * ldlang.c (lang_definedness_table, lang_definedness_newfunc) (lang_symbol_defined, lang_update_definedness): ..and here. * ldexp.c (ldexp_init, ldexp_finish): New functions, extracted from.. * ldlang.c (lang_init, lang_finish): ..here. * ldexp.h (ldexp_init, ldexp_finish): Declare. * ldlang.h (lang_symbol_defined, lang_update_definedness): Delete. * ldmain.c (main): Call ldexp_init and ldexp_finish.
2015-02-11Sort relocs output by ld -rAlan Modra5-8/+17
bfd/ PR 17666 * elflink.c: Include bfd_stdint.h. (cmp_ext32l_r_offset, cmp_ext32b_r_offset, cmp_ext64l_r_offset, cmp_ext64b_r_offset): New functions. (elf_link_adjust_relocs): Sort relocs. Free reloc hashes after sorting invalidates. ld/testsuite/ * ld-powerpc/vxworks-relax.rd: Update for reloc sorting. * ld-powerpc/vxworks-relax-2.rd: Likewise. * ld-sh/sh64/reldl32.rd: Likewise. * ld-sh/sh64/reldl64.rd: Likewise.
2015-01-22Backport from master:Terry Guo4-0/+25
bfd/ChangeLog: 2015-01-22 Thomas Preud'homme <thomas.preudhomme@arm.com> Backport from mainline 2015-01-13 Thomas Preud'homme <thomas.preudhomme@arm.com> * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOLIC_BIND to check if a symbol should be bound symbolically. ld/testsuite/ChangeLog: 2015-01-22 Thomas Preud'homme <thomas.preudhomme@arm.com> Backport from mainline 2015-01-13 Thomas Preud'homme <thomas.preudhomme@arm.com> * ld-aarch64/aarch64-elf.exp: Added relocs-257-symbolic-func test. * ld-aarch64/relocs-257-symbolic-func.d: New file. * ld-aarch64/relocs-257-symbolic-func.s: Likewise.
2015-01-11Only discard space for pc-relative relocs symbolsH.J. Lu5-0/+33
When building PIE, we should only discard space for pc-relative relocs symbols which turn out to need copy relocs. bfd/ PR ld/17827 * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): For PIE, only discard space for pc-relative relocs symbols which turn out to need copy relocs. ld/testsuite/ PR ld/17827 * ld-x86-64/pr17689.out: Updated. * ld-x86-64/pr17689b.S: Likewise. * ld-x86-64/pr17827.rd: New file. * ld-x86-64/x86-64.exp: Run PR ld/17827 test.
2015-01-05Assign file position for .strtab only if neededH.J. Lu3-6/+21
bfd/ PR ld/17773 * elflink.c (bfd_elf_final_link): Assign the file position for the symbol string table only there are symbols to be emitted. ld/testsuite/ PR ld/17773 * ld-elf/binutils.exp (binutils_test): Add an optional readelf_options. Replace -l with $readelf_options. Add a gap test. * ld/testsuite/ld-elf/gap.s: New file.
2014-12-23Bump to version 2.25.0Tristan Gingold2-10/+14
bfd/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * version.m4: Bump version to 2.25.0 * configure: Regenerate. binutils/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gas/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gprof/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. ld/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. opcodes/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate.
2014-12-23Add generated files.binutils-2_25Tristan Gingold23-0/+23908
2014-12-23Version 2.25Tristan Gingold2-10/+14
bfd/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * version.m4: Bump version to 2.25 * configure: Regenerate. binutils/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gas/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gprof/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. ld/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. opcodes/ 2014-12-23 Tristan Gingold <gingold@adacore.com> * configure: Regenerate.
2014-12-19Fix all failing FPXX tests for tx39-elf.Matthew Fortune16-15/+33
ld/testsuite/ * ld-mips-elf/attr-gnu-4-00.d: Relax check for ISA extension. * ld-mips-elf/attr-gnu-4-01.d: Likewise. * ld-mips-elf/attr-gnu-4-02.d: Likewise. * ld-mips-elf/attr-gnu-4-03.d: Likewise. * ld-mips-elf/attr-gnu-4-08.d: Likewise. * ld-mips-elf/attr-gnu-4-10.d: Likewise. * ld-mips-elf/attr-gnu-4-11.d: Likewise. * ld-mips-elf/attr-gnu-4-18.d: Likewise. * ld-mips-elf/attr-gnu-4-20.d: Likewise. * ld-mips-elf/attr-gnu-4-22.d: Likewise. * ld-mips-elf/attr-gnu-4-28.d: Likewise. * ld-mips-elf/attr-gnu-4-30.d: Likewise. * ld-mips-elf/attr-gnu-4-33.d: Likewise. * ld-mips-elf/attr-gnu-4-38.d: Likewise. * ld-mips-elf/attr-gnu-4-44.d: Likewise.
2014-12-19Fix undefined weak symbol reloc testsMatthew Fortune6-78/+55
ld/testsuite/ * ld-mips-elf/mips-elf.exp: Update undefweak-overflow tests. * ld-mips-elf/undefweak-overflow-n32.d: Remove. * ld-mips-elf/undefweak-overflow-n64.d: Likewise. * ld-mips-elf/undefweak-overflow.s: Set mips64r6, noreorder and add a label to mark the micromips region. * ld-mips-elf/undefweak-overflow.d: Update expected output.
2014-12-19[MIPS] When calculating a relocation using an undefined weak symbol don't ↵Andrew Bennett6-0/+110
check for overflow. In MIPS the relocation calculation only ignores the overflow checks for undefined weak symbols on relocations associated with j/jal. This patch extends this to the relocations used by the: b* instructions; pc/gp relative symbol offsets; and the lwpc/ldpc MIPS r6 instructions. bfd/ * elfxx-mips.c (mips_elf_calculate_relocation): Only check for overflow on non-weak undefined symbols. ld/testsuite/ * ld-mips-elf/mips-elf.exp: Add in undefined weak overflow tests for o32, n32 and n64. * ld-mips-elf/undefweak-overflow.s: New test. * ld-mips-elf/undefweak-overflow.d: New test. * ld-mips-elf/undefweak-overflow-n32.d: New test. * ld-mips-elf/undefweak-overflow-n64.d: New test.
2014-12-13Handle weak alias for PIE with copy relocH.J. Lu6-0/+60
When there is a weak symbol with a real definition, the processor independent code will have arranged for us to see the real definition first. We need to copy the needs_copy bit from the real definition and check it when allowing copy reloc in PIE. bfd/ PR ld/17689 * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add needs_copy. Change has_bnd_reloc to bit field. (elf_x86_64_link_hash_newfunc): Initialize needs_copy and has_bnd_reloc to 0. (elf_x86_64_check_relocs): Set has_bnd_reloc to 1 instead of TRUE. (elf_x86_64_adjust_dynamic_symbol): Copy needs_copy from the real definition to a weak symbol. (elf_x86_64_allocate_dynrelocs): Also check needs_copy of a weak symbol for PIE when discarding space for relocs against symbols which turn out to need copy relocs. (elf_x86_64_relocate_section): Also check needs_copy of a weak symbol for PIE with copy reloc. ld/testsuite/ PR ld/17689 * ld-x86-64/pr17689.out: New file. * ld-x86-64/pr17689.rd: Likewise. * ld-x86-64/pr17689a.c: Likewise. * ld-x86-64/pr17689b.S: Likewise. * ld-x86-64/x86-64.exp: Run PR ld/17689 tests.
2014-12-03Replace copyreloc-main.c with copyreloc-main.SH.J. Lu4-10/+25
* ld-x86-64/copyreloc-main.c: Removed. * ld-x86-64/copyreloc-main.S: New. * ld-x86-64/x86-64.exp: Replace copyreloc-main.c with copyreloc-main.S.
2014-12-03X86-64: Allow copy relocs for building PIEH.J. Lu7-0/+63
This patch allows copy relocs for non-GOT pc-relative relocation in PIE. bfd/ * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Always allow copy relocs for building executables. (elf_x86_64_adjust_dynamic_symbol): Allocate copy relocs for PIE. (elf_x86_64_allocate_dynrelocs): For PIE, discard space for relocs against symbols which turn out to need copy relocs. (elf_x86_64_relocate_section): Don't copy a pc-relative relocation into the output file if the symbol needs copy reloc. ld/testsuite/ * ld-x86-64/copyreloc-lib.c: New file. * ld-x86-64/copyreloc-main.c: Likewise. * ld-x86-64/copyreloc-main.out: Likewise. * ld-x86-64/copyreloc-main1.rd: Likewise. * ld-x86-64/copyreloc-main2.rd: Likewise. * ld-x86-64/x86-64.exp: Run copyreloc tests.
2014-12-01Add tests for PR ld/16452 and PR ld/16457H.J. Lu7-0/+42
PR ld/16452 PR ld/16457 * ld-elf/pr16452.map: New file. * ld-elf/pr16452.od: Likewise. * ld-elf/pr16452a.c: Likewise. * ld-elf/pr16452b.c: Likewise. * ld-elf/pr16457.od: Likewise. * ld-elf/shared.exp (build_tests): Add tests for PR ld/16452 and PR ld/16457.
2014-11-24PowerPC64 --plt-alignAlan Modra3-10/+16
Alignment of plt stubs was broken, firstly because the option was being dropped due to the alignment value not being set in the "params" struct used in elf64-ppc.c, and secondly due to not calculating the number of alignment boundary crossings correctly. bfd/ * elf64-ppc.c (plt_stub_pad): Correct. ld/ * ld.texinfo: Correct --plt-align documentation. * emultempl/ppc64elf.em (plt_stub_align): Delete. Use and set params.plt_stub_align instead.
2014-11-18Always run mpx3 and mpx4 tests in 64-bitH.J. Lu2-19/+22
* ld-x86-64/mpx.exp: Always run mpx3 and mpx4 tests in 64-bit.
2014-11-18Add -z bndplt to generate BND prefix in PLT entriesIgor Zamyatin19-16/+175
This patch adds "-z bndplt" option Linux/x86-64 linker to generate BND prefix in PLT entries. It also updated Linux/x86-64 assembler not to generate R_X86_64_PLT32_BND nor R_X86_64_PC32_BND relocations. bfd/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * elf64-x86-64.c (elf_x86_64_check_relocs): Enable MPX PLT only for -z bndplt. gas/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * config/tc-i386-intel.c (i386_operator): Remove last argument from lex_got call. * config/tc-i386.c (reloc): Remove bnd_prefix from parameters' list. Return always BFD_RELOC_32_PCREL. * (output_branch): Remove condition for BFD_RELOC_X86_64_PC32_BND. * (output_jump): Update call to reloc accordingly. * (output_interseg_jump): Likewise. * (output_disp): Likewise. * (output_imm): Likewise. * (x86_cons_fix_new): Likewise. * (lex_got): Remove bnd_prefix from parameters' list in macro and declarations. Don't use BFD_RELOC_X86_64_PLT32_BND. * (x86_cons): Update call to lex_got accordingly. * (i386_immediate): Likewise. * (i386_displacement): Likewise. * (md_apply_fix): Don't use BFD_RELOC_X86_64_PLT32_BND nor BFD_RELOC_X86_64_PC32_BND. * (tc_gen_reloc): Likewise. include/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * bfdlink.h (struct bfd_link_info): Add bndplt. ld/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * emulparams/elf_x86_64.sh (BNDPLT): Set to yes for x86_64. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle "-z bndplt" if BNDPLT is yes. (gld${EMULATION_NAME}_list_options): Add "-z bndplt" entry. * ld.texinfo: Add description for bndplt. ld/testsuite/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * ld-x86-64/bnd-ifunc-1.d: Add bndplt option. * ld-x86-64/bnd-ifunc-2.d: Likewise. * ld-x86-64/bnd-plt-1.d: Likewise. Update dissassembly sections. * ld-x86-64/mpx.exp: Handle mpx3 and mpx4 tests. * ld-x86-64/mpx1a.rd: Remove _BND from relocation name. * ld-x86-64/mpx1c.rd: Likewise. * ld-x86-64/mpx2a.rd: Likewise. * ld-x86-64/mpx2c.rd: Likewise. * ld-x86-64/mpx3.dd: New file. * ld-x86-64/mpx3a.s: Likewise. * ld-x86-64/mpx3b.s: Likewise. * ld-x86-64/mpx4.dd: Likewise. * ld-x86-64/mpx4a.s: Likewise. * ld-x86-64/mpx4b.s: Likewise.
2014-11-10Update .MIPS.abiflags to support MIPS R6Matthew Fortune3-0/+34
Backport from trunk. bfd/ * elfxx-mips.c (update_mips_abiflags_isa): Add E_MIPS_ARCH_32R6 and E_MIPS_ARCH_64R6 support. ld/testsuite/ * ld-mips-elf/abiflags-strip10-ph.d: New file. * ld-mips-elf/mips-eld.exp: Run the new test. gas/ * config/tc-mips.c (mips_elf_final_processing): Add INSN_ISA32R6 and INSN_ISA64R6 support. gas/testsuite/ * gas/mips/elf_arch_mips32r6.d: New file. * gas/mips/elf_arch_mips64r6.d: New file. * gas/mips/mips.exp: Run the new tests.
2014-11-07X32: Add REX prefix to encode R_X86_64_GOTTPOFFH.J. Lu2-2/+10
Structions with R_X86_64_GOTTPOFF relocation must be encoded with REX prefix even if it isn't required by destination register. Otherwise linker can't safely perform IE -> LE optimization. bfd/ PR ld/17482 * elf64-x86-64.c (elf_x86_64_relocate_section): Update comments for IE->LE transition. gas/ PR ld/17482 * config/tc-i386.c (output_insn): Add a dummy REX_OPCODE prefix for structions with R_X86_64_GOTTPOFF relocation for x32 if needed. gas/testsuite/ PR ld/17482 * gas/i386/ilp32/x32-tls.d: New file. * gas/i386/ilp32/x32-tls.s: Likewise. ld/testsuite/ PR ld/17482 * ld-x86-64/tlsie4.dd: Updated.
2014-10-30Fix a memory leak in the recent patch to detect loops in ELF sectionNick Clifton1-0/+1
string indicies. * elf.c (bfd_section_from_shdr): Fix heap use after free memory leak.
2014-10-29Updated and New translations from the Translation Project.Nick Clifton2-527/+575
2014-10-28PR17488, powerpc64-linux-ld segfaultAlan Modra2-1/+10
For binary ouput, we don't have an ELF bfd output so can't access elf_elfheader. The elf64-ppc.c changes are really just a tidy, triggered by looking at all places where the abiversion bits are accessed. bfd/ * elf64-ppc.c (ppc64_elf_before_check_relocs): Do .opd processing even when output is not ppc64 ELF. Remove redundant tests on type of input bfd. ld/ PR 17488 * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Don't attempt to access ELF header e_flags when not ppc64 ELF output.
2014-10-24[AArch64] Cortex-A53 erratum 835769 linker workaroundJiong Wang7-1/+159
2014-10-24 Tejas Belagod <tejas.belagod@arm.com> bfd/ * bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter. * bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise. * elfnn-aarch64.c (aarch64_erratum_835769_stub): New. (elf_aarch64_stub_type): Add new type aarch64_stub_erratum_835769_veneer. (elf_aarch64_stub_hash_entry): New fields for erratum 835769. (aarch64_erratum_835769_fix): New data struct to record erratum 835769. (elf_aarch64_link_hash_table: Global flags for 835769. (aarch64_build_one_stub): Add case for 835769. (aarch64_size_one_stub): Likewise. (aarch64_mem_op_p, aarch64_mlxl_p, aarch64_erratum_sequence,erratum_835769_scan): New. Decode and scan functions for erratum 835769. (elf_aarch64_create_or_find_stub_sec): New. (elfNN_aarch64_size_stubs): Look for erratum 835769 and record them. (bfd_elfNN_aarch64_set_options: Set global flag for 835769. (erratum_835769_branch_to_stub_data, make_branch_to_erratum_835769_stub):New. Connect up all the erratum stubs to occurances by branches. (elfNN_aarch64_write_section): New hook. (aarch64_map_one_stub): Output erratum stub symbol. (elfNN_aarch64_size_dynamic_sections): Init mapping symbol information for erratum 835769. (elf_backend_write_section): Define. ld/ * emultempl/aarch64elf.em: Add command-line option for erratum 835769. ld/testsuite/ * ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum 835769 tests. * ld-aarch64/erratum835769.d: New. * ld-aarch64/erratum835769.s: New.
2014-10-17Backport "Fix sysroot-tests, adding --print-sysroot" from masterHans-Peter Nilsson6-23/+56
2014-10-15Regenerate configure (after change of version)Tristan Gingold2-10/+14
binutils/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gas/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. ld/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. opcodes/ 2014-10-15 Tristan Gingold <gingold@adacore.com> * configure: Regenerate.
2014-10-15Backport "="-ldscript-path-prefix changes from master.Hans-Peter Nilsson11-20/+304