Commit Graph

4825 Commits

Author SHA1 Message Date
Hans-Peter Nilsson eeed9cc785 Allow unquoted = as the first character in ldscript input_list names
* ldlex.l (INPUTLIST): New start condition.
	(comment pattern, ",", "(", ")", "AS_NEEDED")
	({FILENAMECHAR1}{FILENAMECHAR}*, "-l"{FILENAMECHAR}+)
	(quoted string pattern, whitespace pattern): Add INPUTLIST to
	valid start conditions.
	(<INPUTLIST>"="{FILENAMECHAR1}{FILENAMECHAR}*): New NAME rule.
	(ldlex_inputlist): New start-condition-setter function.
	* ldgram.y (input_list1): Rename from input_list.  All recursive
	use changed.
	(input_list): New wrapper rule for input_list1, setting
	INPUTLIST lexer state for the duration of parsing input_list1.

All this to say INPUT(=/path/to/file) and not be forced to use
INPUT("=/path/to/file") whenever there's a need to force a sysroot-
prefix.  Still, IMHO it seems better to make use of a previously
invalid syntax and not only change the meaning of quoted =-prefixed
paths (though arguably that's not very useful before this patchset).

This got a little bit hairier than I'd expected: I had to add a new
lexer state (aka. start condition) to avoid a first "=" being lexed as
the token "=", despite that not making sense in constructs expecting
file-names in the first place.  (The grammar doesn't allow for
expressions in any part of those lists.)  I guess I *could* have made
it work using that token anyway, but I didn't like the idea that you
would be able to separate the "=" from the rest of the file-name with
whitespace.
2014-10-15 03:10:25 +02:00
Hans-Peter Nilsson bfa2343443 If "=" is the first character in a ldscript input file, force a sysroot prefix.
* ldlang.c (lang_add_input_file): If the first character in the
	filename is '=', prepend the sysroot and force the context of that
	input file to non-sysroot.

The "input_flags.sysrooted = 0" thing described in the comment is
covered by the testsuite part ("root-anchored =-prefixed script
inside"), but only observable for --with-sysroot configurations.
2014-10-15 03:04:21 +02:00
Hans-Peter Nilsson ef1ab8e216 Add sysroot-prefix ld linker tests.
* 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-15 02:59:41 +02:00
Hans-Peter Nilsson bdd65db9b9 lib/ld-lib.exp (check_sysroot_available): New proc. 2014-10-15 02:54:56 +02:00
Hans-Peter Nilsson cad60a339b ld.texinfo: "=" path-prefix forces sysroot in scripts not only SEARCH_DIR
* ld.texinfo (input files in linker scripts): When mentioning
	behavior of first character "/" on scripts within sysroot, also
	mention that effect can be forced by prefixing with "=" and
	refer to SEARCH_DIR.
2014-10-15 02:50:03 +02:00
Hans-Peter Nilsson b3b9c41dc6 ld.texinfo: Clarify that sysroot affects "=" expansion.
* ld.texinfo (Options): When mentioning "=" and sysroot, mention
	that --sysroot controls it, not only through the configuration.
2014-10-15 02:43:23 +02:00
Tristan Gingold c50415e24c Add NEWS markers for 2.25.
binutils/
2014-10-14  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.25.

gas/
2014-10-14  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.25.

ld/
2014-10-14  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.25.
2014-10-14 09:49:47 +02:00
Alan Modra 5b69e3572d Run eh_frame optimisation for relocatable link
The idea here is to drop .eh_frame FDEs corresponding to dropped
comdat group sections or linkonce sections, but not perform changes in
encoding.

bfd/
	PR 17467
	* elf-eh-frame.c (ENSURE_NO_RELOCS): Don't stop at first NONE reloc.
	(_bfd_elf_parse_eh_frame): When relocatable output, don't set
	flags enabling conversion of CIEs and FDEs to use relative encoding.
	(find_merged_cie): Similarly.
	(_bfd_elf_write_section_eh_frame): Don't edit FDEs when
	relocatable, except for CIE pointer.
	* elflink.c (bfd_elf_reloc_symbol_deleted_p): Return true for
	relocs against symbols in dropped comdat group sections.
	(bfd_elf_discard_info): Do some eh_frame optimisation when
	relocatable.
ld/
	* ldlang.c (lang_add_section): Set up map_head.s and map_tail.s when
	relocatable.
2014-10-13 22:58:44 +10:30
Alan Modra c2aaac080c Discard zero address range eh_frame FDEs
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-10-04 22:49:32 +09:30
Alan Modra 4dea914eb1 Find lto plugin when using gcc-5.0
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-22 19:04:48 +09:30
Terry Guo 70e99720f9 Make the linker return an error status if it fails to merge ARM binaries with
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-16 13:08:22 +01:00
Kuan-Lin Chen 1c8f6a4d1f NDS32: Code refactoring of relaxation.
Refactor each relaxation pattern to raise the maintainability.
In origin, all patterns is analysed in nds32_elf_relax_section,
so it is hard to debug and maintain.  Therefore, we classify all
patterns into different functions in this patch.
Moreover, we adjust all optimizations into nds32_elf_relax_section
to take these optimizations in turn.  This can promise all relaxation
being done after calling gld${EMULATION_NAME}_after_allocation.
2014-09-16 13:08:00 +08:00
Andrew Bennett 7361da2c95 Add support for MIPS R6.
bfd/
 	* aoutx.h (NAME (aout, machine_type)): Add mips32r6 and mips64r6.
 	* archures.c (bfd_architecture): Likewise.
 	* bfd-in2.h (bfd_architecture): Likewise.
 	(bfd_reloc_code_real): Add relocs BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3 and
 	BFD_RELOC_MIPS_19_PCREL_S2.
 	* cpu-mips.c (arch_info_struct): Add mips32r6 and mips64r6.
 	* elf32-mips.c: Define relocs R_MIPS_PC21_S2, R_MIPS_PC26_S2
 	R_MIPS_PC18_S3, R_MIPS_PC19_S2, R_MIPS_PCHI16 and R_MIPS_PCLO16.
 	(mips_reloc_map): Add entries for BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
 	* elf64-mips.c: Define REL, and RELA relocations R_MIPS_PC21_S2,
	R_MIPS_PC26_S2, R_MIPS_PC18_S3, R_MIPS_PC19_S2, R_MIPS_PCHI16
	and R_MIPS_PCLO16.
 	(mips_reloc_map): Add entries for BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
 	* elfn32-mips.c: Likewise.
 	* elfxx-mips.c (MIPSR6_P): New define.
 	(mipsr6_exec_plt_entry): New array.
	(hi16_reloc_p): Add support for R_MIPS_PCHI16.
	(lo16_reloc_p): Add support for R_MIPS_PCLO16.
 	(aligned_pcrel_reloc_p): New function.
 	(mips_elf_relocation_needs_la25_stub): Add support for relocs:
 	R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
 	(mips_elf_calculate_relocation): Add support for relocs:
 	R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3, R_MIPS_PC19_S2,
 	R_MIPS_PCHI16 and R_MIPS_PCLO16.
 	(_bfd_elf_mips_mach): Add support for mips32r6 and mips64r6.
	(mips_elf_add_lo16_rel_addend): Add support for R_MIPS_PCHI16.
 	(_bfd_mips_elf_check_relocs): Add support for relocs:
	R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
 	(_bfd_mips_elf_relocate_section): Add a check for unaligned
 	pc relative relocs.
 	(_bfd_mips_elf_finish_dynamic_symbol): Add support for MIPS r6
 	plt entry.
 	(mips_set_isa_flags): Add support for mips32r6 and mips64r6.
 	(_bfd_mips_elf_print_private_bfd_data): Likewise.
 	(mips_32bit_flags_p): Add support for mips32r6.
 	* libbfd.h (bfd_reloc_code_real_names): Add entries for
 	BFD_RELOC_MIPS_21_PCREL_S2, BFD_RELOC_MIPS_26_PCREL_S2,
 	BFD_RELOC_MIPS_18_PCREL_S3 and BFD_RELOC_MIPS_19_PCREL_S2.
 	* reloc.c: Document relocs BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3 and
 	BFD_RELOC_MIPS_19_PCREL_S2.

binutils/
 	* readelf.c (get_machine_flags): Add support for mips32r6 and
 	mips64r6.

elfcpp/
 	* mips.h (E_MIPS_ARCH_32R6, E_MIPS_ARCH_64R6): New enum constants.

gas/
 	* config/tc-mips.c (mips_nan2008): New static global.
	(mips_flag_nan2008): Removed.
	(LL_SC_FMT): New define.
	(COP12_FMT): Updated.
	(ISA_IS_R6): New define.
 	(ISA_HAS_64BIT_REGS): Add mips64r6.
 	(ISA_HAS_DROR): Likewise.
 	(ISA_HAS_64BIT_FPRS): Add mips32r6 and mips64r6.
 	(ISA_HAS_ROR): Likewise.
 	(ISA_HAS_ODD_SINGLE_FPR): Likewise.
 	(ISA_HAS_MXHC1): Likewise.
 	(hilo_interlocks): Likewise.
 	(md_longopts): Likewise.
	(ISA_HAS_LEGACY_NAN): New define.
 	(options): Add OPTION_MIPS32R6 and OPTION_MIPS64R6.
 	(mips_ase): Add field rem_rev.
 	(mips_ases): Updated to add which ISA an ASE was removed in.
 	(mips_isa_rev): Add support for mips32r6 and mips64r6.
 	(mips_check_isa_supports_ase): Add support to check if an ASE
 	has been removed in the specified MIPS ISA revision.
 	(validate_mips_insn): Skip '-' character.
	(macro_build): Likewise.
	(mips_check_options): Prevent R6 working with fp32, mips16,
	micromips, or branch relaxation.
	(file_mips_check_options): Set R6 floating point registers to
	64 bit.  Also deal with the nan2008 option.
 	(limited_pcrel_reloc_p): Add relocs: BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
 	(operand_reg_mask): Add support for OP_SAME_RS_RT, OP_CHECK_PREV
	and OP_NON_ZERO_REG.
 	(match_check_prev_operand): New static function.
 	(match_same_rs_rt_operand): New static function.
	(match_non_zero_reg_operand): New static function.
 	(match_operand): Added entries for: OP_SAME_RS_RT, OP_CHECK_PREV
	and OP_NON_ZERO_REG.
 	(insns_between): Added case to deal with forbidden slots.
 	(append_insn): Added support for relocs: BFD_RELOC_MIPS_21_PCREL_S2
 	and BFD_RELOC_MIPS_26_PCREL_S2.
 	(match_insn): Add support for operands -A, -B, +' and +".  Also
 	skip '-' character.
 	(mips_percent_op): Add entries for %pcrel_hi and %pcrel_lo.
 	(md_parse_option): Add support for mips32r6 and mips64r6.  Also
	update the nan option handling.
 	(md_pcrel_from): Add cases for relocs: BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2.
 	(mips_force_relocation): Prevent forced relaxation for MIPS r6.
 	(md_apply_fix): Add support for relocs: BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
 	(s_mipsset): Add support for mips32r6 and mips64r6.
	(s_nan): Update to support the new nan2008 framework.
 	(tc_gen_reloc): Add relocs: BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
	(mips_elf_final_processing): Updated to use the mips_nan2008.
 	(mips_cpu_info_table): Add entries for mips32r6 and mips64r6.
	(macro): Enable ldc2, sdc2, ll, lld, swc2, sc, scd, cache, pref
	macros for R6.
	(mips_fix_adjustable): Make PC relative R6 relocations relative
	to the symbol and not the section.
 	* configure.ac: Add support for mips32r6 and mips64r6.
 	* configure: Regenerate.
 	* doc/c-mips.texi: Document the -mips32r6 and -mips64r6 command line
 	options.
	* doc/as.texinfo: Likewise.

gas/testsuite/
	* gas/mips/24k-triple-stores-1.s: If testing for r6 prevent
	non-supported instructions from being tested.
	* gas/mips/24k-triple-stores-2.s: Likewise.
	* gas/mips/24k-triple-stores-3.s: Likewise.
	* gas/mips/24k-triple-stores-6.s: Likewise.
	* gas/mips/beq.s: Likewise.
	* gas/mips/eva.s: Likewise.
	* gas/mips/ld-zero-3.s: Likewise.
	* gas/mips/mips32-cp2.s: Likewise.
	* gas/mips/mips32.s: Likewise.
	* gas/mips/mips4.s: Likewise.
	* gas/mips/add.s: Don't test the add instructions if r6, and
	add padding.
	* gas/mips/add.d: Check for a triple dot not a nop at the end of the
	disassembly output.
	* gas/mips/micromips@add.d: Likewise.
	* gas/mips/mipsr6@24k-branch-delay-1.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-1.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-2-llsc.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-2.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-3.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-6.d: New file.
	* gas/mips/mipsr6@add.d: New file.
	* gas/mips/mipsr6@attr-gnu-4-1-msingle-float.l: New file.
	* gas/mips/mipsr6@attr-gnu-4-1-msingle-float.s: New file.
	* gas/mips/mipsr6@attr-gnu-4-1-msoft-float.l: New file.
	* gas/mips/mipsr6@attr-gnu-4-1-msoft-float.s: New file.
	* gas/mips/mipsr6@attr-gnu-4-2-mdouble-float.l: New file.
	* gas/mips/mipsr6@attr-gnu-4-2-mdouble-float.s: New file.
	* gas/mips/mipsr6@beq.d: New file.
	* gas/mips/mipsr6@bge.d: New file.
	* gas/mips/mipsr6@bgeu.d: New file.
	* gas/mips/mipsr6@blt.d: New file.
	* gas/mips/mipsr6@bltu.d: New file.
	* gas/mips/mipsr6@branch-misc-1.d: New file.
	* gas/mips/mipsr6@branch-misc-2-64.d: New file.
	* gas/mips/mipsr6@branch-misc-2pic-64.d: New file.
	* gas/mips/mipsr6@branch-misc-4-64.d: New file.
	* gas/mips/mipsr6@cache.d: New file.
	* gas/mips/mipsr6@eva.d: New file.
	* gas/mips/mipsr6@jal-svr4pic-noreorder.d: New file.
	* gas/mips/mipsr6@jal-svr4pic.d: New file.
	* gas/mips/mipsr6@ld-zero-2.d: New file.
	* gas/mips/mipsr6@ld-zero-3.d: New file.
	* gas/mips/mipsr6@loc-swap-dis.d: New file.
	* gas/mips/mipsr6@mips32-cp2.d: New file.
	* gas/mips/mipsr6@mips32-imm.d: New file.
	* gas/mips/mipsr6@mips32.d: New file.
	* gas/mips/mipsr6@mips32r2.d: New file.
	* gas/mips/mipsr6@mips4-fp.d: New file.
	* gas/mips/mipsr6@mips4-fp.l: New file.
	* gas/mips/mipsr6@mips4-fp.s: New file.
	* gas/mips/mipsr6@mips4.d: New file.
	* gas/mips/mipsr6@mips5-fp.d: New file.
	* gas/mips/mipsr6@mips5-fp.l: New file.
	* gas/mips/mipsr6@mips5-fp.s: New file.
	* gas/mips/mipsr6@mips64.d: New file.
	* gas/mips/mipsr6@msa-branch.d: New file.
	* gas/mips/mipsr6@msa.d: New file.
	* gas/mips/mipsr6@pref.d: New file.
	* gas/mips/mipsr6@relax-swap3.d: New file.
	* gas/mips/r6-64-n32.d: New file.
	* gas/mips/r6-64-n64.d: New file.
	* gas/mips/r6-64-removed.l: New file.
	* gas/mips/r6-64-removed.s: New file.
	* gas/mips/r6-64.s: New file.
	* gas/mips/r6-attr-none-double.d: New file.
	* gas/mips/r6-n32.d: New file.
	* gas/mips/r6-n64.d: New file.
	* gas/mips/r6-removed.l: New file.
	* gas/mips/r6-removed.s: New file.
	* gas/mips/r6.d: New file.
	* gas/mips/r6.s: New file.
	* gas/mips/mipsr6@mips32-dsp.d: New file.
	* gas/mips/mipsr6@mips32-dspr2.d: New file.
	* gas/mips/mipsr6@mips32r2-ill.l: New file.
	* gas/mips/mipsr6@mips32r2-ill.s: New file.
	* gas/mips/cache.s: Add r6 instruction varients.
	* gas/mips/mips.exp: Add support for the mips32r6 and mips64r6
	architectures.  Also prevent non r6 supported tests from running.
	Finally, add in support for running the new r6 tests.
	(run_dump_test_arch): Add support for mipsr6 tests.
	(run_list_test_arch): Add support for using files of the
	form arch@testname.l .

include/elf/
 	* mips.h: Add relocs: R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3,
 	R_MIPS_PC19_S2, R_MIPS_PCHI16 and R_MIPS_PCLO16.
 	(E_MIPS_ARCH_32R6): New define.
 	(E_MIPS_ARCH_64R6): New define.

include/opcode/
 	* mips.h (mips_operand_type): Add new entries: OP_SAME_RS_RT,
 	OP_CHECK_PREV and OP_NON_ZERO_REG.  Add descriptions for the MIPS R6
	instruction arguments: -a, -b, -d, -s, -t, -u, -v, -w, -x, -y, -A, -B,
	 +I, +O, +R, +:, +\, +", +;
	(mips_check_prev_operand): New struct.
 	(INSN2_FORBIDDEN_SLOT): New define.
 	(INSN_ISA32R6): New define.
 	(INSN_ISA64R6): New define.
	(INSN_UPTO32R6): New define.
	(INSN_UPTO64R6): New define.
	(mips_isa_table): Add INSN_UPTO32R6 and INSN_UPTO64R6.
 	(ISA_MIPS32R6): New define.
 	(ISA_MIPS64R6): New define.
 	(CPU_MIPS32R6): New define.
 	(CPU_MIPS64R6): New define.
 	(cpu_is_member): Add cases for CPU_MIPS32R6, and CPU_MIPS64R6.

ld/
 	* ldmain.c (get_emulation): Add support for -mips32r6 and -mips64r6.

opcodes/
 	* mips-dis.c (mips_arch_choices): Add entries for mips32r6 and
 	mips64r6.
 	(parse_mips_dis_option): Allow MSA and virtualization support for
 	mips64r6.
 	(mips_print_arg_state): Add fields dest_regno and seen_dest.
 	(mips_seen_register): New function.
 	(print_insn_arg): Refactored code to use mips_seen_register
	function.  Add support for OP_SAME_RS_RT, OP_CHECK_PREV and
	OP_NON_ZERO_REG.  Changed OP_REPEAT_DEST_REG case to print out
	the register rather than aborting.
 	(print_insn_args): Add length argument.  Add code to correctly
	calculate the instruction address for pc relative instructions.
	(validate_insn_args): New static function.
 	(print_insn_mips): Prevent jalx disassembling for r6.  Use
	validate_insn_args.
	(print_insn_micromips): Use validate_insn_args.
	all the arguments are valid.
	* mips-formats.h (PREV_CHECK): New define.
 	* mips-opc.c (decode_mips_operand): Add support for -a, -b, -d, -s,
 	-t, -u, -v, -w, -x, -y, -A, -B, +I, +O, +R, +:, +\, +", +;
 	(RD_pc): New define.
 	(FS): New define.
 	(I37): New define.
 	(I69): New define.
 	(mips_builtin_opcodes): Add MIPS R6 instructions.  Exclude recoded
 	MIPS R6 instructions from MIPS R2 instructions.
2014-09-15 12:15:55 +01:00
Andrew Bennett a9d58c068c Add mips*-img-elf* target triple.
/
	* 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-12 14:25:15 +01:00
Alan Modra a485e98ea0 Move ELF section headers to end of object file
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-11 00:15:51 +09:30
Jon TURNEY 74fffc3982 Change pe/coff build-id section name to '.buildid'
The section name used to store the build-id on pe/coff is arbitrary, as it's
contents should be located using the pe/coff header's DataDirectory debug data
entry, not by using the section name.

But '.build-id' is not a good choice for that section name, as it is 9
characters long, and hence truncated to 8 characters when
--disable-long-section-names is used (which is the default, when producing an
executable with no dwarf debug sections, e.g. using ld --strip-all --build-id)

This truncation then breaks 'objcopy --only-keep-debug', which does use the
section name, due to concerns that keeping an arbitrary section which contains
the debug directory is not sensible.

binutils/ChangeLog

2014-09-01  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* objcopy.c (is_nondebug_keep_contents_section): Change pe/coff
	build-id section name from '.build-id' to '.buildid'.

ld/ChangeLog

2014-09-01  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* emultempl/pe.em (write_build_id, setup_build_id): Change pe/coff
	build-id section name from '.build-id' to '.buildid'.
	* emultempl/pep.em (write_build_id, setup_build_id): Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2014-09-08 17:54:20 +01:00
Matthew Fortune e319abb47d MIPS testsuite cleanup - part 4
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-09-06 18:02:50 +01:00
Alan Modra 5a1431e66e Fix testsuite ld_simple_link_defsyms for windows targets
* lib/ld-lib.exp (ld_simple_link_defsyms): Provide both __main
	and ___main for windows targets.
2014-08-29 10:34:18 +09:30
H.J. Lu c8831961f9 Use bfd_is_abs_section to check discarded input section
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-27 07:59:48 -07:00
H.J. Lu 29a9f53e85 Don't attach dynamic sections to input from ld --just-symbols
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-27 07:39:48 -07:00
Jiong Wang 614b09cefb [AArch64] Improve copy relocation support on four absolute relocation types
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-26 15:48:47 +01:00
Nick Clifton 2836a869c4 Fix linker testsuite failures for Aarch64.
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-26 15:06:49 +01:00
Maciej W. Rozycki fbd940576f Power/GAS: Don't set VLE annotation for non-VLE processors/instructions
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-22 16:52:20 +01:00
Andreas Tobler baa23169d1 * emulparams/armelf_fbsd.sh (TEXT_START_ADDR): Increase alignment to 64kB boundary like in armelf_linux.sh 2014-08-22 06:33:45 +02:00
Alan Modra da44f4e546 Index PowerPC64 linker generated .eh_frame in .eh_frame_hdr
I noticed recently that .eh_frame FDEs generated by the linker for
call stubs and .glink weren't being indexed in .eh_frame_hdr, due to
bfd_elf_discard_info being run before the linker generated .eh_frame
sections were available for parsing.  This patch moves code around in
elf64-ppc.c and ppc64elf.em to avoid that problem.

Another problem fixed here is that --gc-sections parses .eh_frame
early, and the existing machinery allows only one go at parsing the
.eh_frame sections.  That resulted in the linker generated .eh_frame
CIEs not being merged and no .eh_frame_hdr index entries for those
FDEs.  It turns out that all the info from parsing .eh_frame is
attached to the section, so order of parsing isn't important, and
after parsing sec_info_type being set will prevent a section being
parsed again.  At least, when parsing doesn't hit an error.  So there
isn't really any need for "parsed_eh_frame".  "merge_cies" is also
redundant, which means _bfd_elf_{begin,end}_eh_frame_parsing can also
disappear.

bfd/
	* elf-bfd.h (struct eh_frame_hdr_info): Delete merge_cies and
	parsed_eh_frames.
	(_bfd_elf_begin_eh_frame_parsing): Delete.
	(_bfd_elf_end_eh_frame_parsing): Delete.
	* elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): Delete.
	(_bfd_elf_end_eh_frame_parsing): Delete.
	(_bfd_elf_parse_eh_frame): Don't test parsed_eh_frame.  Test
	!info->relocatable in place of merge_cies.
	* elflink.c (bfd_elf_gc_sections, bfd_elf_discard_info): Adjust.
	* elf64-ppc.c (glink_eh_frame_cie): Pad to multiple of 8.
	(ppc64_elf_size_stubs): Likewise pad stub FDE.
	(ppc64_elf_build_stubs): Move code setting glink .eh_frame to..
	(ppc64_elf_size_stubs): ..here and..
	(ppc64_elf_finish_dynamic_sections): ..here.
ld/
	* emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Call
	bfd_elf_discard_info after generating glink .eh_frame.  Delete
	redundant test on ppc64_elf_setup_section_lists status.
2014-08-22 10:09:09 +09:30
Terry Guo c542398150 bfd/ChangeLog
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-21 18:00:35 +08:00
Maciej W. Rozycki 8c45e5ec6b ARM/ld: Correct macro formatting in armelf.em
* emultempl/armelf.em (OPTION_STUBGROUP_SIZE): Fix formatting.
	(OPTION_NO_MERGE_EXIDX_ENTRIES, OPTION_LONG_PLT): Likewise.
2014-08-20 20:17:18 +01:00
Roland McGrath 469a34932a Fix PR ld/17277: bogus dynamic relocs and TEXTREL for ARM PC-relative relocs
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-20 10:12:57 -07:00
Will Newton 01e6c1a48d ARM: Add support for armeb-*-eabi*
At the moment it is possible to configure binutils for these triples
but the resulting linker defaults to little endian with huge numbers
of testsuite failures, which on the face of it does not appear to make
much sense.

This patch makes the behaviour similar to armeb-elf and the testsuite
is clean.

bfd/ChangeLog:

2014-08-20  Will Newton  <will.newton@linaro.org>

	* config.bfd: Default armeb-*-eabi* to big endian.

ld/ChangeLog:

2014-08-20  Will Newton  <will.newton@linaro.org>

	* configure.tgt: Default armeb-*-eabi* to big endian.
2014-08-20 16:58:36 +01:00
Nick Clifton 2d5c3743a3 Enabling the HIGH_ENTROPY_VA flag allows the operating system to use
addresses outside of the 32-bit range before memory exhaustion. This
results in a higher entropy implementation of ASLR when used with the
DYNAMIC_BASE flag.

	* include/coff/pe.h: Add HIGH_ENTROPY_VA flag
	* ld/emultempl/pep.em: Add --high-entropy-va switch
	* ld/ld.texinfo: Document the --high-entropy-va switch
2014-08-20 16:10:29 +01:00
Nick Clifton 985743c7fb Add copyright notice to linker script files. 2014-08-20 10:34:58 +01:00
Alan Modra 2974be626b Fix --diable-shared --enable-plugins build breakage
Directories that don't use libtool need to add -ldl (on most *nix
hosts) to provide dlopen for libbfd.

config/
	* plugins.m4 (AC_PLUGINS): If plugins are enabled, add -ldl to
	LIBS via AC_SEARCH_LIBS.
gdb/
	* acinclude.m4 (GDB_AC_CHECK_BFD): Don't add -ldl.
	* config.in: Regenerate.
sim/ppc/
	* configure.ac: Invoke AC_PLUGINS.
	* config.in: Regenerate.

and regen lots of configure files.
2014-08-19 21:59:56 +09:30
Alan Modra cb8e01c6bb LTO plugin with older gcc
* ld-plugin/lto.exp: Use gcc -print-file-name to find lto plugin.
2014-08-18 21:01:26 +09:30
Alan Modra 1240be6b7d PR 17287, DT_NEEDED of unneeded libraries affects --as-needed
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-18 18:45:01 +09:30
Alan Modra 759388538d Return error status from bfd_elf_discard_info.
bfd/
	* elflink.c (bfd_elf_discard_info): Return int error status.
	* stabs.c (_bfd_discard_section_stabs): Comment typo fix.
	* bfd-in.h (bfd_elf_discard_info): Updata prototype.
	* bfd-in2.h: Regenerate.
ld/
	* emultempl/aarch64elf.em (gld${EMULATION_NAME}_after_allocation):
	Handle error status from bfd_elf_discard_info.
	* emultempl/armelf.em: Likewise.
	* emultempl/elf32.em: Likewise.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/metagelf.em: Likewise.
	* emultempl/nios2elf.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/tic6xdsbt.em: Likewise.
	* emultempl/vms.em: Likewise.
2014-08-18 09:33:35 +09:30
Alan Modra 18cd5bce47 Linker part of PR16563 fix
Presents .eh_frame input sections to the optimisation machinery in
elf-eh-frame.c in the order they are given by the linker script.

	PR 16563
bfd/
	* elflink.c (bfd_elf_discard_info): Process .eh_frame and .stab
	in the order they are mapped to output sections.
ld/
	* ldlang.c (map_head_is_link_order): Rename from
	stripped_excluded_sections.
	(lang_clear_os_map): New function, extracted from..
	(strip_excluded_output_sections): ..here.
	* ldlang.h (lang_clear_os_map): Declare.
	* ldwrite.c (ldwrite): Call lang_clear_os_map.
	* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_after_allocation):
	Likewise.
2014-08-14 13:49:31 +09:30
Alan Modra b879806f2f configury changes to make ld plugin support controlled by --enable-plugins
This also makes --enable-plugins default to on for hosts that can
support plugins, so we have consistent lto toolchain support.  The
ACX_LARGEFILE moves aren't strictly necessary, but are harmless and
will be necessary if plugin support is extended to more hosts via
libtool's dlopen support.  I started down that path then decided it
was more work than I was interested in doing.  (ACX_LARGEFILE invokes
AC_PLUGINS.)

config/
	* plugins.m4: Test for dlfcn.h or windows.h here to set default
	for --enable-plugins.  Report error if someone tries to enable
	plugins on a host we don't support.
bfd/
	* configure.ac: Delete redundant plugin related checks.
	* configure: Regenerate.
binutils/
	* configure.ac: Move ACX_LARGEFILE after LT_INIT.
	* config.in: Regenerate.
	* configure: Regenerate.
gas/
	* configure.ac: Move ACX_LARGEFILE after LT_INIT.
	* config.in: Regenerate.
	* configure: Regenerate.
gprof/
	* configure.ac: Move ACX_LARGEFILE after LT_INIT.
	* configure: Regenerate.
	* gconfig.in: Regenerate.
ld/
	* configure.ac: Move AC_PROG_CC and other macros earlier.  Delete
	plugin checks now done in config/plugins.m4.
	* config.in: Regenerate.
	* configure: Regenerate.
