aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2014-10-24[AArch64] Cortex-A53 erratum 835769 linker workaroundJiong Wang4-0/+138
2014-10-22 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-17Fix ld tests with sysroot=/ and --enable-targets=all and test --print-sysrootHans-Peter Nilsson3-23/+40
* ld-scripts/sysroot-prefix.exp: Log $ld_sysroot. Handle sysroot == "/" as a separate sysroot-configuration with separable test-types. (sysroot_prefix_tests): Include all existing sysroot tests in sysroot == "/" tests except exclude those where a --sysroot option is not specified. * lib/ld-lib.exp (check_sysroot_available): Rewrite to use --print-sysroot instead of relying on error code from using --sysroot=... Also, set $ld_sysroot. The reason we exclude not just the failing "full-path =-prefixed without" but also the passing "plain =-prefixed without but -Lpath" for sysroot == "/" is that for the latter to succeed, we have to make assumptions about the system not having a /sysroot directory or assumptions about its contents etc. When passing --enable-targets=all --enable-64-bit-bfd (the latter not required for a "64-bit-host" of course) the ld --help output got too much to handle for poor tcl (or maybe dejagnu is to blame) and remote_exec exited with an error, so the configuration being tested was mishandled as being a sysroot-less configuration. Using --version instead of --help would work too, but the new --print-sysroot option calls for nominal coverage, so why not use that instead.
2014-10-15Add sysroot-prefix ld linker tests.Hans-Peter Nilsson4-0/+194
* ld-scripts/sysroot-prefix.exp, ld-scripts/sysroot-prefix-x.s, ld-scripts/sysroot-prefix-y.s: New files. N.B: full coverage is only possible with complementary use of --with-sysroot when configuring.
2014-10-15lib/ld-lib.exp (check_sysroot_available): New proc.Hans-Peter Nilsson2-0/+22
2014-10-04Discard zero address range eh_frame FDEsAlan Modra10-14/+30
These are useless because they can't match any address. In fact, worse than useless because the .eh_frame_hdr lookup table matching addresses to FDEs does not contain information about the FDE range. The table is sorted by address; Range is inferred by the address delta from one entry to the next. So if a zero address range FDE is followed by a normal non-zero range FDE for the same address, everything is good. However, the qsort could just as easily sort the FDEs in the other order, in which case the normal FDE would effectively be seen to have a zero range. bfd/ PR 17447 * elf-bfd.h (struct eh_cie_fde): Comment re NULL u.fde.cie_inf. * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Mark zero address range FDEs for discarding. (vma_compare): Sort on range after address. (_bfd_elf_gc_mark_fdes): Test for NULL u.fde.cie_inf. (_bfd_elf_discard_section_eh_frame): Likewise. Write "FDE" in error message rather than "fde". (_bfd_elf_write_section_eh_frame_hdr): Write "PC" and "FDE" in error message. ld/testsuite/ * ld-elf/eh1.s: Don't create FDEs with zero address ranges. * ld-elf/eh3.s: Likewise. * ld-elf/eh1.d, * ld-elf/eh2.d, * ld-elf/eh3.d: Adjust. * ld-mips-elf/eh-frame1-n32.d: Warning match update. * ld-mips-elf/eh-frame1-n64.d: Likewise. * ld-mips-elf/eh-frame2-n32.d: Likewise. * ld-mips-elf/eh-frame2-n64.d: Likewise.
2014-09-22Find lto plugin when using gcc-5.0Alan Modra2-1/+9
I originally had this as --print-prog-name and changed back to --print-file-name to suit older gcc, neglecting to check whether gcc-5.0 --print-file-name finds the lto plugin. It doesn't. * ld-plugin/lto.exp: Use both --print-file-name and --print-prog-name when looking for lto plugin.
2014-09-16Make the linker return an error status if it fails to merge ARM binaries withTerry Guo5-0/+39
different architecture tags. Add a test case to make sure that this works, and update readelf so that it will not seg-fault when trying to display the attributes of binaries with invalid architecture tags. * elf32-arm.c (elf32_arm_merge_eabi_attributes): Return false if failed to merge. * ld-arm/attr-merge-arch-2.d: New test case. * ld-arm/attr-merge-arch-2a.s: New test case source file. * ld-arm/attr-merge-arch-2b.s: Likewise. * ld-arm/arm-elf.exp: Run new test case. * readelf.c (display_arm_attribute): Use unsigned int type for tag, val and type variables.
2014-09-12Add mips*-img-elf* target triple.Andrew Bennett2-2/+8
/ * configure.ac: Add mips*-img-elf* target triple. * configure: Regenerate. bfd/ * config.bfd: Add mips*-img-elf* target triple. gas/ * configure.tgt: Add mips*-img-elf* target triple. gas/testsuite/ * gas/mips/mips.exp: Add mips*-img-elf* target triple. binutils/testsuite/ * binutils-all/objcopy.exp: Add mips*-img-elf* target triple. * binutils-all/readelf.exp: Likewise. ld/ * configure.tgt: Add mips*-img-elf* target triple. ld/testsuite/ * ld-mips-elf/mips-elf.exp: Add support for mips*-img-elf* target triple.
2014-09-11Move ELF section headers to end of object fileAlan Modra31-42/+76
Currently, section ordering differs a little for non-loaded reloc sections output by ld -emit-relocs or ld -r and that after passing such objects through objcopy. Not that it really matters, but it would be better for a simple objcopy to produce an unchanged output object file. Also, section headers are put somewhere in the middle of the non-loaded sections, again slightly differently for ld and objcopy. This patch fixes these discrepancies and puts section headers last, which is where gold puts them, and is where bfd_from_remote_memory wrongly assumed they will be found. bfd/ * elf.c (assign_file_positions_except_relocs): Move section header placement to.. (_bfd_elf_assign_file_positions_for_relocs): ..here. Make static. * elf-bfd.h (_bfd_elf_assign_file_positions_for_relocs): Delete. * elflink.c (bfd_elf_final_link): Don't call above function. gas/testsuite/ * gas/arm/got_prel.d: Adjust for changed section header placement. * gas/i386/ilp32/x86-64-size-1.d: Likewise. * gas/i386/ilp32/x86-64-size-3.d: Likewise. * gas/i386/ilp32/x86-64-size-5.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/size-1.d: Likewise. * gas/i386/size-3.d: Likewise. * gas/i386/x86-64-size-1.d: Likewise. * gas/i386/x86-64-size-3.d: Likewise. * gas/i386/x86-64-size-5.d: Likewise. * gas/i386/x86-64-unwind.d: Likewise. * gas/ia64/alias-ilp32.d: Likewise. * gas/ia64/alias.d: Likewise. * gas/ia64/group-1.d: Likewise. * gas/ia64/group-2.d: Likewise. * gas/ia64/secname-ilp32.d: Likewise. * gas/ia64/secname.d: Likewise. * gas/ia64/unwind-ilp32.d: Likewise. * gas/ia64/unwind.d: Likewise. * gas/mmix/bspec-1.d: Likewise. * gas/mmix/bspec-2.d: Likewise. * gas/mmix/byte-1.d: Likewise. * gas/mmix/loc-1.d: Likewise. * gas/mmix/loc-2.d: Likewise. * gas/mmix/loc-3.d: Likewise. * gas/mmix/loc-4.d: Likewise. * gas/mmix/loc-5.d: Likewise. * gas/tic6x/scomm-directive-4.d: Likewise. ld/testsuite/ * ld-aarch64/emit-relocs-local-addend.d: Adjust for changed section header placement. * ld-aarch64/local-addend-r.d: Likewise. * ld-mmix/bspec1.d: Likewise. * ld-mmix/bspec2.d: Likewise. * ld-mmix/local1.d: Likewise. * ld-mmix/local3.d: Likewise. * ld-mmix/local5.d: Likewise. * ld-mmix/local7.d: Likewise. * ld-mmix/undef-3.d: Likewise. * ld-sh/sh64/crange3-cmpct.rd: Likewise. * ld-sh/sh64/crange3-media.rd: Likewise. * ld-sh/sh64/crangerel1.rd: Likewise. * ld-sh/sh64/crangerel2.rd: Likewise. * ld-tic6x/common.d: Likewise. * ld-tic6x/shlib-1.rd: Likewise. * ld-tic6x/shlib-1b.rd: Likewise. * ld-tic6x/shlib-1r.rd: Likewise. * ld-tic6x/shlib-1rb.rd: Likewise. * ld-tic6x/shlib-app-1.rd: 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. * ld-x86-64/ilp32-4.d: Likewise. * ld-x86-64/split-by-file-nacl.rd: Likewise. * ld-x86-64/split-by-file.rd: Likewise.
2014-09-06MIPS testsuite cleanup - part 4Matthew Fortune62-276/+329
ld/testsuite/ * ld-mips-elf/abiflags-strip1-ph.d: Ignore big/little endian differences. Ignore program headers other than PT_MIPS_ABIFLAGS. Do not force -32, -EB and ld emulation but instead rely on the test driver to build for some form of O32. * ld-mips-elf/abiflags-strip2-ph.d: Likewise. * ld-mips-elf/abiflags-strip3-ph.d: Likewise. * ld-mips-elf/abiflags-strip4-ph.d: Likewise. * ld-mips-elf/abiflags-strip5-ph.d: Likewise. * ld-mips-elf/abiflags-strip6-ph.d: Likewise. * ld-mips-elf/abiflags-strip7-ph.d: Likewise. * ld-mips-elf/abiflags-strip8-ph.d: Likewise. * ld-mips-elf/abiflags-strip9-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-0-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-05.d: Likewise. * ld-mips-elf/attr-gnu-4-06.d: Likewise. * ld-mips-elf/attr-gnu-4-07.d: Likewise. * ld-mips-elf/attr-gnu-4-1-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-10.d: Likewise. * ld-mips-elf/attr-gnu-4-15.d: Likewise. * ld-mips-elf/attr-gnu-4-16.d: Likewise. * ld-mips-elf/attr-gnu-4-17.d: Likewise. * ld-mips-elf/attr-gnu-4-2-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-25.d: Likewise. * ld-mips-elf/attr-gnu-4-26.d: Likewise. * ld-mips-elf/attr-gnu-4-27.d: Likewise. * ld-mips-elf/attr-gnu-4-3-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-35.d: Likewise. * ld-mips-elf/attr-gnu-4-36.d: Likewise. * ld-mips-elf/attr-gnu-4-37.d: Likewise. * ld-mips-elf/attr-gnu-4-4-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-45.d: Likewise. * ld-mips-elf/attr-gnu-4-46.d: Likewise. * ld-mips-elf/attr-gnu-4-47.d: Likewise. * ld-mips-elf/attr-gnu-4-5-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-50.d: Likewise. * ld-mips-elf/attr-gnu-4-51.d: Likewise. * ld-mips-elf/attr-gnu-4-52.d: Likewise. * ld-mips-elf/attr-gnu-4-53.d: Likewise. * ld-mips-elf/attr-gnu-4-54.d: Likewise. * ld-mips-elf/attr-gnu-4-55.d: Likewise. * ld-mips-elf/attr-gnu-4-56.d: Likewise. * ld-mips-elf/attr-gnu-4-57.d: Likewise. * ld-mips-elf/attr-gnu-4-58.d: Likewise. * ld-mips-elf/attr-gnu-4-6-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-60.d: Likewise. * ld-mips-elf/attr-gnu-4-61.d: Likewise. * ld-mips-elf/attr-gnu-4-62.d: Likewise. * ld-mips-elf/attr-gnu-4-63.d: Likewise. * ld-mips-elf/attr-gnu-4-64.d: Likewise. * ld-mips-elf/attr-gnu-4-65.d: Likewise. * ld-mips-elf/attr-gnu-4-66.d: Likewise. * ld-mips-elf/attr-gnu-4-67.d: Likewise. * ld-mips-elf/attr-gnu-4-68.d: Likewise. * ld-mips-elf/attr-gnu-4-7-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-70.d: Likewise. * ld-mips-elf/attr-gnu-4-71.d: Likewise. * ld-mips-elf/attr-gnu-4-72.d: Likewise. * ld-mips-elf/attr-gnu-4-73.d: Likewise. * ld-mips-elf/attr-gnu-4-74.d: Likewise. * ld-mips-elf/attr-gnu-4-75.d: Likewise. * ld-mips-elf/attr-gnu-4-76.d: Likewise. * ld-mips-elf/attr-gnu-4-77.d: Likewise. * ld-mips-elf/attr-gnu-4-78.d: Likewise. * ld-mips-elf/mips-elf.exp: Update default abi_asflags(o32) to explicitly pass -32 for the 'no abi' configurations. Modify the way attr-gnu* tests are run to use O32 flags appropriate for the current target.
2014-08-29Fix testsuite ld_simple_link_defsyms for windows targetsAlan Modra2-2/+7
* lib/ld-lib.exp (ld_simple_link_defsyms): Provide both __main and ___main for windows targets.
2014-08-27Use bfd_is_abs_section to check discarded input sectionH.J. Lu7-0/+41
bfd/ PR ld/17306 * elf32-i386.c (elf_i386_convert_mov_to_lea): Use bfd_is_abs_section to check discarded input section. * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise. ld/testsuite/ PR ld/17306 * ld-i386/i386.exp (i386tests): Add tests for PR ld/17306. * ld-x86-64/x86-64.exp (x86_64tests): Likewise. * ld-i386/pr17306a.s: New file. * ld-i386/pr17306b.s: Likewise. * ld-x86-64/pr17306a.s: Likewise. * ld-x86-64/pr17306b.s: Likewise.
2014-08-27Don't attach dynamic sections to input from ld --just-symbolsH.J. Lu3-0/+14
bfd/ PR ld/17313 * elflink.c (elf_link_add_object_symbols): Don't attach dynamic sections to input from ld --just-symbols. 2014-08-27 H.J. Lu <hongjiu.lu@intel.com> PR ld/17313 * ld-i386/i386.exp (i386tests): Add tests for PR ld/17313. * ld-x86-64/x86-64.exp (x86_64tests): Likewise.
2014-08-26[AArch64] Improve copy relocation support on four absolute relocation typesJiong Wang9-0/+53
2014-08-26 Jiong Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Initialize non_got_ref properly for MOVW_G0/1/2_NC and MOVW_G3. Reject them when linking shared library. (elfNN_aarch64_gc_sweep_hook): Add check on these relocs. ld/testsuite/ * ld-aarch64/copy-relocs-so.s: New test file. * ld-aarch64/copy-relocs-exe.s: Likewise. * ld-aarch64/copy-relocs.d: New expectation file. * ld-aarch64/emit-relocs-264-bad.d: New test file. * ld-aarch64/emit-relocs-266-bad.d: Likewise. * ld-aarch64/emit-relocs-268-bad.d: Likewise. * ld-aarch64/emit-relocs-269-bad.d: Likewise. * ld-aarch64/aarch64-elf.exp: Run new added test.
2014-08-26Fix linker testsuite failures for Aarch64.Nick Clifton5-49/+56
Resolves PR 17312 * ld-aarch64/eh-frame-foo.s: Use 8-byte offset for X30. * ld-aarch64/eh-frame-bar.s: Likewise. * ld-aarch64/eh-frame.d: Updated to match current readelf output. * ld-elf/eh5.d: Allow any register names.
2014-08-22Power/GAS: Don't set VLE annotation for non-VLE processors/instructionsMaciej W. Rozycki5-5/+24
Only set the VLE flag if the instruction has been pulled via the VLE instruction set. This way the flag is guaranteed to be set for VLE-only instructions or for VLE-only processors, however it'll remain clear for dual-mode instructions on dual-mode and, more importantly, standard-mode processors. gas/ * config/tc-ppc.c (md_assemble): Only set the PPC_APUINFO_VLE flag if both the processor and opcode flags match. ld/testsuite/ * ld-powerpc/apuinfo-vle.rd: New test. * ld-powerpc/apuinfo-vle.s: New test source. * ld-powerpc/apuinfo.rd: Adjust according to GAS PPC_APUINFO_VLE handling change. * ld-powerpc/powerpc.exp: Run the new test.
2014-08-21bfd/ChangeLogTerry Guo9-0/+178
2014-08-21 Tony Wang <tony.wang@arm.com> * elf32-arm.c (elf32_arm_final_link_relocate): Implement the veneer routine for R_ARM_THM_JUMP19. (arm_type_of_stub): Add conditional clause for R_ARM_THM_JUMP19 (elf32_arm_size_stub): Ditto. ld/testsuite/ChangeLog 2014-08-21 Tony Wang <tony.wang@arm.com> * ld-arm/jump-reloc-veneers-cond.s: New test. * ld-arm/farcall-cond-thumb-arm.s: Ditto. * ld-arm/jump-reloc-veneers-cond-short.d: Expected output for target without a veneer generation. * ld-arm/jump-reloc-veneers-cond-long.d: Expected output for target with a veneer generation. * ld-arm/farcall-cond-thumb-arm.d: Expected output for inter working veneer generation. * ld-arm/arm-elf.exp: Add tests for conditional branch veneer.
2014-08-20Fix PR ld/17277: bogus dynamic relocs and TEXTREL for ARM PC-relative relocsRoland McGrath4-0/+52
bfd/ PR ld/17277 * elf32-arm.c (elf32_arm_check_relocs): Increment P->pc_count for all reloc types with pc_relative set in the howto, not just for R_ARM_REL32 and R_ARM_REL32_NOI. (allocate_dynrelocs_for_symbol): Update comment. (elf32_arm_gc_sweep_hook): For all reloc types with pc_relative set in the howto, set call_reloc_p and may_need_local_target_p but not may_become_dynamic_p; not only for R_ARM_REL32 and R_ARM_REL32_NOI. (elf32_arm_check_relocs): Likewise. ld/testsuite/ PR ld/17277 * ld-arm/pcrel-shared.s: New file. * ld-arm/pcrel-shared.rd: New file. * ld-arm/arm-elf.exp (armelftests_common): Add it.
2014-08-18LTO plugin with older gccAlan Modra2-1/+5
* ld-plugin/lto.exp: Use gcc -print-file-name to find lto plugin.
2014-08-18PR 17287, DT_NEEDED of unneeded libraries affects --as-neededAlan Modra3-0/+25
PR 17287 bfd/ * elflink.c (on_needed_list): Only consider libraries that have been loaded. ld/ * ld.texinfo (--as-needed): Clarify that references from libraries must be from needed libraries. ld/testsuite/ * ld-plugin/needed3.c: New file. * ld-elf/shared.exp: Add needed3 test.
2014-08-12Tighten test for ld plugin supportAlan Modra2-1/+5
To not match spu --plugin option. * lib/ld-lib.exp (check_plugin_api_available): Match "-plugin PLUGIN".
2014-08-07Don't issue a warning for references in LTO IR to warning symbolsH.J. Lu6-0/+59
bfd/ PR ld/16746 * linker.c (_bfd_generic_link_add_one_symbol): Don't issue a warning for references in LTO IR to warning symbols. ld/testsuite/ PR ld/16746 * ld-plugin/lto.exp: Add 4 tests for PR ld/16746. * ld-plugin/pr16746a.c: New file. * ld-plugin/pr16746b.c: Likewise. * ld-plugin/pr16746c.c: Likewise. * ld-plugin/pr16746d.c: Likewise.
2014-08-06Allow lto tests to run with older compilersAlan Modra3-268/+321
* lib/ld-lib.exp (check_lto_fat_available): New. (check_lto_available): Remove -ffat-lto-objects test. * ld-plugin/lto.exp: Use [list ] rather than { } to set up list variables, allowing substition of vars. Set lto_fat and plug_opt and add to various tests.
2014-08-01Fix PR10373 which is SH relax bug.Kaz Kojima3-3/+15
2014-08-01Fix PR10378 which is SH relax bug.Kaz Kojima3-0/+42
2014-07-29[MIPS] Implement O32 FPXX, FP64 and FP64A ABI extensionsMatthew Fortune161-184/+2000
Specification: https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking include/ * elf/mips.h (PT_MIPS_ABIFLAGS, SHT_MIPS_ABIFLAGS): Define. (Val_GNU_MIPS_ABI_FP_OLD_64): Rename from Val_GNU_MIPS_ABI_FP_64. (Val_GNU_MIPS_ABI_FP_64): Redefine. (Val_GNU_MIPS_ABI_FP_XX): Define. (Elf_External_ABIFlags_v0, Elf_Internal_ABIFlags_v0): New structures. (AFL_REG_NONE, AFL_REG_32, AFL_REG_64, AFL_REG_128): Define. (AFL_ASE_DSP, AFL_ASE_DSPR2, AFL_ASE_EVA, AFL_ASE_MCU): Likewise. (AFL_ASE_MDMX, AFL_ASE_MIPS3D, AFL_ASE_MT, AFL_ASE_SMARTMIPS): Likewise. (AFL_ASE_VIRT, AFL_ASE_MSA, AFL_ASE_MIPS16): Likewise. (AFL_ASE_MICROMIPS, AFL_ASE_XPA): Likewise. (AFL_EXT_XLR, AFL_EXT_OCTEON2, AFL_EXT_OCTEONP): Likewise. (AFL_EXT_LOONGSON_3A, AFL_EXT_OCTEON, AFL_EXT_5900): Likewise. (AFL_EXT_4650, AFL_EXT_4010, AFL_EXT_4100, AFL_EXT_3900): Likewise. (AFL_EXT_10000, AFL_EXT_SB1, AFL_EXT_4111, AFL_EXT_4120): Likewise. (AFL_EXT_5400, AFL_EXT_5500, AFL_EXT_LOONGSON_2E): Likewise. (AFL_EXT_LOONGSON_2F): Likewise. (bfd_mips_elf_swap_abiflags_v0_in): Prototype. (bfd_mips_elf_swap_abiflags_v0_out): Likewise. (bfd_mips_isa_ext): Likewise. bfd/ * elfxx-mips.c (ABI_O32_P, MIPS_ELF_ABIFLAGS_SECTION_NAME_P): New macro. (mips_elf_obj_tdata): Add abiflags and abiflags_valid fields. (bfd_mips_elf_swap_abiflags_v0_in): New function. (bfd_mips_elf_swap_abiflags_v0_out): Likewise. (_bfd_mips_elf_section_from_shdr): Handle SHT_MIPS_ABIFLAGS. (_bfd_mips_elf_fake_sections): Likewise. (_bfd_mips_elf_always_size_sections): Handle .MIPS.abiflags. (_bfd_mips_elf_additional_program_headers): Account for new PT_MIPS_ABIFLAGS program header. (_bfd_mips_elf_modify_segment_map): Create PT_MIPS_ABIFLAGS segment and associate with .MIPS.abiflags. (_bfd_mips_elf_gc_mark_extra_sections): New function. (bfd_mips_isa_ext, update_mips_abiflags_isa): New static function. (infer_mips_abiflags): Likewise. (_bfd_mips_elf_final_link): Handle .MIPS.abiflags. (mips_32bit_flags_p): Moved higher. (mips_elf_merge_obj_attributes, _bfd_mips_fp_abi_string): Error checking for FP ABIs. (_bfd_mips_elf_merge_private_bfd_data): Restructure and add abiflags checks. Check EF_MIPS_FP64 flag consistency. (print_mips_ases, print_mips_isa_ext): New static function. (print_mips_fp_abi_value, get_mips_reg_size): Likewise. (_bfd_mips_elf_print_private_bfd_data): Display abiflags data. (_bfd_mips_post_process_headers): Set EI_ABIVERSION = 3 for Val_GNU_MIPS_ABI_FP_64 or Val_GNU_MIPS_ABI_FP_64A. * elfxx-mips.h (_bfd_mips_elf_gc_mark_extra_sections): New prototype. * elf32-mips.c (elf_backend_gc_mark_extra_sections): Implement. * elfn32-mips.c (elf_backend_gc_mark_extra_sections): Implement. * elf64-mips.c (elf_backend_gc_mark_extra_sections): Implement. binutils/ * readelf.c (get_mips_segment_type): Display name for PT_MIPS_ABIFLAGS. (get_mips_section_type_name): Display name for SHT_MIPS_ABIFLAGS. (display_mips_gnu_attribute): Abstracted fp abi printing to... (print_mips_fp_abi_value): New static function. Handle new FP ABIs. (print_mips_ases, print_mips_isa_ext): New static functions. (get_mips_reg_size): Likewise. (process_mips_specific): Display abiflags data. elfcpp/ * elfcpp.h (PT_MIPS_ABIFLAGS): New program header type. gas/ * config/tc-mips.c (mips_flags_frag): New static global. (struct mips_set_options): Add oddspreg field. (file_mips_opts, mips_opts): Initialize oddspreg. (ISA_HAS_ODD_SINGLE_FPR): Add CPU argument and update for R5900 and Loongson-3a. (enum options, md_longopts, md_parse_option): Add -mfpxx, -modd-spreg and -mno-odd-spreg options. (md_begin): Create .MIPS.abiflags section. (fpabi_incompatible_with, fpabi_requires): New static function. (check_fpabi): Likewise. (mips_check_options): Handle fp=xx and oddspreg restrictions. (file_mips_check_options): Set oddspreg by default for fp=xx. (mips_oddfpreg_ok): Re-write function. (check_regno): Check odd numbered registers regardless of FPR size. For fp != 32 use as_bad instead of as_warn. (match_float_constant): Rewrite check regarding FP register width. Add support for generating constants when MXHC1 is present. Handle fp=xx to comply with the ABI. (macro): Update M_LI_DD similarly to match_float_constant. Generate MTHC1 when available. Check that correct code can be generated for fp=xx and fp=64 ABIs. (parse_code_option, s_mipsset): Add fp=xx, oddspreg and nooddspreg options. (mips_convert_ase_flags): New static function. (mips_elf_final_processing): Use fpabi == Val_GNU_MIPS_ABI_FP_OLD_64 to determine when to add the EF_MIPS_FP64 flag. Populate the .MIPS.abiflags section. (md_mips_end): Update .gnu_attribute based on command line and .module as applicable. Use check_fpabi to ensure .gnu.attribute and command line/.module options are consistent. * doc/as.texinfo: Add missing -mgp64/-mfp64 options and document new -mfpxx, -modd-spreg and -mno-odd-spreg options. * doc/c-mips.texi: Document -mfpxx, -modd-spreg, -mno-odd-spreg, gnu_attribute values and FP ABIs. ld/ * emulparams/elf32bmip.sh: Add .MIPS.abiflags. * emulparams/elf32bmipn32-defs.sh: Likewise. * emulparams/elf64bmip-defs.sh: Likewise. opcodes/ * micromips-opc.c (COD, LCD) New macros. (cfc1, ctc1): Remove FP_S attribute. (dmfc1, mfc1, mfhc1): Add LCD attribute. (dmtc1, mtc1, mthc1): Add COD attribute. * mips-opc.c (cfc1, cftc1, ctc, cttc1): Remove FP_S attribute. binutils/testsuite/ * binutils-all/readelf.s: Account for .MIPS.abiflags and .gnu.attributes. * binutils-all/readelf.ss-tmips: Likewise. * binutils-all/strip-3.d: Likewise. gas/testsuite/ * gas/mips/attr-gnu-4-0.d: New. * gas/mips/attr-gnu-4-0.s: Likewise. * gas/mips/attr-gnu-4-1-mfp32.l: Likewise. * gas/mips/attr-gnu-4-1-mfp32.s: Likewise. * gas/mips/attr-gnu-4-1-mfp64.l: Likewise. * gas/mips/attr-gnu-4-1-mfp64.s: Likewise. * gas/mips/attr-gnu-4-1-mfpxx.s: Likewise. * gas/mips/attr-gnu-4-1-msingle-float.l: Likewise. * gas/mips/attr-gnu-4-1-msingle-float.s: Likewise. * gas/mips/attr-gnu-4-1-msoft-float.l: Likewise. * gas/mips/attr-gnu-4-1-msoft-float.s: Likewise. * gas/mips/attr-gnu-4-1.d: Likewise. * gas/mips/attr-gnu-4-1.s: Likewise. * gas/mips/attr-gnu-4-2-mdouble-float.l: Likewise. * gas/mips/attr-gnu-4-2-mdouble-float.s: Likewise. * gas/mips/attr-gnu-4-2-msoft-float.l: Likewise. * gas/mips/attr-gnu-4-2-msoft-float.s: Likewise. * gas/mips/attr-gnu-4-2.d: Likewise. * gas/mips/attr-gnu-4-2.s: Likewise. * gas/mips/attr-gnu-4-3-mhard-float.l: Likewise. * gas/mips/attr-gnu-4-3-mhard-float.s: Likewise. * gas/mips/attr-gnu-4-3.d: Likewise. * gas/mips/attr-gnu-4-3.s: Likewise. * gas/mips/attr-gnu-4-4.l: Likewise. * gas/mips/attr-gnu-4-4.s: Likewise. * gas/mips/attr-gnu-4-5-64.l: Likewise. * gas/mips/attr-gnu-4-5-64.s: Likewise. * gas/mips/attr-gnu-4-5.d: Likewise. * gas/mips/attr-gnu-4-5.l: Likewise. * gas/mips/attr-gnu-4-5.s: Likewise. * gas/mips/attr-gnu-4-6-64.l: Likewise. * gas/mips/attr-gnu-4-6-64.s: Likewise. * gas/mips/attr-gnu-4-6.d: Likewise. * gas/mips/attr-gnu-4-6.l: Likewise. * gas/mips/attr-gnu-4-6.s: Likewise. * gas/mips/attr-gnu-4-6-msingle-float.l: Likewise. * gas/mips/attr-gnu-4-6-msingle-float.s: Likewise. * gas/mips/attr-gnu-4-6-msoft-float.l: Likewise. * gas/mips/attr-gnu-4-6-msoft-float.s: Likewise. * gas/mips/attr-gnu-4-6-noodd.l: Likewise. * gas/mips/attr-gnu-4-6-noodd.s: Likewise. * gas/mips/attr-gnu-4-7-64.l: Likewise. * gas/mips/attr-gnu-4-7-64.s: Likewise. * gas/mips/attr-gnu-4-7-msingle-float.l: Likewise. * gas/mips/attr-gnu-4-7-msingle-float.s: Likewise. * gas/mips/attr-gnu-4-7-msoft-float.l: Likewise. * gas/mips/attr-gnu-4-7-msoft-float.s: Likewise. * gas/mips/attr-gnu-4-7-odd.l: Likewise. * gas/mips/attr-gnu-4-7-odd.s: Likewise. * gas/mips/attr-gnu-4-7.d: Likewise. * gas/mips/attr-gnu-4-7.l: Likewise. * gas/mips/attr-gnu-4-7.s: Likewise. * gas/mips/attr-none-double.d: Likewise. * gas/mips/attr-none-o32-fp64.d: Likewise. * gas/mips/attr-none-o32-fp64-nooddspreg.d * gas/mips/attr-none-o32-fpxx.d: Likewise. * gas/mips/attr-none-single-float.d: Likewise. * gas/mips/attr-none-soft-float.d: Likewise. * gas/mips/elf_arch_mips32r3.d: Likewise. * gas/mips/elf_arch_mips32r5.d: Likewise. * gas/mips/elf_arch_mips64r3.d: Likewise. * gas/mips/elf_arch_mips64r5.d: Likewise. * gas/mips/li-d.d: Likewise. * gas/mips/li-d.s: Likewise. * gas/mips/module-check-warn.l: Likewise. * gas/mips/module-check-warn.s: Likewise. * gas/mips/module-check.d: Likewise. * gas/mips/module-check.s: Likewise. * gas/mips/module-mfp32.d: Likewise. * gas/mips/module-mfp32.s: Likewise. * gas/mips/module-mfp64.d: Likewise. * gas/mips/module-mfp64.s: Likewise. * gas/mips/module-mfp64-noodd.d: Likewise. * gas/mips/module-mfp64-noodd.s: Likewise. * gas/mips/module-mfpxx.d: Likewise. * gas/mips/module-mfpxx.s: Likewise. * gas/mips/module-msingle-float.d: Likewise. * gas/mips/module-msingle-float.s: Likewise. * gas/mips/module-msoft-float.d: Likewise. * gas/mips/module-msoft-float.s: Likewise. * gas/mips/module-set-mfpxx.d: Likewise. * gas/mips/module-set-mfpxx.s: Likewise. * gas/mips/fpxx-oddfpreg.d: Likewise. * gas/mips/fpxx-oddfpreg.l: Likewise. * gas/mips/fpxx-oddfpreg.s: Likewise. * gas/mips/no-odd-spreg.d: Likewise. * gas/mips/odd-spreg.d: Likewise. * gas/elf/section2.e-mips: Adjust expected output. * gas/mips/attr-gnu-abi-fp-1.d: Likewise. * gas/mips/attr-gnu-abi-msa-1.d: Likewise. * gas/mips/call-nonpic-1.d: Likewise. * gas/mips/elf_arch_mips1.d: Likewise. * gas/mips/elf_arch_mips2.d: Likewise. * gas/mips/elf_arch_mips3.d: Likewise. * gas/mips/elf_arch_mips32.d: Likewise. * gas/mips/elf_arch_mips32r2.d: Likewise. * gas/mips/elf_arch_mips4.d: Likewise. * gas/mips/elf_arch_mips5.d: Likewise. * gas/mips/elf_arch_mips64.d: Likewise. * gas/mips/elf_arch_mips64r2.d: Likewise. * gas/mips/elf_ase_micromips-2.d: Likewise. * gas/mips/elf_ase_micromips.d: Likewise. * gas/mips/elf_ase_mips16-2.d: Likewise. * gas/mips/elf_ase_mips16.d: Likewise. * gas/mips/module-defer-warn1.d: Likewise. * gas/mips/module-override.d: Likewise. * gas/mips/n32-consec.d: Likewise. * gas/mips/nan-2008-1.d: Likewise. * gas/mips/nan-2008-2.d: Likewise. * gas/mips/nan-2008-3.d: Likewise. * gas/mips/nan-2008-4.d: Likewise. * gas/mips/nan-legacy-1.d: Likewise. * gas/mips/nan-legacy-2.d: Likewise. * gas/mips/nan-legacy-3.d: Likewise. * gas/mips/nan-legacy-4.d: Likewise. * gas/mips/nan-legacy-5.d: Likewise. * gas/mips/tmips16-e.d: Likewise. * gas/mips/tmips16-f.d: Likewise. * gas/mips/tmipsel16-e.d: Likewise. * gas/mips/tmipsel16-f.d: Likewise. * gas/testsuite/gas/mips/mips.exp: Add new tests. ld/testsuite/ * ld-mips-elf/abiflags-strip1-ph.d: New. * ld-mips-elf/abiflags-strip2-ph.d: Likewise. * ld-mips-elf/abiflags-strip3-ph.d: Likewise. * ld-mips-elf/abiflags-strip4-ph.d: Likewise. * ld-mips-elf/abiflags-strip5-ph.d: Likewise. * ld-mips-elf/abiflags-strip6-ph.d: Likewise. * ld-mips-elf/abiflags-strip7-ph.d: Likewise. * ld-mips-elf/abiflags-strip8-ph.d: Likewise. * ld-mips-elf/abiflags-strip9-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-0-n32-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-0-n64-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-0-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-06.d: Likewise. * ld-mips-elf/attr-gnu-4-07.d: Likewise. * ld-mips-elf/attr-gnu-4-08.d: Likewise. * ld-mips-elf/attr-gnu-4-1-n32-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-1-n64-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-1-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-16.d: Likewise. * ld-mips-elf/attr-gnu-4-17.d: Likewise. * ld-mips-elf/attr-gnu-4-18.d: Likewise. * ld-mips-elf/attr-gnu-4-2-n32-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-2-n64-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-2-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-26.d: Likewise. * ld-mips-elf/attr-gnu-4-27.d: Likewise. * ld-mips-elf/attr-gnu-4-28.d: Likewise. * ld-mips-elf/attr-gnu-4-3-n32-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-3-n64-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-3-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-36.d: Likewise. * ld-mips-elf/attr-gnu-4-37.d: Likewise. * ld-mips-elf/attr-gnu-4-38.d: Likewise. * ld-mips-elf/attr-gnu-4-4-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-46.d: Likewise. * ld-mips-elf/attr-gnu-4-47.d: Likewise. * ld-mips-elf/attr-gnu-4-48.d: Likewise. * ld-mips-elf/attr-gnu-4-5-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-50.d: Likewise. * ld-mips-elf/attr-gnu-4-52.d: Likewise. * ld-mips-elf/attr-gnu-4-53.d: Likewise. * ld-mips-elf/attr-gnu-4-54.d: Likewise. * ld-mips-elf/attr-gnu-4-55.d: Likewise. * ld-mips-elf/attr-gnu-4-56.d: Likewise. * ld-mips-elf/attr-gnu-4-57.d: Likewise. * ld-mips-elf/attr-gnu-4-58.d: Likewise. * ld-mips-elf/attr-gnu-4-6-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-6.s: Likewise. * ld-mips-elf/attr-gnu-4-60.d: Likewise. * ld-mips-elf/attr-gnu-4-61.d: Likewise. * ld-mips-elf/attr-gnu-4-62.d: Likewise. * ld-mips-elf/attr-gnu-4-63.d: Likewise. * ld-mips-elf/attr-gnu-4-64.d: Likewise. * ld-mips-elf/attr-gnu-4-65.d: Likewise. * ld-mips-elf/attr-gnu-4-66.d: Likewise. * ld-mips-elf/attr-gnu-4-67.d: Likewise. * ld-mips-elf/attr-gnu-4-68.d: Likewise. * ld-mips-elf/attr-gnu-4-7-ph.d: Likewise. * ld-mips-elf/attr-gnu-4-7.s: Likewise. * ld-mips-elf/attr-gnu-4-70.d: Likewise. * ld-mips-elf/attr-gnu-4-71.d: Likewise. * ld-mips-elf/attr-gnu-4-72.d: Likewise. * ld-mips-elf/attr-gnu-4-73.d: Likewise. * ld-mips-elf/attr-gnu-4-74.d: Likewise. * ld-mips-elf/attr-gnu-4-75.d: Likewise. * ld-mips-elf/attr-gnu-4-76.d: Likewise. * ld-mips-elf/attr-gnu-4-77.d: Likewise. * ld-mips-elf/attr-gnu-4-78.d: Likewise. * ld-mips-elf/attr-gnu-4-8.s: Likewise. * ld-mips-elf/attr-gnu-4-81.d: Likewise. * ld-mips-elf/empty.s: Likewise. * ld-mips-elf/attr-gnu-4-00.d: Adjust expected output. * 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-04.d: Likewise. * ld-mips-elf/attr-gnu-4-05.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-14.d: Likewise. * ld-mips-elf/attr-gnu-4-15.d: Likewise. * ld-mips-elf/attr-gnu-4-2.s: 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-24.d: Likewise. * ld-mips-elf/attr-gnu-4-25.d: Likewise. * ld-mips-elf/attr-gnu-4-3.s: 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-34.d: Likewise. * ld-mips-elf/attr-gnu-4-35.d: Likewise. * ld-mips-elf/attr-gnu-4-40.d: Likewise. * ld-mips-elf/attr-gnu-4-41.d: Likewise. * ld-mips-elf/attr-gnu-4-42.d: Likewise. * ld-mips-elf/attr-gnu-4-43.d: Likewise. * ld-mips-elf/attr-gnu-4-44.d: Likewise. * ld-mips-elf/attr-gnu-4-45.d: Likewise. * ld-mips-elf/attr-gnu-4-5.s: Likewise. * ld-mips-elf/attr-gnu-4-51.d: Likewise. * ld-mips-elf/attr-gnu-8-00.d: Likewise. * ld-mips-elf/attr-gnu-8-01.d: Likewise. * ld-mips-elf/attr-gnu-8-02.d: Likewise. * ld-mips-elf/attr-gnu-8-10.d: Likewise. * ld-mips-elf/attr-gnu-8-11.d: Likewise. * ld-mips-elf/attr-gnu-8-20.d: Likewise. * ld-mips-elf/attr-gnu-8-22.d: Likewise. * ld-mips-elf/jalx-2.dd: Likewise. * ld-mips-elf/mips16-pic-1.gd: Likewise. * ld-mips-elf/mips16-pic-2.gd: Likewise. * ld-mips-elf/mips16-pic-3.gd: Likewise. * ld-mips-elf/mips16-pic-4a.gd: Likewise. * ld-mips-elf/multi-got-no-shared.d: Likewise. * ld-mips-elf/nan-2008.d: Likewise. * ld-mips-elf/nan-legacy.d: Rework test. * ld-mips-elf/pic-and-nonpic-3a.gd: Likewise. * ld-mips-elf/pic-and-nonpic-3b.gd: Likewise. * ld-mips-elf/pic-and-nonpic-5b.gd: Likewise. * ld-mips-elf/pic-and-nonpic-6.ld: Likewise. * ld-mips-elf/rel32-n32.d: Likewise. * ld-mips-elf/rel32-o32.d: Likewise. * ld-mips-elf/rel64.d: Likewise. * ld-mips-elf/tls-multi-got-1.r: Likewise. * ld-elf/group.ld: Discard .MIPS.abiflags and .gnu.attributes. * ld-elf/orphan-region.ld: Likewise. * ld-elf/orphan.ld: Likewise. * ld-mips-elf/compressed-plt-1.ld: Likewise. * ld-mips-elf/dyn-sec64.ld: Likewise. * ld-mips-elf/got-dump-1.ld: Likewise. * ld-mips-elf/got-dump-2.ld: Likewise. * ld-mips-elf/got-page-1.ld: Likewise. * ld-mips-elf/mips-dyn.ld: Likewise. * ld-mips-elf/mips-lib.ld: Likewise. * ld-mips-elf/pic-and-nonpic-3a.ld: Likewise. * ld-mips-elf/pic-and-nonpic-3b.ld: Likewise. * ld-mips-elf/pic-and-nonpic-4b.ld: Likewise. * ld-mips-elf/pic-and-nonpic-5b.ld: Likewise. * ld-mips-elf/region1.t: Likewise. * ld-mips-elf/stub-dynsym-1.ld: Likewise. * ld-mips-elf/tls-hidden3.ld: Likewise. * ld-mips-elf/vxworks1.ld: Likewise. * ld-scripts/overlay-size.t: Likewise. * ld-mips-elf/elf-rel-got-n32-embed.d: Remove .MIPS.abiflags from objects. * ld-mips-elf/elf-rel-got-n32.d: Likewise. * ld-mips-elf/elf-rel-got-n64-embed.d: Likewise. * ld-mips-elf/elf-rel-got-n64-linux.d: Likewise. * ld-mips-elf/elf-rel-got-n64.d: Likewise. * ld-mips-elf/elf-rel-xgot-n32.d: Likewise. * ld-mips-elf/elf-rel-xgot-n32-embed.d: Likewise. * ld-mips-elf/elf-rel-xgot-n64.d: Likewise. * ld-mips-elf/elf-rel-xgot-n64-linux.d: Likewise. * ld-mips-elf/elf-rel-xgot-n64-embed.d: Likewise. * ld-mips-elf/mips-elf.exp: Add new tests.
2014-07-16Properly match PLT entry against .got.plt relocationH.J. Lu9-5/+218
Relocations against .got.plt section may not be in the same order as entries in PLT section. It is incorrect to assume that the Ith reloction index against .got.plt section always maps to the (I + 1)th entry in PLT section. This patch matches the .got.plt relocation offset/index in PLT entry against the index in .got.plt relocation table. It only checks R_*_JUMP_SLOT and R_*_IRELATIVE relocations. It ignores R_*_TLS_DESC and R_*_TLSDESC relocations since they have different PLT entries. bfd/ PR binutils/17154 * elf32-i386.c (elf_i386_plt_sym_val): Only match R_*_JUMP_SLOT and R_*_IRELATIVE relocation offset with PLT entry. * elf64-x86-64.c (elf_x86_64_plt_sym_val): Likewise. (elf_x86_64_plt_sym_val_offset_plt_bnd): New. (elf_x86_64_get_synthetic_symtab): Use it. ld/testsuite/ PR binutils/17154 * ld-ifunc/pr17154-i386.d: New file. * ld-ifunc/pr17154-x86-64.d: Likewise. * ld-ifunc/pr17154-x86.s: Likewise. * ld-x86-64/bnd-ifunc-2.d: Likewise. * ld-x86-64/bnd-ifunc-2.s: Likewise. * ld-x86-64/mpx.exp: Run bnd-ifunc-2. * ld-x86-64/tlsdesc-nacl.pd: Updated. * ld-x86-64/tlsdesc.pd: Likewise.
2014-07-15Update elf_i386_compute_jump_table_sizeH.J. Lu4-0/+20
Commit e1f987424b7b3f5ac63a2a6ae044a202a44b8ff8 changed how next_tls_desc_index was set up. This patch updates elf_i386_compute_jump_table_size to use elf.srelplt->reloc_count instead of next_tls_desc_index. bfd/ PR ld/17057 * elf32-i386.c (elf_i386_compute_jump_table_size): Replace next_tls_desc_index with elf.srelplt->reloc_count. ld/testsuite/ PR ld/17057 * ld-i386/i386.exp: Run pr17057. * ld-i386/pr17057.d: New file. * ld-i386/pr17057.s: Likewise.
2014-07-15[AArch64] Fix ld testcase linker script glitch.Jiong Wang2-7/+11
Specify -T relocs.ld for emit-relocs-local-addend.d to be consistent will all other emit-relocs* testcases ld/testsuite/ * ld-aarch64/emit-relocs-local-addend.d: Use target linker script.
2014-07-10Fix tests when configured for arm-linux and arm-elfWill Newton27-214/+246
With this change all gas and most ld tests pass when configured for arm-linux. It doesn't look like these configurations have been tested in a long time but this attempts to stem the bit-rot slightly. gas/testsuite/ChangeLog: 2014-07-10 Will Newton <will.newton@linaro.org> * gas/arm/bl-local-2.d: Only enable the test on EABI and NaCl configurations. * gas/arm/bl-local-v4t.d: Likewise. * gas/arm/blx-local.d: Likewise. * gas/arm/branch-reloc.d: Likewise. ld/testsuite/ChangeLog: 2014-07-10 Will Newton <will.newton@linaro.org> * ld-arm/arm-elf.exp (armelftests_nonacl): Move Cortex-A8 fix tests, IFUNC tests and other EABI requiring tests to... (armeabitests_nonacl): ...here. * ld-arm/arm-app-abs32.d: Loosen regex for architecture type to allow test to pass on configurations without an attributes section. * ld-arm/arm-app.d: Likewise. * ld-arm/arm-lib-plt32.d: Likewise. * ld-arm/arm-lib.d: Likewise. * ld-arm/arm-static-app.d: Likewise. * ld-arm/armthumb-lib.d: Likewise. * ld-arm/cortex-a8-far.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/mixed-app-v5.d: Likewise. * ld-arm/mixed-app.d: Likewise. * ld-arm/mixed-lib.d: Likewise. * ld-arm/tls-app.d: Likewise. * ld-arm/tls-descrelax-be32.d: Likewise. * ld-arm/tls-descrelax.d: Likewise. * ld-arm/tls-descseq.d: Likewise. * ld-arm/tls-gdesc-got.d: Likewise. * ld-arm/tls-gdesc.d: Likewise. * ld-arm/tls-gdierelax.d: Likewise. * ld-arm/tls-gdierelax2.d: Likewise. * ld-arm/tls-gdlerelax.d: Likewise. * ld-arm/tls-lib-loc.d: Likewise. * ld-arm/tls-lib.d: Likewise. * ld-arm/tls-thumb1.d: Likewise.
2014-07-10ld/testsuite: Disable non-PIC shared library tests on ARMWill Newton2-1/+6
ARM doesn't support non-PIC shared libraries so don't run those tests. ld/testsuite/ChangeLog: 2014-07-10 Will Newton <will.newton@linaro.org> * ld-elfvers/vers.exp: Set pic to yes for ARM targets.
2014-07-08ld/ARM: Increase maximum page size to 64kBWill Newton5-8/+17
Increase the maximum page size to 64kB and align the TEXT_START_ADDR to a 64kB boundary. This brings AArch32 in line with AArch64 and improves compatability under certain conditions. bfd/ChangeLog: 2014-07-08 Will Newton <will.newton@linaro.org> * elf32-arm.c (ELF_MAXPAGESIZE): Increase the default value to 64kB and remove custom setting for NaCl. ld/ChangeLog: 2014-07-08 Will Newton <will.newton@linaro.org> * emulparams/armelf_linux.sh (TEXT_START_ADDR): Increase alignment to 64kB boundary. ld/testsuite/ChangeLog: 2014-07-08 Will Newton <will.newton@linaro.org> * ld-arm/arm-lib.ld: Increase MAXPAGESIZE value to match bfd. * ld-arm/cortex-a8-fix-bl-rel-plt.d: Update offsets to take into account increased segment alignment. * ld-arm/ifunc-gdesc.r: Likewise. * ld-arm/tls-lib.d: Likewise.
2014-07-08Copy st_other for linker script symbol assignmentsAlan Modra4-0/+51
This fixes a problem seen on powerpc64le ELFv2 when creating a function symbol alias with ld --defsym. st_other needs to be copied from the source symbol to the alias in order to set up the local entry offset for the alias. I decided to make this change in the generic ELF code rather than in elf64-ppc.c since it looks like other targets that use st_other bits might benefit too. bfd/ * elflink.c (_bfd_elf_copy_link_hash_symbol_type): Copy st_other bits from source to dest. * linker.c (_bfd_generic_copy_link_hash_symbol_type): Update comment. * targets.c (struct bfd_target <_bfd_copy_link_hash_symbol_type>): Likewise. * bfd-in2.h: Regenerate. ld/testsuite/ * ld-powerpc/defsym.s, * ld-powerpc/defsym.d: New test. * ld-powerpc/powerpc.exp: Run it.
2014-07-08Enable elf_backend_rela_normal for AArch64Jiong Wang6-0/+82
If we are generating non-relocatable object and --emit-relocs specified, aarch64 ld is actually generating wrong addend for rela entry when relocate against local symbol. for example, for simple testcase foo.c === const char * const a = "foo"; const char * foo () { return a; } bar.c === const char * const b = "bar"; const char * bar () { return b; } aarch64-none-linux-gnu-ld --emit-relocs -o x.o foo.o bar.o aarch64-none-linux-gnu-readelf -r x.o ... R_AARCH64_ADR_PRE 0000000000400018 .rodata + 0 ... R_AARCH64_ADD_ABS 0000000000400018 .rodata + 0 ... R_AARCH64_ADR_PRE 0000000000400018 .rodata + 0 ... R_AARCH64_ADD_ABS 0000000000400018 .rodata + 0 while it should be: ... R_AARCH64_ADR_PRE 0000000000400018 .rodata + 0 ... R_AARCH64_ADD_ABS 0000000000400018 .rodata + 0 ... R_AARCH64_ADR_PRE 0000000000400018 .rodata + 10 ... R_AARCH64_ADD_ABS 0000000000400018 .rodata + 10 bfd generic code could actually handle this properly, but only when elf_backend_rela_normal set to '1'. this patch enable this and remove those target specific hack. bfd/ * elfnn-aarch64.c (elf_backend_rela_normal): Set to 1. (elfNN_aarch64_relocate_section): Remove duplicated addend adjustment when info->relocatable be true. ld/testsuite/ * ld-aarch64/emit-relocs-local-addend-bar.s: * New source file. * ld-aarch64/emit-relocs-local-addend-foo.s: * Likewise. * ld-aarch64/emit-relocs-local-addend.d: * New testcase. * ld-aarch64/local-addend-r.d: Likewise.
2014-07-08Run ar with --plugin for LTO 11 testAlan Modra2-1/+20
Objects built with -fno-fat-lto-objects (the default for gcc-4.9) have no normal symbols, except things like __gnu_lto_slim. These useless symbols are the ones put into the archive index, and of course nothing references them so no objects are extracted by the linker. Running ar with --plugin changes ar behaviour to put the lto symbols into the archive index. PR 17112 * ld-plugin/lto.exp: When building liblti-11.a, pass --plugin path_to_gcc/liblto_plugin.so to ar.
2014-07-07Reinstate compiler checkAlan Modra2-0/+9
* lib/ld-lib.exp (check_lto_shared_available): Reinstate compiler check here too.
2014-07-07This patch prevents a linker testsuite error if the checks are run with aNick Clifton2-0/+9
toolchain that just contains the binutils - ie without a compiler. * lib/ld-lib.exp (check_lto_available): Check that a compiler is available before testing for LTO support.
2014-07-07Ensure ld testsuite gcc -B options precede $CC -B optionsAlan Modra5-108/+93
Various ld-elf/shared.exp and ld-plugin/lto.exp tests simply appended the testsuite -B options intended to force gcc use the linker under test. This fails if $CC itself has -B options, as when setting CC to run gcc out of a build directory. Net result is that tests were run using the gcc build dir collect-ld. * config/default.exp: Don't make tmpdir/gas. Put as symlink into tmpdir/ld. (gcc_gas_flag, gcc_ld_flag): Delete. (gcc_B_opt, ld_L_opt): New globals. ld-elf/shared.exp: Remove all refs to gcc_gas_flag and gcc_ld_flag. ld-plugin/lto.exp: Likewise. lib/ld-lib.exp (run_host_cmd): Add gcc_B_opt and ld_L_opt here. (ld_simple_link): Remove -B handling now that this is done in run_host_cmd. Simplify. (default_ld_compile): Simplify. (check_lto_available): Use run_host_cmd_yesno. (check_lto_shared_available): Likewise.
2014-07-05Rid libdummy.a from lto.expAlan Modra3-66/+74
libdummy.a is used to make run_cc_link_tests compile objects and archive them. libdummy.a isn't used. What we're really doing is preventing a final link. So do that directly. * lib/ld-lib.exp (run_ld_link_tests): Stop after assembling objects if binfile is empty. (run_ld_link_exec_tests, run_cc_link_tests): Likewise. Tidy status checks. * ld-plugin/lto.exp: Don't use libdummy.a trick to compile objects. Instead use an empty output file.
2014-07-03Reload --as-needed libraries inside groupsAlan Modra9-6/+58
When a shared library appears within --start-group/--end-group ld may only discover a need for loading the library on the second or subsequent pass over archive libraries, as more objects are extracted. ld/ PR 17068 * ldlang.c (load_symbols): Always check flags.reload. (open_input_bfds): Always reload --as-needed shared libraries, not just when rescanning. * ldlang.h (struct lang_input_statement_flags): Update reload comment. * plugin.c (plugin_should_reload): Assume shared library arg. * plugin.h (plugin_should_reload): Update comment. ld/testsuite * ld-elf/pr17068.s: New. * ld-elf/pr17068a.s: New. * ld-elf/pr17068b.s: New. * ld-elf/pr17068c.s: New. * ld-elf/pr17068d.s: New. * ld-elf/pr17068e.s: New. * ld-elf/pr17068ez.s: New. * ld-elf/elf.exp: Run new test.
2014-07-02Taking an undefined function's address in an executableAlan Modra7-9/+186
doesn't always mean you need to define a function symbol on plt code. If all references are in read-write sections, then using dynamic relocs is OK. bfd/ * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Clear pointer_equality_needed when !readonly_dynrelocs. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. ld/testsuite/ * ld-powerpc/ambiguousv1.d: Match symbol table too. * ld-powerpc/ambiguousv2.d: Likewise. * ld-powerpc/ambiguousv1b.d: New. * ld-powerpc/ambiguousv2b.d: New. * ld-powerpc/powerpc.exp: Run new tests.
2014-06-25ld/arm: adjust offsets in tls-gdierelax2.dKyle McMartin2-4/+8
Addition of DF_STATIC_TLS in eea6dad2 results in the addition of flags to the dynamic section, which in turn changes these addresses. Fix them up to match their new positions. ld/testsuite/Changelog: 2014-06-24 Kyle McMartin <kyle@redhat.com> * ld-arm/tls-gdierelax2.d: Fix expected offsets.
2014-06-16ld/ARM: Fix IFUNC and TLS descriptors in the same shared objectWill Newton5-0/+49
Combining TLS descriptors and GNU indirect functions in the same object could lead to assertions or multiple dynamic relocations for the same GOT slot. Fix the bookkeeping so this doesn't happen. This allows building and make checking glibc with -mtls-dialect=gnu2. bfd/ChangeLog: 2014-06-16 Will Newton <will.newton@linaro.org> * elf32-arm.c (elf32_arm_allocate_plt_entry): Increment htab->next_tls_desc_index in the non-IPLT case. Calculate GOT offset correctly for the non-IPLT case. (allocate_dynrelocs_for_symbol): Don't increment htab->next_tls_desc_index here. ld/testsuite/ChangeLog: 2014-06-16 Will Newton <will.newton@linaro.org> * ld-arm/arm-elf.exp: Add ifunc-gdesc test. * ld-arm/ifunc-gdesc.r: New file. * ld-arm/ifunc-gdesc.s: Likewise. * ld-arm/ifunc-gdesc.ver: Likewise.
2014-06-09Remove reference to GASp from linker testsuite configuration.Ryan Mansfield2-4/+4
* config/default.exp (GASP): Remove.
2014-06-03Support fusion for ELFv2 stubsAlan Modra2-4/+8
Power8 fuses addis,addi and addis,ld sequences when the target of the addis is the same as the addi/ld. Thus addis r12,r2,xxx@ha addi r12,r12,xxx@l / ld r12,xxx@l(r12) is faster than addis r11,r2,xxx@ha addi r12,r11,xxx@l / ld r12,xxx@l(r11) So use the form that allows fusion in plt call and branch stubs. bfd/ * elf64-ppc.c (ADDIS_R12_R2): Define. (build_plt_stub): Support fusion on ELFv2 stub. (ppc_build_one_stub): Likewise for plt branch stubs. gold/ * powerpc.cc (addis_12_2): Define. (Stub_table::do_write): Support fusion on ELFv2 stubs. ld/testsuite/ * ld-powerpc/elfv2exe.d: Update for changed plt call stubs. gdb/ * ppc64-tdep.c (ppc64_standard_linkage8): New. (ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-05-28Add objcopy stage between assembly and linking for run_dump_testmfortune2-0/+42
ld/testsuite/ * lib/ld-lib.exp: Add objcopy_objects command to run_dump_test. This allows each input object to be optionally run through objcopy before linking.
2014-05-20ld/aarch64: xfail non-PIC shared object tests on aarch64Will Newton2-0/+8
aarch64 does not support building non-PIC shared objects, so mark tests for these as xfail. ld/testsuite/ChangeLog: 2014-05-20 Will Newton <will.newton@linaro.org> * ld-shared/shared.exp: Mark non-PIC shared object tests as xfail on aarch64.
2014-05-19Don't link FreeBSD tests with -ldl.Andreas Tobler3-14/+29
* ld-elf/shared.exp: Introduce the extralibs variable to control the libraries to be linked. Don't link -ldl on *-*-freebsd*. * ld-bootstrap/bootstrap.exp: Do not add -ldl to the extralibs on *-*-freebsd*.
2014-05-10Fix freeing of link_info.hashHans-Peter Nilsson10-0/+107
ld: * ldlang.c (lang_finish): Don't call bfd_link_hash_table_free here. (output_bfd_hash_table_free_fn): New variable. (open_output): Save the _bfd_link_hash_table_free function for the output_bfd into output_bfd_hash_table_free_fn. * ldmain.c (ld_cleanup): If set, call output_bfd_hash_table_free_fn on link_info.hash. * ldlang.h (output_bfd_hash_table_free_fn): Declare. ld/testsuite: * ld-mmix/wrap1.d, ld-mmix/wrap1a.s, ld-mmix/wrap1b.s, ld-mmix/wrap1c.s, ld-mmix/wrap2.d, ld-mmix/wrap3.d, ld-mmix/wrap3a.s, ld-mmix/wrap3b.s, ld-mmix/wrap4.d: New tests.
2014-05-09Properly display extra data/address size prefixesH.J. Lu8-26/+35
X86 disassembler checks data and address size prefixes when displaying instruction mnemonic and operands. For the extra data and address size prefixes, their names depend only on the address mode, not the data and address size prefixes. This patch changes x86 disassembler not to check the data and address size prefix when printing extra data and address size prefixes. gas/testsuite/ * gas/i386/nops-1-core2.d: Replace data32 with data16. * gas/i386/nops-4a-i686.d: Likewise. * gas/i386/nops-5-i686.d: Likewise. * gas/i386/nops-5.d: Likewise. * gas/i386/x86-64-cbw-intel.d: Likewise. * gas/i386/x86-64-cbw.d: Likewise. * gas/i386/x86-64-io-intel.d: Likewise. * gas/i386/x86-64-io-suffix.d: Likewise. * gas/i386/x86-64-io.d: Likewise. * gas/i386/x86-64-nops-1-core2.d: Likewise. * gas/i386/x86-64-nops-1-g64.d: Likewise. * gas/i386/x86-64-nops-1-nocona.d: Likewise. * gas/i386/x86-64-nops-1.d: Likewise. * gas/i386/x86-64-nops-2.d: Likewise. * gas/i386/x86-64-nops-3.d: Likewise. * gas/i386/x86-64-nops-4-core2.d: Likewise. * gas/i386/x86-64-nops-4.d: Likewise. * gas/i386/x86-64-nops-5-k8.d: Likewise. * gas/i386/x86-64-nops-5.d: Likewise. * gas/i386/x86-64-stack-intel.d: Likewise. * gas/i386/x86-64-stack-suffix.d: Likewise. * gas/i386/x86-64-stack.d: Likewise. * gas/i386/ilp32/x86-64-cbw-intel.d: Likewise. * gas/i386/ilp32/x86-64-cbw.d: Likewise. * gas/i386/ilp32/x86-64-io-intel.d: Likewise. * gas/i386/ilp32/x86-64-io-suffix.d: Likewise. * gas/i386/ilp32/x86-64-io.d: Likewise. * gas/i386/ilp32/x86-64-nops-1-core2.d: * gas/i386/ilp32/x86-64-nops-1-nocona.d: Likewise. * gas/i386/ilp32/x86-64-nops-1.d: Likewise. * gas/i386/ilp32/x86-64-nops-2.d: Likewise. * gas/i386/ilp32/x86-64-nops-3.d: Likewise. * gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * gas/i386/ilp32/x86-64-nops-4.d: Likewise. * gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * gas/i386/ilp32/x86-64-nops-5.: Likewise. * gas/i386/ilp32/x86-64-stack-intel.d: Likewise. * gas/i386/ilp32/x86-64-stack-suffix.: Likewise. * gas/i386/ilp32/x86-64-stack.d: Likewise. ld/testsuite/ * ld-x86-64/tlsbin.dd: Replace data32 with data16. * ld-x86-64/tlsdesc-nacl.pd: Likewise. * ld-x86-64/tlsgdesc.dd: Likewise. * ld-x86-64/tlsld1.dd: Likewise. * ld-x86-64/tlsld3.dd: Likewise. * ld-x86-64/tlspic.dd: Likewise. opcodes/ 2014-05-09 H.J. Lu <hongjiu.lu@intel.com> * i386-dis.c (ADDR16_PREFIX): Removed. (ADDR32_PREFIX): Likewise. (DATA16_PREFIX): Likewise. (DATA32_PREFIX): Likewise. (prefix_name): Updated. (print_insn): Simplify data and address size prefixes processing.