aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2014-01-30Nios II CALL26 linker relaxationSandra Loosemore22-0/+333
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.
2014-01-28Update the tic6x linker tests to match the current behaviour of the linker ↵Nick Clifton15-40/+58
and readelf. PR binutils/16317 * ld-tic6x/shlib-1.rd: Expect I attribute with RELA sections. * ld-tic6x/shlib-1b.rd: Likewise. * ld-tic6x/shlib-1r.rd: Likewise. * ld-tic6x/shlib-1rb.rd: Likewise. * ld-tic6x/shlib-app-1rd: Likewise. * ld-tic6x/shlib-app-1b.rd: Likewise. * ld-tic6x/shlib-app-1r.rd: Likewise. * ld-tic6x/shlib-app-1rb.rd: Likewise. * ld-tic6x/shlib-noindex.rd: Likewise. * ld-tic6x/static-app-1.rd: Likewise. * ld-tic6x/static-app-1b.rd: Likewise. * ld-tic6x/static-app-1r.rd: Likewise. * ld-tic6x/static-app-1rb.rd: Likewise. PR binutils/16318 * ld-tic6x/tic6x.exp: Expect C6000 osabi value in relocatable objects.
2014-01-24Replace .align with .p2alignH.J. Lu2-3/+7
* ld-elf/pr16498a.s: Replace .align with .p2align.
2014-01-24Add another testcase for PR ld/16498H.J. Lu3-0/+22
PR ld/16498 * ld-elf/pr16498b.d: New file. * ld-elf/pr16498b.t: Likewise.
2014-01-24Improve orphaned TLS section handlingH.J. Lu4-0/+45
ld/ PR ld/16498 * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Improve orphaned TLS section handling. ld/testsuite/ PR ld/16498 * ld-elf/pr16498a.d: New file. * ld-elf/pr16498a.s: Likewise. * ld-elf/pr16498a.t: Likewise.
2014-01-22Miscellaneous ld tidiesAlan Modra2-1/+5
Localise a struct, prevent an unneeded symbol lookup, and fix a testcase. ld/ * ld.h (struct map_symbol_def): Move to.. * ldlang.h: ..here. * ldlang.c (print_assignment): Don't set expld.assign_name to dot. ld/testsuite/ * ld-scripts/pr14962-2.d: Correct target triple.
2014-01-22Make assignments to dot keep an empty output section.Alan Modra15-32/+38
An assignment to dot in an output section that allocates space of course keeps the output section. Here, I'm changing the behaviour for assignments that don't allocate space. The idea is not so much to allow people to force output of an empty section with ". = .", but to fix cases where an otherwise empty section has padding added by an alignment expression that changes with relaxation or .eh_frame editing. Such a section might have zero size before relaxation and so be stripped incorrectly. ld/ * ld.texinfo (Output Section Discarding): Mention assigning to dot as a way of keeping otherwise empty sections. * ldexp.c (is_dot, is_value, is_sym_value, is_dot_ne_0, is_dot_plus_0, is_align_conditional): New predicates. (exp_fold_tree_1): Set SEC_KEEP when assigning to dot inside an output section, except for some special cases. * scripttempl/elfmicroblaze.sc: Use canonical form to align at end of .heap and .stack. ld/testsuite/ * ld-shared/elf-offset.ld: Align end of .bss with canonical form of ALIGN that allows an empty .bss to be removed. * ld-arm/arm-dyn.ld: Likewise. * ld-arm/arm-lib.ld: Likewise. * ld-elfvsb/elf-offset.ld: Likewise. * ld-mips-elf/mips-dyn.ld: Likewise. * ld-mips-elf/mips-lib.ld: Likewise. * ld-arm/arm-no-rel-plt.ld: Remove duplicate ALIGN. * ld-powerpc/vle-multiseg-1.ld: Remove ALIGN at start of section. ALIGN address of section instead. * ld-powerpc/vle-multiseg-2.ld: Likewise. * ld-powerpc/vle-multiseg-3.ld: Likewise. * ld-powerpc/vle-multiseg-4.ld: Likewise. * ld-powerpc/vle-multiseg-6.ld: Likewise. * ld-scripts/empty-aligned.d: Check section headers not program headers. Remove xfail and notarget. * ld-scripts/empty-aligned.t: Use canonical ALIGN for end of .text2.
2014-01-21Check incompatible existing default symbol definitionH.J. Lu9-0/+90
After resolving a versioned reference, foo@VER1, to a default versioned definition, foo@@VER1, from a shared object, we also merge it with the existing regular default symbol definition, foo. When foo is IFUNC and foo@@VER1 aren't, we will merge 2 incompatible definitions. This patch avoids merging foo@@VER1 definition with foo definition if one is IFUNC and the other isn't.
2014-01-21Don't check shared/export_dynamic/ref_dynamic for type mismatchH.J. Lu2-0/+31
There is nothing linker can do when a type mismatched default definition are made dynamic by info->shared, info->export_dynamic or h->ref_dynamic. But we do want to avoid exporting it when building PIE. Let's remove those checks. bfd/ PR ld/2404 * elflink.c (_bfd_elf_merge_symbol): Don't check info->shared, info->export_dynamic, nor !h->ref_dynamic for type mismatch when adding the default version. ld/testsuite/ PR ld/2404 * ld-elf/shared.exp: Add a PIE test for PR ld/2404.
2014-01-20Add a testcase for PR ld/2404H.J. Lu5-0/+55
PR ld/2404 was fixed without a testcase. This patch to add one. PR ld/2404 * ld-elf/pr2404.out: New file. * ld-elf/pr2404a.c: Likewise. * ld-elf/pr2404b.c: Likewise. * ld-elf/shared.exp (build_tests): Build libpr2404a.so and libpr2404b.a. (run_tests): Run pr2404.
2014-01-20Allow self-assignment for absolute symbols defined in a linker scriptAlan Modra4-0/+28
Modifies ld machinery tracking linker script assignments to notice all assignments, not just those symbols mentioned in DEFINED(). ld/ PR ld/14962 * ldlang.h (struct lang_definedness_hash_entry): Add by_object and by_script. Make iteration a single bit field. (lang_track_definedness, lang_symbol_definition_iteration): Delete. (lang_symbol_defined): Declare. * ldlang.c (lang_statement_iteration): Expand comment a little. (lang_init <lang_definedness_table>): Make it bigger. (lang_track_definedness, lang_symbol_definition): Delete. (lang_definedness_newfunc): Update. (lang_symbol_defined): New function. (lang_update_definedness): Create entries here. Do track whether script definition of symbol is valid, even when also defined in an object file. * ldexp.c (fold_name <DEFINED>): Update. (fold_name <NAME>): Allow self-assignment for absolute symbols defined in a linker script. ld/testsuite/ * ld-scripts/pr14962-2.d, * ld-scripts/pr14962-2.t: New test. * ld-scripts/expr.exp: Run it.
2014-01-15non-PIC references to __ehdr_start in pie and sharedAlan Modra5-0/+19
Rather than hacking every backend to not discard dynamic relocations against an undefined hidden __ehdr_start, make it appear to be defined early. We want __ehdr_start hidden before size_dynamic_sections so that it isn't put in .dynsym, but we do need the dynamic relocations for a PIE or shared library with a non-PIC reference. Defining it early is wrong if we don't actually define the symbol later to its proper value. (In some cases we want to leave the symbol undefined, for example, when the ELF header isn't loaded, and we don't have this infomation available in before_allocation.) ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Define __ehdr_start before size_dynamic_sections and restore afterwards. ld/testsuite/ * ld-elf/ehdr_start-shared.d: New. * ld-elf/ehdr_start-userdef.d: xfail frv. * ld-elf/ehdr_start-weak.d: Likewise. * ld-elf/ehdr_start.d: Likewise.
2014-01-14 * lib/ld-lib.exp (default_ld_link): Remove support for ldflags.Vidya Praveen2-9/+6
(default_ld_simple_link): Likewise.
2014-01-10Don't adjust LOAD segment to match GNU_RELRO segmentAlan Modra2-1/+5
Instead, fix Jakub's original code setting up the PR_GNU_RELRO header from the PT_LOAD header. PR ld/14207 PR ld/16322 PR binutils/16323 bfd/ * elf.c (assign_file_positions_for_load_sections): Revert last change. (assign_file_positions_for_non_load_sections): When setting up PT_GNU_RELRO header, don't require a corresponding PT_LOAD header that completely covers the relro region. ld/ * ldlang.c (lang_size_sections): Remove unneeded RELRO base adjust. Tidy comments. * ld.texinfo (DATA_SEGMENT_RELRO_END): Correct description. ld/testsuite/ * ld-x86-64/pr14207.d: Adjust
2014-01-09Fix copyright yearH.J. Lu1-1/+1
2014-01-09Check if GNU_RELRO segment is is generatedH.J. Lu2-1/+30
Fail if GNU_RELRO segment isn't generated, but should. * ld-elf/binutils.exp (binutils_test): Check if GNU_RELRO segment is generated.
2014-01-09Add and use check_lto_shared_availableH.J. Lu3-2/+45
2014-01-09 Vidya Praveen <vidyapraveen@arm.com> * lib/ld-lib.exp (check_lto_shared_available): New check. * ld-plugin/lto.exp: Use check_lto_shared_available.
2014-01-08Adjust LOAD segment to generate GNU_RELRO segmentH.J. Lu4-4/+42
This patch fixes 2 GNU_RELRO segment bugs: 1. lang_size_sections didn't properly align base to the maximum alignment power of sections between DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END. 2. ld failed to adjust LOAD segment to generate GNU_RELRO segment when LOAD segment doesn't fit GNU_RELRO segment. This is https://sourceware.org/bugzilla/show_bug.cgi?id=14207 We "fixed" ld by not generating GNU_RELRO segment. This patch adjusts LOAD segment to generate GNU_RELRO segment. It fixes PR ld/16322 and at the same time it also fixes PR binutils/16323 since now we can adjust LOAD segment if it is too small. bfd/ PR ld/14207 PR ld/16322 PR binutils/16323 * elf.c (_bfd_elf_map_sections_to_segments): Don't check section size for PT_GNU_RELRO segment. (assign_file_positions_for_load_sections): If PT_LOAD segment doesn't fit PT_GNU_RELRO segment, adjust its p_filesz and p_memsz. ld/ PR ld/14207 PR ld/16322 PR binutils/16323 * ldlang.c (lang_size_sections): Properly align RELRO base. ld/testsuite/ PR ld/14207 PR ld/16322 PR binutils/16323 * ld-elf/pr16322.d: New file. * ld-elf/pr16322.s: Likewise. * ld-x86-64/pr14207.d: Expect PT_GNU_RELRO segment.
2014-01-08New Year - binutils ChangeLog rotationH.J. Lu2-1652/+1666
2013-12-19Set SHF_INFO_LINK bit for SHT_REL/SHT_RELA sectionsH.J. Lu4-0/+26
It is a good pratice to set the SHF_INFO_LINK bit when the sh_info field represents a section header index. bfd/ PR binutils/16317 * elf.c (assign_section_numbers): Set the SHF_INFO_LINK bit for SHT_REL/SHT_RELA sections when setting the sh_info field. binutils/testsuite/ PR binutils/16317 * binutils-all/readelf.s: Updated. * binutils-all/readelf.s-64: Likewise. ld/testsuite/ PR binutils/16317 * ld-elf/linkinfo1.s: New file. * ld-elf/linkinfo1a.d: Likewise. * ld-elf/linkinfo1b.d: Likewise.
2013-12-18ld/testsuiteYufeng Zhang2-3/+19
2013-12-18 Vidya Praveen <vidyapraveen@arm.com> * lib/ld-lib.exp (check_lto_available): Support cflags, ldflags and test by compiling for an executable rather than shared library.
2013-12-13 * lib/ld-lib.exp (default_ld_link): Use ldflags from board descriptionVidya Praveen2-0/+19
file. (default_ld_simple_link): Likewise. (default_ld_compile): Use cflags from board description file.
2013-12-13Add support for Andes NDS32:Kuan-Lin Chen22-0/+308
BFD: * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add nds32 files. * Makefile.in: Regenerate. * archures.c (bfd_nds32_arch): Add nds32 target. * bfd-in2.h: Regenerate. * config.bfd (nds32*le-*-linux): Add bfd_elf32_nds32lelin_vec and bfd_elf32_nds32belin_vec. (nds32*be-*-linux*): Likewise. (nds32*le-*-*): Add bfd_elf32_nds32le_vec and bfd_elf32_nds32be_vec. (nds32*be-*-*): Likewise. * configure.in (bfd_elf32_nds32be_vec): Add elf32-nds32.lo. (bfd_elf32_nds32le_vec): Likewise. (bfd_elf32_nds32belin_vec): Likewise. (bfd_elf32_nds32lelin_vec): Likewise. * configure: Regenerate. * cpu-nds32.c: New file for nds32. * elf-bfd.h: Add NDS32_ELF_DATA. * elf32-nds32.c: New file for nds32. * elf32-nds32.h: New file for nds32. * libbfd.h: Regenerate. * reloc.c: Add relocations for nds32. * targets.c (bfd_elf32_nds32be_vec): New declaration for nds32. (bfd_elf32_nds32le_vec): Likewise. (bfd_elf32_nds32belin_vec): Likewise. (bfd_elf32_nds32lelin_vec): Likewise. BINUTILS: * readelf.c: Include elf/nds32.h (guess_is_rela): Add case for EM_NDS32. (dump_relocations): Add case for EM_NDS32. (decode_NDS32_machine_flags): New. (get_machine_flags): Add case for EM_NDS32. (is_32bit_abs_reloc): Likewise. (is_16bit_abs_reloc): Likewise. (process_nds32_specific): New. (process_arch_specific): Add case for EM_NDS32. * NEWS: Announce Andes nds32 support. * MAINTAINERS: Add nds32 maintainers. TESTSUITE: * binutils-all/objdump.exp: Add NDS32 cpu. * binutils-all/readelf.r: Skip extra reloc created by NDS32. GAS: * Makefile.am (TARGET_CPU_CFILES): Add config/tc-nds32.c. (TARGET_CPU_HFILES): Add config/tc-nds32.h. * Makefile.in: Regenerate. * configure.in (nds32): Add nds32 target extension config support. * configure.tgt : Add case for nds32-*-elf* and nds32-*-linux*. * configure: Regenerate. * config/tc-nds32.c: New file for nds32. * config/tc-nds32.h: New file for nds32. * doc/Makefile.am (CPU_DOCS): Add c-nds32.texi. * doc/Makefile.in: Regenerate. * doc/as.texinfo: Add nds32 options. * doc/all.texi: Set NDS32. * doc/c-nds32.texi: New file dor nds32 document. * NEWS: Announce Andes nds32 support. TESTSUITE: * gas/all/gas.exp: Add expected failures for NDS32. * gas/elf/elf.exp: Likewise. * gas/lns/lns.exp: Use alternate test. * gas/macros/irp.d: Skip for NDS32. * gas/macros/macros.exp: Skip some tests for the NDS32. * gas/macros/rept.d: Skip for NDS32. * gas/macros/test3.d: Skip for NDS32. * gas/nds32: New directory. * gas/nds32/alu-1.s: New test. * gas/nds32/alu-1.d: Likewise. * gas/nds32/alu-2.s: Likewise. * gas/nds32/alu-2.d: Likewise. * gas/nds32/br-1.d: Likewise. * gas/nds32/br-1.s: Likewise. * gas/nds32/br-2.d: Likewise. * gas/nds32/br-2.s: Likewise. * gas/nds32/ji-jr.d: Likewise. * gas/nds32/ji-jr.s: Likewise. * gas/nds32/ls.d: Likewise. * gas/nds32/ls.s: Likewise. * gas/nds32/lsi.d: Likewise. * gas/nds32/lsi.s: Likewise. * gas/nds32/to-16bit-v1.d: Likewise. * gas/nds32/to-16bit-v1.s: Likewise. * gas/nds32/to-16bit-v2.d: Likewise. * gas/nds32/to-16bit-v2.s: Likewise. * gas/nds32/to-16bit-v3.d: Likewise. * gas/nds32/to-16bit-v3.s: Likewise. * gas/nds32/nds32.exp: New test driver. LD: * Makefile.am (ALL_EMULATION_SOURCES): Add nds32 target. * Makefile.in: Regenerate. * configure.tgt: Add case for nds32*le-*-elf*, nds32*be-*-elf*, nds32*le-*-linux-gnu*, and nds32*be-*-linux-gnu*. * emulparams/nds32belf.sh: New file for nds32. * emulparams/nds32belf_linux.sh: Likewise. * emulparams/nds32belf16m.sh: Likewise. * emulparams/nds32elf.sh: Likewise. * emulparams/nds32elf_linux.sh: Likewise. * emulparams/nds32elf16m.sh: Likewise. * emultempl/nds32elf.em: Likewise. * scripttempl/nds32elf.sc}: Likewise. * gen-doc.texi: Set NDS32. * ld.texinfo: Set NDS32. * NEWS: Announce Andes nds32 support. TESTSUITE: * lib/ld-lib.exp: Add NDS32 to list of targets that do not support shared library generation. * ld-nds32: New directory. * ld-nds32/branch.d: New test. * ld-nds32/branch.ld: New test. * ld-nds32/branch.s: New test. * ld-nds32/diff.d: New test. * ld-nds32/diff.ld: New test. * ld-nds32/diff.s: New test. * ld-nds32/gp.d: New test. * ld-nds32/gp.ld: New test. * ld-nds32/gp.s: New test. * ld-nds32/imm.d: New test. * ld-nds32/imm.ld: New test. * ld-nds32/imm.s: New test. * ld-nds32/imm_symbol.s: New test. * ld-nds32/relax_jmp.d: New test. * ld-nds32/relax_jmp.ld: New test. * ld-nds32/relax_jmp.s: New test. * ld-nds32/relax_load_store.d: New test. * ld-nds32/relax_load_store.ld: New test. * ld-nds32/relax_load_store.s: New test. * ld-nds32/nds32.exp: New file. OPCODES: * Makefile.am (TARGET_LIBOPCODES_CFILES): Add nds32-asm.c and nds32-dis.c. * Makefile.in: Regenerate. * configure.in: Add case for bfd_nds32_arch. * configure: Regenerate. * disassemble.c (ARCH_nds32): Define. * nds32-asm.c: New file for nds32. * nds32-asm.h: New file for nds32. * nds32-dis.c: New file for nds32. * nds32-opc.h: New file for nds32. INCLUDE: * dis-asm.h (print_insn_nds32): Add nds32 target. * elf/nds32.h: New file for nds32. * opcode/nds32.h: New file for nds32.
2013-12-12Add "#..."H.J. Lu2-0/+5
* ld-elf/ehdr_start-userdef.d: Add "#...".
2013-12-12Set ET_EXEC for -pie -Ttext-segment=H.J. Lu4-0/+34
bfd/ * elf.c (assign_file_positions_except_relocs): Set e_type in ELF header to ET_EXEC for -pie -Ttext-segment=. 2013-12-10 H.J. Lu <hongjiu.lu@intel.com> * ld-pie/vaddr-0.d: New file. * ld-pie/vaddr-1.d: Likewise. * ld-pie/vaddr.s: Likewise.
2013-12-11ld/testsuite/ld-aarch64: Fixup IFUNC tests to work on all targetsWill Newton3-16/+17
Make the ifunc-21 and ifunc-22 tests more generic to support aarch64_be and ELF targets. ld/testsuite/ChangeLog: 2013-12-11 Will Newton <will.newton@linaro.org> * ld-aarch64/ifunc-21.d: Make test more generic to support aarch64_be and ELF targets. * ld-aarch64/ifunc-22.d: Likewise.
2013-12-11Add a test for --as-needed with symbol versioningH.J. Lu6-0/+39
* ld-elf/shared.exp (build_tests): Add libneeded2a.so, libneeded2b.so, libneeded2c.o and needed2. * ld-elf/needed2.ver: New file. * ld-elf/needed2a.c: Likewise. * ld-elf/needed2b.c: Likewise. * ld-elf/needed2c.c: Likewise.
2013-12-07strip off +x bits on non-executable/script filesMike Frysinger27-0/+29
These files are source files and have no business being +x. We couldn't easily fix it in CVS (you need login+write access to the raw rcs files), but we can fix this w/git. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-11-27[ld/testsuite/]Kyrylo Tkachov3-5/+10
2013-11-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * ld-plugin/lto.exp: Add -ffat-lto-objects. * lib/ld-lib.exp (check_lto_available): Likewise.
2013-11-27binutils/testsuite/Richard Sandiford2-2/+9
2013-11-27 Matthew Fortune <matthew.fortune@imgtec.com> * binutils-all/objcopy.exp: Consider mips-mti-elf the same as mips-sde-elf * binutils-all/readelf.exp: Likewise gas/testsuite/ 2013-11-27 Matthew Fortune <matthew.fortune@imgtec.com> * gas/mips/mips.exp: Consider mips-mti-elf the same as mips-sde-elf ld/testsuite/ 2013-11-27 Matthew Fortune <matthew.fortune@imgtec.com> * ld-mips-elf/mips-elf.exp: Consider mips-mti-elf the same as mips-sde-elf
2013-11-26Add HOSTING_SLIBS and use it for -pieH.J. Lu3-3/+11
ld/ PR ld/16259 * Makefile.am (HOSTING_SLIBS): New. * configure.host (HOSTING_SLIBS): New. Used for PIE. * configure.in (HOSTING_SLIBS): New AC_SUBST. * Makefile.in: Regenerated. * configure: Likewise. ld/testsuite/ PR ld/16259 * config/default.exp (get_target_emul): Also set HOSTING_SLIBS. * lib/ld-lib.exp (default_ld_link): Use HOSTING_SLIBS for -pie.
2013-11-26bfd/elfnn-aarch64.c: Handle static links with ifunc correctly.Will Newton4-0/+32
The code for handling GOT references to ifunc symbols in static links was missing. bfd/ChangeLog: 2013-11-26 Will Newton <will.newton@linaro.org> * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Handle STT_GNU_IFUNC symbols correctly in static links. ld/testsuite/ChangeLog: 2013-11-26 Will Newton <will.newton@linaro.org> * ld-aarch64/aarch64-elf.exp: Add ifunc-22. * ld-aarch64/ifunc-22.d: New file. * ld-aarch64/ifunc-22.s: Likewise.
2013-11-26bfd/elfnn-aarch64.c: Fix miscalculation of GOTPLT offset for ifunc syms.Will Newton4-0/+51
The .got.plt header size was not being correctly taken into account when calculating the offset for relocations against ifunc symbols. bfd/ChangeLog: 2013-11-26 Will Newton <will.newton@linaro.org> * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Ensure PLT_INDEX is calculated using correct header size. ld/testsuite/ChangeLog: 2013-11-26 Will Newton <will.newton@linaro.org> * ld-aarch64/aarch64-elf.exp: Add ifunc-21 test. * ld-aarch64/ifunc-21.d: New file. * ld-aarch64/ifunc-21.s: Likewise.
2013-11-21Add bnd-branch-1 testusers/hjl/mpx/masterH.J. Lu4-0/+36
* ld-x86-64/mpx.exp: Run bnd-branch-1. * ld-x86-64/bnd-branch-1.d: New file. * ld-x86-64/bnd-branch-1.s: Likewise.
2013-11-20Add mpx1static, mpx2 and mpx2static testsH.J. Lu8-0/+62
* ld-x86-64/mpx.exp (build_tests): Add libmpx2a.a, libmpx2b.a and libmpx2c.a. (run_tests): Add mpx1static, mpx2 and mpx2static. * ld-x86-64/mpx2.out: Likewise. * ld-x86-64/mpx2a.c: Likewise. * ld-x86-64/mpx2a.rd: Likewise. * ld-x86-64/mpx2b.c: Likewise. * ld-x86-64/mpx2c.c: Likewise. * ld-x86-64/mpx2c.rd: Likewise.
2013-11-19Fix references to __ehdr_start when it cannot be definedRoland McGrath8-1/+59
ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Don't use bfd_elf_record_link_assignment to mark __ehdr_start hidden. Instead, just do it directly here, and only if it was referenced but not defined. ld/testsuite/ * ld-elf/ehdr_start-userdef.t: New file. * ld-elf/ehdr_start-userdef.d: New file. * ld-elf/ehdr_start-strongref.s: New file. * ld-elf/ehdr_start-missing.t: New file. * ld-elf/ehdr_start-missing.d: New file. * ld-elf/ehdr_start-weak.d: New file. * ld-mips-elf/ehdr_start-2.nd: Expect __ehdr_start to be global.
2013-11-17Add R_X86_64_PC32_BND and R_X86_64_PLT32_BNDH.J. Lu8-0/+102
bfd/ * elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND. (R_X86_64_standard): Replace R_X86_64_RELATIVE64 with R_X86_64_PLT32_BND. (IS_X86_64_PCREL_TYPE): Add R_X86_64_PLT32_BND. (x86_64_reloc_map): Add BFD_RELOC_X86_64_PC32_BND and BFD_RELOC_X86_64_PLT32_BND. (elf_x86_64_check_relocs): Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. * reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_PC32_BND and BFD_RELOC_X86_64_PLT32_BND. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. gas/ * config/tc-i386.c (reloc): Add an argument, bnd_prefix, to indicate if instruction has the BND prefix. Return BFD_RELOC_X86_64_PC32_BND instead of BFD_RELOC_32_PCREL if bnd_prefix isn't zero. (output_branch): Pass BFD_RELOC_X86_64_PC32_BND to frag_var if needed. (output_jump): Update reloc call. (output_interseg_jump): Likewise. (output_disp): Likewise. (output_imm): Likewise. (x86_cons_fix_new): Likewise. (lex_got): Add an argument, bnd_prefix, to indicate if instruction has the BND prefix. Use BFD_RELOC_X86_64_PLT32_BND if needed. (x86_cons): Update lex_got call. (i386_immediate): Likewise. (i386_displacement): Likewise. (md_apply_fix): Handle BFD_RELOC_X86_64_PC32_BND and BFD_RELOC_X86_64_PLT32_BND. (tc_gen_reloc): Likewise. * config/tc-i386-intel.c (i386_operator): Update lex_got call. gas/testsuite/ * gas/i386/i386.exp: Run x86-64-mpx-branch-1 and x86-64-mpx-branch-2 on 64-bit ELF targets. * gas/i386/x86-64-mpx-branch-1.d: New file. * gas/i386/x86-64-mpx-branch-1.s: Likewise. * gas/i386/x86-64-mpx-branch-2.d: Likewise. * gas/i386/x86-64-mpx-branch-2.s: Likewise. include/elf/ * x86-64.h: Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND. ld/testsuite/ * ld-x86-64/mpx.exp: New file. * ld-x86-64/mpx1.out: Likewise. * ld-x86-64/mpx1a.c: Likewise. * ld-x86-64/mpx1a.rd: Likewise. * ld-x86-64/mpx1b.c: Likewise. * ld-x86-64/mpx1c.c: Likewise. * ld-x86-64/mpx1c.rd: Likewise.
2013-11-14ld/ARM: Fix script-type testsuite failure.Will Newton2-1/+4
Commit 34a79995c4cc34f6f41e2a4b2df477db31b31f0c changed how STT_FILE symbols were emitted but this testcase got missed in the cleanup. ld/testsuite/ChangeLog: 2013-11-14 Will Newton <will.newton@linaro.org> * ld-arm/script-type.sym: Remove redundant STT_FILE symbol.
2013-11-07Set CPU type in BFD backend for x86_64-nacl* and i?86-nacl* targetsRoland McGrath6-6/+15
bfd/ * archures.c (bfd_mach_i386_nacl): Fix definition so it doesn't collide with bfd_mach_l1om. * bfd-in2.h: Regenerate. * elf32-i386.c (elf32_i386_nacl_elf_object_p): New function. (elf_backend_object_p): Use that in elf32-i386-nacl definition. * elf64-x86-64.c (elf64_x86_64_nacl_elf_object_p): New function. (elf_backend_object_p): Use that in elf64-x86-64-nacl definition. (elf32_x86_64_nacl_elf_object_p): New function. (elf_backend_object_p): Use that in elf32-x86-64-nacl definition. binutils/ * objdump.c (dump_dwarf): Grok bfd_mach_x86_64_nacl and bfd_mach_x64_32_nacl as equivalent to bfd_mach_x86_64. ld/testsuite/ * ld-x86-64/x86-64.exp (mixed1, mixed2): Loosen error string match so it accepts "i386:nacl" in place of "i386". * ld-x86-64/ilp32-2.d: Likewise. * ld-x86-64/ilp32-3.d: Likewise. * ld-x86-64/lp64-2.d: Likewise. * ld-x86-64/lp64-3.d: Likewise.
2013-11-05Pass ignored unresolved relocations to ld backendH.J. Lu5-0/+59
bfd/ PR ld/4409 * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Add an argument for error ignored. * elf-m10200.c (mn10200_elf_relocate_section): Updated. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-avr.c (elf32_avr_relocate_section): Likewise. * elf32-bfin.c (bfinfdpic_relocate_section): Likewise. (bfin_relocate_section): Likewise. * elf32-cr16.c (elf32_cr16_relocate_section): Likewise. * elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-crx.c (elf32_crx_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. * elf32-epiphany.c (epiphany_elf_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-h8300.c (elf32_h8_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise. * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise. * elf32-lm32.c (lm32_elf_relocate_section): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-metag.c (elf_metag_relocate_section): Likewise. * elf32-microblaze.c (microblaze_elf_relocate_section): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-mep.c (mep_elf_relocate_section): Likewise. * elf32-moxie.c (moxie_elf_relocate_section): Likewise. * elf32-msp430.c (elf32_msp430_relocate_section): Likewise. * elf32-mt.c (mt_elf_relocate_section): Likewise. * elf32-nios2.c (nios2_elf32_relocate_section): Likewise. * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-rl78.c (rl78_elf_relocate_section): Likewise. * elf32-rx.c (rx_elf_relocate_section): Likewise. * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise. * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-v850.c (v850_elf_relocate_section): Likewise. * elf32-vax.c (elf_vax_relocate_section): Likewise. * elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise. * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise. * elf64-mmix.c (mmix_elf_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise. * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise. * elfnn-ia64.c (elfNN_ia64_relocate_section): Skip if error from RELOC_FOR_GLOBAL_SYMBOL in executable is ignored. ld/testsuite/ PR ld/4409 * ld-ia64/error1.d: New file. * ld-ia64/error1.s: Likewise. * ld-ia64/error2.d: Likewise. * ld-ia64/error3.d: Likewise.
2013-11-04Edit ELFv2 global entry prologue to non-PICAlan Modra2-2/+6
Changing addis r2,r12,..; addi r2,r2,.. to lis r2,..; addi r2,r2.. in non-PIC executables has the benefit of removing a dependency on r12. bfd/ * elf64-ppc.c (ppc64_elf_relocate_section): Edit global entry prologue to non-PIC in non-PIC executables. ld/testsuite/ * ld-powerpc/elfv2exe.d: Adjust for non-PIC global entry.
2013-11-04Allow for extra st_other readelf output in ld testsuiteAlan Modra3-3/+10
On PowerPC64 ELFv2 readelf emits [<localentry>: 8] describing extra symbol st_other bits. * ld-elfvers/vers24.rd: Allow extra readelf output after symbol visibility. * ld-ifunc/ifunc.exp: Likewise.
2013-11-04ld crossref test fixAlan Modra2-2/+16
* ld-scripts/crossref.exp: Don't allow changes made to CFLAGS for this test to bleed into following tests. Don't set -mcall-aixdesc for powerpc64le.
2013-11-02Assorted x86 testsuite fixes.Alan Modra2-3/+7
I think HJ has already fixed the binutils and ld tests with his 2013-09-27 readelf change, but this allows them to pass with wider address output as per Nick's 2013-09-12 readelf change. binutils/testsuite/ * binutils-all/x86-64/compressed-1a.d: Allow wide display of addresses. gas/testsuite/ * gas/cfi/cfi-x86_64.d: Match when lacking end of section padding. ld/testsuite/ * ld-pe/cfi.d: Allow wide display of addresses.
2013-11-01x86_64-*-nacl*: Adjust test cases for PLT nop fix.Roland McGrath3-3/+8
ld/testsuite/ * ld-x86-64/plt-nacl.pd: Update expected disassembly for PLT nop fix. * ld-x86-64/tlsdesc-nacl.pd: Likewise.
2013-10-30Add PowerPC64 ELFv2 tests.Alan Modra5-0/+163
* ld-powerpc/elfv2.s, * ld-powerpc/elfv2so.d, * ld-powerpc/elfv2exe.d: New tests. * ld-powerpc/powerpc.exp: Run them.
2013-10-30Change plt stubs to have destination in r12.Alan Modra20-181/+229
This change is to support the new ELFv2 ABI, which uses the value in r12 on function entry to calculate the got/toc pointer. bfd/ * elf64-ppc.c (build_plt_stub): Switch stubs to use r11 as base reg and r12 as destination. (ppc_build_one_stub): Likewise. (ppc64_elf_build_stubs): Likewise for glink. ld/testsuite/ * ld-powerpc/tls.s: Add proper .opd entry for _start. * ld-powerpc/tlstoc.s: Likewise. * ld-powerpc/relbrlt.d: Update for changed stubs. * ld-powerpc/tls.d: Update for changed stubs and _start .opd entry. * 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.d: Likewise. * ld-powerpc/tlstoc.g: Likewise. * ld-powerpc/tlstocso.d: Likewise. * ld-powerpc/tlstocso.g: Likewise. * ld-powerpc/tlstocso.r: Likewise.
2013-10-29ld/ELF: refine fake STT_FILE symbol emissionJan Beulich26-25/+29
There's no real need to emit these always: They're needed only if we indeed want to emit a localized symbol. Hence defer emission until we at least did the basic early checks that would lead to no such symbol getting emitted. This in particular avoids emitting such a symbol in the majority of (if not all) "ld -r" cases. I hope my set of cross build tests caught all the test cases needing adjustment - please forgive if I missed a few. bfd/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * elflink.c (struct elf_outext_info): Add field file_sym_done. (bfd_elf_final_link): Initialize new field. Move fake STT_FILE symbol emission from here ... (elf_link_output_extsym): ... to here. gas/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * gas/microblaze/relax_size.elf: Drop expectation of no longer present STT_FILE symbol. * gas/microblaze/relax_size2.elf: Likewise. ld/testsuite/ 2013-10-29 Jan Beulich <jbeulich@suse.com> * ld-cris/tls-e-tpoffcomm1.d: Drop expectation of no longer present STT_FILE symbol. * ld-mmix/bpo-18.d: Likewise. * ld-mmix/bpo-22.d: Likewise. * ld-mmix/greg-6.d: Likewise. * ld-mmix/greg-7.d: Likewise. * ld-mmix/loc4.d: Likewise. * ld-mmix/local1.d: Likewise. * ld-mmix/local3.d: Likewise. * ld-mmix/local5.d: Likewise. * ld-mmix/local7.d: Likewise. * ld-mmix/loct-1.d: Likewise. * ld-sh/sh64/abi32.xd: Likewise. * ld-sh/sh64/abi64.xd: Likewise. * ld-sh/sh64/cmpct1.xd: Likewise. * ld-sh/sh64/crange1.rd: Likewise. * ld-sh/sh64/crange2.rd: Likewise. * ld-sh/sh64/crange3-cmpct.rd: Likewise. * ld-sh/sh64/crange3-media.rd: Likewise. * ld-sh/sh64/crange3.rd: Likewise. * ld-sh/sh64/crangerel1.rd: Likewise. * ld-sh/sh64/crangerel2.rd: Likewise. * ld-sh/sh64/mix1.xd: Likewise. * ld-sh/sh64/mix2.xd: Likewise. * ld-sh/sh64/shdl32.xd: Likewise. * ld-sh/sh64/shdl64.xd: Likewise.
2013-10-18 * ld-cris/asneed1.d: New test.Hans-Peter Nilsson2-0/+29