2014-08-14 13:46:09 +09:30
Alan Modra 23ebe1a0bd Simplify is_ir_dummy_bfd test
is_ir_dummy_bfd started life before BFD_PLUGIN was invented.

	* plugin.c (is_ir_dummy_bfd): Test BFD_PLUGIN flag rather than
	flags.claimed.
2014-08-14 13:39:40 +09:30
Yaakov Selkowitz 63e1777c6c This is necessary for adding __cxa_atexit support for Cygwin in GCC without
exporting __dso_handle from every DLL.

	* pe-dll.c (autofilter_entry_type autofilter_symbollist_i386): Add
	__dso_handle.
2014-08-13 11:43:28 +01:00
Alan Modra 0fef4b9893 Fix non-ELF build breakage
* ldlang.c (open_input_bfds): Don't use bfd_elf_get_dyn_lib_class.
2014-08-13 07:36:30 +09:30
Alan Modra 2d03dd2f8d Tighten test for ld plugin support
To not match spu --plugin option.

	* lib/ld-lib.exp (check_plugin_api_available): Match "-plugin PLUGIN".
2014-08-12 20:51:11 +09:30
Alan Modra e77620a58f Fix build breakage when ld plugins disabled
* ldlang.h (struct lang_input_statement_flags): Don't make "reload"
	field conditional on ENABLE_PLUGINS.
	* ldlang.c (open_input_bfds): Expand plugin_should_reload.
	* plugin.h (plugin_should_reload): Delete.
	* plugin.c (plugin_should_reload): Delete.
2014-08-12 20:49:58 +09:30
Alan Modra 4613510308 Change ld "notice" interface for better handling of indirect symbols
The main aim of this change was to have non_ir_ref set correctly on
new indirect symbols.  I could have added a "copy" param to the "notice"
function, so that indirect symbols could be created in plugin_notice,
but it seemed cleaner to create indirect syms earlier and pass them
rather than "string" to "notice".

include/
	* bfdlink.h (struct bfd_link_callbacks <notice>): Remove "string"
	param, add "inh".
bfd/
	* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Only call "notice"
	here when not calling the generic add_symbol function.  Formatting.
	Correct handling of indirect symbols.  Update notice call.
	* elflink.c (_bfd_elf_notice_as_needed): Update notice call.
	* linker.c (_bfd_generic_link_add_one_symbol): Create indirect
	symbols early.  Update notice call.  Add comments regarding weak
	symbols vs. indirect.
ld/
	* ldmain.c (notice): Update args.
	* plugin.c (plugin_notice): Likewise.  Follow warning sym link.
	Handle new indirect symbol.
2014-08-12 20:47:36 +09:30
Alan Modra 88d3f0870b missing changelog 2014-08-12 11:08:26 +09:30
Alan Modra 61f41c3c24 Fix non-plugin warning symbol handling
PR ld/16746
include/
	* bfdlink.h (struct bfd_link_info): Add lto_plugin_active.
bfd/
	* linker.c (_bfd_generic_link_add_one_symbol <WARN>): Handle
	!lto_plugin_active.
ld/
	* plugin.c (plugin_load_plugins): Set link_info.lto_plugin_active.
2014-08-12 10:31:41 +09:30
Ulrich Drepper 26278bb871 * ldlang.h (struct lang_input_statement_flags): Add pushed
member.
        * ldlex.h (enum option_values): Add OPTION_PUSH_STATE and
        OPTION_POP_STATE.
        * lexsup.c (ld_options): Add entries for --push-state and
        --pop-state.
        (parse_args): Handle OPTION_PUSH_STATE and OPTION_POP_STATE.
        * ld.texinfo: Document --push-state and --pop-state.
2014-08-08 20:26:41 -04:00
H.J. Lu db7129469b Don't issue a warning for references in LTO IR to warning symbols
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-07 10:28:48 +09:30
Alan Modra 97964ab320 PR14918, lto always links in libgcc_s.so
PR14918
	* plugin.c (plugin_opt_plugin_arg): Drop --pass-through.
2014-08-06 13:31:47 +09:30
Alan Modra c3e11cbe51 Allow lto tests to run with older compilers
* 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-06 13:26:18 +09:30
Alan Modra c26fd07110 Regen ld/Makefile.in
* Makefile.in: Regenerate.
2014-08-05 11:24:42 +09:30
Kaz Kojima 8c78401680 Fix PR10373 which is SH relax bug. 2014-08-01 19:17:47 +09:00
Kaz Kojima b131d1fcfa Fix PR10378 which is SH relax bug. 2014-08-01 19:13:39 +09:00
Matthew Fortune 351cdf24d2 [MIPS] Implement O32 FPXX, FP64 and FP64A ABI extensions
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-29 11:27:59 +01:00
Anthony Green 48494700d5 Add moxiebox target 2014-07-27 08:51:20 -04:00
Stefan Kristiansson 8d14e1918d or1k: increase linux TEXT_START_ADDR to 0x2000
Override the default value of 0x0000 defined in
TEXT_START_ADDR to avoid linux executables to be mapped
at zero page.

ld/
	* emulparams/elf32or1k_linux.sh (TEXT_START_ADDR): Increase from
	0x0 to first page boundary at 0x2000.
2014-07-17 00:26:45 +03:00
H.J. Lu 144bed8d4d Properly match PLT entry against .got.plt relocation
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-16 10:57:49 -07:00
H.J. Lu 998d811a23 Update elf_i386_compute_jump_table_size
Commit e1f987424b 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 13:09:55 -07:00
Jiong Wang d6f18fe6ca [AArch64] Fix ld testcase linker script glitch.
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-15 10:08:55 +01:00
Max Filippov e7d17e71cd Fix xtensa ld segfault when linking linux modules
is_inconsistent_linkonce_section makes an assumption that section name
that starts with ".gnu.linkonce.prop." has one more dot in its suffix.
However gas generates such section name by insertion of "prop." right
after ".gnu.linkonce." part of the name of the original section. So, for
section named ".gnu.linkonce.this_module" corresponding property section
name does not satisfy the assumption. Such section names are common in
linux modules. This bug was exposed by the patch "a35d5e8 Fix alignment
for the first section frag on xtensa", that makes gas produce property
section for each section that has ".align" directive in it.

Use suffix that immediately follows ".gnu.linkonce.prop." when there are
no more dots following it.

2014-07-10  Max Filippov  <jcmvbkbc@gmail.com>

ld/
    * emultempl/xtensaelf.em (is_inconsistent_linkonce_section):
    correctly handle missing dot in section name after
    ".gnu.linkonce.prop.".
2014-07-10 19:22:07 +04:00
Will Newton 6a2619f953 Fix tests when configured for arm-linux and arm-elf
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-10 09:32:56 +01:00
Will Newton 6f86b3b000 ld/testsuite: Disable non-PIC shared library tests on ARM
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-10 09:32:42 +01:00
Denis Chertykov b484180108 * scripttempl/avr.sc: Remove KEEP for .data and
force .bss VMA to end of .data VMA.
2014-07-08 20:15:18 +04:00
Will Newton 7572ca8989 ld/ARM: Increase maximum page size to 64kB
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-08 15:00:12 +01:00
Alan Modra bffebb6ba5 Copy st_other for linker script symbol assignments
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-08 19:42:03 +09:30
Jiong Wang 2e0488d33f Enable elf_backend_rela_normal for AArch64
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-08 09:29:06 +01:00
Alan Modra 37a6ac445d Run ar with --plugin for LTO 11 test
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-08 10:01:47 +09:30
Alan Modra 3bb9e7b43f Reinstate compiler check
* lib/ld-lib.exp (check_lto_shared_available): Reinstate compiler
	check here too.
2014-07-07 23:46:37 +09:30
Nick Clifton 19aef622f3 This patch prevents a linker testsuite error if the checks are run with a
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-07 14:41:10 +01:00
Alan Modra f1d7f4a64c Ensure ld testsuite gcc -B options precede $CC -B options
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-07 13:37:16 +09:30
Alan Modra abc868c609 Rid libdummy.a from lto.exp
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-05 12:54:40 +09:30
Alan Modra 1110793abe Update "configure.in" in comments and doco
bfd/
	* Makefile.am: Update "configure.in" comments.
	* PORTING: Likewise.
	* aoutx.h: Likewise.
	* configure.host: Likewise.
	* doc/bfdint.texi: Likewise.
	* targets.c: Likewise.
	* warning.m4: Likewise.
	* Makefile.in: Regenerate.
gas/
	* doc/internals.texi: Update "configure.in" comments.
	* acinclude.m4: Likewise.
	* config/tc-sparc.c: Likewise.
ld/
	* configure.ac: Update "configure.in" comments.
	* configure: Regenerate.
2014-07-04 15:06:40 +09:30
Alan Modra 35eafcc71b Rename configure.in to configure.ac
bfd/
	* configure.ac: Rename from configure.in.
	* Makefile.in: Regenerate.
	* config.in: Regenerate.
	* doc/Makefile.in: Regenerate.
opcodes/
	* configure.ac: Rename from configure.in.
	* Makefile.in: Regenerate.
	* config.in: Regenerate.
binutils/
	* configure.ac: Rename from configure.in.
	* Makefile.in: Regenerate.
	* config.in: Regenerate.
	* doc/Makefile.in: Regenerate.
gas/
	* configure.ac: Rename from configure.in.
	* Makefile.in: Regenerate.
	* config.in: Regenerate.
	* doc/Makefile.in: Regenerate.
gprof/
	* configure.ac: Rename from configure.in.
	* configure.ac: Rename from configure.in.
	* Makefile.in: Regenerate.
	* gconfig.in: Regenerate.
ld/
	* configure.ac: Rename from configure.in.
	* Makefile.in: Regenerate.
	* config.in: Regenerate.
2014-07-04 13:40:28 +09:30
Alan Modra 2e98a7bd88 Use modern AC_INIT in configure.in
This removes usage of the obsolete AC_INIT and AM_INIT_AUTOMAKE in all
binutils configure.in files.  The BFD version is now in bfd/version.m4
rather than bfd/configure.in, which allows automake to automatically
track this dependency.

bfd/
	* version.m4: New file.
	* configure.in: Include version.m4.
	(AC_INIT): Update.
	* Makefile.am (RELEASE): Delete.
	(bfdver.h): Depend on development.sh, use instead of RELEASE.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
opcodes/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
binutils/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
gas/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* configure.com: Get bfd version from bfd/version.m4.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
gprof/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
ld/
	* configure.in: Include bfd/version.m4.
	(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
	(BFD_VERSION): Delete.
	* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
2014-07-04 12:41:26 +09:30
Alan Modra d215621ebe Reload --as-needed libraries inside groups
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-03 17:05:42 +09:30
Alan Modra d1eca1e41d Taking an undefined function's address in an executable
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-07-02 18:16:14 +09:30
Alan Modra 7341d5e22f Add symbols for global entry stub, and report stats
The undefined function symbols (with non-zero value) on global entry
stubs are discarded by objdump when disassembling, so give objdump
another symbol to mark the stubs.

Also fixes a couple of bugs:
- entry_section was set to .opd for ELFv2, which meant a hard error
  rather than a warning when _start wasn't defined.
- global entry stubs were not built if they were the only type of
  stub in an executable.

bfd/
	* elf64-ppc.c (ppc_stub_type): Add ppc_stub_global_entry.
	(struct ppc_link_hash_table): Increase size of stub_count array.
	(build_global_entry_stubs): Emit symbol on global entry stub.
	(ppc64_elf_build_stubs): NULL check htab->brlt.  Add global entry
	stub stats.
ld/
	* emultempl/ppc64elf.em (stub_added): Delete.
	(gld${EMULATION_NAME}_finish): Call ppc64_elf_build_stubs even when
	none of the usual stubs have been added.  Only change entry_section
	for ELFv1.
2014-07-01 20:28:20 +09:30
Alan Modra 2dc0e7b400 Don't include sys/param.h
sys/param.h on recent versions of powerpc glibc ends up including
asm/elf.h via asm/sigcontex.h.  asm/elf.h defines R_PPC_* and R_PPC64_*
macros, which clash with our include/elf/ppc.h and include/elf/ppc64.h.
It turns out that no current source uses LD_PATHMAX, so there is no
need for limits.h or sys/param.h, except for one occurrence of UINT_MAX.
I don't have a quarrel with limits.h, but it seems unnecessary just
for UINT_MAX.

	* sysdep.h: Don't include limits.h and sys/param.h.  Don't
	include unistd.h twice.
	(LD_PATHMAX): Don't define.
	* ldlang.c (lang_common): Don't use UINT_MAX.
2014-07-01 20:26:11 +09:30
Barney Stratford f36e88862f Add support for the AVR Tiny series of microcontrollers.
* archures.c: add avrtiny architecture for avr target.
	* bfd-in2.h: Regenerate.
	* cpu-avr.c (arch_info_struct): add avrtiny arch info.
	* elf32-avr.c (elf_avr_howto_table): new relocation R_AVR_LDS_STS_16
	added for 16 bit LDS/STS instruction of avrtiny arch.
	(avr_reloc_map): reloc R_AVR_LDS_STS_16 is mapped to
	BFD_RELOC_AVR_LDS_STS_16.
	(bfd_elf_avr_final_write_processing): select machine number avrtiny arch.
	(elf32_avr_object_p): set machine number for avrtiny arch.
	* libbfd.h: Regenerate.
	* reloc.c: Add documentation for BFD_RELOC_AVR_LDS_STS_16 reloc.

         * config/tc-avr.c (mcu_types): Add avrtiny arch.
	Add avrtiny arch devices attiny4, attiny5, attiny9, attiny10, attiny20
	and attiny40.
	(md_show_usage): Add avrtiny arch in usage message.
	(avr_operand): validate and issue error for invalid register for avrtiny.
	add new reloc exp for 16 bit lds/sts instruction.
	(md_apply_fix): check 16 bit lds/sts operand for out of range and encode.
	(md_assemble): check ISA for arch and issue diagnostic.

	* include/elf/avr.h (E_AVR_MACH_AVRTINY): define avrtiny machine number.
	(R_AVR_LDS_STS_16): define 16 bit lds/sts reloc number.
	* include/opcode/avr.h (AVR_ISA_TINY): define avrtiny specific ISA.
	(AVR_ISA_2xxxa): define ISA without LPM.
	(AVR_ISA_AVRTINY): define avrtiny arch ISA.
	Add doc for contraint used in 16 bit lds/sts.
	Adjust ISA group for icall, ijmp, pop and push.
	Add 16 bit lds/sts encoding and update 32 bit lds/sts constraints.
	* opcodes/avr-dis.c (avr_operand): Handle constraint j for 16 bit lds/sts.
	(print_insn_avr): do not select opcode if insn ISA is avrtiny and machine
	is not avrtiny.

	* Makefile.am (ALL_EMULATION_SOURCES): add avrtiny emulation source.
	(eavrtiny.c): add rules for avrtiny emulation source.
	* Makefile.in: Regenerate.
	* configure.tgt: Add avrtiny to avr target emulations.
	* scripttempl/avrtiny.sc: New file.
	linker script template for avrtiny arch.
	* emulparams/avrtiny.sh: New file.
	emulation parameters for avrtiny arch.
2014-07-01 10:20:17 +01:00
Ulrich Drepper b005481975 lexsup.c (parse_args): Check whether provided SONAME is empty
string.  If yes, warn and ignore it.  Don't overwrite valid SONAME
	with empty string.
2014-06-30 06:58:52 -04:00
Linda Zhang eeb14e5a5b Change the default behaviour of the PE targeted linker so that timestamps are
inserted.  This is for compatibility with other, non-GNU tools.  Deterministic
binaries can still be created by using the new --no-insert-timestamp command line
option.

	* emultempl/pe.em: Initialise insert_timestamp to true.
	Add a --no-insert-timestamp command line option.
	* emultempl/pep.em: Likewise.
	* ld.texinfo: Document that --insert-timestamp is enabled by
	default and that it now has an inverse command line option.
	* NEWS: Mention the new behaviour.
2014-06-26 12:18:39 +01:00
Nick Clifton 9d069ac37f Fixes to allow a toolchain configured with --enable-all to build on a 32-bit host.
* Makefile.am (ALL_EMULATION_SOURCES): Move ei386pep.c from
	here...
	(ALL_64_EMULATION_SOURCES): ... to here.
	(ALL_EMUL_EXTRA_OFILES): Move pep-dll.o from here...
	(ALL_64_EMUL_EXTRA_OFILES): New.  ... to here.
	* configure.in (EMUL_EXTRA_OFILES): Include
	ALL_64_EMUL_EXTRA_OFILES when making a 64-bit enabled build.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
2014-06-25 16:35:58 +01:00
Kyle McMartin 28bf260962 ld/arm: adjust offsets in tls-gdierelax2.d
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-25 10:57:45 -04:00
Andreas Tobler 1804dbce5a ld/ARM: Add target arm*b-*-freebsd*, update target arm*-*-freebsd*.
ld/ChangeLog:

2014-06-18  Andreas Tobler  <andreast@fgznet.ch>

        * configure.tgt (arm*-*-freebsd*): Update targ_extra_emuls.
	(arm*b-*-freebsd*): Add target.
	* emulparams/armelfb_fbsd.sh: Added.
	* emulparams/armelf_fbsd.sh: Updated.
	* Makefile.am (ALL_EMULATION_SOURCES): Add earmelfb_fbsd.c.
	* Makefile.in: Regenerate.
2014-06-18 21:58:19 +02:00
Will Newton 9f19ab6dfa ld/ARM: Fix IFUNC and TLS descriptors in the same shared object
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-16 15:51:21 +01:00
Alan Modra e1279d1d6b Fix duplicated assignments to __rel_iplt and __rela_iplt symbols
and fix more nds32 dependencies.

	* scripttempl/elf.sc: Edit out __rela_iplt symbol assignments from
	.rel sections, and __rel_iplt from .rela sections.
	* scripttempl/nds32elf.sc: Likewise.
	* Makefile.am (ends32*.c): Depend on nds32elf.sc.
	* Makefile.in: Regenerate.
2014-06-16 22:32:45 +09:30
Alan Modra caa4096e84 Don't call bfd_link_hash_table_free
Freeing the linker hash table is a royal pain.  It can't be freed
before the _bfd_write_contents call in bfd_close, because some target
bfd_write_contents functions access the hash table.  It can't be freed
after bfd_close either, since bfd_alloc memory holding side data
structures disappears (PR17047).  Clearly the only place it can be freed
is actually in bfd_close.  This patch doesn't do that, but kills off
the existing means of freeing the hash table via a bfd target xvec call.

bfd/
	PR 17047
	* targets.c (BFD_JUMP_TABLE): Delete NAME##_bfd_link_hash_table_free.
	(struct bfd_target <_bfd_link_hash_table_free>): Delete.
	* bfd.c (bfd_link_hash_table_free): Don't define.
	* aout-adobe.c, * aout-target.h, * aout-tic30.c, * binary.c, * bout.c,
	* coff64-rs6000.c, * coffcode.h, * elf-m10300.c, * elf32-arm.c,
	* elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc11.c,
	* elf32-m68hc12.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c,
	* elf32-sparc.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c,
	* elf64-sparc.c, * elf64-x86-64.c, * elfnn-aarch64.c, * elfnn-ia64.c,
	* elfxx-target.h, * i386msdos.c, * i386os9k.c, * ieee.c, * ihex.c,
	* libbfd-in.h, * libecoff.h, * mach-o-target.c, * mmo.c,
	* nlm-target.h, * oasys.c, * pef.c, * plugin.c, * ppcboot.c, * som.c,
	* srec.c, * tekhex.c, * verilog.c, * versados.c, * vms-alpha.c,
	* xsym.c: Don't define various link_hash_table_free defines, and
	remove from bfd_target vars.  Temporarily reference some of the
	target link_hash_table_free functions to avoid warnings.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
ld/
	PR 17047
	* ldlang.c (output_bfd_hash_table_free_fn): Delete.
	(open_output): Don't set it..
	* ldmain.c (ld_cleanup): ..or call it.
2014-06-13 19:11:29 +09:30
Alan Modra c72f2fb2bb Make bfd.link_next field a union
This field of struct bfd is currently only used to chain together
linker input files.  This patch prepares to use the field to stash
the linker hash table, which is always created on the linker output
file.

bfd/
	* bfd.c (struct bfd): Replace link_next with a union.
	* aoutx.h, * bfd.c, * coff-ppc.c, * coff-rs6000.c, * cofflink.c,
	* ecoff.c, * elf-m10300.c, * elf32-arm.c, * elf32-avr.c,
	* elf32-hppa.c, * elf32-i386.c, * elf32-lm32.c, * elf32-m32c.c,
	* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-metag.c,
	* elf32-microblaze.c, * elf32-nds32.c, * elf32-nios2.c,
	* elf32-or1k.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-s390.c,
	* elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c,
	* elf32-tic6x.c, * elf32-tilepro.c, * elf32-xstormy16.c,
	* elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c,
	* elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-x86-64.c,
	* elflink.c, * elfnn-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
	* elfxx-tilegx.c, * linker.c, * pdp11.c, * peXXigen.c, * simple.c,
	* sunos.c, * vms-alpha.c, * xcofflink.c: Update for above.
	* bfd-in2.h: Regenerate.
include/
	* bfdlink.h: Update for bfd.link_next change.
ld/
	* emultempl/cr16elf.em, * emultempl/elf32.em, * emultempl/genelf.em,
	* emultempl/m68kcoff.em, * emultempl/m68kelf.em,
	* emultempl/nds32elf.em, * emultempl/pe.em, * emultempl/pep.em,
	* ldlang.c, * ldmain.c, * pe-dll.c: Update for bfd.link_next change.
2014-06-13 19:10:57 +09:30
Alan Modra 07cccc39f3 Add missing ld makefile dependency for nios.
* Makefile.am (ALL_EMULATION_SOURCES): Add enios2elf.c, enios2linux.c.
	* Makefile.in: Regenerate.
2014-06-13 18:58:53 +09:30
Ryan Mansfield 203e84589f Remove reference to GASp from linker testsuite configuration.
* config/default.exp (GASP): Remove.
2014-06-09 15:09:02 +01:00
Alan Modra b893397a4b PROVIDE in linker script vs. built-in symbols
* ldexp.c (exp_fold_tree_1 <etree_provide>): Make PROVIDEd
	linker script symbol value override a built-in linker symbol.
2014-06-07 14:55:12 +09:30
Joel Brobecker 270c993744 Make it easy to make --disable-werror the default for both binutils and gdb
The goal of this patch is to provide an easy way to make
--disable-werror the default when building binutils, or the parts
of binutils that need to get built when building GDB. In development
mode, we want to continue making -Werror the default with GCC.
But, when making releases, I think we want to make it as easy as
possible for regular users to successfully build from sources.

GDB already has this kind of feature to turn -Werror as well as
the use of the libmcheck library. As GDB Release Manager, I take
advantage of it to turn those off after having cut the branch.
I'd like to be able to do the same for the binutils bits. And
perhaps Tristan will want to do the same for his releases too
(not sure, binutils builders might be a little savvier than GDB
builders).

This patch introduces a new file, called development.sh, which
just sets a variable called $development. In our development branches
(Eg. "master"), it's set to true. But setting it to false would allow
us to change the default behavior of various development-related
features to be turned off; in this case, it turns off the use of
-Werror by default (use --enable-werror to turn it back on).

bfd/ChangeLog:

        * development.sh: New file.
        * warning.m4 (AM_BINUTILS_WARNINGS): Source bfd/development.sh.
        Make -Werror the default with GCC only if DEVELOPMENT is true.
        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add
        $(srcdir)/development.sh.
        * Makefile.in, configure: Regenerate.

binutils/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

gas/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

gold/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
        * Makefile.in, configure: Regenerate.

gprof/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

ld/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

opcodes/ChangeLog:

        * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
        bfd's development.sh.
        * Makefile.in, configure: Regenerate.

gdb/ChangeLog:

        * development.sh: Delete.
        * Makefile.in (config.status): Adjust dependency on development.sh.
        * configure.ac: Adjust development.sh source call.
        * configure: Regenerate.

gdb/gdbserver/ChangeLog:

        * configure.ac: Adjust development.sh source call.
        * Makefile.in (config.status): Adjust dependency on development.sh.
        * configure: Regenerate.

Tested on x86_64-linux by building two ways: One with DEVELOPMENT
set to true, and one with DEVELOPMENT set to false. In the first
case, I could see the use of -Werror, while it disappeared in
the second case.
2014-06-05 05:47:29 -07:00
Alan Modra 397998fc32 Support fusion for ELFv2 stubs
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-06-03 10:55:29 +09:30
Alan Modra ab251b8980 fix typos in ChangeLog 2014-06-02 15:59:21 +09:30
Alan Modra ce46249c15 fix 2014-05-28 ld Makefile.am changes
bfin, msp, and score all used an extra parameter to genscripts.sh
to select a "customizer_script" different from the standard one
named from the emulation.  This patch renames the scripts to avoid
the need, tidying them in the process.

	* emulparams/elf32bfin.sh: Rename from bfin.sh.
	* emulparams/elf32bfinfd.sh: Update to suit.
	* emulparams/: Delete.
	* emulparams/msp430.sh: Rename from msp430all.sh.  Remove
	MSP430_NAME and msp430X vars.
	* emulparams/msp430X.sh: New.
	* emulparams/: Delete.
	* emulparams/score3_elf.sh: Rename from scoreelf.sh.  Remove
	SCORE_NAME and score7_elf ARCH setting.
	* emulparams/score7_elf.sh: New.
	* Makefile.am (eelf32bfin.c, eelf32bfinfd.c): Update dependencies.
	(emsp430.c, emsp430X.c, escore3_elf.c, escore7_elf.c): Likewise.
	* Makefile.in: Regenerate.
	* genscripts.sh: Delete customizer_script param.
2014-06-02 14:52:52 +09:30
Hans-Peter Nilsson 77ac17b845 ld: Split GENSCRIPTS rule from dependencies to fix tdir_'s.
* Makefile.am: Change all rules with ${GENSCRIPTS}
	invocations to be just dependencies.
	($(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES))
	(run-genscripts): New rules.
	* Makefile.in: Regenerate.
2014-05-28 18:20:16 +02:00
mfortune 9854d43d40 Add objcopy stage between assembly and linking for run_dump_test
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-28 16:21:19 +01:00
DJ Delorie b26dbe2773 Fix typo. 2014-05-27 19:05:18 -04:00
DJ Delorie 7a2f2d82fd Add new link-map-text hook and RX auto-vector support.
* bfd/elf32-rx.c (get_symbol_value_maybe): New.
(rx_elf_relocate_section): If we find a reloc against
$tableentry$default$<name>, redirect it to the appropriate
$tableentry$<n>$.
(RX_Table_Info): New.
(rx_table_find): New.  Check all tables and SEC_KEEP all sections
with table parts in them.
(rx_check_directives): New.
(rx_table_map_2): New.
(rx_table_map): New.
(rx_additional_link_map_text): New.  Called to dump tables to the
map file.
* bfd/elf32-rx.h: New.

* ld/ldemul.h (extra_map_file_text): New field.
(ldemul_extra_map_file_text): Declare.
* ld/ldemul.c (ldemul_extra_map_file_text): Define.
* ld/ldlang.c (lang_map): Call it.

* ld/emultempl/rxelf.em: Add extra_map_file_text hook.
* ld/emultempl/aix.em: Add NULL extra_map_file_text hook.
* ld/emultempl/armcoff.em: Likewise.
* ld/emultempl/beos.em: Likewise.
* ld/emultempl/elf32.em: Likewise.
* ld/emultempl/generic.em: Likewise.
* ld/emultempl/gld960.em: Likewise.
* ld/emultempl/gld960c.em: Likewise.
* ld/emultempl/linux.em: Likewise.
* ld/emultempl/lnk960.em: Likewise.
* ld/emultempl/m68kcoff.em: Likewise.
* ld/emultempl/pe.em: Likewise.
* ld/emultempl/pep.em: Likewise.
* ld/emultempl/sunos.em: Likewise.
* ld/emultempl/ticoff.em: Likewise.
* ld/emultempl/vanilla.em: Likewise.
2014-05-27 17:14:49 -04:00
Alan Modra 0ef76c43d7 Localize varible to avoid warning
* ldlang.c (base): Move variable to..
	* mri.c: ..here, and make static.
	* ldlang.h (base): Delete declaration.
2014-05-25 00:54:22 +09:30
Hans-Peter Nilsson 865d0aef3a ld: Add missing eelf32mbel_linux.c to ALL_EMULATION_SOURCES.
ld:
	* Makefile.am (ALL_EMULATION_SOURCES): Add missing eelf32mbel_linux.c.
	* Makefile.in: Regenerate.
2014-05-20 23:13:08 +02:00
Will Newton 273dc27930 ld/aarch64: xfail non-PIC shared object tests on aarch64
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-20 09:47:29 +01:00
Alan Modra 93d1b056cb Rewrite ppc32 backend .sdata and .sdata2 handling
1) _SDA_BASE_ and _SDA2_BASE_ and defined automatically, in a similar
   manner to the way _GLOBAL_OFFSET_TABLE_ is handled.  It's a little
   more complicated to remove the symbols because _SDA_BASE_ needs to
   be there if either .sdata or .sbss is present, and similarly for
   _SDA2_BASE.
2) The linker created .sdata and .sdata2 sections used for
   R_PPC_EMB_SDAI16 and R_PPC_EMB_SDA2I16 pointers are created early.
   Nowadays we strip unneeded sections from the output, so it isn't
   necessary to delay creating the sections.
3) The output section for targets of various SDA relocs is now checked
   as per the ABI(s).  We previously allowed .sdata.foo and similar,
   most likely because at some stage we were checking input sections.

Also, the patch fixes a long-standing bug in size_input_sections
that affects the values of symbols defined in stripped input
sections.

	PR 16952
bfd/
	* elf32-ppc.c (ppc_elf_create_linker_section): Move earlier.
	Remove redundant setting of htab->elf.dynobj.  Don't align.
	Define .sdata symbols using _bfd_elf_define_linkage_sym.
	(ppc_elf_create_glink): Call ppc_elf_create_linker_section.
	(create_sdata_sym): Delete.
	(elf_allocate_pointer_linker_section): Rename from
	elf_create_pointer_linker_section.  Align section.
	(ppc_elf_check_relocs): Don't call ppc_elf_creat_linker_section
	directly here, or create_sdata_sym.  Set ref_regular on _SDA_BASE_
	and _SDA2_BASE_.
	(ppc_elf_size_dynamic_sections): Remove ATTRIBUTE_UNUSED on param.
	Remove unnecessary tests on _SDA_BASE_ sym.
	(maybe_strip_sdasym, ppc_elf_maybe_strip_sdata_syms): New functions.
	(ppc_elf_relocate_section): Tighten SDA reloc symbol section checks.
	* elf32-ppc.h (ppc_elf_set_sdata_syms): Delete.
	(ppc_elf_maybe_strip_sdata_syms): Declare.
ld/
	* emulparams/elf32ppccommon.sh (_SDA_BASE_, _SDA2_BASE_): Delete.
	* emultempl/ppc32elf.em (ppc_before_allocation): Call
	ppc_elf_maybe_strip_sdata_syms.
	* ldlang.c (size_input_section): Correct output_offset value
	for excluded input sections.
2014-05-20 13:13:23 +09:30
Andreas Tobler fb2c6e43b8 Don't link FreeBSD tests with -ldl.
* 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-19 08:49:55 +02:00
John Marino 5febff9be8 * configure.tgt: Add /lib to dragonfly NATIVE_LIB_DIRS. 2014-05-16 15:39:47 +01:00
Chung-Lin Tang fae663595d 2014-05-11 Chung-Lin Tang <cltang@codesourcery.com>
* emulparams/nios2linux.sh (OTHER_GOT_SYMBOLS): Wrap _gp in HIDDEN(),
	and gp in PROVIDE_HIDDEN.
2014-05-11 10:04:45 -07:00
Hans-Peter Nilsson eae25ec577 Fix freeing of link_info.hash
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-10 02:52:14 +02:00
H.J. Lu df18fdba5d Properly display extra data/address size prefixes
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.
2014-05-09 10:58:00 -07:00
Volodymyr Arbatov 1058c7532d Use signed data type for R_XTENSA_DIFF* relocation offsets.
R_XTENSA_DIFF relocation offsets are in fact signed. Treat them as such.
Add testcase that examines ld behaviour on R_XTENSA_DIFF relocation
changing sign during relaxation.

2014-05-02  Volodymyr Arbatov  <arbatov@cadence.com>
	    David Weatherford  <weath@cadence.com>
	    Max Filippov  <jcmvbkbc@gmail.com>

bfd/
  * elf32-xtensa.c (relax_section): treat R_XTENSA_DIFF* relocations as
  signed.

gas/
  * config/tc-xtensa.c (md_apply_fix): mark BFD_RELOC_XTENSA_DIFF*
  fixups as signed.

ld/testsuite/
  * ld-xtensa/diff_overflow.exp, * ld-xtensa/diff_overflow1.s,
  * ld-xtensa/diff_overflow2.s: Add test for DIFF* relocation
  signedness and overflow checking.
2014-05-08 01:55:41 +04:00
Alan Modra 6d00b59031 bfd target vector rationalisation
This renames the bfd targets to <cpu>_<format>_<other>_<endian>_vec.
So for example, bfd_elf32_ntradlittlemips_vec becomes
mips_elf32_ntrad_le_vec and hp300bsd_vec becomes m68k_aout_hp300bsd_vec.

bfd/
	* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-ns32k.c,
	* aout-sparcle.c, * aout0.c, * aoutx.h, * armnetbsd.c, * bout.c,
	* cf-i386lynx.c, * cf-sparclynx.c, * cisco-core.c, * coff-alpha.c,
	* coff-apollo.c, * coff-arm.c, * coff-aux.c, * coff-go32.c,
	* coff-h8300.c, * coff-h8500.c, * coff-i386.c, * coff-i860.c,
	* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mips.c,
	* coff-rs6000.c, * coff-sh.c, * coff-sparc.c, * coff-stgo32.c,
	* coff-svm68k.c, * coff-tic80.c, * coff-u68k.c, * coff-w65.c,
	* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
	* coff64-rs6000.c, * config.bfd, * configure.com, * configure.in,
	* demo64.c, * elf-m10200.c, * elf-m10300.c, * elf32-am33lin.c,
	* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c,
	* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
	* elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
	* elf32-fr30.c, * elf32-frv.c, * elf32-gen.c, * elf32-h8300.c,
	* elf32-hppa.c, * elf32-i370.c, * elf32-i386.c, * elf32-i860.c,
	* elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
	* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
	* elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c,
	* elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
	* elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c,
	* elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c,
	* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-sh-symbian.c,
	* elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c,
	* elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilepro.c, * elf32-v850.c,
	* elf32-vax.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xstormy16.c,
	* elf32-xtensa.c, * elf64-alpha.c, * elf64-gen.c, * elf64-hppa.c,
	* elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c,
	* elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c,
	* elf64-x86-64.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
	* epoc-pe-arm.c, * epoc-pei-arm.c, * hp300bsd.c, * hp300hpux.c,
	* hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386bsd.c,
	* i386dynix.c, * i386freebsd.c, * i386linux.c, * i386lynx.c,
	* i386mach3.c, * i386msdos.c, * i386netbsd.c, * i386os9k.c,
	* irix-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c,
	* m88kmach3.c, * m88kopenbsd.c, * mach-o-i386.c, * mach-o-x86-64.c,
	* makefile.vms, * mipsbsd.c, * mmo.c, * netbsd-core.c, * newsos3.c,
	* nlm32-alpha.c, * nlm32-i386.c, * nlm32-ppc.c, * nlm32-sparc.c,
	* ns32knetbsd.c, * osf-core.c, * pc532-mach.c, * pe-arm-wince.c,
	* pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-ppc.c,
	* pe-sh.c, * pe-x86_64.c, * pei-arm-wince.c, * pei-arm.c,
	* pei-i386.c, * pei-ia64.c, * pei-mcore.c, * pei-mips.c, * pei-ppc.c,
	* pei-sh.c, * pei-x86_64.c, * ppcboot.c, * ptrace-core.c, * riscix.c,
	* sco5-core.c, * som.c, * sparclinux.c, * sparclynx.c,
	* sparcnetbsd.c, * sunos.c, * targets.c, * trad-core.c,
	* vax1knetbsd.c, * vaxbsd.c, * vaxnetbsd.c, * versados.c,
	* vms-alpha.c, * vms-lib.c: Rename bfd targets to
	<cpu>_<format>_<other>_<endian>_vec.  Adjust associated MY macros
	on aout targets.
	* configure: Regenerate.
binutils/
	* emul_aix.c: Update bfd target vector naming.
	* testsuite/binutils-all/objcopy.exp: Likewise.
ld/
	* emultempl/metagelf.em: Update bfd target vector naming.
	* emultempl/nios2elf.em: Likewise.
	* emultempl/spuelf.em: Likewise.
	* emultempl/tic6xdsbt.em: Likewise.
2014-05-02 20:09:40 +09:30
Hans-Peter Nilsson b46fa76826 ld/testsuite:
* ld-mmix/sec-11.d, ld-mmix/sec-11.ld, ld-mmix/sec-10.s,
	ld-mmix/sec-10.d, ld-mmix/b-offlocmis.s, ld-mmix/sec-12.d: New
	tests.
	* ld-mmix/b-offloc.s: Correct address in comment.
2014-05-02 00:31:58 +02:00
Will Newton 8a52f0d983 ld/arm: Fix testsuite failures for armeb-linux-eabi
Fix all the cases where endianness needs to be taken into account
in the ARM ld dump tests.

ld/testsuite/ChangeLog:

2014-04-23  Will Newton  <will.newton@linaro.org>

	* ld-arm/arm-no-rel-plt.ld: Remove OUTPUT_FORMAT and
	SEARCH_DIR commands.
	* ld-arm/arm-rel32.d: Update regexps to allow test to
	pass on armeb-linux-eabi configuration.
	* ld-arm/data-only-map.d: Likewise.
	* ld-arm/fix-arm1176-off.d: Likewise.
	* ld-arm/fix-arm1176-on.d: Likewise.
	* ld-arm/ifunc-1.gd: Likewise.
	* ld-arm/ifunc-10.gd: Likewise.
	* ld-arm/ifunc-11.gd: Likewise.
	* ld-arm/ifunc-12.gd: Likewise.
	* ld-arm/ifunc-13.gd: Likewise.
	* ld-arm/ifunc-14.gd: Likewise.
	* ld-arm/ifunc-15.gd: Likewise.
	* ld-arm/ifunc-16.gd: Likewise.
	* ld-arm/ifunc-17.gd: Likewise.
	* ld-arm/ifunc-2.gd: Likewise.
	* ld-arm/ifunc-3.gd: Likewise.
	* ld-arm/ifunc-4.gd: Likewise.
	* ld-arm/ifunc-5.gd: Likewise.
	* ld-arm/ifunc-6.gd: Likewise.
	* ld-arm/ifunc-7.gd: Likewise.
	* ld-arm/ifunc-8.gd: Likewise.
	* ld-arm/ifunc-9.gd: Likewise.
	* ld-arm/jump-reloc-veneers-long.d: Likewise.
	* ld-arm/reloc-boundaries.d: Likewise.
2014-04-23 13:56:49 +01:00
H.J. Lu 43c001c7d6 Add tests for PR ld/16846
PR ld/16846
	* ld-plugin/lto.exp (lto_link_tests): Add tests for PR ld/16846.
	* ld-plugin/pr16846a.c: New file.
	* ld-plugin/pr16846b.c: Likewise.
	* ld-plugin/pr16846c.c: Likewise.
2014-04-22 10:22:39 -07:00
Christian Svensson 73589c9dbd Remove support for the (deprecated) openrisc and or32 configurations and replace
with support for the new or1k configuration.
2014-04-22 15:57:47 +01:00
Richard Henderson d1c109de72 Fix alpha-elf relaxation
ld/
	* emultempl/alphaelf.em (alpha_after_parse): Enable 2 relax passes.
bfd/
	* elf64-alpha.c (elf64_alpha_size_got_sections): New may_merge
	parameter; honor it and disable got merging when false.
	(elf64_alpha_relax_got_load): Do not relax to GPREL relocs during
	the first pass of relaxation.
	(elf64_alpha_relax_with_lituse): Likewise.  Move relaxed relocs to
	the end of the LITERAL+LITUSE chain.
	(elf64_alpha_relax_section): Only process LITERAL relocs during the
	second pass of relaxation.
2014-04-21 08:14:18 -07:00
Kwok Cheung Yeung cb22ccf411 This patch causes local GOT entries addressed via a 16-bit index to
be placed towards the front of local GOT space, while entries addressed
via a 32-bit index are placed towards the rear.

Provided that there are fewer than ~16K local GOT entries addressed via
a 16-bit index in total, this should eliminate any relocation overflows
caused by such GOT entries being allocated beyond the addressable range.

bfd/
	* elfxx-mips.c (struct mips_got_info): Delete assigned_gotno
	field.  Add assigned_low_gotno and assigned_high_gotno fields.
	(mips_elf_create_local_got_entry): Update out-of-space condition.
	Set index of new GOT entry to assigned_low_gotno if required by
	the current relocation, else set it to assigned_high_gotno.
	(mips_elf_set_global_gotidx): Replace uses of assigned_gotno
	with assigned_low_gotno.
	(mips_elf_multi_got): Initialize assigned_low_gotno and
	assigned_high_gotno in secondary GOTs.  Use assigned_low_gotno
	in place of assigned_gotno when handling global GOT entries.
	(mips_elf_lay_out_got): Initialize assigned_low_gotno and
	assigned_high_gotno.
	(_bfd_mips_elf_finish_dynamic_sections): Account for a possible
	gap in the middle of local GOT space.

ld/testsuite/
	* ld-mips-elf/elf-rel-xgot-n32.d: Update for new GOT layout.
	* 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-embed.d: Likewise.
	* ld-mips-elf/elf-rel-xgot-n64-linux.d: Likewise.
2014-04-17 14:40:08 +01:00
Steve Ellcey 8056826a68 2014-04-16 Steve Ellcey <sellcey@mips.com>
* emultempl/elf32.em: Include safe-ctype.h.
2014-04-16 10:47:13 -07:00
Steve Ellcey 751e54c92e 2014-04-16 Steve Ellcey <sellcey@mips.com>
* ldbuildid.c (generate_build_id): Add ATTRIBUTE_UNUSED to size arg.
2014-04-16 10:45:08 -07:00
Marcus Shawcroft fa85fb9a1b [AArch64] Fix off by one error in instruction relaxation mask.
The AArch64 TLSDESC to IE relaxation code uses a bit mask intended to
ensure that destination register in a relaxed ldr instruction is
always X0.  The mask has an off by one error resulting in the most
significant bit of the destination register being retained in the
relaxed instruction.  The issue generally appears when the compiler
emits TLS accesses code under high register pressure resulting in a
broken code sequence.
2014-04-15 17:46:07 +01:00
Denis Chertykov e4ef1b6c3f bfd/ChangeLog
* elf32-avr.c: Add DIFF relocations for AVR.
	(avr_final_link_relocate): Handle the DIFF relocs.
	(bfd_elf_avr_diff_reloc): New.
	(elf32_avr_is_diff_reloc): New.
	(elf32_avr_adjust_diff_reloc_value): Reduce difference value.
	(elf32_avr_relax_delete_bytes): Recompute difference after deleting
	bytes.

	* reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations

gas/ChangeLog

	* config/tc-avr.c: Add new flag mlink-relax.
	(md_show_usage): Add flag and help text.
	(md_parse_option): Record whether link relax is turned on.
	(relaxable_section): New.
	(avr_validate_fix_sub): New.
	(avr_force_relocation): New.
	(md_apply_fix): Generate DIFF reloc.
	(avr_allow_local_subtract): New.

	* config/tc-avr.h (TC_LINKRELAX_FIXUP): Define to 0.
	(TC_FORCE_RELOCATION): Define.
	(TC_FORCE_RELOCATION_SUB_SAME): Define.
	(TC_VALIDATE_FIX_SUB): Define.
	(avr_force_relocation): Declare.
	(avr_validate_fix_sub): Declare.
	(md_allow_local_subtract): Define.
	(avr_allow_local_subtract): Declare.

gas/testsuite/ChangeLog

	* gas/avr/diffreloc_withrelax.d: New testcase.
	* gas/avr/noreloc_withoutrelax.d: Likewise.
	* gas/avr/relax.s: Likewise.

include/ChangeLog

	* elf/avr.h: Add new DIFF relocs.

ld/testsuite/ChangeLog

	* ld-avr/norelax_diff.d: New testcase.
	* ld-avr/relax_diff.d: Likewise.
	* ld-avr/relax.s: Likewise.
2014-04-10 19:50:33 +04:00
Nick Clifton edf84efc4e Remove remaining default manifest support.
* Makefile.am (default-manifest.o): Remove rule.
	(EMUL_EXTRA_BINARIES): Delete.
	(ALL_EMUL_EXTRA_BINARIES): Delete.
	(ld_new_DEPENDENCIES): Remove EMUL_EXTRA_BINARIES.
	(install-data-local): Remove EMUL_EXTRA_BINARIES.
	* Makefile.in: Regenerate.
	* configure.in (all_emul_extra_binaries): Delete.
	(EMUL_EXTRA_BINARIES): Remove.
	* configure: Regenerate.
	* configure.tgt (target_extra_binaries): Delete.
	* emultempl/default-manifest.rc: Delete.
	* ld.texinfo: Remove discussion of default manifest.
	* emulparams/i386pe.sh (DEFAULT_MANIFEST): Delete.
	* emulparams/i386pep.sh (DEFAULT_MANIFEST): Delete.
2014-04-09 17:12:30 +01:00
Alan Modra e30d16e9ec Fix fallout from splitting ldbuildid.[ch] off elf32.em.
bfd/
	* libcoff.h: Regenerate.
ld/
	* emultempl/spuelf.em: Include safe-ctype.h, remove duplicate errno.h.
	* emultempl/nds32elf.em: Include bfd_stdint.h.
	* po/POTFILES.in: Regenerate.
2014-04-09 13:49:05 +09:30
Alan Modra b4ab436423 ppc476 icache workaround fix for bctr
I got the ppc476 workaround wrong.  bctr (and bctrl) as the last
instruction in a page can hit the icache bug if the preceding mtctr
insn is close by, and the destination is in the first few instructions
on the next page.  This scenario can occur with code generated by gcc
to implement switch statements, or in code generated to call by
function pointer.

To prevent the bctr problem it is also necessary to remove other
instructions that otherwise would be safe.

bfd/
	* elf32-ppc.c (ppc_elf_relocate_section): Remove bctr from list
	of safe ppc476 insns at end of page.  Also remove non-branch insns.
	Expand comments.
ld/
	* emultempl/ppc32elf.em (no_zero_padding, ppc_finish): New functions.
	(LDEMUL_FINISH): Define.
2014-04-09 07:07:06 +09:30
Nick Clifton 6c1799adab This patch removes the inclusion of the default manifest in final links for
the Cygwin and MinGW targets.  The manifest is now going to be handled by gcc.

	* scripttempl/pe.sc (R_RSRC): Remove default manifest.
	* scripttempl/pep.sc (R_RSRC): Remove default manifest.
2014-04-08 17:45:33 +01:00
Jon TURNEY 61e2488cd8 Add support for generating and inserting build IDs into COFF binaries.
* peXXigen.c (pe_print_debugdata): New function: Displays the
	contents of the debug directory and decodes codeview entries.
	(_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
	(_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record):
	Add functions for reading and writing debugdir and codeview
	records.
	* libpei.h (_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
	(_bfd_XXi_write_codeview_record): Add prototypes and macros.
	* libcoff-in.h (pe_tdata): Add build-id data.
	* libcoff.h: Regenerate.
	* coffcode.h (coff_write_object_contents): Run build_id
	after_write_object_contents hook.

	* pe.h (external_IMAGE_DEBUG_DIRECTORY, _CV_INFO_PDB70)
	(_CV_INFO_PDB20): Add structures and constants for debug directory
	and codeview records.
	* internal.h (internal_IMAGE_DEBUG_DIRECTORY, CODEVIEW_INFO):
	Add structures and constants for internal representation of debug
	directory and codeview records.

	* emultempl/elf32.em (id_note_section_size, read_hex, write_build_id):
	Move code for parsing build-id option and calculating the build-id to...
	* ldbuildid.c: New file.
	* ldbuildid.h: New file.
	* Makefile.am (CFILES, HFILES, OFILES, ld_new_SOURCES): Add new
	files.
	* Makefile.in: Regenerate.
	* ld.texinfo: Update --build-id description to mention COFF
	support.
	* NEWS: Mention support for COFF build ids.
	* emultempl/pe.em (gld${EMULATION_NAME}_handle_option):
	(pecoff_checksum_contents, write_build_id, setup_build_id)
	(gld_${EMULATION_NAME}_after_open):  Handle and implement
	build-id option.
	* emultempl/pep.em: Likewise.
2014-04-08 10:59:43 +01:00
Andreas Schwab 17c34b8f3d Fix spurious failures in ld-plugin/lto.exp
* ld-plugin/lto.exp: Make "-Wp," prefix optional when filtering
out _FORTIFY_SOURCE.
("Build libdummy.a 9", "PR ld/12696"): Mark as c++.
2014-04-07 19:07:03 +02:00
Cary Coutant abc9061b5c Document optional comma in linker script.
The linker script documentation does not mention the optional comma
that may follow an output section command or an overlay command.
In some cases, where a fill expression is used, and the next
output section command begins with an operator (e.g., "/DISCARD/"),
the comma may be required to separate the two commands.

Currently, GNU ld doesn't require the comma, but gold does.

ld/
	PR gold/16804
	* ld.texinfo: Document optional comma following output section
	command and overlay command.
2014-04-04 09:28:51 -07:00
Alan Modra ffe54b3798 Pad sections according to current script FILL.
When aligning input sections, we are supposed to take the fill pattern
from a FILL statement, if there is one in the output section statement.

ld/
	* ldlang.c (lang_size_sections_1 <lang_input_section_enum>): Use
	current "fill", not "output_section_statement->fill".
ld/testsuite/
	* ld-scripts/fill.d, * ld-scripts/fill.t, * ld-scripts/fill_0.s,
	* ld-scripts/fill_1.s, * ld-scripts/fill_2.s: New test.
	* ld-scripts/data.exp: Run it.
2014-04-04 19:06:35 +10:30
Nick Clifton 76f0cad6f4 This is a fix for PR ld/16744 which showed that an object file linked with -r and -z [no]execstack
would not honour the [no]execstack.  Fully linked binaries use a special segment to indicate the
state of the stack, but relocatable object files only have sections, and .note.GNU-stack was not
being created.

	* emultempl/elf32.em (_after_open): Create a .note.GNU-stack
	section when performing a relocatable link with -z [no]execstack
	specified.
2014-03-31 13:14:44 +01:00
Marcus Shawcroft 72c56015dd [AArch64] Fixup ld-aarch64/eh-frame.d expected PC range.
Fix the expected output for ld-aarch64/eh-frame.d.  This issue was
exposed by the recent fix to the output of objdump -Wf here:
https://sourceware.org/ml/binutils/2014-03/msg00251.html
2014-03-31 12:58:48 +01:00
Chris Faylor 8547a0f903 * ChangeLog: Fix duplicate entry. Set date on entry correctly. 2014-03-29 16:01:46 -04:00
H.J. Lu 4c6d802e59 Scan all input files for symbol reference warning
This patch scans all input files for symbol reference warning if the
symbol reference doesn't exist in the current input file.

ld/

	PR ld/16756
	* ldmain.c (symbol_warning): New function.
	(warning_callback): Use it.  Scan all input files for a reference
	to SYMBOL.

ld/testsuite/

	PR ld/16756
	* ld-plugin/lto.exp: Expect filename and line number for PR
	ld/12760 test.
2014-03-27 08:12:17 -07:00
Yury Gribov 6a631e86cf Add support for limited pretty-printing of ARM PLT entries on eabi and nacl targets.
* elf32-arm.c (elf32_arm_get_synthetic_symtab): Add new callback.
    	(elf32_arm_nacl_plt_sym_val): Likewise.
    	(elf32_arm_plt0_size): Add helper function.
    	(elf32_arm_plt_size): Likewise.

    	* ld-arm/arm-app-abs32.d: Updated test.
    	* ld-arm/arm-app.d: Likewise.
    	* ld-arm/arm-lib-plt32.d: Likewise.
    	* ld-arm/arm-lib.d: Likewise.
    	* ld-arm/armthumb-lib.d: Likewise.
    	* ld-arm/cortex-a8-fix-b-plt.d: Likewise.
    	* ld-arm/cortex-a8-fix-bcc-plt.d: Likewise.
    	* ld-arm/cortex-a8-fix-bl-plt.d: Likewise.
    	* ld-arm/cortex-a8-fix-bl-rel-plt.d: Likewise.
    	* ld-arm/cortex-a8-fix-blx-plt.d: Likewise.
    	* ld-arm/farcall-mixed-app-v5.d: Likewise.
    	* ld-arm/farcall-mixed-app.d: Likewise.
    	* ld-arm/farcall-mixed-lib-v4t.d: Likewise.
    	* ld-arm/farcall-mixed-lib.d: Likewise.
    	* ld-arm/ifunc-10.dd: Likewise.
    	* ld-arm/ifunc-14.dd: Likewise.
    	* ld-arm/ifunc-15.dd: Likewise.
    	* ld-arm/ifunc-3.dd: Likewise.
    	* ld-arm/ifunc-4.dd: Likewise.
    	* ld-arm/ifunc-7.dd: Likewise.
    	* ld-arm/ifunc-8.dd: Likewise.
    	* ld-arm/ifunc-9.dd: Likewise.
    	* ld-arm/long-plt-format.d: Likewise.
    	* ld-arm/mixed-app-v5.d: Likewise.
    	* ld-arm/mixed-app.d: Likewise.
    	* ld-arm/mixed-lib.d: Likewise.
    	* ld-arm/thumb2-bl-undefweak.d: Likewise.
    	* ld-arm/thumb2-bl-undefweak1.d: Likewise.
2014-03-27 13:54:03 +00:00
Alan Modra f6c7c3e8b7 Referencing a function's address on PowerPC64 ELFv2
ELFv2 needs to create plt entries in a non-PIC executable for an
address reference to a function defined in a shared object.  It's
possible that an object file has no features that distinguish it as
ELFv1 or ELFv2, eg. an object only containing data.  Such files need
to be handled like those that are known to be ELFv2.
However, this unnecessarily creates plt entries for the analogous
ELFv1 case, so arrange to set output abi version earlier, and use the
output abi version to further distinguish ambiguous input files.

bfd/
	* elf64-ppc.c (ppc64_elf_check_relocs): Account for possibly
	needed plt entries when taking the address of functions for
	abiversion == 0 (ie. unknown) as well as abiversion == 2.
	Move opd setup and abiversion checks to..
	(ppc64_elf_before_check_relocs): ..here.  Renamed from
	ppc64_elf_process_dot_syms.  Set output abiversion from input and
	input abiversion from output, if either is not set.
	(ppc64_elf_merge_private_bfd_data): Don't merge flags here.
	(elf_backend_check_directives): Update.
ld/testsuite/
	* ld-powerpc/startv1.s, * ld-powerpc/startv2.s, * ld-powerpc/funref.s,
	* ld-powerpc/funv1.s, * ld-powerpc/funv2.s,
	* ld-powerpc/ambiguousv1.d, * ld-powerpc/ambiguousv2.d: New test files.
	* ld-powerpc/powerpc.exp: Run new tests.
2014-03-27 00:49:38 +10:30
Will Newton c955de363b bfd/elfnn-aarch64.c: Fix calculation of DT_RELASZ
The current code subtracts the size of the output section containing
relplt from RELASZ. In some cases this will be the same output
section as the dynamic relocs causing a value of zero to be output.
Calculating the size from input sections seems to make more sense.

bfd/ChangeLog:

2014-03-25  Will Newton  <will.newton@linaro.org>

	 * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_sections):
	 Set value of DT_PLTRELSZ and DT_RELASZ based on the size
	 of input sections rather than output sections.

ld/testsuite/ChangeLog:

2014-03-25  Will Newton  <will.newton@linaro.org>

	 * ld-aarch64/aarch64-elf.exp: Add relasz dump test.
	 * ld-aarch64/relasz.d: New file.
	 * ld-aarch64/relasz.s: Likewise.
2014-03-25 09:01:50 +00:00
Chris Faylor d0e6d77b3f 2014-03-21 Christopher Faylor <me.binutils2014@cgf.cx>
* ld.texinfo: Document change in handling of --enable-auto-image-base.
	* emultempl/pe.em (pe_auto_image_base): Set to default base.
	(gld_${EMULATION_NAME}_list_options): Change usage message to reflect
	optional --enable-auto-image-base argument.
	(gld${EMULATION_NAME}_handle_option): Handle optional
	--enable-auto-image-base argument.
	(compute_dll_image_base): Eliminate constant.  Use pe_auto_image_base.
2014-03-21 13:33:43 -04:00
Richard Sandiford d56a8dda6d gas/
* config/tc-mips.h (DIFF_EXPR_OK, CFI_DIFF_EXPR_OK): Define.
	* config/tc-mips.c (md_pcrel_from): Remove error message.
	(md_apply_fix): Convert PC-relative BFD_RELOC_32s to
	BFD_RELOC_32_PCREL.  Report a specific error message for unhandled
	PC-relative expressions.  Handle BFD_RELOC_8.

gas/testsuite/
	* gas/all/gas.exp: Remove XFAIL of forward.d for MIPS.
	* gas/mips/pcrel-1.s, gas/mips/pcrel-1.d, gas/mips/pcrel-2.s,
	gas/mips/pcrel-2.d, gas/mips/pcrel-3.s, gas/mips/pcrel-3.l,
	gas/mips/pcrel-4.s, gas/mips/pcrel-4-32.d, gas/mips/pcrel-4-n32.d,
	gas/mips/pcrel-4-64.d: New tests.
	* gas/mips/mips.exp: Run them.
	* gas/mips/lui-2.l: Tweak error message for line 7.

ld/testsuite/
	* ld-elf/merge.d: Remove MIPS XFAIL.
2014-03-20 21:18:43 +00:00
Will Newton 97323ad113 bfd/elf32-arm.c: Set st_value to zero for undefined symbols
Unless pointer_equality_needed is set then set st_value to be zero
for undefined symbols.

bfd/ChangeLog:

2014-03-20  Will Newton  <will.newton@linaro.org>

	PR ld/16715
	* elf32-arm.c (elf32_arm_check_relocs): Set
	pointer_equality_needed for absolute references within
	executable links.
	(elf32_arm_finish_dynamic_symbol): Set st_value to zero
	unless pointer_equality_needed is set.

ld/testsuite/ChangeLog:

2014-03-20  Will Newton  <will.newton@linaro.org>

	* ld-arm/ifunc-14.rd: Update symbol values.
2014-03-20 11:43:33 +00:00
Nick Clifton 6caf711179 Improve .rsrc section merging again. This time with an algorithm that
should work for all types of input .rsrc section.

	* peXXigen.c (rsrc_process_section): Add code to scan input
	sections and record their lengths.  Use these lengths to find the
	start of each merged .rsrc section.

	* scripttempl/pe.sc (R_RSRC): Fix default-manifest exclusion.
	(.rsrc): Add SUBALIGN(4).  Remove SORT.
	* scripttempl/pep.sc: Likewise.
2014-03-19 14:46:15 +00:00
Nick Clifton e57190430e Fix RX linker testsuite failures by making the assembler use conventional section names.
* config/default.exp (ASFLAGS): For the RX target add:
	-muse-conventional-section-names.
2014-03-19 12:21:39 +00:00
Nick Clifton 1d63324c56 Improve .rsrc section merging with better handling of the alignment adjustments
made between merged .rsrc sections.

	* peXXigen.c (rsrc_align): New function.  Attempts to cope with
	alignment variances when .rsrc sections are merged.
	(rsrc_process_section): Use rsrc_align.

	* Makefile.am (default-manifest.o): Use WINDRES_FOR_TARGET.
	* Makefile.in: Regenerate.
	* emultempl/default-manifest.rc: Fix typo.
	* scripttempl/pe.sc (R_RSRC): Fix default-manifest exclusion.
	(.rsrc): Add SUBALIGN(4).
	* scripttempl/pep.sc: Likewise.
2014-03-19 08:51:20 +00:00
Chris Faylor c712f1e3f7 2014-03-17 Christopher Faylor <me.cygwin2014@cgf.cx>
* Makefile.am: Use host version of windres.
	* Makefile.in: Regenerate.
2014-03-17 13:19:49 -04:00
Alan Modra e5b98723a5 Correct ld-powerpc/vle-reloc-2 test
* ld-powerpc/vle-reloc-3.d: Remove addresses.
2014-03-15 00:12:56 +10:30
Alan Modra c3301df1da Fix overflow handling of VLE_SDA21
bfd/
	* elf32-ppc.c (ppc_elf_relocate_section): Correct overflow
	handling for VLE_SDA21 relocs.
ld/testsuite/
	* ld-powerpc/vle.ld: Place .PPC.EMB.sdata0 within 32k of 0.
	* ld-powerpc/vle-reloc-3.d: Update.
2014-03-14 15:01:53 +10:30
Alan Modra d4ae5fb0b5 Remove search path from -l:namespec DT_NEEDED
For libraries without a soname, -l:libfoo.so set DT_NEEDED to the search
dir plus filename, while gold and -lfoo just use the filename.  This
patch fixes the inconsistency.

	* ldlang.h (full_name_provided): New input flag.
	* ldlang.c (new_afile): Don't use lang_input_file_is_search_file_enum
	for -l:namespec.  Instead use lang_input_file_is_l_enum with
	full_name_provided flag.
	* ldlfile.c (ldfile_open_file_search): Don't complete lib name if
	full_name_provided flag is set.
	* emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive):
	Handle full_name_provided libraries.  Tidy EXTRA_SHLIB_EXTENSION
	support.  Set DT_NEEDED for -l:namespec as namespec.
	* emultempl/aix.em (ppc_after_open_output): Handle full_name_provided.
	* emultempl/linux.em (gld${EMULATION_NAME}_open_dynamic_archive):
	Don't handle full_name_provided libraries.
	* emultempl/pe.em (gld${EMULATION_NAME}_open_dynamic_archive): Ditto.
	* emultempl/pep.em (gld${EMULATION_NAME}_open_dynamic_archive): Ditto.
	* emultempl/vms.em (gld${EMULATION_NAME}_open_dynamic_archive): Ditto.
2014-03-14 12:54:24 +10:30
Alan Modra fa47fa9246 autoreconf
Regenerate Makefile.in in bfd, binutils, gas, gold, gprof, ld, opcodes.
Regenerate gas/config.in.
2014-03-12 15:02:00 +10:30
Roland McGrath c125dbfb8c Apply ld-arm/gc-hidden-1 to all ELF targets, not just *eabi* targets
ld/testsuite/
	* ld-arm/gc-hidden-1.d: Remove target, add not-target to match
	other ELF-only tests in this directory.  Loosen regexps so they
	don't care what the exact addresses are.
2014-03-06 09:46:15 -08:00
Roland McGrath 8548f8419a Disable --long-plt test for arm-nacl targets.
ld/testsuite/
	* ld-arm/arm-elf.exp (armelftests_common): Move long-plt case ...
	(armelftests_nonacl): ... here.
2014-03-06 09:44:25 -08:00
Alan Modra 4b95cf5c0c Update copyright years 2014-03-05 22:16:15 +10:30
Alan Modra 45965137be Support R_PPC64_ADDR64_LOCAL
This adds support for "func@localentry", an expression that returns the
ELFv2 local entry point address of function "func".  I've excluded
dynamic relocation support because that obviously would require glibc
changes.

include/elf/
	* ppc64.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
bfd/
	* elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_ADDR64_LOCAL entry.
	(ppc64_elf_reloc_type_lookup): Support R_PPC64_ADDR64_LOCAL.
	(ppc64_elf_check_relocs): Likewise.
	(ppc64_elf_relocate_section): Likewise.
	* Add BFD_RELOC_PPC64_ADDR64_LOCAL.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
gas/
	* config/tc-ppc.c (ppc_elf_suffix): Support @localentry.
	(md_apply_fix): Support R_PPC64_ADDR64_LOCAL.
ld/testsuite/
	* ld-powerpc/elfv2-2a.s, ld-powerpc/elfv2-2b.s: New files.
	* ld-powerpc/elfv2-2exe.d, ld-powerpc/elfv2-2so.d: New files.
	* ld-powerpc/powerpc.exp: Run new test.
elfcpp/
	* powerpc.h (R_PPC64_REL24_NOTOC, R_PPC64_ADDR64_LOCAL): Define.
gold/
	* powerpc.cc (Target_powerpc::Scan::local, global): Support
	R_PPC64_ADDR64_LOCAL.
	(Target_powerpc::Relocate::relocate): Likewise.
2014-03-05 19:57:39 +10:30
Nick Clifton 0b55a33ebe Remove default-manifest from ALL_EMUL_EXTRA_BINARIES so that it is not mistakenly
built when constructing a toolchain configued from all targets.

	* Makefile.am (ALL_EMUL_EXTRA_BINARIES): Remove default-manifest.
	* Makefile.in: Regenerate.
2014-03-04 17:22:46 +00:00
Alan Modra 2c80b75360 Fix various copyright issues
binutils/
	* README: Add "Copyright Notices" paragraph.
gas/
	* config/bfin-lex-wrapper.c: Correct copyright date.
	* config/tc-frv.c: Correct copyright punctuation.
	* config/tc-ip2k.c: Likewise.
	* config/tc-iq2000.c: Likewise.
	* config/tc-mep.c: Likewise.
	* config/tc-tic4x.c: Likewise.
	* config/tc-tic4x.h: Likewise.
ld/testsuite/
	* ld-scripts/phdrs2.exp: Correct copyright punctuation.
	* ld-v850/v850.exp: Correct copyright typo.
opcodes/
	* i386-gen.c (process_copyright): Emit copyright notice on one line.
gold/
	* dwp.cc (print_version): Update copyright year to current.
2014-03-03 11:03:08 +10:30
Yuri Gribov 512c56d662 ld-arm/long-plt-format.d, ld-arm/arm-elf.exp: Adjust for arm-eabi. 2014-03-01 12:19:53 +01:00
Yuri Gribov 1db37fe627 This patch adds support for ARM PLT entries that support a full 32-bit offset range.
Enabled via the use of a new linker command line option: --long-plt.

	* bfd-in.h: Add export of bfd_elf32_arm_use_long_plt.
	* bfd-in2.h: Regenerate.
	* elf32-arm.c (elf32_arm_plt_entry_long): New array.
	(elf32_arm_link_hash_table_create): Set plt_entry_size to 16 if
	using long PLT entries.
	(bfd_elf32_arm_use_long_plt): New function.
	(elf32_arm_populate_plt_entry): Add support for long PLT entries.

	* emultempl/armelf.em (OPTION_LONG_PLT): Define.
	(PARSE_AND_LIST_LONGOPTS): Add long-plt.
	(PARSE_AND_LIST_OPTIONS): Likewise.
	(PARSE_AND_LIST_ARGS_CASES): Handle long-plt.
	* ld.texinfo: Document --long-plt.

	* ld-arm/long-plt-format.s: New test case.
	* ld-arm/long-plt-format.d: Expected disassembly.
	* ld-arm/arm-elf.exp: Run the new test.
2014-02-27 14:35:37 +00:00
Nick Clifton 5063daf735 This patch adds a default manifest in to the final links performed by the Cygwin and MinGW targets.
The manifest is necessary in order for the linked binaries to be executed in a Windows 8 environment.

The manifest is added using a linker script so that this feature will be compiler-neutral.  The resource
merging code in the linker means that if an application provides its own manifest then the default
manifest will be ignored.

	* configure.in (all_emul_extra_binaries): New variable.  Populated
	by invoking configure.tgt.
	(EMUL_EXTRA_BINARIES): New substitution.
	* configure: Regenerate.
	* configure.tgt (target_extra_binaries): New variable.  Set to
	default-manifest.o for Cygwin and MinGW targets.
	* Makefile.am (EMUL_EXTRA_BINARIES): New variable.  Initialised
	by the configure script.
	(ALL_EMUL_EXTRA_BINARIES): New variable.
	(default-manifest.o): New rule to build the default manifest.
	(ld_new_DEPENDENCIES): Add EMUL_EXTRA_BINARIES.
	(install-data-local): Add EMUL_EXTRA_BINARIES.
	* Makefile.in: Regenerate.
	* ld.texinfo: Document default manifest support.
	* emulparams/i386pe.sh (DEFAULT_MANIFEST): Define.
	* emulparams/i386pep.sh (DEFAULT_MANIFEST): Define.
	* emultempl/default-manifest.rc: New file.
	* scripttempl/pe.sc (R_RSRC): Include DEFAULT_MANIFEST, if defined.
	* scripttempl/pep.sc (R_RSRC): Likewise.

	* ld-pe/longsecn-1.d: Allow for extra sections.
	* ld-pe/longsecn-2.d: Likewise.
	* ld-pe/longsecn.d: Likewise.
	* ld-pe/secrel.d: Likewise.
2014-02-27 14:13:43 +00:00
Alan Modra db434ba03e Fix ELF ppc32 targets that don't use ppc32elf.em
5446cbdf82 broke powerpc-lynxos,
powerpc-netware, powerpc-windiss and powerpc-vxworks.

bfd/
	* elf32-ppc.c (ppc_elf_link_hash_table_create): Provide default
	params for targets that don't use ppc32elf.em.
ld/
	* emulparams/elf32ppcvxworks.sh: Source plt_unwind.sh and
	use ppc32elf.em.
	* emultempl/ppc32elf.em (ppc_after_open): Don't compile for
	vxworks.
	(LDEMUL_AFTER_OPEN): Don't set for vxworks.
	(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Exclude
	-secure-plt, -bss-plt and -sdata-got when vxworks.
2014-02-27 23:39:01 +10:30
Dan Mick e3e3703534 Resolve PR ld/16569 by emitting (and comparing) unmangled names, unless
demangling has specifically been requested.
2014-02-26 12:05:02 +00:00
Alan Modra 0cbc458c9f Add file missed from last commit. 2014-02-21 23:18:50 +10:30
Alan Modra a97726da10 Add ppc476 workaround bootstrap test
I was running this by hand to test out --ppc476-workaround.  Another
bootstrap test doesn't take all that long, so let's add it to the
testsuite.

	* ld-bootstrap/bootstrap.exp: Add ppc476 workaround test.
	* ld-bootstrap/ppc476.t: New file.
2014-02-21 10:22:51 +10:30
H.J. Lu 0ff2b86e7c Create the second PLT for BND relocations
Intel MPX introduces 4 bound registers, which will be used for parameter
passing in x86-64.  Bound registers are cleared by branch instructions.
Branch instructions with BND prefix will keep bound register contents.
This leads to 2 requirements to 64-bit MPX run-time:

1. Dynamic linker (ld.so) should save and restore bound registers during
symbol lookup.
2. Change the current 16-byte PLT0:

  ff 35 08 00 00 00	pushq  GOT+8(%rip)
  ff 25 00 10 00	jmpq  *GOT+16(%rip)
  0f 1f 40 00		nopl   0x0(%rax)

and 16-byte PLT1:

  ff 25 00 00 00 00    	jmpq   *name@GOTPCREL(%rip)
  68 00 00 00 00       	pushq  $index
  e9 00 00 00 00       	jmpq   PLT0

which clear bound registers, to preserve bound registers.

We use 2 new relocations:

to mark branch instructions with BND prefix.

When linker sees any R_X86_64_PC32_BND or R_X86_64_PLT32_BND relocations,
it switches to a different PLT0:

  ff 35 08 00 00 00	pushq  GOT+8(%rip)
  f2 ff 25 00 10 00	bnd jmpq *GOT+16(%rip)
  0f 1f 00		nopl   (%rax)

to preserve bound registers for symbol lookup and it also creates an
external PLT section, .pl.bnd.  Linker will create a BND PLT1 entry
in .plt:

  68 00 00 00 00       	pushq  $index
  f2 e9 00 00 00 00     bnd jmpq PLT0
  0f 1f 44 00 00        nopl 0(%rax,%rax,1)

and a 8-byte BND PLT entry in .plt.bnd:

  f2 ff 25 00 00 00 00  bnd jmpq *name@GOTPCREL(%rip)
  90			nop

Otherwise, linker will create a legacy PLT1 entry in .plt:

  68 00 00 00 00       	pushq  $index
  e9 00 00 00 00        jmpq PLT0
  66 0f 1f 44 00 00     nopw 0(%rax,%rax,1)

and a 8-byte legacy PLT in .plt.bnd:

  ff 25 00 00 00 00     jmpq  *name@GOTPCREL(%rip)
  66 90                 xchg  %ax,%ax

The initial value of the GOT entry for "name" will be set to the the
"pushq" instruction in the corresponding entry in .plt.  Linker will
resolve reference of symbol "name" to the entry in the second PLT,
.plt.bnd.

Prelink stores the offset of pushq of PLT1 (plt_base + 0x10) in GOT[1]
and GOT[1] is stored in GOT[3].  We can undo prelink in GOT by computing
the corresponding the pushq offset with

GOT[1] + (GOT offset - &GOT[3]) * 2

Since for each entry in .plt except for PLT0 we create a 8-byte entry in
.plt.bnd, there is extra 8-byte per PLT symbol.

We also investigated the 16-byte entry for .plt.bnd.  We compared the
8-byte entry vs the the 16-byte entry for .plt.bnd on Sandy Bridge.
There are no performance differences in SPEC CPU 2000/2006 as well as
micro benchmarks.

Pros:
	No change to undo prelink in dynamic linker.
	Only 8-byte memory overhead for each PLT symbol.
Cons:
	Extra .plt.bnd section is needed.
	Extra 8 byte for legacy branches to PLT.
	GDB is unware of the new layout of .plt and .plt.bnd.

bfd/

	* elf64-x86-64.c (elf_x86_64_bnd_plt0_entry): New.
	(elf_x86_64_legacy_plt_entry): Likewise.
	(elf_x86_64_bnd_plt_entry): Likewise.
	(elf_x86_64_legacy_plt2_entry): Likewise.
	(elf_x86_64_bnd_plt2_entry): Likewise.
	(elf_x86_64_bnd_arch_bed): Likewise.
	(elf_x86_64_link_hash_entry): Add has_bnd_reloc and plt_bnd.
	(elf_x86_64_link_hash_table): Add plt_bnd.
	(elf_x86_64_link_hash_newfunc): Initialize has_bnd_reloc and
	plt_bnd.
	(elf_x86_64_copy_indirect_symbol): Also copy has_bnd_reloc.
	(elf_x86_64_check_relocs): Create the second PLT for Intel MPX
	in 64-bit mode.
	(elf_x86_64_allocate_dynrelocs): Handle the second PLT for IFUNC
	symbols.  Resolve call to the second PLT if it is created.
	(elf_x86_64_size_dynamic_sections): Keep the second PLT section.
	(elf_x86_64_relocate_section): Resolve PLT references to the
	second PLT if it is created.
	(elf_x86_64_finish_dynamic_symbol): Use BND PLT0 and fill the
	second PLT entry for BND relocation.
	(elf_x86_64_finish_dynamic_sections): Use MPX backend data if
	the second PLT is created.
	(elf_x86_64_get_synthetic_symtab): New.
	(bfd_elf64_get_synthetic_symtab): Likewise.  Undefine for NaCl.

ld/

	* emulparams/elf_x86_64.sh (TINY_READONLY_SECTION): New.

ld/testsuite/

	* ld-x86-64/mpx.exp: Run bnd-ifunc-1 and bnd-plt-1.
	* ld-x86-64/bnd-ifunc-1.d: New file.
	* ld-x86-64/bnd-ifunc-1.s: Likewise.
	* ld-x86-64/bnd-plt-1.d: Likewise.
2014-02-19 11:48:23 -08:00
Alan Modra 7d4c687d56 Control powerpc64-ld provision of register save/restore
This patch allows the user to override powerpc64-ld's default for
providing linker generated register save and restore functions as used
by gcc -Os code.  Normally these are not provided by ld -r, so Linux
kernel modules have needed to include their own copies.

bfd/
	* elf64-ppc.h (struct ppc64_elf_params): Add save_restore_funcs.
	* elf64-ppc.c (ppc64_elf_func_desc_adjust): Use it to control
	provision of out-of-line register save/restore routines.
ld/
	* emultempl/ppc64elf.em (params): Init new field.
	(ppc_create_output_section_statements): Set params.save_restore_funcs
	default.
	(PARSE_AND_LIST_*): Add support for --save-restore-funcs and
	--no-save-restore-funcs.
2014-02-19 14:53:50 +10:30
Jack Carter 5db3e65d39 The PT_DYNAMIC segment was being hard coded to have read, write, and
execute permission regardless of the underlying PT_LOAD segment permissions.
Deleting this code allows the default linker behavior which is to set the
dynamic segment to the same permissions as the sections that make it up.

This change alters one existing test case to check the segment flags for
PT_DYNAMIC.

bfd/ChangeLog
        * elfxx-mips.c(_bfd_mips_elf_modify_segment_map): Deleted hard coding of
        PT_DYNAMIC segment flags.

ld/testsuite/ChangeLog
	* ld-mips-elf/pic-and-nonpic-3a.sd: Check DYNAMIC segment flags.
2014-02-18 16:23:48 -08:00
Alan Modra e7d1c40ce5 Consolidate ppc64 ld/bfd communication
Moves assorted variables used to communicate between ld and bfd into
a struct, hooks it into the bfd link_hash_table early, and removes
all other places where such variables were passed piecemeal.

bfd/
	* elf64-ppc.h (struct ppc64_elf_params): Define.
	(ppc64_elf_init_stub_bfd, ppc64_elf_edit_opd, ppc64_elf_tls_setup,
	ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
	ppc64_elf_build_stubs): Update prototype.
	* elf64-ppp.c (struct ppc_link_hash_table): Add params, delete other
	fields now in params.  Adjust code throughout file.
	(ppc64_elf_init_stub_bfd): Delete "abfd" parameter, add "params".
	Save params pointer in htab.
	(ppc64_elf_edit_opd, ppc64_elf_tls_setup,
	ppc64_elf_setup_section_lists, ppc64_elf_size_stubs,
	ppc64_elf_build_stubs): Remove parameters now in "params".
ld/
	* emultemps/ppc64elf.em (params): New static struct replacing
	various other static vars.  Adjust code throughout file.
2014-02-17 17:11:11 +10:30
Alan Modra 668e22e51b ppc476 workaround for ld -r fixes
This fixes the glaring error that the ppc476 workaround wasn't
actually enabled for ld -r, and adjusts relocations to match moved
code.

bfd/
	* elf32-ppc.c (ppc_elf_relocate_section): Move relocs on insns
	patched for ppc476 workaround.  Reapply branch taken/not taken
	relocs.
ld/
	* emultempl/ppc32elf.em (ppc_after_open_output): Really enable
	ppc476 workaround for ld -r.
2014-02-17 17:00:19 +10:30
Thomas Schwinge 6e03f3da7d Missing ChangeLog entry from commit 60ef20e285. 2014-02-16 09:01:29 +01:00
Thomas Schwinge 60ef20e285 ld: Remove Hurd-specific XFAILs related to weak symbols.
This has been fixed properly, in glibc.

	ld/testsuite/
	* ld-elfweak/elfweak.exp (setup_xfail_gnu_hurd): Remove function
	and all usage of it.
2014-02-16 08:30:25 +01:00
Alan Modra 795bc6b3ea Enable ppc476 workaround for ld -r.
The Linux kernel builds modules using ld -r.  These might need the
ppc476 workaround, so enable it for ld -r if sections have sufficient
alignment to tell location within a page.

bfd/
	* elf32-ppc.c (ppc_elf_relax_section): Enable ppc476 workaround
	for ld -r, when code sections are sufficiently aligned.
	* elf32-ppc.h (struct ppc_elf_params): Delete pagesize.  Add
	pagesize_p2.
ld/
	* emultempl/ppc32elf.em (pagesize): New static var.
	(ppc_after_open_output): Set params.pagesize_p2 from pagesize.
	(PARSE_AND_LIST_ARGS_CASES): Adjust to use pagesize.
2014-02-12 22:10:09 +10:30
Andrew Pinski 7d0edd4bb6 2014-02-11 Andrew Pinski <apinski@cavium.com>
* emulparams/aarch64linux32.sh (LIBPATH_SUFFIX): Change to ilp32.
	(ELF_INTERPRETER_NAME): Define.
	* emulparams/aarch64linux32b.sh (ELF_INTERPRETER_NAME): Define.
2014-02-11 11:16:30 -08:00
H.J. Lu d6f6f45577 Mark symbol in executables if it matches dynamic_list
bfd/

	PR gold/16530
	* elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark symbol in
	executables if it matches dynamic_list.

ld/testsuite/

	PR gold/16530
	* ld-elf/dynamic-1.c: New file.
	* ld-elf/dynamic-1.rd: Likewise.
	* ld-elf/dynamic-1.syms: Likewise.

	* ld-elf/shared.exp (build_tests): Add dynamic-1.
2014-02-10 08:05:54 -08:00
Alan Modra c1c69e839e binutils potfiles regen
Adds nds32 files to POTFILES.in
2014-02-10 09:59:35 +10:30
Alan Modra 5446cbdf82 ppc476 icache bug workaround
This implements a work-around for an icache bug on 476 that can cause
execution of stale instructions when control falls through from one
page to the next.  The idea is to prevent such fall-through by
replacing the last instruction on a page with a branch to a patch
area containing the instruction, then branch to the next page.

The patch also fixes a number of bugs in the existing support for long
branch trampolines.

bfd/
	* elf32-ppc.c (struct ppc_elf_link_hash_table): Add params.
	Delete emit_stub_syms, no_tls_get_addr_opt.  Update all uses.
	(ppc_elf_link_params): New function.
	(ppc_elf_create_glink): Align .glink to 64 bytes for ppc476
	workaround.
	(ppc_elf_select_plt_layout): Remove plt_style and emit_stub_syms
	parameters.  Use htab->params instead.
	(ppc_elf_tls_setup): Remove no_tls_get_addr_opt parameter.
	(ppc_elf_size_dynamic_sections): Align __glink_PLTresolve to
	64 bytes for ppc476 workaround.
	(struct ppc_elf_relax_info): New.
	(ppc_elf_relax_section): Exclude linker created sections and
	those too small to hold one instruction.  Don't add another
	branch 	around trampolines on later relax passes.  Don't
	generate trampolines for undefined symbols when !relocatable,
	nor for plugin symbols.  Allocate space for ppc476 workaround
	patch area.  Free fixups on error return path.
	(ppc_elf_relocate_section): Handle ppc476 workaround patching.
	* elf32-ppc.h (struct ppc_elf_params): New.
	(ppc_elf_select_plt_layout, ppc_elf_tls_setup): Update prototype.
	(ppc_elf_link_params): Declare.
	* section.c (SEC_INFO_TYPE_TARGET): Define.
	* bfd-in2.h: Regenerate.
ld/
	* emultempl/ppc32elf.em (no_tls_get_addr_opt, emit_stub_syms)
	plt_style): Delete.  Adjust all refs to instead use..
	(params): ..this.  New variable.
	(ppc_after_open_output): New function.  Tweak params and pass to
	ppc_elf_link_params.
	(ppc_after_open): Adjust ppc_elf_select_plt_layout call.
	(ppc_before_allocation): Adjust ppc_elf_tls_setup call.  Enable
	relaxation for ppc476 workaround.
	(PARSE_AND_LIST_*): Add --{no-,}ppc476-workaround support.
	(LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Define.
2014-02-03 20:24:20 +10:30
Sebastian Huber 13075d049d Fix ALIGN_WITH_INPUT
ld/

2014-02-02  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	* ld/ld.texinfo: Change ALIGN_WITH_INPUT documentation.
	* ld/ldlang.c (lang_size_sections_1): Add dotdelta
	variable which reflects the VMA change due to alignment
	requirements.  Use dotdelta do change the LMA if
	ALIGN_WITH_INPUT is requested.

ld/testsuite/ChangeLog

2014-02-02  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	* ld-scripts/rgn-at9.d: New file.
	* ld-scripts/rgn-at9.t: Likewise.
	* ld-scripts/rgn-at10.d: Likewise.
	* ld-scripts/rgn-at10.s: Likewise.
	* ld-scripts/rgn-at10.t: Likewise.
	* ld-scripts/rgn-at11.d: Likewise.
	* ld-scripts/rgn-at11.t: Likewise.
2014-02-02 06:39:39 -08:00
Hans-Peter Nilsson 0a09fb4a09 Fix MMIX build breakage from bfd_set_section_vma change.
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): Fix typo in
	call to bfd_set_section_vma exposed by recent bfd_set_section_vma
	change.
2014-02-01 01:11:28 +01:00
Sandra Loosemore 78058a5e4f Nios II CALL26 linker relaxation
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-30 17:47:07 -08:00
H.J. Lu 50a53d3ffe Add rdynamic-1 test
It is added for

commit 409ff343a4
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-29 14:30:41 -08:00
Nick Clifton 1ade065130 The MSP430 linker contains emulations for old and obsolete MCU types.
Since all MCUs now have their own specific linker script (courtesy of
TI) there is no need for these emulations and so this patch removes
them.

	* Makefile.am: Remove obsolete MSP430 emulations.
	* configure.tgt: Likewise.
	* emulparams/msp430all.sh: Likewise.
	* Makefile.in: Regenerate.
2014-01-28 12:25:48 +00:00
Nick Clifton bcf1df010c Update the tic6x linker tests to match the current behaviour of the linker 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-28 11:56:13 +00:00
H.J. Lu a5262f834a Replace .align with .p2align
* ld-elf/pr16498a.s: Replace .align with .p2align.
2014-01-24 10:01:56 -08:00
H.J. Lu a78ad74bbf Add another testcase for PR ld/16498
PR ld/16498
	* ld-elf/pr16498b.d: New file.
	* ld-elf/pr16498b.t: Likewise.
2014-01-24 09:03:21 -08:00
H.J. Lu d85e71fec0 Improve orphaned TLS section handling
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-24 08:56:07 -08:00
Alan Modra d9d94ac86b TLS orphan section placement
Ensures TLS orphans are placed adjacent to existing TLS sections,
and fixes places where the output_section_statement flags (which might
not be set) were tested when bfd_section flags were available.

	* ldlang.c (lang_output_section_find_by_flags): Be careful to
	test look->bfd_section->flags if available rather than
	look->flags.  Separate SEC_THREAD_LOCAL handling from
	SEC_READONLY loop, and rewrite.
2014-01-24 23:17:28 +10:30
Alan Modra 16e4ecc0db Display the reference causing a shared library to be needed
Adds a section for --as-needed libraries to a linker map file, similar
to what we do for archive libraries.

bfd/
	* elflink.c (elf_link_add_object_symbols): Call minfo for --as-needed.
ld/
	* ldlang.c (asneeded_list_head, asneeded_list_tail): New vars.
	(lang_init): Initialise them.
	(lang_print_asneeded): New function.
	(lang_process): Call lang_print_asneeded.
	* ldlang.h (struct asneeded_minfo): New.
	(asneeded_list_tail): Declare.
	* ldmain.c (add_archive_element): Improve archive map heading.
	* ldmisc.c (minfo): Stash --as-needed info.
2014-01-22 16:21:34 +10:30
Alan Modra 7dd9c6eb05 Miscellaneous ld tidies
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-22 12:51:19 +10:30
Alan Modra 2edab91c10 Make assignments to dot keep an empty output section.
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-22 11:58:29 +10:30
H.J. Lu 4584ec1207 Check incompatible existing default symbol definition
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-21 15:42:51 -08:00
H.J. Lu 22ef172a21 Don't check shared/export_dynamic/ref_dynamic for type mismatch
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-21 05:33:48 -08:00
Marcus Shawcroft 5a4f233680 [AArch64] Define LP64 BE linker name. 2014-01-20 18:20:04 +00:00
Marcus Shawcroft 30feb35816 [AArch64] Define LP64 LE loader name. 2014-01-20 18:18:52 +00:00
H.J. Lu cec2c50d38 Add a testcase for PR ld/2404
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-20 04:50:47 -08:00
Alan Modra fa72205cb9 Allow self-assignment for absolute symbols defined in a linker script
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-20 21:28:42 +10:30
Guy Martin 24ef1aa73e Fix duplicate output section statement lookup
Tie output section statements to their associated output section via
output section userdata.  This allows us to avoid hash lookups which
are slower and fail when multiple output sections have the same name.

	* ldlang.h (lang_output_section_get): Define.
	* ldlang.c (lang_output_section_get): Likewise.
	(init_os): Set the output_section userdata to the output
	section statement.
	* emultempl/hppaelf.em: Use lang_output_section_get instead of
	lang_output_section_find where applicable.
	* emultempl/aarch64elf.em: Likewise.
	* emultempl/aix.em: Likewise.
	* emultempl/armelf.em: Likewise.
	* emultempl/m68hc1xelf.em: Likewise.
	* emultempl/metagelf.em: Likewise.
	* emultempl/mipself.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/spuelf.em: Likewise.
2014-01-20 14:21:36 +10:30
Alan Modra 7225345dbb Allow ld target customiser script to force on disk scripts.
Mucking with EMULATION_LIBPATH has unwanted side effects.  Allow nds32
emulparams scripts to disable compiled-in scripts naturally, by
setting COMPILE_IN=no.

	* genscripts.sh (COMPILE_IN): Don't set if already set.
	* emulparams/nds32elf.sh: Don't clear EMULATION_LIBPATH, set
	COMPILE_IN=no.
	* emulparams/nds32elf16m.sh: Likewise.
	* emulparams/nds32elf_linux.sh: Likewise.
	* emultempl/aix.em: Test COMPILE_IN value is "yes".
	* emultempl/armcoff.em: Likewise.
	* emultempl/elf32.em: Likewise.
	* emultempl/generic.em: Likewise.
	* emultempl/gld960.em: Likewise.
	* emultempl/gld960c.em: Likewise.
	* emultempl/linux.em: Likewise.
	* emultempl/lnk960.em: Likewise.
	* emultempl/m68kcoff.em: Likewise.
	* emultempl/sunos.em: Likewise.
	* emultempl/ticoff.em: Likewise.
2014-01-17 10:41:49 +10:30
H.J. Lu f6f6c6790a Skip directories with LIBPATH_SUFFIX_SKIP suffix
On Linux/x86-64, when binutils is configured with --libdir=/usr/lib64,
genscripts.sh treats /usr/lib64 as the default search directory.  It
puts /usr/lib64 in linker scripts for all emulations, like

---
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
	      "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR("/usr/x86_64-redhat-linux/lib32");
SEARCH_DIR("/usr/i386-redhat-linux/lib32"); SEARCH_DIR("/usr/lib6432");
SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32");
SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i386-redhat-linux/lib");
SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib");
SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
---

/usr/lib6432 is odd and /usr/lib64 is wrong.  This patch changes
genscripts.sh to check LIBPATH_SUFFIX_SKIP if it is defined.  It
skips directories with LIBPATH_SUFFIX_SKIP suffix.

	PR ld/16456
	* genscripts.sh: Don't search directory with LIBPATH_SUFFIX_SKIP
	suffix.
	* emulparams/elf32_x86_64.sh (LIBPATH_SUFFIX_SKIP): Set to 64
	for elf32_x86_64 emulation.
	* emulparams/elf_i386.sh (LIBPATH_SUFFIX_SKIP): Set to 64
	for elf_i386 emulation.
2014-01-15 20:09:09 -08:00
Alan Modra 6fcc66ab70 Tidy ld use of bfd_section userdata.
A long time ago ld made use of userdata to tie an output section to
its lang_input_statement_struct object file.  Some time later Joern
made map file printing of symbols at lot faster, using userdata on
input sections.  That complicated allocation of userdata, and when the
output section use disappeared a year later, the code wasn't properly
cleaned up.  This patch does that cleanup, and also tidies the symbol
printing code to not allocate userdata where it won't be needed.  We
don't print symbols defined in the absolute section or in output
sections.

	* ld.h (fat_section_userdata_type, get_userdata): Move to..
	* ldlang.h (input_section_userdata_type, get_userdata): ..here.
	* ldlang.c (init_map_userdata): Delete.  Fold into..
	(sort_def_symbol): ..here.  Don't attach input section userdata
	to output sections or global bfd sections.
	(lang_map): Don't pre-allocate input section userdata.
	(init_os): Don't allocate userdata for output sections.
	(print_all_symbols): Update.
2014-01-16 11:56:51 +10:30
H.J. Lu f9c316c4d7 Silence uninitialized warning on ehdr_start_save
Older GCC, like 4.1/4.2, will issue an uninitialized warning on
ehdr_start_save.  This patch silences by using

struct bfd_link_hash_entry ehdr_start_save = ehdr_start_save;

	* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
	Silence uninitialized warning on ehdr_start_save with older
	GCC.
2014-01-15 07:43:19 -08:00
Alan Modra 4199e3b866 non-PIC references to __ehdr_start in pie and shared
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-15 22:23:16 +10:30
Vidya Praveen c0a6c611f1 * lib/ld-lib.exp (default_ld_link): Remove support for ldflags.
(default_ld_simple_link): Likewise.
2014-01-14 13:09:22 +00:00
Alan Modra eec2f3ed9f Don't adjust LOAD segment to match GNU_RELRO segment
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-10 21:49:56 +10:30
Hans-Peter Nilsson d1e1519e66 * emulparams/crislinux.sh (COMMONPAGESIZE): Define. 2014-01-10 01:25:26 +01:00
H.J. Lu c66a241cde Fix copyright year 2014-01-09 10:23:03 -08:00
H.J. Lu d345186d05 Check if GNU_RELRO segment is is generated
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-09 10:19:19 -08:00
H.J. Lu 92c09111f3 Add and use check_lto_shared_available
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-09 09:01:53 -08:00
H.J. Lu 43a8475ca0 Adjust LOAD segment to generate GNU_RELRO segment
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-08 05:57:21 -08:00
H.J. Lu 221fd5d598 Update copyright year to 2014
binutils/

	* version.c (print_version): Update copyright year to 2014.

gas/

	* as.c (parse_args): Update copyright year to 2014.

gold/

	* version.cc (print_version): Update copyright year to 2014.

ld/

	* ldver.c (ldversion): Update copyright year to 2014.

opcodes/

	* i386-gen.c (process_copyright): Update copyright year to 2014.
2014-01-08 05:48:12 -08:00
H.J. Lu 5fb776a637 New Year - binutils ChangeLog rotation 2014-01-08 05:32:12 -08:00
H.J. Lu a319637f7c Define IREL_IN_PLT for elf_k1om.sh and elf_l1om.sh
* emulparams/elf_k1om.sh (IREL_IN_PLT): Define.
	* emulparams/elf_l1om.sh (IREL_IN_PLT): Likewise.
2013-12-20 08:27:02 -08:00
H.J. Lu abd266be45 Covert leading spaces to tab 2013-12-20 08:25:24 -08:00
H.J. Lu 9ef5d93881 Set SHF_INFO_LINK bit for SHT_REL/SHT_RELA sections
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-19 11:34:47 -08:00
Yufeng Zhang 7174e19ff2 ld/testsuite
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-18 15:16:41 +00:00
Vidya Praveen 3046b3d356 * lib/ld-lib.exp (default_ld_link): Use ldflags from board description
file.
	(default_ld_simple_link): Likewise.
	(default_ld_compile): Use cflags from board description file.
2013-12-13 12:02:26 +00:00
Kuan-Lin Chen 35c081572f Add support for Andes NDS32:
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-13 11:52:32 +00:00
H.J. Lu c40ad180ea Add "#..."
* ld-elf/ehdr_start-userdef.d: Add "#...".
2013-12-12 14:01:28 -08:00
H.J. Lu 58e7ebacdd Set ET_EXEC for -pie -Ttext-segment=
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-12 07:41:27 -08:00
Will Newton d3b76a45a9 ld/testsuite/ld-aarch64: Fixup IFUNC tests to work on all targets
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-11 21:05:36 +00:00
H.J. Lu 2b8c06a34c Remove shared object from -Ttext-segment
* ld.texinfo: Remove shared object from -Ttext-segment.
2013-12-11 10:28:02 -08:00
H.J. Lu 5e319dd3e1 Add a test for --as-needed with symbol versioning
* 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-11 08:00:34 -08:00
Roland McGrath f2c7d7ee5b Use $(INSTALL_PROGRAM_ENV) consistently.
binutils/
	* Makefile.am (install-exec-local): Prefix libtool invocation with
	$(INSTALL_PROGRAM_ENV).
	* Makefile.in: Regenerate.

gas/
	* Makefile.am (install-exec-bindir): Prefix libtool invocation
	with $(INSTALL_PROGRAM_ENV).
	(install-exec-tooldir): Likewise.
	* Makefile.in: Regenerate.

gold/
	* Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
	with $(INSTALL_PROGRAM_ENV).
	* Makefile.in: Regenerate.

ld/
	* Makefile.am (install-exec-local): Prefix libtool invocation with
	$(INSTALL_PROGRAM_ENV).
	* Makefile.in: Regenerate.
2013-12-10 15:19:50 -08:00
Mike Frysinger 594d8fa8e9 strip off +x bits on non-executable/script files
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-12-07 02:03:03 -05:00
Kyrylo Tkachov b35d44f1af [ld/testsuite/]
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-27 13:43:39 +00:00
Richard Sandiford d4a43794d2 binutils/testsuite/
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-27 09:11:06 +00:00
H.J. Lu 36d740a772 Fix a typo 2013-11-26 11:25:25 -08:00
H.J. Lu b27caf75c3 Add HOSTING_SLIBS and use it for -pie
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-26 11:17:08 -08:00
Will Newton 4920638856 bfd/elfnn-aarch64.c: Handle static links with ifunc correctly.
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-26 15:25:11 +00:00
Will Newton b1ee0cc489 bfd/elfnn-aarch64.c: Fix miscalculation of GOTPLT offset for ifunc syms.
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-26 15:24:54 +00:00
Cory Fields 0cb112f740 * windres.c (define_resource): Use zero for timestamp, making
output deterministic. time.h include is no longer needed.
	* resres.c (res_append_resource): Likewise.

	* pe-dll.c (fill_edata): Only use a real timestamp if
	--insert-timestamp was used.
	* emultempl/pe.em: Add the --insert-timestamp option.
	* emultempl/pep.em: Likewise for 64bit.
	* ld.texinfo: Document the --insert-timestamp option.

	* libcoff-in.h: Add insert_timestamp flag to the pe_data struct.
	* libcoff.h: Regenerate.
	* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Only use a real
	timestamp if --insert-timestamp was used.
2013-11-22 14:55:56 +00:00
Senthil Kumar Selvaraj 5ed365b417 * scripttempl/avr.sc: Set .data section's LMA to next available
address in text region.
2013-11-22 12:00:55 +00:00
Andrew Pinski 56244278a6 ld/ChangeLog:
* Makefile.am (ALL_64_EMULATION_SOURCES): Add eaarch64linux32.c
	and eaarch64linux32b.c
	(eaarch64linux32.c): New target.
	(eaarch64linux32b.c): Likewise.
	* Makefile.in: Regenerate.
	* configure.tgt (aarch64_be-*-linux*): Add
	aarch64linux32 and aarch64linux32b to targ_extra_libpath.
	(aarch64-*-linux*): Likewise.
	* emulparams/aarch64elf32.sh (SEPARATE_GOTPLT): Change to 12 (3 words).
	* emulparams/aarch64linux32.sh: New file.
	* emulparams/aarch64linux32b.sh: New file.
2013-11-21 11:17:50 -08:00
Andrew Pinski 0d091088ea ld/ChangeLog:
* configure.tgt (aarch64_be-*-linux*): Split out the linux targets
	into targ_extra_libpath.
	(aarch64-*-linux*): Likewise.
2013-11-21 11:16:58 -08:00
Nick Clifton 8d5c4b7bfd PR ld/16192
* pe-dll.c (pe_create_runtime_relocator_reference): Zero the
	newly allocated idata5 block.
2013-11-21 13:29:47 +00:00
H.J. Lu 97122a4cff Add bnd-branch-1 test
* 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-21 04:53:05 -08:00
H.J. Lu 9a2310125b Add mpx1static, mpx2 and mpx2static tests
* 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-20 12:35:10 -08:00
Nick Clifton 925bbbbb98 * scripttempl/elf32msp430.sc (.data): Set the based on the next
free location in the text memory region, not a computation based
	upon the size of the text section.  Orphaned sections or other
	linker scripts might insert new sections between the .text section
	and the .data section.
	* scripttempl/elf32msp430_3.sc (.data): Likewise.
2013-11-20 16:51:21 +00:00
Roland McGrath c2763e270c Fix references to __ehdr_start when it cannot be defined
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-19 10:54:00 -08:00
Chung-Lin Tang baa2af86d4 Separate emulations for nios2-elf and nios2-linux.
2013-11-18  Chung-Lin Tang  <cltang@codesourcery.com>

	* emulparams/nios2linux.sh: New emulation file.
	* configure.tgt: Add nios2*-*-linux* emulation case.
	* Makefile.am (enios2linux.c): New emulation entry.
	* Makefile.in: Regenerate.
2013-11-18 06:57:28 -08:00
H.J. Lu c33205431a Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND
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-17 08:57:56 -08:00
Will Newton 180a9db096 ld/ARM: Fix script-type testsuite failure.
Commit 34a79995c4 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-14 08:39:59 +00:00
Roland McGrath 64b384e1e8 Set CPU type in BFD backend for x86_64-nacl* and i?86-nacl* targets
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-07 10:00:32 -08:00
H.J. Lu 62d887d406 Pass ignored unresolved relocations to ld backend
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-05 10:29:44 -08:00
Alan Modra 52a82034ac Edit ELFv2 global entry prologue to non-PIC
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-04 10:21:32 +10:30
Alan Modra 4115bfc683 Allow for extra st_other readelf output in ld testsuite
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-04 10:18:47 +10:30
Alan Modra 14f2c47675 ld crossref test fix
* 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-04 10:17:55 +10:30
Alan Modra c7c3f80e9c Assorted x86 testsuite fixes.
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-02 15:31:16 +10:30
Roland McGrath 61674ef7c5 x86_64-*-nacl*: Adjust test cases for PLT nop fix.
ld/testsuite/
	* ld-x86-64/plt-nacl.pd: Update expected disassembly for PLT nop fix.
	* ld-x86-64/tlsdesc-nacl.pd: Likewise.
2013-11-01 14:54:40 -07:00
Alan Modra d4a95d4999 Add PowerPC64 ELFv2 tests.
* ld-powerpc/elfv2.s,
	* ld-powerpc/elfv2so.d,
	* ld-powerpc/elfv2exe.d: New tests.
	* ld-powerpc/powerpc.exp: Run them.
2013-10-30 13:44:10 +10:30
Alan Modra 71a39c98f8 Change plt stubs to have destination in r12.
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-30 13:35:47 +10:30
Jan Beulich 34a79995c4 ld/ELF: refine fake STT_FILE symbol emission
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-29 17:52:24 +01:00
Hans-Peter Nilsson 18080097c8 * ld-cris/asneed1.d: New test. 2013-10-18 02:38:35 +00:00
Chao-ying Fu 7c79037879 2013-10-14 Chao-ying Fu <Chao-ying.Fu@imgtec.com>
* ld-mips-elf/attr-gnu-8-0.s, ld-mips-elf/attr-gnu-8-1.s,
	ld-mips-elf/attr-gnu-8-2.s,
	ld-mips-elf/attr-gnu-8-00.d, ld-mips-elf/attr-gnu-8-01.d,
	ld-mips-elf/attr-gnu-8-02.d, ld-mips-elf/attr-gnu-8-10.d,
	ld-mips-elf/attr-gnu-8-11.d, ld-mips-elf/attr-gnu-8-12.d,
	ld-mips-elf/attr-gnu-8-20.d, ld-mips-elf/attr-gnu-8-21.d,
	ld-mips-elf/attr-gnu-8-22.d: New.
	* ld-mips-elf/mips-elf.exp: Run new tests.
2013-10-14 19:02:00 +00:00
Nick Clifton b2e951ec58 * gen-aout.c (main): Fix formatting. Close file.
* emultempl/aix.em (_read_file): Close file at end of function.

	* gas/all/itbl-test.c (main): Close fas.

	* read.c (add_include_dir): Use xrealloc.
	* config/tc-score.c (do_macro_bcmp): Initialise inst_main.
	* config/tc-tic6x.c (tic6x_parse_operand): Initialise second_reg.

	* readelf.c (decode_arm_unwind): Initialise addr structure.
	(process_symbol_table): Free lengths.
	* srcconv.c (wr_sc): Free info.

	* chew.c (perform): Free next.
2013-10-14 09:15:09 +00:00
Richard Sandiford 690f47bf98 ld/testsuite/
* lib/ld-lib.exp (default_ld_compile): Add a -I option for the source
	directory.
	* ld-mips-elf/compressed-plt-1.ld, ld-mips-elf/compressed-plt-1.s,
	ld-mips-elf/compressed-plt-1-dyn.s, ld-mips-elf/compressed-plt-1a.s,
	ld-mips-elf/compressed-plt-1b.s, ld-mips-elf/compressed-plt-1c.s,
	ld-mips-elf/compressed-plt-1d.s, ld-mips-elf/compressed-plt-1e.s,
	ld-mips-elf/compressed-plt-1-o32-se.rd,
	ld-mips-elf/compressed-plt-1-o32-se.od,
	ld-mips-elf/compressed-plt-1-o32-mips16-only.rd,
	ld-mips-elf/compressed-plt-1-o32-mips16-only.od,
	ld-mips-elf/compressed-plt-1-o32-umips-only.rd,
	ld-mips-elf/compressed-plt-1-o32-umips-only.od,
	ld-mips-elf/compressed-plt-1-o32-mips16.rd,
	ld-mips-elf/compressed-plt-1-o32-mips16.od,
	ld-mips-elf/compressed-plt-1-o32-mips16-got.rd,
	ld-mips-elf/compressed-plt-1-o32-mips16-got.od,
	ld-mips-elf/compressed-plt-1-o32-mips16-word.rd,
	ld-mips-elf/compressed-plt-1-o32-mips16-word.od,
	ld-mips-elf/compressed-plt-1-o32-umips.rd,
	ld-mips-elf/compressed-plt-1-o32-umips.od,
	ld-mips-elf/compressed-plt-1-o32-umips-got.rd,
	ld-mips-elf/compressed-plt-1-o32-umips-got.od,
	ld-mips-elf/compressed-plt-1-o32-umips-word.rd,
	ld-mips-elf/compressed-plt-1-o32-umips-word.od,
	ld-mips-elf/compressed-plt-1-n32-mips16.rd,
	ld-mips-elf/compressed-plt-1-n32-mips16.od,
	ld-mips-elf/compressed-plt-1-n32-umips.rd,
	ld-mips-elf/compressed-plt-1-n32-umips.od: New tests.
	* ld-mips-elf/mips-elf.exp: Run them.
2013-10-13 10:17:20 +00:00
Richard Sandiford c5d6fa4495 bfd/
* elfxx-mips.c (mips_use_local_got_p): New function.
	(mips_elf_count_got_symbols, mips_elf_calculate_relocation): Use it.
	(_bfd_mips_elf_check_relocs): Set pointer_equality_needed for
	GOT and absolute references.

ld/testsuite/
	* ld-mips-elf/pic-and-nonpic-6-n32.ad,
	ld-mips-elf/pic-and-nonpic-6-n32.dd,
	ld-mips-elf/pic-and-nonpic-6-n32.gd,
	ld-mips-elf/pic-and-nonpic-6-n32.nd,
	ld-mips-elf/pic-and-nonpic-6-n32.rd,
	ld-mips-elf/pic-and-nonpic-6-n64.ad,
	ld-mips-elf/pic-and-nonpic-6-n64.dd,
	ld-mips-elf/pic-and-nonpic-6-n64.gd,
	ld-mips-elf/pic-and-nonpic-6-n64.nd,
	ld-mips-elf/pic-and-nonpic-6-n64.rd,
	ld-mips-elf/pic-and-nonpic-6-o32.ad,
	ld-mips-elf/pic-and-nonpic-6-o32.dd,
	ld-mips-elf/pic-and-nonpic-6-o32.gd,
	ld-mips-elf/pic-and-nonpic-6-o32.nd,
	ld-mips-elf/pic-and-nonpic-6-o32.rd: Fix symbol value of extf4.
	No longer expect extf3, extf4 and extd2 to be in the global GOT.
2013-10-13 10:03:22 +00:00
Roland McGrath 18ff9b9b57 ld/
* ldmisc.c (vfinfo): Use Boolean ? "" : ":" in place of ":" + Boolean.
	It silences some compilers' warnings and is much less bizarre to read.
2013-10-10 22:50:40 +00:00
Roland McGrath 677e5a92b1 ld/
* emultempl/elf32.em (id_note_section_size): Use ATTRIBUTE_UNUSED
	rather than a dummy assignment for unused parameter.
	* plugin.c (get_input_file, release_input_file): Likewise.
2013-10-09 18:16:18 +00:00
Nick Clifton d9313f4f43 PR ld/16028
* ldmain.c (add_keepsyms_file): Close file at end of function.
2013-10-09 16:30:02 +00:00
Will Newton 1419bbe571 aarch64: Add support for GNU indirect functions.
Add support for STT_GNU_IFUNC symbols to the AArch64 bfd backend. The tests
are ported from the ld-ifunc tests but are enabled for cross builds so can
be run easily without hardware or a simulator.

bfd/ChangeLog:

2013-10-03  Will Newton  <will.newton@linaro.org>

	* configure: Regenerate.
	* configure.in: Build elf-ifunc.o for AArch64.
	* elfnn-aarch64.c: Include objalloc.h.
	(elfNN_aarch64_local_htab_hash): New function.
	(elfNN_aarch64_local_htab_eq): New function.
	(elfNN_aarch64_get_local_sym_hash): New function.
	(elfNN_aarch64_link_hash_table_create): Initialize local STT_GNU_IFUNC
	symbol hash.
	(elfNN_aarch64_hash_table_free): Free local STT_GNU_IFUNC symbol hash.
	(elfNN_aarch64_final_link_relocate): Add sym argument.  Add support
	for handling STT_GNU_IFUNC symbols.
	(elfNN_aarch64_gc_sweep_hook): Add support for garbage collecting
	references to STT_GNU_IFUNC symbols.
	(elfNN_aarch64_adjust_dynamic_symbol): Add support for handling
	STT_GNU_IFUNC symbols.
	(elfNN_aarch64_check_relocs): Add support for handling STT_GNU_IFUNC
	symbols.  Ensure we don't increase plt.refcount from -1 to 0.
	(elfNN_aarch64_post_process_headers): Call _bfd_elf_set_osabi.
	(elfNN_aarch64_is_function_type): Remove function.
	(elfNN_aarch64_allocate_dynrelocs): Handle STT_GNU_IFUNC symbols.
	(elfNN_aarch64_allocate_ifunc_dynrelocs): New function.
	(elfNN_aarch64_allocate_local_dynrelocs): New function.
	(elfNN_aarch64_allocate_local_ifunc_dynrelocs): New function.
	(elfNN_aarch64_size_dynamic_sections): Call
	elfNN_aarch64_allocate_local_dynrelocs.
	(elfNN_aarch64_create_small_pltn_entry): Add info argument.
	Add support for creating .iplt entries for STT_GNU_IFUNC symbols.
	(elfNN_aarch64_finish_dynamic_symbol): Add support for handling
	STT_GNU_IFUNC symbols and .iplt.
	(elfNN_aarch64_finish_local_dynamic_symbol): New function.
	(elfNN_aarch64_finish_dynamic_sections): Call
	elfNN_aarch64_finish_local_dynamic_symbol.

ld/ChangeLog:

2013-10-03  Will Newton  <will.newton@linaro.org>

	* emulparams/aarch64elf.sh: Add IREL_IN_PLT.
	* emulparams/aarch64elf32.sh: Likewise.

ld/testsuite/ChangeLog:

2013-10-03  Will Newton  <will.newton@linaro.org>

	* ld-ifunc/ifunc.exp: Enable ifunc tests for AArch64.
	* ld-aarch64/aarch64-elf.exp: Run ifunc tests.
	* ld-aarch64/ifunc-1-local.d: New file.
	* ld-aarch64/ifunc-1-local.s: Likewise.
	* ld-aarch64/ifunc-1.d: Likewise.
	* ld-aarch64/ifunc-1.s: Likewise.
	* ld-aarch64/ifunc-10.d: Likewise.
	* ld-aarch64/ifunc-10.s: Likewise.
	* ld-aarch64/ifunc-11.d: Likewise.
	* ld-aarch64/ifunc-11.s: Likewise.
	* ld-aarch64/ifunc-12.d: Likewise.
	* ld-aarch64/ifunc-12.s: Likewise.
	* ld-aarch64/ifunc-13.d: Likewise.
	* ld-aarch64/ifunc-13a.s: Likewise.
	* ld-aarch64/ifunc-13b.s: Likewise.
	* ld-aarch64/ifunc-14a.d: Likewise.
	* ld-aarch64/ifunc-14a.s: Likewise.
	* ld-aarch64/ifunc-14b.d: Likewise.
	* ld-aarch64/ifunc-14b.s: Likewise.
	* ld-aarch64/ifunc-14c.d: Likewise.
	* ld-aarch64/ifunc-14c.s: Likewise.
	* ld-aarch64/ifunc-14d.d: Likewise.
	* ld-aarch64/ifunc-14e.d: Likewise.
	* ld-aarch64/ifunc-14f.d: Likewise.
	* ld-aarch64/ifunc-15.d: Likewise.
	* ld-aarch64/ifunc-15.s: Likewise.
	* ld-aarch64/ifunc-16.d: Likewise.
	* ld-aarch64/ifunc-16.s: Likewise.
	* ld-aarch64/ifunc-17a.d: Likewise.
	* ld-aarch64/ifunc-17a.s: Likewise.
	* ld-aarch64/ifunc-17b.d: Likewise.
	* ld-aarch64/ifunc-17b.s: Likewise.
	* ld-aarch64/ifunc-18a.d: Likewise.
	* ld-aarch64/ifunc-18a.s: Likewise.
	* ld-aarch64/ifunc-18b.d: Likewise.
	* ld-aarch64/ifunc-18b.s: Likewise.
	* ld-aarch64/ifunc-19a.d: Likewise.
	* ld-aarch64/ifunc-19a.s: Likewise.
	* ld-aarch64/ifunc-19b.d: Likewise.
	* ld-aarch64/ifunc-19b.s: Likewise.
	* ld-aarch64/ifunc-2-local.d: Likewise.
	* ld-aarch64/ifunc-2-local.s: Likewise.
	* ld-aarch64/ifunc-2.d: Likewise.
	* ld-aarch64/ifunc-2.s: Likewise.
	* ld-aarch64/ifunc-20.d: Likewise.
	* ld-aarch64/ifunc-20.s: Likewise.
	* ld-aarch64/ifunc-3.s: Likewise.
	* ld-aarch64/ifunc-3a.d: Likewise.
	* ld-aarch64/ifunc-3b.d: Likewise.
	* ld-aarch64/ifunc-4.d: Likewise.
	* ld-aarch64/ifunc-4.s: Likewise.
	* ld-aarch64/ifunc-4a.d: Likewise.
	* ld-aarch64/ifunc-5-local.s: Likewise.
	* ld-aarch64/ifunc-5.s: Likewise.
	* ld-aarch64/ifunc-5a-local.d: Likewise.
	* ld-aarch64/ifunc-5a.d: Likewise.
	* ld-aarch64/ifunc-5b-local.d: Likewise.
	* ld-aarch64/ifunc-5b.d: Likewise.
	* ld-aarch64/ifunc-5r-local.d: Likewise.
	* ld-aarch64/ifunc-6.s: Likewise.
	* ld-aarch64/ifunc-6a.d: Likewise.
	* ld-aarch64/ifunc-6b.d: Likewise.
	* ld-aarch64/ifunc-7.s: Likewise.
	* ld-aarch64/ifunc-7a.d: Likewise.
	* ld-aarch64/ifunc-7b.d: Likewise.
	* ld-aarch64/ifunc-7c.d: Likewise.
	* ld-aarch64/ifunc-8.d: Likewise.
	* ld-aarch64/ifunc-8a.s: Likewise.
	* ld-aarch64/ifunc-8b.s: Likewise.
	* ld-aarch64/ifunc-9.d: Likewise.
	* ld-aarch64/ifunc-9.s: Likewise.
2013-10-03 14:46:09 +00:00
Nick Clifton cbb2b07e33 * emulparams/msp430all.sh: Update ARCH names.
* cpu-msp430.c: Use printable names that match the values
	displayed by readelf.
2013-09-30 09:03:59 +00:00
Richard Sandiford 2f9efdfcdb bfd/
2013-09-24  Gregory Fong  <gregory.0xf0@gmail.com>

	* elfxx-mips.c (mips_elf_create_got_section): Hide
	_GLOBAL_OFFSET_TABLE_.

ld/testsuite/
2013-09-24  Gregory Fong  <gregory.0xf0@gmail.com>

	* ld-mips-elf/eh-frame5.d, ld-mips-elf/jalx-2.dd,
	ld-mips-elf/mips-elf.exp, ld-mips-elf/mips16-pic-2.ad,
	ld-mips-elf/mips16-pic-2.nd, ld-mips-elf/pic-and-nonpic-3a.dd,
	ld-mips-elf/pic-and-nonpic-3b.ad, ld-mips-elf/pic-and-nonpic-3b.dd,
	ld-mips-elf/pic-and-nonpic-3b.nd, ld-mips-elf/pic-and-nonpic-4b.ad,
	ld-mips-elf/pic-and-nonpic-4b.nd, ld-mips-elf/pic-and-nonpic-4b.rd,
	ld-mips-elf/pic-and-nonpic-5b.ad, ld-mips-elf/pic-and-nonpic-5b.nd,
	ld-mips-elf/pic-and-nonpic-6-n32.ad,
	ld-mips-elf/pic-and-nonpic-6-n32.dd,
	ld-mips-elf/pic-and-nonpic-6-n32.nd,
	ld-mips-elf/pic-and-nonpic-6-n64.ad,
	ld-mips-elf/pic-and-nonpic-6-n64.dd,
	ld-mips-elf/pic-and-nonpic-6-n64.nd,
	ld-mips-elf/pic-and-nonpic-6-o32.ad,
	ld-mips-elf/pic-and-nonpic-6-o32.dd,
	ld-mips-elf/pic-and-nonpic-6-o32.nd, ld-mips-elf/rel32-n32.d,
	ld-mips-elf/rel32-o32.d, ld-mips-elf/rel64.d,
	ld-mips-elf/tls-multi-got-1.got, ld-mips-elf/tls-multi-got-1.r,
	ld-mips-elf/tlsdyn-o32-1.d, ld-mips-elf/tlsdyn-o32-1.got,
	ld-mips-elf/tlsdyn-o32-2.d, ld-mips-elf/tlsdyn-o32-2.got,
	ld-mips-elf/tlsdyn-o32-3.d, ld-mips-elf/tlsdyn-o32-3.got,
	ld-mips-elf/tlsdyn-o32.d, ld-mips-elf/tlsdyn-o32.got,
	ld-mips-elf/tlslib-o32-ver.got, ld-mips-elf/tlslib-o32.got: Update
	for removal of _GLOBAL_OFFSET_TABLE_ from .dynsym.
2013-09-24 22:15:38 +00:00
Alan Modra 6c668e71eb * emulparams/elf32ppccommon.sh (LIBPATH_SUFFIX): Provide 32-bit
and cross-endian values.
	* emulparams/elf64ppc.sh: Source elf32ppccomon.sh.  Delete duplicate,
	and unset unwanted variables.
2013-09-24 06:29:39 +00:00
Alan Modra 0f70b6b504 * genscripts.sh (LIB_PATH): Don't exclude libdir or tooldir when
sysrooted.  Also, don't always add tooldir when non-sysrooted.
	Instead add both when native and tooldir also when TOOL_DIR is
	defined.  Always prepend '=' to paths when sysrooted.  Always
	put paths with LIBPATH_SUFFIX first in search order.
2013-09-24 05:59:55 +00:00
Chung-Lin Tang ecb33a7949 2013-09-20 Chung-Lin Tang <cltang@codesourcery.com>
* Makefile.am (enios2elf.c): Change tdir_nios2 to tdir_nios2elf.
	* Makefile.in: Regenerate.
2013-09-20 10:27:11 +00:00
Alan Modra cc9afea3e4 * libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical
ppc host match.  Support little-endian powerpc linux hosts.
Regenerate binutils configure files.
2013-09-20 09:51:25 +00:00
Kyrylo Tkachov 25f686c226 2013-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* ld-aarch64/eh-frame.d: Update expected output to allow for
	64-bit addresses.
2013-09-18 13:59:12 +00:00
Tristan Gingold 58ca03a25d binutils/
2013-09-18  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.24.

gas/
2013-09-18  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.24.

ld/
2013-09-18  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.24.
2013-09-18 10:39:38 +00:00
Nick Clifton 3d4a522e25 PR ld/15957
* deffilep.y (def_file_add_directive): Avoid readin past end of
	buffer.
2013-09-17 13:57:21 +00:00
Nick Clifton bf5117e32d * dwarf.c (dwarf_vmatoa): Rename to dwarf_vmatoa_1 and add a
precision parameter.
	(dwarf_vmatoa): New wrapper for dwarf_vmatoa_1.
	(print_dwarf_vma): Use dwarf_vmatoa_1.
	(SAFE_BYTE_GET): Add check that VAL is big enough to contain
	AMOUNT bytes.
	(process_debug_info): Use an unsigned int for the offset size.
	(process_debug_pubnames): Likewise.
	(display_debug_aranges): Likewise.
	(struct Frame_Chunk): Use dwarf_vma type for pc_begin and pc_range
	fields.
	(frame_display_row): Use print_dwarf_vma to display dwarf_vma
	values.
	(display_debug_frames): Likewise.

	* binutils-all/x86-64/compressed-1a.d: Update expected output to
	allow for 64-bit addresses.

	* ld-elf/eh1.d: Update expected output to allow for
	64-bit addresses.
	* ld-elf/eh2.d: Likewise.
	* ld-elf/eh3.d: Likewise.
	* ld-elf/eh4.d: Likewise.
	* ld-elf/eh5.d: Likewise.
	* ld-elf/eh6.d: Likewise.
	* ld-mips-elf/eh-frame1-n64.d: Likewise.
	* ld-mips-elf/eh-frame2-n64.d: Likewise.
	* ld-mips-elf/eh-frame3.d: Likewise.

	* gas/cfi/cfi-alpha-1.d: Update expected output to allow for
	64-bit addresses.
	* gas/cfi/cfi-alpha-3.d: Likewise.
	* gas/cfi/cfi-arm-1.d: Likewise.
	* gas/cfi/cfi-common-1.d: Likewise.
	* gas/cfi/cfi-common-2.d: Likewise.
	* gas/cfi/cfi-common-3.d: Likewise.
	* gas/cfi/cfi-common-4.d: Likewise.
	* gas/cfi/cfi-common-5.d: Likewise.
	* gas/cfi/cfi-common-6.d: Likewise.
	* gas/cfi/cfi-common-7.d: Likewise.
	* gas/cfi/cfi-hppa-1.d: Likewise.
	* gas/cfi/cfi-i386-2.d: Likewise.
	* gas/cfi/cfi-i386.d: Likewise.
	* gas/cfi/cfi-m68k.d: Likewise.
	* gas/cfi/cfi-mips-1.d: Likewise.
	* gas/cfi/cfi-ppc-1.d: Likewise.
	* gas/cfi/cfi-s390-1.d: Likewise.
	* gas/cfi/cfi-s390x-1.d: Likewise.
	* gas/cfi/cfi-sh-1.d: Likewise.
	* gas/cfi/cfi-sparc-1.d: Likewise.
	* gas/cfi/cfi-sparc64-1.d: Likewise.
	* gas/cfi/cfi-x86_64.d: Likewise.
2013-09-12 09:14:47 +00:00
Yufeng Zhang 0e80562ec2 ld/testsuite/
2013-09-04  Vidya Praveen  <vidyapraveen@arm.com>

	* ld-arm/export-class.exp: Fix the condition.
2013-09-04 14:35:13 +00:00
Jakub Jelinek 5c98a14e1e * elf64-x86-64.c (elf_x86_64_check_tls_transition): Allow
64-bit -mcmodel=large -fpic TLS GD and LD sequences.
	(elf_x86_64_relocate_section): Handle -mcmodel=large -fpic
	TLS GD and LD sequences in GD->LE, GD->IE and LD->LE transitions.
ld/testsuite/
	* ld-x86-64/x86-64.exp: Add tlsld3, tlsgd7 and tlsgd8 tests.
	* ld-x86-64/tlspic1.s: Add -mcmodel=large -fpic TLS GD and LD
	sequences.
	* ld-x86-64/tlspic.dd: Adjusted.
	* ld-x86-64/tlspic.rd: Adjusted.
	* ld-x86-64/tlspic-nacl.rd: Adjusted.
	* ld-x86-64/tlsld3.dd: New test.
	* ld-x86-64/tlsld3.s: New file.
	* ld-x86-64/tlsgd7.dd: New test.
	* ld-x86-64/tlsgd7.s: New file.
	* ld-x86-64/tlsgd8.dd: New test.
	* ld-x86-64/tlsgd8.s: New file.
2013-08-29 10:25:27 +00:00
Nick Clifton fe6d7d6aa2 PR ld/15896
* ld.texinfo: Fix uses of MB abbreviation.
2013-08-28 09:17:35 +00:00
Roland McGrath 1098fd41ac bfd/
* archures.c (bfd_mach_i386_nacl, bfd_mach_i386_i386_nacl): New macros.
	(bfd_mach_x86_64_nacl, bfd_mach_x64_32_nacl): New macros.
	* cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): New function.
	(bfd_i386_nacl_arch): New variable.
	(bfd_x86_64_nacl_arch, bfd_x64_32_nacl_arch): New variables.
	(bfd_x64_32_arch_intel_syntax): Link them into the list.
	* bfd-in2.h: Regenerate.

ld/
	* emulparams/elf_i386_nacl.sh (ARCH): Set to i386:nacl.
	* emulparams/elf_x86_64_nacl.sh (ARCH): Set to i386:x86-64:nacl.
	* emulparams/elf32_x86_64_nacl.sh (ARCH): Set to i386:x64-32:nacl.

ld/testsuite/
	* ld-x86-64/x86-64.exp (Mixed x86_64 and i386 input test 1):
	Loosen string match to admit i386:x86-64*.
	(Mixed x86_64 and i386 input test 2): Likewise.
	* 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.
	* ld-x86-64/ia32-2.d: Likewise, and i386.* too.
	* ld-x86-64/ia32-3.d: Likewise.
2013-08-26 22:18:07 +00:00
Roland McGrath 887badb310 bfd/
* elf-nacl.c (nacl_modify_segment_map): Fix logic reordering the
	elf_segment_map list.  If an executable segment is page-aligned
	but does not end with a full page, then append a fake section into
	the segment map entry that pads out the page.
	(nacl_final_write_processing): New function.  Write the code fill
	laid out in nacl_modify_segment_map.
	* elf-nacl.h: Declare it.
	* elf32-arm.c (elf32_arm_nacl_final_write_processing): New function.
	(elf_backend_final_write_processing): Define it for NaCl backend.
	* elf32-i386.c (elf_backend_final_write_processing): Likewise.
	* elf64-x86-64.c (elf_backend_final_write_processing): Likewise.

	* elf-nacl.c (segment_eligible_for_headers): Rename MAXPAGESIZE
	parameter to MINPAGESIZE.
	(nacl_modify_segment_map): Use minpagesize instead of maxpagesize.

	* elf32-arm.c (ELF_MINPAGESIZE, ELF_COMMONPAGESIZE): Set to
	0x10000	for NaCl targets.

ld/testsuite/
	* ld-x86-64/ilp32-4-nacl.d: Loosen .shstrtab line regexp to match
	any file offset.
	* ld-x86-64/tlsbin-nacl.rd: Update expected code segment PT_LOAD.
	* ld-x86-64/tlsbindesc-nacl.rd: Likewise.
	* ld-scripts/rgn-at3.d: XFAIL for *-*-nacl* targets.
	* ld-scripts/rgn-over8-ok.d: Likewise.
2013-08-26 19:27:25 +00:00
Maciej W. Rozycki fe9cd7ab17 * ld-elf/comm-data.exp: Use check_shared_lib_support rather than
explicit patterns for test target qualification.  Define extra
	tool flags for *-*-hpux* and tic6x-*-* targets.  Link with a
	linker script.  Use alternative patterns for targets that do not
	eliminate copy relocs, currently mn10300-*-* and vax-*-*.
	* ld-elf/comm-data2.s: Handle HPUX's `.comm' syntax.
	* ld-elf/comm-data2.ld: New test linker script.
	* ld-elf/comm-data2.xd: Match section's VMA too.  Ignore ASCII
	data dump.
	* ld-elf/comm-data2r.rd: New test pattern.
	* ld-elf/comm-data2r.sd: New test pattern.
	* ld-elf/comm-data2r.xd: New test pattern.
	* ld-mips-elf/comm-data.exp: Use check_shared_lib_support rather
	than an explicit pattern for test target qualification.  Link
	with a linker script.
2013-08-24 22:37:18 +00:00
Maciej W. Rozycki aea6ea421d * ld-arm/export-class.exp: Handle non-EABI targets. 2013-08-24 22:27:00 +00:00
Roland McGrath 2e6b61f18f ld/testsuite/
* ld-x86-64/ilp32-4-nacl.d: Update for 2013-05-31 gas alignment change.
	* ld/testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise.
	* ld/testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise.
	* ld/testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
	* ld/testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
2013-08-23 23:13:46 +00:00
Roland McGrath 724e34c6f7 ld/
* emulparams/elf_nacl.sh (nacl_rodata_addr): Don't add in
	SIZEOF_HEADERS here; elf.sc does it already.
2013-08-23 22:38:42 +00:00
Nick Clifton 8c661d24dc Fix typo. 2013-08-23 15:21:53 +00:00
Nick Clifton 9aff4b7ac1 PR binutils/15834
Fix typos:
---
 bfd/bfdio.c                                  |  2 +-
 bfd/elf32-spu.c                              |  2 +-
 bfd/elfnn-aarch64.c                          |  2 +-
 binutils/od-xcoff.c                          |  2 +-
 config/tcl.m4                                |  2 +-
 gas/config/tc-ia64.c                         |  2 +-
 gas/config/tc-sparc.c                        |  2 +-
 gas/config/tc-z80.c                          | 12 ++++++------
 gas/doc/c-i386.texi                          |  6 +++---
 gas/doc/c-m32r.texi                          |  2 +-
 gas/testsuite/gas/d10v/instruction_packing.d |  2 +-
 gas/testsuite/gas/z80/atend.d                |  2 +-
 gold/object.h                                |  2 +-
 include/gdb/remote-sim.h                     |  2 +-
 include/opcode/ChangeLog                     |  2 +-
 include/opcode/i960.h                        |  2 +-
 ld/testsuite/ld-mips-elf/mips16-pic-1.inc    |  2 +-
 opcodes/aarch64-asm.c                        |  2 +-
 opcodes/aarch64-dis.c                        |  2 +-
 opcodes/msp430-dis.c                         |  2 +-
2013-08-23 07:54:19 +00:00
Nick Clifton 865acd3586 PR ld/15839
* scripttempl/avr.sc: Do not include gc'able sections into general
	sections during relocatable links.
2013-08-23 07:37:31 +00:00
Nick Clifton f69a2f978f * emultempl/pe.em: Add --disable-large-address-aware option.
* ld.texinfo (--disable-large-address-aware): Add documentation.
2013-08-22 15:28:42 +00:00
Alan Modra 65fd058fe6 * ld-powerpc/powerpc.exp: Substitute for le in options_regsub(ld).
Correct ppc64elftests option replacement.
	(supports_ppc64): Match elf64lppc too.
	* ld-powerpc/relbrlt.d: Update for little-endian.
	* ld-powerpc/symtocbase.d: Likewise.
	* ld-powerpc/tls.t: Likewise.
	* ld-powerpc/tlsexetoc.g: Likewise.
	* ld-powerpc/tlsso.d: Likewise.
	* ld-powerpc/tlsso.g: Likewise.
	* ld-powerpc/tlstoc.t: Likewise.
	* ld-powerpc/tlstocso.d: Likewise.
	* ld-powerpc/tlstocso.g: Likewise.
	* ld-powerpc/tlstocso.t: 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.
2013-08-22 07:34:28 +00:00
Nick Clifton 2e53f7d601 * ldexp.c: Add LOG2CEIL() builtin function to linker script language
* ldgram.y: Likewise
	* ldlex.l: Likewise
	* NEWS: Mention the new feature.
	* ld.texinfo: Document the new feature.

	* ld-scripts/log2.exp: New: Run the new log2 test.
	* ld-scripts/log2.s: Source for the new test.
	* ld-scripts/log2.t: Linker script for new test.
2013-08-15 07:30:15 +00:00
Nick Clifton 62c34db3dc PR ld/15787
* elf32-arm.c (elf32_arm_final_link_relocate): Use origin of output
	segment containing the relocating symbol instead of assuming 0 for
	sb group relocations.

	* ld-arm/group-relocs-ldr-bad.s: Redefine bar into foo section
	beyond 16 bit offset width.
	* ld-arm/group-relocs-ldrs-bad.s: Likewise.
	* ld-arm/group-relocs-ldr-bad.d: Adjust expected result.
	* ld-arm/group-relocs-ldrs-bad.d: Likewise.
	* ld-arm/group-relocs.s: Add comments.  Move symbols used for sb
	group relocations into .data section.  Drop section zero.  Use pc/r0
	as base register when pc/sb group relocations are used.
	* ld-arm/group-relocs.d: Adjust expected result.
	* ld-arm/group-relocs-alu-bad-2.d: New test for sb group relocation.
	* ld-arm/group-relocs-ldc-bad-2.d: Likewise.
	* ld-arm/group-relocs-ldr-bad-2.d: New test for pc group relocation.
	* ld-arm/group-relocs-ldrs-bad-2.d: Likewise.
	* ld-arm/unresolved-2.d: Add sb relocation failure test.
	* ld-arm/group-relocs-alu-bad-2.s: New test source.
	* ld-arm/group-relocs-ldr-bad-2.s: Likewise.
	* ld-arm/group-relocs-ldrs-bad-2.s: Likewise.
	* ld-arm/group-relocs-ldc-bad-2.s: Likewise.
	* ld-arm/unresolved-2.s: Likewise.
	* ld-arm/arm-elf.exp: For group-relocs, drop section zero start
	definition.  Run the new tests.
2013-08-14 12:20:41 +00:00
Nick Clifton 4046d87a36 * elf32-rl78.c (rl78_elf_merge_private_bfd_data): Complain if G10
flag bits do not match.
	(rl78_elf_print_private_bfd_data): Describe G10 flag.

	* readelf.c (get_machine_flags): Handle RL78 G10 flag.

	* config/tc-rl78.c (elf_flags): New variable.
	(enum options): Add OPTION_G10.
	(md_longopts): Add mg10.
	(md_parse_option): Parse -mg10.
	(rl78_elf_final_processing): New function.
	* config/tc-rl78.c (tc_final_processing): Define.
	* doc/c-rl78.texi: Document -mg10 option.

	* rl78.c (E_FLAG_RL78_G10): Define.

	* lib/ld-lib.exp (check_shared_lib_support): Note that the RL78
	does not support shared library generation.
2013-08-09 10:40:04 +00:00
Nick Clifton 31a91d61f9 PR ld/15787
* elf32-arm.c (elf32_arm_final_link_relocate): Base SB on the
	output section VMA.

	* ld-arm/group-relocs-alu-bad-2.d; New.
	* ld-arm/group-relocs-alu-bad-2.s: New.
	* ld-arm/group-relocs-ldc-bad-2.d: New.
	* ld-arm/group-relocs-ldc-bad-2.s: New.
	* ld-arm/group-relocs-ldr-bad-2.d: New.
	* ld-arm/group-relocs-ldr-bad-2.s: New.
	* ld-arm/group-relocs-ldrs-bad-2.d: New.
	* ld-arm/group-relocs-ldrs-bad-2: New.
	* ld-arm/arm-elf.exp: Add the new tests.
	* ld-arm/group-relocs-ldr-bad.d: Update expected output.
	* ld-arm/group-relocs-ldr-bad.s: Likewise.
	* ld-arm/group-relocs-ldrs-bad.d: Likewise.
	* ld-arm/group-relocs-ldrs-bad.s: Likewise.
	* ld-arm/group-relocs.d: Likewise.
	* ld-arm/group-relocs.s: Likewise.
2013-07-31 16:26:02 +00:00
Maciej W. Rozycki 1581972d79 * ld-vax-elf/export-class-call.dd: New test.
* ld-vax-elf/export-class-call.rd: New test.
	* ld-vax-elf/export-class-call.xd: New test.
	* ld-vax-elf/export-class-data.dd: New test.
	* ld-vax-elf/export-class-data.rd: New test.
	* ld-vax-elf/export-class-data.xd: New test.
	* ld-vax-elf/export-class.ld: New test linker script.
	* ld-vax-elf/export-class-call.s: New test source.
	* ld-vax-elf/export-class-data.s: New test source.
	* ld-vax-elf/export-class-def.s: New test source.
	* ld-vax-elf/vax-elf.exp: Run the new tests.
	* ld-vax-elf/vax-export-class.rd: New test.
	* ld-vax-elf/vax-export-class.xd: New test.
	* ld-vax-elf/export-class.exp: New test script.
2013-07-27 22:28:29 +00:00
Maciej W. Rozycki 125b5bac98 bfd/
* elf32-vax.c (elf_vax_check_relocs) <R_VAX_GOT32, R_VAX_PLT32>:
	Don't check symbol visibility here.  Remove a check already
	asserted for.
	(elf_vax_instantiate_got_entries): Use SYMBOL_REFERENCES_LOCAL
	instead of individual checks.
	(elf_vax_relocate_section) <R_VAX_GOT32, R_VAX_PLT32>: Only
	check the offset to decide if produce a GOT or PLT entry.
	Remove redundant assertions.  Remove code to produce GOT entries
	for local symbols.  Remove a duplicate comment and add a comment
	on GOT relocations.
	(elf_vax_finish_dynamic_symbol): Remove code to produce RELATIVE
	dynamic relocs.

	ld/testsuite/
	* ld-vax-elf/got-local-exe.xd: New test.
	* ld-vax-elf/got-local-lib.xd: New test.
	* ld-vax-elf/got-local-aux.s: New test source.
	* ld-vax-elf/got-local-def.s: New test source.
	* ld-vax-elf/got-local-ref.s: New test source.
	* ld-vax-elf/vax-elf.exp: Run the new tests.
2013-07-27 22:21:11 +00:00
H.J. Lu df71cb5cbf Check .gnu.warning section in shared library
PR ld/15762
	* ld-elf/shared.exp (build_tests): Check .gnu.warning section
	in the libbarw.so library.
	* ld-elf/libbarw.rd: New.

	* lib/ld-lib.exp (run_cc_link_tests): Support checking on
	output with warning message.
2013-07-24 17:24:20 +00:00
Nick Clifton dffc89775f oops - omitted from previous delta 2013-07-23 07:40:46 +00:00
Nick Clifton eb013ee23c oops - omitted fromn previous delta 2013-07-22 13:04:57 +00:00
Nick Clifton 9933d19149 * ld-scripts/script.exp: Use run_dump_test instead of
ld_simple_link to check the error message.
	* ld-scripts/align-with-input.d: New file.
	* ld-scripts/region-alias-1.d: Likewise.
	* ld-scripts/region-alias-2.d: Likewise.
	* ld-scripts/region-alias-3.d: Likewise.
	* ld-scripts/region-alias-4.d: Likewise.
2013-07-22 13:03:30 +00:00
Nick Clifton 0a01f695e0 oops - omitted from previous delta 2013-07-19 13:21:55 +00:00
Nick Clifton 1eec346e12 * ldgram.y: Add ALIGN_WITH_INPUT output section attribute.
* ldlang.c: Likewise.
	* ldlang.h: Likewise.
	* ldlex.l: Likewise.
	* mri.c: Likewise.
	* ld.texinfo: Document new feature.
	* NEWS: Mention new feature.

	* ld-scripts/script.exp: Run align with input test.
	* ld-scripts/align-with-input.t: New file.
	* ld-scripts/rgn-at8.d: Likewise.
	* ld-scripts/rgn-at8.t: Likewise.
2013-07-19 10:39:51 +00:00
Nick Clifton 39f2162499 * elf32-arm.c (arm_type_of_stub): Don't use ST_BRANCH_TO_ARM for
thumb only targets.
        (elf32_arm_final_link_relocate): Likewise.

        * ld-arm/thumb-b-lks-sym.d: Updated to be more flexible.
        * ld-arm/thumb-bl-lks-sym.d: Likewise.
2013-07-18 12:00:26 +00:00
Nick Clifton 7a89b94e91 * elf32-arm.c (elf32_arm_stub_long_branch_arm_nacl): New variable.
(elf32_arm_stub_long_branch_arm_nacl_pic): New variable.
	(arm_build_one_stub): Increase MAXRELOCS to 3.
	(arm_type_of_stub): Use them if GLOBALS->nacl_p.
	(struct elf32_arm_link_hash_table): Give add_stub_section member's
	pointee type a third argument.
	(elf32_arm_create_or_find_stub_sec): Update caller.
	(elf32_arm_size_stubs): Update argument type.
	* bfd-in.h (elf32_arm_size_stubs): Update decl.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.

	* emultempl/armelf.em (elf32_arm_add_stub_section): Take third
	argument ALIGNMENT_POWER, use it instead of constant 3.

	* ld-arm/farcall-arm-nacl.d: New file.
	* ld-arm/farcall-arm-nacl-pic.d: New file.
	* ld-arm/farcall-data-nacl.d: New file.
	* ld-arm/arm-elf.exp (armeabitests_common): Add extra element to
	"action" lists for those cases to use a different dump file for NaCl
	targets.
	Massage $armeabitests_common to drop the extra element or the one
	before it, depending on [istarget "arm*-*-nacl*"].

	* ld-arm/arm-elf.exp (armelftests_common): Move all "Cortex-A8
	erratum fix", Thumb-only and interworking cases to ...
	(armelftests_nonacl): ... here.
	(armeabitests_common): Move all "erratum 760522 fix", Thumb-only
	and interworking cases to ...
	(armeabitests_nonacl): ... here.
2013-07-18 11:24:11 +00:00
Maciej W. Rozycki ba92f88752 include/elf/
* mips.h (EF_MIPS_NAN2008): New macro.

	bfd/
	* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Handle
	EF_MIPS_NAN2008.
	(_bfd_mips_elf_print_private_bfd_data): Likewise.

	binutils/
	* readelf.c (get_machine_flags): Handle EF_MIPS_NAN2008.

	gas/
	* config/tc-mips.c (mips_flag_nan2008): New variable.
	(options): Add OPTION_NAN enum value.
	(md_longopts): Handle it.
	(md_parse_option): Likewise.
	(s_nan): New function.
	(mips_elf_final_processing): Handle EF_MIPS_NAN2008.
	(md_show_usage): Add -mnan.

	* doc/as.texinfo (Overview): Add -mnan.
	* doc/c-mips.texi (MIPS Opts): Document -mnan.
	(MIPS NaN Encodings): New node.  Document .nan directive.
	(MIPS-Dependent): List the new node.

	gas/testsuite/
	* gas/mips/nan-2008-1.d: New test.
	* gas/mips/nan-2008-2.d: New test.
	* gas/mips/nan-2008-3.d: New test.
	* gas/mips/nan-2008-4.d: New test.
	* gas/mips/nan-legacy-1.d: New test.
	* gas/mips/nan-legacy-2.d: New test.
	* gas/mips/nan-legacy-3.d: New test.
	* gas/mips/nan-legacy-4.d: New test.
	* gas/mips/nan-legacy-5.d: New test.
	* gas/mips/nan-error-1.l: New list test.
	* gas/mips/nan-error-2.l: New list test.
	* gas/mips/nan-2008-override.s: New test source.
	* gas/mips/nan-2008.s: New test source.
	* gas/mips/nan-legacy-override.s: New test source.
	* gas/mips/nan-legacy.s: New test source.
	* gas/mips/nan-error-1.s: New test source.
	* gas/mips/nan-error-2.s: New test source.
	* gas/mips/mips.exp: Run the new tests.

	ld/testsuite/
	* ld-mips-elf/nan-2008.d: New test.
	* ld-mips-elf/nan-legacy.d: New test.
	* ld-mips-elf/nan-mixed-1.d: New test.
	* ld-mips-elf/nan-mixed-2.d: New test.
	* ld-mips-elf/nan-2008.s: New test source.
	* ld-mips-elf/nan-legacy.s: New test source.
2013-07-12 15:58:15 +00:00
Jeff Law 1de778ed23 * scripttempl/elf.sc: Handle function names and other
text after .text.unlikely too.
2013-07-08 17:07:15 +00:00
Tristan Gingold 639453f58d 2013-07-08 Tristan Gingold <gingold@adacore.com>
* scripttempl/ia64vms.sc: Add support of per data and per function
	sections.
2013-07-08 13:02:21 +00:00
Andreas Krebbel a63cc5f70c 2013-07-05 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
bfd/
	* elf32-s390.c: Rewrite GOT accesses using larl if possible.
	* elf64-s390.c: Likewise.

ld/testsuite/
	* ld-s390/gotreloc-1.s: New file.
	* ld-s390/gotreloc-1.ver: New file.
	* ld-s390/gotreloc_31-1.dd: New file.
	* ld-s390/gotreloc_64-1.dd: New file.
	* ld-s390/s390.exp: Run the new tests. Run 31 bit tests also on 64
	bit.
2013-07-05 09:51:00 +00:00
Marcus Shawcroft 4aa2c5e2cb [PATCH, COMMITTED] [AArch64] Replace the :got_prel19: address modifier with :got: 2013-07-03 17:26:36 +00:00
Marcus Shawcroft cc0efaa802 [AArch64] Fix creation of .got and placement of _GLOBAL_OFFSET_TABLE_ 2013-07-02 06:39:26 +00:00
Marcus Shawcroft 9d115506b6 [AArch64] Adjust testcases for move of &_DYNAMIC to got[0]. 2013-07-02 06:37:33 +00:00
H.J. Lu 0ca92f2e81 Adjust ld-x86-64/tlsg.sd
* ld-x86-64/tlsg.sd: Adjusted.
2013-07-01 16:17:11 +00:00
Alan Modra 1c865ab2fb bfd/
* elf64-ppc.h (ppc64_elf_toc): Delete.
	(ppc64_elf_set_toc): Declare.
	* elf64-ppc.c (ppc64_elf_toc_reloc): Replace call to ppc64_elf_toc
	with call the ppc64_elf_set_toc.
	(ppc64_elf_toc_ha_reloc, ppc64_elf_toc64_reloc): Likewise.
	(ppc64_elf_start_multitoc_partition): Likewise.
	(struct ppc_link_hash_table): Delete dot_toc_dot.  Replace all uses
	with elf.hgot.
	(ppc64_elf_process_dot_syms): Don't make a fake function descriptor
	for ".TOC.".
	(ppc64_elf_check_relocs): Mark sections with a reference to .TOC.
	as needing a toc pointer.
	(ppc64_elf_size_stubs): Don't set dot_toc_dot here.
	(ppc64_elf_set_toc): Rename from ppc64_elf_toc.  Add info param.
	Set elf.hgot value.
ld/
	* emultempl/ppc64elf.em: (ppc_layout_sections_again): Call
	ppc64_elf_set_toc rather than ppc64_elf_toc/_bfd_set_gp_value.
	(gld${EMULATION_NAME}_after_allocation): Likewise.
2013-07-01 03:45:05 +00:00
H.J. Lu a69ed7f7aa Handle R_X86_64_DTPOFF64
bfd/

	PR ld/15685
	* elf64-x86-64.c (elf_x86_64_relocate_section): Handle
	R_X86_64_DTPOFF64.

ld/testsuite/

	PR ld/15685
	* ld-x86-64/tlsg.s: Add a test for R_X86_64_DTPOFF64.
	* ld-x86-64/tlsg.sd: Updated.
2013-06-28 15:07:55 +00:00
Yufeng Zhang 0609b76739 [AArch64, ILP32] Really add ld/emulparams/aarch64elf32.sh that was missed
from the previous commit

ld/

	* emulparams/aarch64elf32.sh: New file.
2013-06-26 10:59:17 +00:00
Yufeng Zhang 70f0bc67ba [AArch64, ILP32] 6/6 Add big-endian targets
ld/

	* Makefile.am (ALL_64_EMULATION_SOURCES): Add eaarch64elf32b.c.
	(eaarch64elf32b.c): New dependency and rule.
	* Makefile.in: Re-generated.
	* configure.tgt (aarch64-*-elf): Add aarch64elf32b.
	(aarch64_be-*-elf, aarch64_be-*-linux*, aarch64-*-linux*): Likewise.
	* emulparams/aarch64elf32b.sh: New file.
2013-06-26 10:56:05 +00:00
Yufeng Zhang cec5225bd8 [AArch64, ILP32] 2/6 Parametrize elfnn-aarch64.c and add basic support in ld
and gas.

bfd/

	* Makefile.am (BFD64_BACKENDS): Add elf32-aarch64.lo.
	(BUILD_CFILES): Add elf32-aarch64.c.
	(elf32-aarch64.c): New rule for generating from elfnn-aarch64.c.
	* Makefile.in: Re-generated.
	* archures.c (bfd_mach_aarch64_ilp32): New define.
	* bfd-in.h (bfd_elf32_aarch64_init_maps): New declaration.
	(bfd_elf32_aarch64_set_options): Ditto.
	(elf32_aarch64_setup_section_lists): Ditto.
	(elf32_aarch64_next_input_section): Ditto.
	(elf32_aarch64_size_stubs): Ditto.
	(elf32_aarch64_build_stubs): Ditto.
	* bfd-in2.h: Re-generated.
	* config.bfd (aarch64-*-elf): Add bfd_elf32_littleaarch64_vec
	and bfd_elf32_bigaarch64_vec.
	(aarch64-*-linux*): Likewise.
	(aarch64_be-*-elf): Likewise.
	(aarch64_be-*-linux*): Likewise.
	* configure.in (bfd_elf32_bigaarch64_vec)
	(bfd_elf32_littleaarch64_vec): New.
	* configure: Re-generated.
	* cpu-aarch64.c (compatible): Don't allow mixing ilp32 objects with
	lp64 ones.
	(bfd_aarch64_arch_ilp32): New.
	(bfd_aarch64_arch): Link to bfd_aarch64_arch_ilp32.
	* elfnn-aarch64.c (ARCH_SIZE): New define.
	(AARCH64_R, AARCH64_R_STR, LOG_FILE_ALIGN): New defines.
	(GOT_ENTRY_SIZE): Re-define as (ARCH_SIZE / 8).
	(elf64_aarch64_*): Rename to elfNN_aarch64_*.
	(ELF64_R_*): Rename to ELFNN_R_*.
	Plus other paramaterization.
	* targets.c (bfd_elf32_bigaarch64_vec, bfd_elf32_littleaarch64_vec):
	New declarations.
	(_bfd_target_vector): Add bfd_elf32_bigaarch64_vec and
	bfd_elf32_littleaarch64_vec.

gas/

	* config/tc-aarch64.c (ilp32_p): New static variable.
	(elf64_aarch64_target_format): Return the target according to the
	value of 'ilp32_p'.
	(md_begin): Determine 'mach' according to the value of 'ilp32_p'.
	(aarch64_opts): Add support for options '-milp32' and '-mlp64'.
	(aarch64_dwarf2_addr_size): New function.
	* config/tc-aarch64.h (aarch64_dwarf2_addr_size): New declaration.
	(DWARF2_ADDR_SIZE): New define.

ld/

	* Makefile.am (ALL_64_EMULATION_SOURCES): Add eaarch64elf32.c.
	(eaarch64elf32.c): New dependency and rule.
	* Makefile.in: Re-generated.
	* configure.tgt (aarch64-*-elf): Add aarch64elf32.
	(aarch64_be-*-elf, aarch64_be-*-linux*, aarch64-*-linux*): Likewise.
	* emulparams/aarch64elf32.sh: New file.
2013-06-26 10:41:42 +00:00
Maciej W. Rozycki 833794fc12 bfd/
* elfxx-mips.h (_bfd_mips_elf_insn32): New prototype.
	* elfxx-mips.c (mips_elf_link_hash_table): Add insn32 member.
	(STUB_MOVE32_MICROMIPS, STUB_JALR32_MICROMIPS): New macros.
	(MICROMIPS_INSN32_FUNCTION_STUB_NORMAL_SIZE): Likewise.
	(MICROMIPS_INSN32_FUNCTION_STUB_BIG_SIZE): Likewise.
	(micromips_insn32_o32_exec_plt0_entry): New variable.
	(micromips_insn32_o32_exec_plt_entry): Likewise.
	(_bfd_mips_elf_adjust_dynamic_symbol): Handle insn32 mode.
	(mips_elf_estimate_stub_size): Likewise.
	(_bfd_mips_elf_size_dynamic_sections): Likewise.
	(_bfd_mips_elf_finish_dynamic_symbol): Likewise.
	(mips_finish_exec_plt): Likewise.
	(_bfd_mips_elf_relax_section): Likewise.
	(_bfd_mips_elf_insn32): New function.
	(_bfd_mips_elf_get_synthetic_symtab): Handle insn32 PLT.

	gas/
	* config/tc-mips.c (mips_set_options): Add insn32 member.
	(mips_opts): Initialize it.
	(NOP_INSN, NOP_INSN_SIZE): Handle insn32 mode.
	(options): Add OPTION_INSN32 and OPTION_NO_INSN32 enum values.
	(md_longopts): Add "minsn32" and "mno-insn32" options.
	(is_size_valid): Handle insn32 mode.
	(md_assemble): Pass instruction string down to macro.
	(brk_fmt): Add second dimension and insn32 mode initializers.
	(mfhl_fmt): Likewise.
	(BRK_FMT, MFHL_FMT): Handle insn32 mode.
	(macro_build) <'c'>: Handle microMIPS 32-bit BREAK encoding.
	(macro_build_jalr, move_register): Handle insn32 mode.
	(macro_build_branch_rs): Likewise.
	(macro): Handle insn32 mode.
	<M_JRADDIUSP>, <M_JRC>, <M_MOVEP>: New cases.
	(mips_ip): Handle insn32 mode.
	(md_parse_option): Handle OPTION_INSN32 and OPTION_NO_INSN32.
	(s_mipsset): Handle "insn32" and "noinsn32" pseudo-ops.
	(mips_handle_align): Handle insn32 mode.
	(md_show_usage): Add -minsn32 and -mno-insn32.

	* doc/as.texinfo (Target MIPS options): Add -minsn32 and
	-mno-insn32 options.
	(-minsn32, -mno-insn32): New options.
	* doc/c-mips.texi (MIPS Opts): Add -minsn32 and -mno-insn32
	options.
	(MIPS assembly options): New node.  Document .set insn32 and
	.set noinsn32.
	(MIPS-Dependent): List the new node.

	gas/testsuite/
	* gas/mips/micromips-insn32.d: New test.
	* gas/mips/micromips-noinsn32.d: Likewise.
	* gas/mips/micromips.l: Rename to...
	* gas/mips/micromips-warn.l: ... this.
	* gas/mips/micromips.d: Update accordingly.
	* gas/mips/micromips-trap.d: Likewise.
	* gas/mips/micromips.l: New list test.
	* gas/mips/micromips.s: Add conditionals.
	* gas/mips/mips.exp: Run the new tests.

	include/opcode/
	* mips.h: Add M_JRADDIUSP, M_JRC and M_MOVEP anonymous enum
	values.

	ld/
	* emultempl/mipself.em (insn32): New variable.
	(mips_create_output_section_statements): Handle insn32 mode.
	(PARSE_AND_LIST_PROLOGUE): New macro.
	(PARSE_AND_LIST_LONGOPTS): Likewise.
	(PARSE_AND_LIST_OPTIONS): Likewise.

	* gen-doc.texi: Set MIPS.
	* ld.texinfo: Likewise.
	(Options specific to MIPS targets): New section.
	(ld and MIPS family): New node.
	(Top, Machine Dependent): List the new node.

	opcodes/
	* micromips-opc.c (micromips_opcodes): Add "jraddiusp", "jrc"
	and "movep" macros.
2013-06-25 18:02:34 +00:00
Maciej W. Rozycki 1bbce13264 bfd/
* elfxx-mips.h (_bfd_mips_elf_get_synthetic_symtab): New
	prototype.
	* elf32-mips.c (elf_backend_plt_sym_val): Remove macro.
	(bfd_elf32_get_synthetic_symtab): New macro.
	* elfxx-mips.c (plt_entry): New structure.
	(mips_elf_link_hash_entry): Add use_plt_entry member.
	(mips_elf_link_hash_table): Rename plt_entry_size member to
	plt_mips_entry_size.  Add plt_comp_entry_size, plt_mips_offset,
	plt_comp_offset, plt_got_index entries and plt_header_is_comp
	members.
	(STUB_LW_MICROMIPS, STUB_MOVE_MICROMIPS): New macros.
	(STUB_LUI_MICROMIPS, STUB_JALR_MICROMIPS): Likewise.
	(STUB_ORI_MICROMIPS, STUB_LI16U_MICROMIPS): Likewise.
	(STUB_LI16S_MICROMIPS): Likewise.
	(MICROMIPS_FUNCTION_STUB_NORMAL_SIZE): Likewise.
	(MICROMIPS_FUNCTION_STUB_BIG_SIZE): Likewise.
	(micromips_o32_exec_plt0_entry): New variable.
	(mips16_o32_exec_plt_entry): Likewise.
	(micromips_o32_exec_plt_entry): Likewise.
	(mips_elf_link_hash_newfunc): Initialize use_plt_entry.
	(mips_elf_output_extsym): Update to use gotplt_union's plist
	member rather than offset.
	(mips_elf_gotplt_index): Likewise.  Remove the VxWorks
	restriction.  Use MIPS_ELF_GOT_SIZE to calculate GOT address.
	(mips_elf_count_got_symbols): Update to use gotplt_union's plist
	member rather than offset.
	(mips_elf_calculate_relocation): Handle MIPS16/microMIPS PLT
	entries.
	(_bfd_mips_elf_create_dynamic_sections): Don't set PLT sizes
	here.
	(mips_elf_make_plt_record): New function.
	(_bfd_mips_elf_check_relocs): Update comment.  Record occurences
	of JAL relocations that might need a PLT entry.
	(_bfd_mips_elf_adjust_dynamic_symbol): Update to use
	gotplt_union's plist member rather than offset.  Set individual
	PLT entry sizes here.  Handle MIPS16/microMIPS PLT entries.
	Don't set the symbol's value in the symbol table for PLT
	references here.  Don't set the PLT or PLT GOT section sizes
	here.
	(mips_elf_estimate_stub_size): Handle microMIPS stubs.
	(mips_elf_allocate_lazy_stub): Likewise.
	(mips_elf_lay_out_lazy_stubs): Likewise.  Define a _MIPS_STUBS_
	magic symbol.
	(mips_elf_set_plt_sym_value): New function.
	(_bfd_mips_elf_size_dynamic_sections): Set PLT header size and
	PLT and PLT GOT section sizes here.  Set the symbol values in
	the symbol table for PLT references here.  Handle microMIPS
	annotation of the _PROCEDURE_LINKAGE_TABLE_ magic symbol.
	(_bfd_mips_elf_finish_dynamic_symbol): Update to use
	gotplt_union's plist member rather than offset.  Handle
	MIPS16/microMIPS PLT entries.  Handle microMIPS stubs.
	(_bfd_mips_vxworks_finish_dynamic_symbol): Update to use
	gotplt_union's plist member rather than offset.  Use
	MIPS_ELF_GOT_SIZE to calculate GOT address.
	(mips_finish_exec_plt): Handle microMIPS PLT.  Return status.
	(_bfd_mips_elf_finish_dynamic_sections): Handle result from
	mips_finish_exec_plt.
	(_bfd_mips_elf_link_hash_table_create): Update to use
	gotplt_union's plist member rather than offset.
	(_bfd_mips_elf_get_synthetic_symtab): New function.

	include/elf/
	* mips.h (ELF_ST_IS_MIPS_PLT): Respect STO_MIPS16 setting.
	(ELF_ST_SET_MIPS_PLT): Likewise.

	gdb/
	* mips-tdep.c (mips_elf_make_msymbol_special): Handle MIPS16 and
	microMIPS synthetic symbols.

	ld/
	* emulparams/elf32btsmip.sh: Arrange for .got.plt to be placed
	as close to .plt as possible.
	* scripttempl/elf.sc: Handle $INITIAL_READWRITE_SECTIONS and
	$PLT_NEXT_DATA variables.

	ld/testsuite/
	* ld-mips-elf/jalx-2.dd: Update for microMIPS PLT support.
	* ld-mips-elf/pic-and-nonpic-3a.dd: Update for the _MIPS_STUBS_
	magic symbol.
	* ld-mips-elf/pic-and-nonpic-3b.dd: Likewise.
	* ld-mips-elf/pic-and-nonpic-6-n32.dd: Likewise.
	* ld-mips-elf/pic-and-nonpic-6-n64.dd: Likewise.
	* ld-mips-elf/pic-and-nonpic-6-o32.dd: Likewise.
	* ld-mips-elf/stub-dynsym-1-10000.d: Likewise.
	* ld-mips-elf/stub-dynsym-1-2fe80.d: Likewise.
	* ld-mips-elf/stub-dynsym-1-7fff.d: Likewise.
	* ld-mips-elf/stub-dynsym-1-8000.d: Likewise.
	* ld-mips-elf/stub-dynsym-1-fff0.d: Likewise.
	* ld-mips-elf/tlslib-o32.d: Likewise.

	opcodes/
	* mips-dis.c (is_mips16_plt_tail): New function.
	(print_insn_mips16): Handle MIPS16 PLT entry's GOT slot address
	word.
	(is_compressed_mode_p): Handle MIPS16/microMIPS PLT entries.
2013-06-24 23:55:46 +00:00
Richard Sandiford 42429eacb4 bfd/
* Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Move MIPS ELF
	files to...
	(BFD64_BACKENDS, BFD64_BACKENDS_CFILES): ...here.
	* Makefile.in: Regenerate.
	* config.bfd: Enclose all MIPS ELF targets in #ifdef BFD64.
	Set want64 to true for them at the end.
	* targets.c (_bfd_target_vector): Protect MIPS ELF targets with
	#ifdef BFD64.

gas/
	* config/tc-mips.c: Assert that offsetT and valueT are at least
	8 bytes in size.
	(GPR_SMIN, GPR_SMAX): New macros.
	(macro, mips_ip): Remove code for 4-byte valueT and offsetT.

ld/
	* Makefile.am (ALL_EMULATION_SOURCES): Move MIPS ELF emulations to...
	(ALL_64_EMULATION_SOURCES): ...here.
	* Makefile.in: Regenerate.
2013-06-23 20:08:23 +00:00
Richard Sandiford e8044f355d * configure.ac (mips*-*-bsd*, mips*-*-ultrix*, mips*-*-osf*)
(mips*-*-ecoff*, mips*-*-pe*, mips*-*-irix* [v4 and earlier])
	(mips*-*-lnews*, mips*-*-riscos*): Add gas and ld to noconfigdirs.
	* configure: Regenerate.

gas/
	* NEWS: Note removal of ECOFF support.
	* doc/as.texinfo (--emulation): Update for the removal of MIPS ECOFF.
	* Makefile.am (TARG_ENV_HFILES): Remove config/te-lnews.h.
	(MULTI_CFILES): Remove config/e-mipsecoff.c.
	* Makefile.in: Regenerate.
	* configure.in: Remove MIPS ECOFF references.
	(mips-sony-bsd*, mips-*-bsd*, mips-*-lnews*-ecoff, mips-*-*-ecoff):
	Delete cases.
	(mips-*-irix5*-*, mips*-*-linux*-*, mips*-*-freebsd*)
	(mips*-*-kfreebsd*-gnu, mips-*-*-elf): Fold into...
	(mips-*-*): ...this single case.
	(mipsbecoff, mipslecoff, mipsecoff): Remove emulations.  Expect
	MIPS emulations to be e-mipself*.
	* configure: Regenerate.
	* configure.tgt (mips-sony-bsd*, mips-*-ultrix*, mips-*-osf*)
	(mips-*-ecoff*, mips-*-pe*, mips-*-irix*, ips-*-lnews*, mips-*-riscos*)
	(mips-*-sysv*): Remove coff and ecoff cases.
	* as.c (mipsbecoff, mipslecoff, mipsecoff): Remove.
	* ecoff.c: Remove reference to MIPS ECOFF.
	* config/e-mipsecoff.c, config/te-lnews.h: Delete files.
	* config/tc-mips.c (ECOFF_LITTLE_FORMAT): Delete.
	(RDATA_SECTION_NAME, mips_target_form): Remove COFF and ECOFF cases.
	(mips_hi_fixup): Tweak comment.
	(append_insn): Require a howto.
	(mips_after_parse_args): Remove OBJ_MAYBE_ECOFF code.

gas/testsuite/
	* gas/all/gas.exp: Remove reference to mips-ecoff.
	* gas/mips/branch-misc-1.d, gas/mips/branch-misc-2.d,
	gas/mips/branch-misc-2-64.d, gas/mips/branch-misc-2pic.d,
	gas/mips/branch-misc-2pic-64.d, gas/mips/branch-swap.d: Remove
	skips for mips-*-ecoff.

ld/
	* NEWS: Document the removal of MIPS ECOFF targets.
	* ld.texinfo (--gpsize=@var{value}): Use MIPS ELF rather than
	MIPS ECOFF as an example of a target that supports small data.
	* ldmain.c (g_switch_value): Likewise.
	* configure.tgt (mips*-*-pe, mips*-dec-ultrix*, mips*-dec-osf*)
	(mips*-sgi-irix* [v4 and earlier], mips*el-*-ecoff*, mips*-*-ecoff*)
	(mips*-*-bsd*, mips*-*-lnews*): Remove cases.
	* Makefile.am (ALL_EMULATION_SOURCES): Remove emipsbig.c, emipsbsd.c,
	emipsidt.c, emipsidtl.c, emipslit.c, emipslnews.c and emipspe.c.
	(emipsbig.c, emipsbsd.c, emipsidt.c, emipsidtl.c, emipslit.c)
	(emipslnews.c, emipspe.c): Delete rules.
	* Makefile.in: Regenerate.
	* emulparams/mipsbig.sh, emulparams/mipsbsd.sh, emulparams/mipsidt.sh,
	emulparams/mipsidtl.sh, emulparams/mipslit.sh, emulparams/mipslnews.sh,
	emulparams/mipspe.sh, emultempl/mipsecoff.em: Delete.
	* emultempl/m68kcoff.em: Update comment to say that MIPS ECOFF support
	has now been removed.
	* emultempl/pe.em: Remove TARGET_IS_mipspe checks.
2013-06-22 16:44:16 +00:00
Will Newton 8847944f8c aarch64: Revert AArch64 ifunc changes.
The AArch64 ifunc patch introduced a regression caused by incorrect
PLT layout. Revert it until a fix is verified.

bfd/ChangeLog:

2013-06-19  Will Newton  <will.newton@linaro.org>

	* configure: Regenerated.
	* configure.in: Remove aarch64 dependency on elf-ifunc.c.
	* elf64-aarch64.c: Remove objalloc.h include.
	(elf64_aarch64_howto_dynrelocs): Remove R_AARCH64_IRELATIVE howto.
	(struct elf64_aarch64_link_hash_table): Remove ifunc related
	members. (elf_aarch64_local_htab_hash): Remove function.
	(elf_aarch64_local_htab_eq): Remove function.
	(elf_aarch64_get_local_sym_hash): Remove function.
	(elf64_aarch64_link_hash_table_create): Remove local hash
	table initialization.
	(elf64_aarch64_final_link_relocate): Remove sym argument and
	handling of ifunc symbols.
	(elf64_aarch64_relocate_section): Don't pass sym argument to
	elf64_aarch64_final_link_relocate.
	(elf64_aarch64_gc_sweep_hook): Remove handling of ifunc symbols.
	(elf64_aarch64_adjust_dynamic_symbol): Likewise.
	(elf64_aarch64_check_relocs): Likewise.
	(elf64_aarch64_post_process_headers): Remove call to
	_bfd_elf_set_osabi.
	(elf64_aarch64_is_function_type): New function.
	(elf64_aarch64_allocate_dynrelocs): Remove handling of ifunc
	symbols. (elf_aarch64_allocate_local_dynrelocs): Remove function.
	(elf64_aarch64_size_dynamic_sections): Remove call to
	elf_aarch64_allocate_local_dynrelocs.
	(elf64_aarch64_create_small_pltn_entry): Remove info argument.
	Remove creation of R_AARCH64_IRELATIVE dynamic relocs.
	(elf64_aarch64_finish_dynamic_symbol): Remove handling of ifunc
	symbols. (elf_aarch64_finish_local_dynamic_symbol): Remove
	function. (elf64_aarch64_finish_dynamic_sections): Remove call to
	elf_aarch64_finish_local_dynamic_symbol.
	(elf64_aarch64_add_symbol_hook): Remove function.

include/elf/ChangeLog:

2013-06-19  Will Newton  <will.newton@linaro.org>

	* aarch64.h: Remove R_AARCH64_IRELATIVE.

ld/ChangeLog:

2013-06-19  Will Newton  <will.newton@linaro.org>

	* emulparams/aarch64elf.sh: Remove IREL_IN_PLT.

ld/testsuite/ChangeLog:

2013-06-19  Will Newton  <will.newton@linaro.org>

	* ld-aarch64/aarch64-elf.exp: Remove ifunc tests.
	* ld-ifunc/ifunc.exp: Disable ifunc tests on AArch64.
	* ld-aarch64/ifunc-1-local.d: Remove.
	* ld-aarch64/ifunc-1-local.s: Likewise.
	* ld-aarch64/ifunc-1.d: Likewise.
	* ld-aarch64/ifunc-1.s: Likewise.
	* ld-aarch64/ifunc-10.d: Likewise.
	* ld-aarch64/ifunc-10.s: Likewise.
	* ld-aarch64/ifunc-11.d: Likewise.
	* ld-aarch64/ifunc-11.s: Likewise.
	* ld-aarch64/ifunc-12.d: Likewise.
	* ld-aarch64/ifunc-12.s: Likewise.
	* ld-aarch64/ifunc-13.d: Likewise.
	* ld-aarch64/ifunc-13a.s: Likewise.
	* ld-aarch64/ifunc-13b.s: Likewise.
	* ld-aarch64/ifunc-14a.d: Likewise.
	* ld-aarch64/ifunc-14a.s: Likewise.
	* ld-aarch64/ifunc-14b.d: Likewise.
	* ld-aarch64/ifunc-14b.s: Likewise.
	* ld-aarch64/ifunc-14c.d: Likewise.
	* ld-aarch64/ifunc-14c.s: Likewise.
	* ld-aarch64/ifunc-14d.d: Likewise.
	* ld-aarch64/ifunc-14e.d: Likewise.
	* ld-aarch64/ifunc-14f.d: Likewise.
	* ld-aarch64/ifunc-15.d: Likewise.
	* ld-aarch64/ifunc-15.s: Likewise.
	* ld-aarch64/ifunc-16.d: Likewise.
	* ld-aarch64/ifunc-16.s: Likewise.
	* ld-aarch64/ifunc-17a.d: Likewise.
	* ld-aarch64/ifunc-17a.s: Likewise.
	* ld-aarch64/ifunc-17b.d: Likewise.
	* ld-aarch64/ifunc-17b.s: Likewise.
	* ld-aarch64/ifunc-18a.d: Likewise.
	* ld-aarch64/ifunc-18a.s: Likewise.
	* ld-aarch64/ifunc-18b.d: Likewise.
	* ld-aarch64/ifunc-18b.s: Likewise.
	* ld-aarch64/ifunc-19a.d: Likewise.
	* ld-aarch64/ifunc-19a.s: Likewise.
	* ld-aarch64/ifunc-19b.d: Likewise.
	* ld-aarch64/ifunc-19b.s: Likewise.
	* ld-aarch64/ifunc-2-local.d: Likewise.
	* ld-aarch64/ifunc-2-local.s: Likewise.
	* ld-aarch64/ifunc-2.d: Likewise.
	* ld-aarch64/ifunc-2.s: Likewise.
	* ld-aarch64/ifunc-20.d: Likewise.
	* ld-aarch64/ifunc-20.s: Likewise.
	* ld-aarch64/ifunc-3.s: Likewise.
	* ld-aarch64/ifunc-3a.d: Likewise.
	* ld-aarch64/ifunc-3b.d: Likewise.
	* ld-aarch64/ifunc-4.d: Likewise.
	* ld-aarch64/ifunc-4.s: Likewise.
	* ld-aarch64/ifunc-4a.d: Likewise.
	* ld-aarch64/ifunc-5-local.s: Likewise.
	* ld-aarch64/ifunc-5.s: Likewise.
	* ld-aarch64/ifunc-5a-local.d: Likewise.
	* ld-aarch64/ifunc-5a.d: Likewise.
	* ld-aarch64/ifunc-5b-local.d: Likewise.
	* ld-aarch64/ifunc-5b.d: Likewise.
	* ld-aarch64/ifunc-5r-local.d: Likewise.
	* ld-aarch64/ifunc-6.s: Likewise.
	* ld-aarch64/ifunc-6a.d: Likewise.
	* ld-aarch64/ifunc-6b.d: Likewise.
	* ld-aarch64/ifunc-7.s: Likewise.
	* ld-aarch64/ifunc-7a.d: Likewise.
	* ld-aarch64/ifunc-7b.d: Likewise.
	* ld-aarch64/ifunc-7c.d: Likewise.
	* ld-aarch64/ifunc-8.d: Likewise.
	* ld-aarch64/ifunc-8a.s: Likewise.
	* ld-aarch64/ifunc-8b.s: Likewise.
	* ld-aarch64/ifunc-9.d: Likewise.
	* ld-aarch64/ifunc-9.s: Likewise.
2013-06-19 10:30:59 +00:00
Will Newton 6c74eac210 ld/testsuite: Enable ifunc tests on AArch64 big-endian.
ld/testsuite/ChangeLog:

2013-06-17  Will Newton  <will.newton@linaro.org>

	* ld-aarch64/ifunc-1-local.d: Enable test on aarch64_be.
	* ld-aarch64/ifunc-1.d: Likewise.
	* ld-aarch64/ifunc-10.d: Likewise.
	* ld-aarch64/ifunc-11.d: Likewise.
	* ld-aarch64/ifunc-12.d: Likewise.
	* ld-aarch64/ifunc-13.d: Likewise.
	* ld-aarch64/ifunc-14a.d: Likewise.
	* ld-aarch64/ifunc-14b.d: Likewise.
	* ld-aarch64/ifunc-14c.d: Likewise.
	* ld-aarch64/ifunc-14d.d: Likewise.
	* ld-aarch64/ifunc-14e.d: Likewise.
	* ld-aarch64/ifunc-14f.d: Likewise.
	* ld-aarch64/ifunc-15.d: Likewise.
	* ld-aarch64/ifunc-16.d: Likewise.
	* ld-aarch64/ifunc-17a.d: Likewise.
	* ld-aarch64/ifunc-17b.d: Likewise.
	* ld-aarch64/ifunc-18a.d: Likewise.
	* ld-aarch64/ifunc-18b.d: Likewise.
	* ld-aarch64/ifunc-19a.d: Likewise.
	* ld-aarch64/ifunc-19b.d: Likewise.
	* ld-aarch64/ifunc-2-local.d: Likewise.
	* ld-aarch64/ifunc-2.d: Likewise.
	* ld-aarch64/ifunc-20.d: Likewise.
	* ld-aarch64/ifunc-3a.d: Likewise.
	* ld-aarch64/ifunc-3b.d: Likewise.
	* ld-aarch64/ifunc-4.d: Likewise.
	* ld-aarch64/ifunc-4a.d: Likewise.
	* ld-aarch64/ifunc-5a-local.d: Likewise.
	* ld-aarch64/ifunc-5a.d: Likewise.
	* ld-aarch64/ifunc-5b-local.d: Likewise.
	* ld-aarch64/ifunc-5b.d: Likewise.
	* ld-aarch64/ifunc-5r-local.d: Likewise.
	* ld-aarch64/ifunc-6a.d: Likewise.
	* ld-aarch64/ifunc-6b.d: Likewise.
	* ld-aarch64/ifunc-7a.d: Likewise.
	* ld-aarch64/ifunc-7b.d: Likewise.
	* ld-aarch64/ifunc-8.d: Likewise.
	* ld-aarch64/ifunc-9.d: Likewise.
	* ld-ifunc/ifunc.exp: Likewise.
2013-06-17 09:08:52 +00:00
Yufeng Zhang 2532064ada bfd/
* elf64-aarch64.c (elf64_aarch64_final_link_relocate): Call
	aarch64_resolve_relocation and bfd_elf_aarch64_put_addend to
	handle the relocations of R_AARCH64_JUMP26, R_AARCH64_CALL26,
	R_AARCH64_LD64_GOT_LO12_NC, R_AARCH64_ADR_GOT_PAGE and
	R_AARCH64_GOT_LD_PREL19.

ld/testsuite/

	* ld-aarch64/aarch64-elf.exp: Add 'ifunc-7c'.
	* ld-aarch64/ifunc-7c.d: New test.
2013-06-14 16:07:20 +00:00
Yufeng Zhang aa489d7c4a ld/
* emulparams/aarch64elf.sh: Add IREL_IN_PLT.

ld/testsuite/

	* ld-aarch64/ifunc-1-local.d: Replace hard-coded immediate offset
	with regexp.
	* ld-aarch64/ifunc-1.d: Likewise.
	* ld-aarch64/ifunc-2-local.d: Likewise.
	* ld-aarch64/ifunc-2.d: Likewise.
	* ld-aarch64/ifunc-3a.d: Likewise.
	* ld-aarch64/ifunc-2-local.s: Change not to declare __GI_foo and foo
	global.
2013-06-14 15:55:36 +00:00
Nick Clifton 2f47f5fc13 PR ld/15302
* elf32-arm.c (allocate_dynrelocs_for_symbol): Transform
	ST_BRANCH_TO_ARM into ST_BRANCH_TO_THUMB if the target only
	supports thumb instructions.

	PR ld/15302
	* ld-arm/branch-lks-sym.ld: New script.
	* ld-arm/thumb-b-lks-sym.s: New test.
	* ld-arm/thumb-b-lks-sym.d: Expected disassembly.
	* ld-arm/thumb-bl-lks-sym.s: New test.
	* ld-arm/thumb-bl-lks-sym.d: Expected disassembly.
	* ld-arm/arm-elf.exp: Run the new tests.
2013-06-13 12:36:02 +00:00
Nick Clifton 049c1c8e38 oops - omitted 2013-06-12 07:52:38 +00:00
Nick Clifton 316b4980f0 * ldcref.c (output_one_cref): Place common definitions after
ordinary definitions but before references.
2013-06-12 07:48:32 +00:00
Nick Clifton 10bf68945e PR ld/15598
* ld.texinfo (Source Code Reference): Fix typos.
2013-06-10 11:59:44 +00:00
Will Newton 692e2b8bcd aarch64: Add support for GNU indirect functions.
Add support for STT_GNU_IFUNC symbols to the AArch64 bfd backend. The tests
are ported from the ld-ifunc tests but are enabled for cross builds so can
be run easily without hardware or a simulator.

bfd/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* configure: Regenerate.
	* configure.in: Build elf-ifunc.o for AArch64.
	* elf64-aarch64.c: Include objalloc.h.
	(elf64_aarch64_howto_dynrelocs): Add R_AARCH64_IRELATIVE howto.
	(struct elf64_aarch64_link_hash_table): Add members for handling
	R_AARCH64_IRELATIVE relocations.
	(elf_aarch64_local_htab_hash): New function.
	(elf_aarch64_local_htab_eq): New function.
	(elf_aarch64_get_local_sym_hash): New function.
	(elf64_aarch64_link_hash_table_create): Initialize local STT_GNU_IFUNC
	symbol hash.
	(elf64_aarch64_hash_table_free): Free local STT_GNU_IFUNC symbol hash.
	(elf64_aarch64_final_link_relocate): Add sym argument.  Add support
	for handling STT_GNU_IFUNC symbols.
	(elf64_aarch64_gc_sweep_hook): Add support for garbage collecting
	references to STT_GNU_IFUNC symbols.
	(elf64_aarch64_adjust_dynamic_symbol): Add support for handling
	STT_GNU_IFUNC symbols.
	(elf64_aarch64_check_relocs): Add support for handling STT_GNU_IFUNC
	symbols.  Ensure we don't increase plt.refcount from -1 to 0.
	(elf64_aarch64_post_process_headers): Call _bfd_elf_set_osabi.
	(elf64_aarch64_is_function_type): Remove function.
	(elf64_aarch64_allocate_dynrelocs): Call
	_bfd_elf_allocate_ifunc_dyn_relocs for STT_GNU_IFUNC symbols.
	(elf_aarch64_allocate_local_dynrelocs): New function.
	(elf64_aarch64_size_dynamic_sections): Call
	elf_aarch64_allocate_local_dynrelocs.  Initialize next_irelative_index.
	(elf64_aarch64_create_small_pltn_entry): Add info argument.
	Add support for creating .iplt entries for STT_GNU_IFUNC symbols.
	(elf64_aarch64_finish_dynamic_symbol): Add support for handling
	STT_GNU_IFUNC symbols and .iplt.
	(elf_aarch64_finish_local_dynamic_symbol): New function.
	(elf64_aarch64_finish_dynamic_sections): Call
	elf_aarch64_finish_local_dynamic_symbol.
	(elf64_aarch64_add_symbol_hook): New function.

include/elf/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* aarch64.h: Add R_AARCH64_IRELATIVE reloc.

ld/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* emulparams/aarch64elf.sh: Add IREL_IN_PLT.

ld/testsuite/ChangeLog:

2013-06-07  Will Newton  <will.newton@linaro.org>

	* ld-ifunc/ifunc.exp: Enable ifunc tests for AArch64.
	* ld-aarch64/aarch64-elf.exp: Add ifunc tests.
	* ld-aarch64/ifunc-1-local.d: New file.
	* ld-aarch64/ifunc-1-local.s: Likewise.
	* ld-aarch64/ifunc-1.d: Likewise.
	* ld-aarch64/ifunc-1.s: Likewise.
	* ld-aarch64/ifunc-10.d: Likewise.
	* ld-aarch64/ifunc-10.s: Likewise.
	* ld-aarch64/ifunc-11.d: Likewise.
	* ld-aarch64/ifunc-11.s: Likewise.
	* ld-aarch64/ifunc-12.d: Likewise.
	* ld-aarch64/ifunc-12.s: Likewise.
	* ld-aarch64/ifunc-13.d: Likewise.
	* ld-aarch64/ifunc-13a.s: Likewise.
	* ld-aarch64/ifunc-13b.s: Likewise.
	* ld-aarch64/ifunc-14a.d: Likewise.
	* ld-aarch64/ifunc-14a.s: Likewise.
	* ld-aarch64/ifunc-14b.d: Likewise.
	* ld-aarch64/ifunc-14b.s: Likewise.
	* ld-aarch64/ifunc-14c.d: Likewise.
	* ld-aarch64/ifunc-14c.s: Likewise.
	* ld-aarch64/ifunc-14d.d: Likewise.
	* ld-aarch64/ifunc-14e.d: Likewise.
	* ld-aarch64/ifunc-14f.d: Likewise.
	* ld-aarch64/ifunc-15.d: Likewise.
	* ld-aarch64/ifunc-15.s: Likewise.
	* ld-aarch64/ifunc-16.d: Likewise.
	* ld-aarch64/ifunc-16.s: Likewise.
	* ld-aarch64/ifunc-17a.d: Likewise.
	* ld-aarch64/ifunc-17a.s: Likewise.
	* ld-aarch64/ifunc-17b.d: Likewise.
	* ld-aarch64/ifunc-17b.s: Likewise.
	* ld-aarch64/ifunc-18a.d: Likewise.
	* ld-aarch64/ifunc-18a.s: Likewise.
	* ld-aarch64/ifunc-18b.d: Likewise.
	* ld-aarch64/ifunc-18b.s: Likewise.
	* ld-aarch64/ifunc-19a.d: Likewise.
	* ld-aarch64/ifunc-19a.s: Likewise.
	* ld-aarch64/ifunc-19b.d: Likewise.
	* ld-aarch64/ifunc-19b.s: Likewise.
	* ld-aarch64/ifunc-2-local.d: Likewise.
	* ld-aarch64/ifunc-2-local.s: Likewise.
	* ld-aarch64/ifunc-2.d: Likewise.
	* ld-aarch64/ifunc-2.s: Likewise.
	* ld-aarch64/ifunc-20.d: Likewise.
	* ld-aarch64/ifunc-20.s: Likewise.
	* ld-aarch64/ifunc-3.s: Likewise.
	* ld-aarch64/ifunc-3a.d: Likewise.
	* ld-aarch64/ifunc-3b.d: Likewise.
	* ld-aarch64/ifunc-4.d: Likewise.
	* ld-aarch64/ifunc-4.s: Likewise.
	* ld-aarch64/ifunc-4a.d: Likewise.
	* ld-aarch64/ifunc-5-local.s: Likewise.
	* ld-aarch64/ifunc-5.s: Likewise.
	* ld-aarch64/ifunc-5a-local.d: Likewise.
	* ld-aarch64/ifunc-5a.d: Likewise.
	* ld-aarch64/ifunc-5b-local.d: Likewise.
	* ld-aarch64/ifunc-5b.d: Likewise.
	* ld-aarch64/ifunc-5r-local.d: Likewise.
	* ld-aarch64/ifunc-6.s: Likewise.
	* ld-aarch64/ifunc-6a.d: Likewise.
	* ld-aarch64/ifunc-6b.d: Likewise.
	* ld-aarch64/ifunc-7.s: Likewise.
	* ld-aarch64/ifunc-7a.d: Likewise.
	* ld-aarch64/ifunc-7b.d: Likewise.
	* ld-aarch64/ifunc-8.d: Likewise.
	* ld-aarch64/ifunc-8a.s: Likewise.
	* ld-aarch64/ifunc-8b.s: Likewise.
	* ld-aarch64/ifunc-9.d: Likewise.
	* ld-aarch64/ifunc-9.s: Likewise.
2013-06-07 18:57:03 +00:00
Nick Clifton c5da8c7d17 * ld.texinfo (SEGMENT_START): Rephrase to indicate that a -T
option must appear before the SEGMENT_START is encountered in
	order for the default value to be overridden.
2013-06-07 15:11:18 +00:00
Roland McGrath 9b4fce51f3 ld/testsuite/
* ld-size/size.exp: For *-*-nacl* targets, use options_regsub(ld)
	to massage -m arguments into _nacl variants.
	* ld/testsuite/ld-size/size32-1-i386.d: Loosen regexps so they
	don't care what the exact addresses are.
	* ld/testsuite/ld-size/size32-1-x32.d: Likewise.
	* ld/testsuite/ld-size/size32-1-x86-64.d: Likewise.
	* ld/testsuite/ld-size/size32-2-i386.d: Likewise.
	* ld/testsuite/ld-size/size32-2-x32.d: Likewise.
	* ld/testsuite/ld-size/size32-2-x86-64.d: Likewise.
	* ld/testsuite/ld-size/size64-1-x32.d: Likewise.
	* ld/testsuite/ld-size/size64-1-x86-64.d: Likewise.
	* ld/testsuite/ld-size/size64-2-x32.d: Likewise.
	* ld/testsuite/ld-size/size64-2-x86-64.d: Likewise.
2013-06-04 19:24:10 +00:00
H.J. Lu fafd78e9a5 Update x86 nacl tests for section alignment change
* ld-i386/tlsbindesc-nacl.rd: Updated for text/data/bss section
	alignment change.
	* ld-x86-64/split-by-file-nacl.rd: Likewise.
2013-06-04 16:08:51 +00:00
H.J. Lu f60cf82f20 Don't align text/data/bss sections for ELF
binutils/testsuite/

	* binutils-all/i386/compressed-1b.d: Updated for text/data/bss
	section alignment change.
	* binutils-all/i386/compressed-1c.d: Likewise.
	* binutils-all/x86-64/compressed-1b.d: Likewise.
	* binutils-all/x86-64/compressed-1c.d: Likewise.

gas/

	* config/tc-i386.c (md_begin): Don't align text/data/bss sections
	for ELF.

gas/testsuite/

	* gas/i386/size-3.d: Updated for text/data/bss section alignment
	change.
	* gas/i386/x86-64-size-1.d: Likewise.
	* gas/i386/x86-64-unwind.d: Likewise.
	* gas/i386/ilp32/x86-64-size-1.d: Likewise.
	* gas/i386/ilp32/x86-64-size-5.d: Likewise.
	* gas/i386/ilp32/x86-64-unwind.d: Likewise.

ld/testsuite/

	* ld-i386/pr12718.d: Updated for text/data/bss section alignment
	change.
	* ld-i386/tlsbindesc.dd: Likewise.
	* ld-i386/tlsbindesc.rd: Likewise.
	* ld-i386/tlsnopic.dd: Likewise.
	* ld-i386/tlspic.dd: Likewise.
	* ld-x86-64/ilp32-4.d: Likewise.
	* ld-x86-64/pr12718.d: Likewise.
	* ld-x86-64/split-by-file.rd: Likewise.
	* ld-x86-64/tlsbin.dd: Likewise.
	* ld-x86-64/tlsbin.rd: Likewise.
	* ld-x86-64/tlsbindesc.dd: Likewise.
	* ld-x86-64/tlsbindesc.rd: Likewise.
	* ld-x86-64/tlsdesc.dd: Likewise.
	* ld-x86-64/tlsdesc.rd: Likewise.
	* ld-x86-64/tlspic.dd: Likewise.
	* ld-x86-64/tlspic.rd: Likewise.
2013-05-31 17:27:28 +00:00
Maciej W. Rozycki d6101ac200 gas/
* write.c (resolve_reloc_expr_symbols): On REL targets don't
	convert relocs who have no relocatable field either.  Rephrase
	the conditional so that the PC-relative check is only applied
	for REL targets.

	gas/testsuite/
	* gas/mips/jalr3.d: New test.
	* gas/mips/jalr3-n32.d: New test.
	* gas/mips/jalr3-n64.d: New test.
	* gas/mips/jalr3.s: New test source.
	* gas/mips/mips.exp: Run the new tests.

	ld/testsuite/
	* ld-mips-elf/jalr3.dd: New test.
	* ld-mips-elf/jalr3.ld: New test linker script.
	* ld-mips-elf/mips-elf.exp: Run the new test.
2013-05-29 16:22:14 +00:00
Alan Modra c22554775b PR ld/12982
* ld-plugin/pr12982.d: Fail if RWE GNU_STACK present.
2013-05-21 07:15:22 +00:00
Alan Modra 60245b8847 * ld-powerpc/export-class.exp (supports_ppc64): Delete.
(powerpc_export_class_test): Add "endian" param.
	(abis): Add little-endian targets and test.
	* ld-powerpc/powerpc-64-export-class.xd: Update for little-endian.
2013-05-21 01:37:41 +00:00
Joel Brobecker 110a61d342 XCOFF/AIX: Remove SEC_ALLOC flags for unmapped sections.
The .except, .loader and .typchk are not mapped to memory,
so do not set their SEC_ALLOC flag.

bfd/ChangeLog:

        * coffcode.h (styp_to_sec_flags) [RS6000COFF_C]: Add handling
        of STYP_EXCEPT, STYP_LOADER and STYP_TYPCHK sections.

ld/testsuite/ChangeLog:

        * ld-powerpc/aix-core-sec-1.hd, ld-powerpc/aix-core-sec-2.hd,
        ld-powerpc/aix-core-sec-3.hd: Adjust expected section flags
        for section .loader.
2013-05-10 13:08:24 +00:00
Maciej W. Rozycki cde7cb0129 gold/
PR ld/15365
        * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.

        ld/
        PR ld/15365
        * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
        Restrict __ehdr_start's export class to no less than STV_HIDDEN.

        ld/testsuite/
        PR ld/15365
        * ld-elf/ehdr_start.d: Expect __ehdr_start to be STB_LOCAL.
        * ld-mips-elf/ehdr_start-1.nd: New test.
        * ld-mips-elf/ehdr_start-2.nd: New test.
        * ld-mips-elf/ehdr_start-1.ld: New test linker script.
        * ld-mips-elf/ehdr_start-2.ld: New test linker script.
        * ld-mips-elf/ehdr_start-new.s: New test source.
        * ld-mips-elf/ehdr_start-o32.s: New test source.
        * ld-mips-elf/mips-elf.exp: Run the new tests.
2013-05-03 15:19:27 +00:00
Maciej W. Rozycki a5382c42bb * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
Only call lang_for_each_statement if an ELF hash table is used.
2013-05-03 15:01:19 +00:00
Maciej W. Rozycki c9606f65f6 * ld-elf/provide-hidden-s.nd: New test.
* ld-elf/provide-hidden-abs.nd: New test.
	* ld-elf/provide-hidden-def.nd: New test.
	* ld-elf/provide-hidden-dyn.nd: New test.
	* ld-elf/provide-hidden-sec.nd: New test.
	* ld-elf/provide-hidden-dynabs.nd: New test.
	* ld-elf/provide-hidden-dynsec.nd: New test.
	* ld-elf/provide-hidden-s.ld: New test linker script.
	* ld-elf/provide-hidden-1.ld: New test linker script.
	* ld-elf/provide-hidden-2.ld: New test linker script.
	* ld-elf/provide-hidden-1.s: New test source.
	* ld-elf/provide-hidden-2.s: New test source.
	* ld-elf/provide-hidden-3.s: New test source.
	* ld-elf/provide-hidden-4.s: New test source.
	* ld-elf/provide-hidden.exp: New test script.
2013-05-03 14:57:15 +00:00
Nick Clifton 13761a1136 * archures.c: Add some more MSP430 machine numbers.
* config.bfd (msp430): Define targ_selvecs.
	* configure.in: Add bfd_elf32_msp430_ti_vec.
	* cpu-msp430.c: Add some more MSP430 machine numbers.
	* elf32-msp430.c Add support for MSP430X relocations.
	Add support for TI compiler generated relocations.
	Add support for sym_diff relocations.
	Add support for relaxing out of range short branches into long
	branches.
	Add support for MSP430 attribute section.
	* reloc.c: Add MSP430X relocations.
	* targets.c: Add bfd_elf32_msp430_ti_vec.
	* bfd-in2.h: Regenerate.
	* configure: Regenerate.
	* libbfd.h: Regenerate.

	* readelf.c: Add support for MSP430X architecture.

	* readelf.exp: Expect -wi test to fail for the MSP430.

	* config/tc-msp430.c: Add support for the MSP430X architecture.
	Add code to insert a NOP instruction after any instruction that
	might change the interrupt state.
	Add support for the LARGE memory model.
	Add code to initialise the .MSP430.attributes section.
	* config/tc-msp430.h: Add support for the MSP430X architecture.
	* doc/c-msp430.texi: Document the new -mL and -mN command line
	options.
	* NEWS: Mention support for the MSP430X architecture.

	* gas/all/gas.exp: Skip the DIFF1 test for the MSP430.
	Expect the FORWARD test to pass for the MSP430.
	Skip the REDEF tests for the MSP430.
	Expect the 930509A test to fail for the MSP430.
	* gas/all/sleb128-4.d: Skip for the MSP430.
	* gas/elf/elf.exp: Set target_machine to msp430 for the MSP430.
	Skip the EHOPT0 test for the MSP430.
	Skip the REDEF and EQU-RELOC tests for the MSP430.
	* gas/elf/section2.e-msp430: New file.
	* gas/lns/lns-big-delta.d: Remove expectation of 20-bit
	addresses.
	* gas/lns/lns.exp: Use alternate LNS COMMON test for the MSP430.
	* gas/msp430/msp430x.s: New test.
	* gas/msp430/msp430x.d: Expected disassembly.
	* gas/msp430/msp430.exp: Run new test.
	* gas/msp430/opcode.d: Update expected disassembly.

	* msp430.h: Add MSP430X relocs.
	Add some more MSP430 machine numbers.
	Add values used by .MSP430.attributes section.

	* msp430.h: Add patterns for MSP430X instructions.

	* Makefile.am: Add emsp430X.c
	* Makefine.in: Regenerate.
	* configure.tgt (msp430): Add msp430X emulation.
	* ldmain.c (multiple_definition): Only disable relaxation if it
	was enabled by the user.
	* ldmain.h (RELAXATION_ENABLED_BY_USER): New macro.
	* emulparams/msp430all.sh: Add support for MSP430X.
	* emultempl/generic.em: (before_parse): Enable relaxation for the
	MSP430.
	* scripttempl/msp430.sc: Reorganize sections.  Add .rodata
	section.
	* scripttempl/msp430_3.sc: Likewise.
	* NEWS: Mention support for MSP430X.

	* ld-elf/flags1.d: Expect this test to pass on the MSP430.
	* ld-elf/init-fini-arrays.d: Expect this test to fail on the
	MSP430.
	* ld-elf/merge.d: Expect this test to pass on the MSP430.
	* ld-elf/sec64k.exp: Skip these tests for the MSP430.
	* ld-gc/pr13683.d: Expect this test to fail on the MSP430.
	* ld-srec/srec.exp: Expect these tests to fail on the MSP430.
	* ld-undefined/undefined.exp: Expect the UNDEFINED LINE test to
	fail on the MSP430.

	* msp430-dis.c: Add support for MSP430X instructions.
2013-05-02 21:06:15 +00:00
Maciej W. Rozycki df26367c79 bfd/
* config.bfd: Replace alpha*-*-linuxecoff* pattern with
	alpha*-*-linux*ecoff*.

	binutils/testsuite/
	* lib/binutils-common.exp (is_elf_format): Also exclude
	*-*-linux*ecoff*.

	gas/
	* configure.tgt: Replace alpha*-*-linuxecoff* pattern with
	alpha*-*-linux*ecoff*.

	ld/
	* configure.tgt: Replace alpha*-*-linuxecoff* pattern with
	alpha*-*-linux*ecoff*.  Update the `sed' pattern used to convert
	from alpha*-*-linux-* to alpha*-*-linux*ecoff*.
2013-05-01 17:27:46 +00:00
Maciej W. Rozycki 23c80bf47b * lib/ld-lib.exp (check_shared_lib_support): Also exclude
mips*-*-elf.
2013-05-01 17:22:03 +00:00
Maciej W. Rozycki b4d040b158 * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation):
Use is_elf_hash_table rather than a handcoded condition.
2013-05-01 17:18:43 +00:00
Hans-Peter Nilsson 5220199df0 * lib/ld-lib.exp (check_shared_lib_support): Match cris*-*-elf as
a negative pattern instead of cris*-*-*.
2013-04-30 17:19:38 +00:00
Nick Clifton ee83b8a6c7 line omitted from previous delta. 2013-04-30 14:01:03 +00:00
Will Newton fdb056307c ld/testsuite/ld-arm: Fix ifunc-17 failure with arm-eabi.
ld/testsuite/ChangeLog:

2013-04-30  Will Newton  <will.newton@linaro.org>

	* ld-arm/arm-elf.exp: Use linker script for IFUNC test 17.
	* ld-arm/ifunc-17.dd: Update offsets for linker script.
	* ld-arm/ifunc-17.gd: Likewise.
	* ld-arm/ifunc-17.rd: Likewise.
2013-04-30 13:40:27 +00:00
Nick Clifton 1ae5c3ae9b * ld.texinfo (SORT_BY_ALIGNMENT): Fix and clarify typo - sections
are sorted by descending order of alignment.
2013-04-30 12:52:58 +00:00
Nick Clifton b40bf0a255 * elflink.c (_bfd_elf_gc_mark_extra_sections): Remove mark from
fragmented .debug_line sections associated with unmarked code
	sections.

	* dwarf.c (read_debug_line_header): New function.  Reads in a
	header in a .debug_line section.
	(display_debug_lines_raw): Use new function.  Handle fragmentary
	.debug_line sections.
	(display_debug_lines_decoded): Likewise.
	* readelf.c (process_section_headers): Handle fragmenatry
	.debug_line sections.
	(display_debug_section): Likewise.

	* as.c (Options): Add -gdwarf-sections.
	(parse_args): Likewise.
	* as.h (flag_dwarf_sections): Declare.
	* dwarf2dbg.c (emit_fixed_inc_line_addr): Skip section changes.
	(process_entries): When -gdwarf-sections is enabled generate
	fragmentary .debug_line sections.
	(out_debug_line): Set the section for the .debug_line section end
	symbol.
	* doc/as.texinfo: Document -gdwarf-sections.
	* NEWS: Mention -gdwarf-sections.

	* gas/elf/dwarf2-3.d: Fix expected readelf output.

	* scripttempl/DWARF.sc: Add support for .debug_line.* and
	.debug_line_end.
2013-04-29 13:38:59 +00:00
Will Newton aba8c3de87 bfd/efl32-arm.c: Fix handling of IRELATIVE relocs.
bfd/ChangeLog:

2013-04-24  Will Newton  <will.newton@linaro.org>

	* elf32-arm.c (elf32_arm_populate_plt_entry): Call
	elf32_arm_add_dynreloc when emitting R_ARM_IRELATIVE relocs.

ld/testsuite/ChangeLog:

2013-04-24  Will Newton  <will.newton@linaro.org>

	* ld-arm/arm-elf.exp: Add IFUNC test 17.
	* ld-arm/ifunc-17.dd: New file.
	* ld-arm/ifunc-17.gd: Likewise.
	* ld-arm/ifunc-17.rd: Likewise.
	* ld-arm/ifunc-17.s: Likweise.
	* ld-arm/ifunc-1.rd: Reorder relocs to match linker output.
	* ld-arm/ifunc-2.rd: Likewise.
	* ld-arm/ifunc-5.rd: Likewise.
	* ld-arm/ifunc-6.rd: Likewise.
2013-04-29 09:48:32 +00:00
Will Newton 2810e26c6a ld-plugin/lto.exp: Disable ld/12942 test for gcc < 4.7.0.
The test for ld/12942 fails with gcc versions before 4.7.0. This patch
disables this test with these versions of gcc.

ld/testsuite/ChangeLog:

2013-04-29  Will Newton  <will.newton@linaro.org>

	* ld-plugin/lto.exp: Disable ld/12942 test for gcc < 4.7.0.
2013-04-29 08:57:48 +00:00
Nick Clifton 27320b8511 * emultempl/pe.em [cygwin]: Do not merge rdata with v2
psuedo-relocs.
2013-04-29 08:22:16 +00:00
Thomas Schwinge d061dfac16 ld/
* scripttempl/armbpabi.sc: Replace "source" usage with ".".
	* scripttempl/avr.sc: Likewise.
	* scripttempl/elf.sc: Likewise.
	* scripttempl/elf32cr16.sc: Likewise.
	* scripttempl/elf32crx.sc: Likewise.
	* scripttempl/elf32msp430.sc: Likewise.
	* scripttempl/elf32msp430_3.sc: Likewise.
	* scripttempl/elf32sh-symbian.sc: Likewise.
	* scripttempl/elf64hppa.sc: Likewise.
	* scripttempl/elf_chaos.sc: Likewise.
	* scripttempl/elfd10v.sc: Likewise.
	* scripttempl/elfd30v.sc: Likewise.
	* scripttempl/elfi370.sc: Likewise.
	* scripttempl/elfm68hc11.sc: Likewise.
	* scripttempl/elfm68hc12.sc: Likewise.
	* scripttempl/elfxgate.sc: Likewise.
	* scripttempl/elfxtensa.sc: Likewise.
	* scripttempl/epiphany_4x4.sc: Likewise.
	* scripttempl/i386beos.sc: Likewise.
	* scripttempl/i386go32.sc: Likewise.
	* scripttempl/ia64vms.sc: Likewise.
	* scripttempl/ip2k.sc: Likewise.
	* scripttempl/iq2000.sc: Likewise.
	* scripttempl/mep.sc: Likewise.
	* scripttempl/mmo.sc: Likewise.
	* scripttempl/v850.sc: Likewise.
	* scripttempl/v850_rh850.sc: Likewise.
	* scripttempl/xstormy16.sc: Likewise.
2013-04-28 14:52:55 +00:00
Nick Clifton 778ee4a6f2 * scripttempl/avr.sc: Add ALIGN directive after *(.progmem*). 2013-04-26 15:27:55 +00:00
Alan Modra 4706eab946 * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Test
unresolved_syms_in_shared_libs rather than !executable to
	determine whether to load DT_NEEDED libraries.
2013-04-26 01:26:45 +00:00
Alan Modra 49926cd0c8 bfd/
* config.bfd: Add powerpc64le-linux.
gas/
	* configure.in: Allow little-endian linux.
	* configure: Regenerate.
gold/
	* configure.tgt: Add powerpcle and powerpc64le.
ld/
	* Makefile.am (ALL_EMULATION_SOURCES): Add eelf32lppclinux.c.
	(eelf32lppclinux.c): New rule.
	* Makefile.in: Regenerate.
	* configure.tgt: Merge powerpc-linux and other powerpc-elf targets
	with corresponding little-endian targets.
	* emulparams/elf32lppc.sh: Update comment.
	* emulparams/elf32lppclinux.sh: New.
2013-04-25 13:22:52 +00:00
H.J. Lu 05567e3d0b Enable x32 for x86_64-*-elf*
This patch enables x32 for x86_64-*-elf* for embedded target and disables
rex tests since it uses '/' as prefix separator which is `\' for
x86_64-*-elf*.

bfd/

	* config.bfd (targ_selvecs): Add bfd_elf32_x86_64_vec for
	x86_64-*-elf*.

gas/testsuite/

	* gas/i386/rex.d: Skip x86_64-*-elf*.
	* gas/i386/ilp32/rex.d: Likewise.

ld/

	* configure.tgt (targ_extra_emuls): Adds elf32_x86_64 for
	x86_64-*-elf*.
	(targ_extra_libpath): Likewise.
	(tdir_elf_i386): Replace x86_64 with i386 for x86_64-*-elf*.
2013-04-24 18:58:14 +00:00
Yufeng Zhang 4390599b4e ld/
* emulparams/aarch64elf.sh: Define ELFSIZE=64.
	* emulparams/aarch64linux.sh: Ditto.
	* emultempl/aarch64elf.em (aarch64_elf_before_allocation):
	Replace elf64 with elf${ELFSIZE}.
	(elf64_aarch64_add_stub_section): Likewise.
	(build_section_lists): Likewise.
	(gld${EMULATION_NAME}_after_allocation): Likewise.
	(gld${EMULATION_NAME}_finish): Likewise.
	(aarch64_elf_create_output_section_statements): Likewise.
2013-04-24 17:22:31 +00:00
Nick Clifton 2cfa18a94a PR ld/15389
* scripttempl/avr.sc: Add .note.gnu.build-id section.
2013-04-24 15:28:12 +00:00
Alan Modra bfeb4a285a bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Don't call
	create_linkage_sections here..
	(ppc64_elf_init_stub_bfd): ..do so here.  Return status.
	(create_linkage_sections): Move earlier in file.
	(ppc64_elf_setup_section_lists): Remove now useless htab->brlt test.
	* elf64-ppc.h (ppc64_elf_init_stub_bfd): Update proto.
ld/
	* emultempl/ppc64elf.em (ppc_create_output_section_statements):
	Check return from ppc64_elf_init_stub_bfd.
ld/testsuite/
	* ld-powerpc/tlsexe.d: Adjust.
	* ld-powerpc/tlsexe.r: Adjust.
	* ld-powerpc/tlsexetoc.d: Adjust.
	* ld-powerpc/tlsexetoc.r: Adjust.
	* ld-powerpc/tlsso.d: Adjust.
	* ld-powerpc/tlsso.r: Adjust.
	* ld-powerpc/tlstocso.d: Adjust.
	* ld-powerpc/tlstocso.r: Adjust.
2013-04-22 03:11:40 +00:00
Nick Clifton ec05a26b76 * Makefile.am (emmo.c): Add a dependency upon scripttempl/DWARF.sc. 2013-04-16 14:50:20 +00:00