Commit Graph

4294 Commits

Author SHA1 Message Date
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
H.J. Lu 1622ff3b43 Check regular reference without non-GOT reference
non_got_ref may not be set when building shared library. We need to set
non_got_ref if there are any non-PIC relocations.  But we only did this
when there were no PLT/GOT relocations.  It failed when there is a PLT
relocation.  This checkin moves the non_got_ref check out.

bfd/

2013-04-15  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/15371
	* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Check
	regular reference without non-GOT reference when building
	shared library.

ld/testsuite/

2013-04-15  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/15371
	* ld-ifunc/ifunc-20-i386.d: New file.
	* ld-ifunc/ifunc-20-x86-64.d: Likewise.
	* ld-ifunc/ifunc-20.s: Likewise.
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
index e56427d..7e7ec36 100644
--- a/bfd/elf-ifunc.c
+++ b/bfd/elf-ifunc.c
@@ -187,23 +187,20 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,

   htab = elf_hash_table (info);

+  /* When building shared library, we need to handle the case where it is
+     marked with regular reference, but not non-GOT reference since the
+     non-GOT reference bit may not be set here.  */
+  if (info->shared && !h->non_got_ref && h->ref_regular)
+    for (p = *head; p != NULL; p = p->next)
+      if (p->count)
+	{
+	  h->non_got_ref = 1;
+	  goto keep;
+	}
+
   /* Support garbage collection against STT_GNU_IFUNC symbols.  */
   if (h->plt.refcount <= 0 && h->got.refcount <= 0)
     {
-      /* When building shared library, we need to handle the case
-         where it is marked with regular reference, but not non-GOT
-	 reference.  It may happen if we didn't see STT_GNU_IFUNC
-	 symbol at the time when checking relocations.  */
-      if (info->shared
-	  && !h->non_got_ref
-	  && h->ref_regular)
-	for (p = *head; p != NULL; p = p->next)
-	  if (p->count)
-	    {
-	      h->non_got_ref = 1;
-	      goto keep;
-	    }
-
       h->got = htab->init_got_offset;
       h->plt = htab->init_plt_offset;
       *head = NULL;
diff --git a/ld/testsuite/ld-ifunc/ifunc-20-i386.d b/ld/testsuite/ld-ifunc/ifunc-20-i386.d
new file mode 100644
index 0000000..9373fcf
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-20-i386.d
@@ -0,0 +1,13 @@
+#source: ifunc-20.s
+#ld: -shared -m elf_i386 -z nocombreloc
+#as: --32
+#readelf: -r --wide
+#target: x86_64-*-* i?86-*-*
+
+Relocation section '.rel.ifunc' at offset 0x[0-9a-f]+ contains 1 entries:
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_32[ ]+ifunc\(\)[ ]+ifunc
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_JUMP_SLOT[ ]+ifunc\(\)[ ]+ifunc
diff --git a/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
new file mode 100644
index 0000000..39492d4
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
@@ -0,0 +1,13 @@
+#source: ifunc-20.s
+#ld: -shared -m elf_x86_64 -z nocombreloc
+#as: --64
+#readelf: -r --wide
+#target: x86_64-*-*
+
+Relocation section '.rela.ifunc' at offset 0x[0-9a-f]+ contains 1 entries:
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_64[ ]+ifunc\(\)[ ]+ifunc \+ 0
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
+[ ]+Offset[ ]+Info[ ]+Type[ ]+.*
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_JUMP_SLOT[ ]+ifunc\(\)[ ]+ifunc \+ 0
diff --git a/ld/testsuite/ld-ifunc/ifunc-20.s b/ld/testsuite/ld-ifunc/ifunc-20.s
new file mode 100644
index 0000000..9d45455
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-20.s
@@ -0,0 +1,16 @@
+	.section .data.rel,"aw",@progbits
+	.globl ifunc_ptrt
+	.type	ifunc_ptr, @object
+ifunc_ptr:
+	.dc.a ifunc
+	.text
+	.type ifunc, @gnu_indirect_function
+	.globl ifunc
+ifunc:
+	ret
+	.size	ifunc, .-ifunc
+	.type bar, @function
+	.globl bar
+bar:
+	call	ifunc@PLT
+	.size	bar, .-bar
2013-04-15 21:16:18 +00:00
Nick Clifton cb1238c083 * Makefile.am (ELF_DEPS): Add a dependency upon
scripttempl/DWARF.sc.
	(ELF_GEN_DEPS): Likewise.
	* Makefile.in: Regenerate.
2013-04-15 12:04:48 +00:00
Nick Clifton ceb0a680b1 * scripttempl/armbpabi.sc: Replace DWARF sections with an
inclusion of DWARF.sc.
	* 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.
	* scripttempl/DWARF.sc: New.
2013-04-15 08:51:58 +00:00
Marcus Shawcroft edb2fa9a96 2013-04-10 Venkataramanan Kumar <venkataramanan.kumar@linaro.org>
* ld-aarch64/gc-plt1.s: New file.
        * ld-aarch64/gc-plt2.s: Likewise.
        * ld-aarch64/gc-plt-hidden.s: Likewise.
        * ld-aarch64/gc-plt-main.s: Likewise.
        * ld-aarch64/gc-relocs-257.s: Likewise.
        * ld-aarch64/gc-plt-relocs.d: Update expected objdump.
        * ld-aarch64/gc-relocs-257.d: Likewise.
        * ld-aarch64/gc-relocs-257-dyn.d: Likewise.
        * ld-aarch64/aarch64-elf.exp: Add test.
2013-04-10 12:00:14 +00:00
Ramana Radhakrishnan 6b5d81517f Handle big-endian for some aarch64 tests
2013-04-08  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

	* ld-aarch64/gc-tls-relocs.d: Handle big endian format.
	* ld-aarch64/gc-got-relocs.d: Likewise.
2013-04-08 09:41:52 +00:00
Alan Modra e65cb106a6 * ld-elf/shared.exp: Update regexp on --no-add-needed and
--no-copy-dt-needed-entries tests.
2013-04-04 14:51:48 +00:00
Alan Modra 8ff4c1f3c9 * ldlang.c (load_symbols): Report "error adding symbols" on
bfd_link_add_symbols failure.
	* emultempl/elf32.em (gld${EMULATION_NAME}_try_needed): Likewise.
	* emultempl/sunos.em (gld${EMULATION_NAME}_after_open): Likewise.
	(gld${EMULATION_NAME}_try_needed): Likewise.
2013-04-04 14:38:47 +00:00
Nick Clifton cb8af559c1 * elf64-aarch64.c (elf64_aarch64_gc_sweep_hook): Use
elf64_aarch64_locals to get local GOT reference counts.

        * ld-aarch64/gc-relocs-tlsle.s: New gc section test.
        * ld-aarch64/gc-relocs-tlsle.s: Likewise
        * ld-aarch64/gc-relocs-tlsgd.s: Likewise
        * ld-aarch64/gc-relocs-tlsdesc.s: Likewise
        * ld-aarch64/gc-relocs-312.s: Likewise
        * ld-aarch64/gc-relocs-311.s: Likewise
        * ld-aarch64/gc-relocs-309.s: Likewise
        * ld-aarch64/gc-start.s: Likewise
        * ld-aarch64/gc-got-relocs.d: Update expected objdump
        * ld-aarch64/gc-tls-relocs.d: Likewise
        * ld-aarch64/aarch64-elf.exp: add test
2013-04-03 14:21:18 +00:00
Alan Modra 203f0950a3 PR ld/15227
* ld-plugin/lto.exp (PR ld/12942 (3)): Remove file name and
	line number from regexp.
	(PR ld/15146 (2)): Similarly.
	* ld-plugin/pr12942a.cc (main): Use __builtin_abort.
2013-04-03 11:44:41 +00:00
Alan Modra 81fbe831fe PR ld/15323
bfd/
	* elf-m10300.c (mn10300_elf_check_relocs): Set non_ir_ref for
	global symbols referenced by relocs.
	* elf32-arm.c (elf32_arm_check_relocs): Likewise.
	* elf32-bfin.c (bfin_check_relocs): Likewise.
	* elf32-cr16.c (cr16_elf_check_relocs): Likewise.
	* elf32-cris.c (cris_elf_check_relocs): Likewise.
	* elf32-d10v.c (elf32_d10v_check_relocs): Likewise.
	* elf32-dlx.c (elf32_dlx_check_relocs): Likewise.
	* elf32-fr30.c (fr30_elf_check_relocs): Likewise.
	* elf32-frv.c (elf32_frv_check_relocs): Likewise.
	* elf32-hppa.c (elf32_hppa_check_relocs): Likewise.
	* elf32-i370.c (i370_elf_check_relocs): Likewise.
	* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
	* elf32-lm32.c (lm32_elf_check_relocs): Likewise.
	* elf32-m32c.c (m32c_elf_check_relocs): Likewise.
	* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
	* elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise.
	* elf32-m68k.c (elf_m68k_check_relocs): Likewise.
	* elf32-mcore.c (mcore_elf_check_relocs): Likewise.
	* elf32-metag.c (elf_metag_check_relocs): Likewise.
	* elf32-microblaze.c (microblaze_elf_check_relocs): Likewise.
	* elf32-moxie.c (moxie_elf_check_relocs): Likewise.
	* elf32-msp430.c (elf32_msp430_check_relocs): Likewise.
	* elf32-mt.c (mt_elf_check_relocs): Likewise.
	* elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
	* elf32-openrisc.c (openrisc_elf_check_relocs): Likewise.
	* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
	* elf32-rl78.c (rl78_elf_check_relocs): Likewise.
	* elf32-s390.c (elf_s390_check_relocs): Likewise.
	* elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
	* elf32-sh.c (sh_elf_check_relocs): Likewise.
	* elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
	* elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
	* elf32-v850.c (v850_elf_check_relocs): Likewise.
	* elf32-vax.c (elf_vax_check_relocs): Likewise.
	* elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise.
	* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
	* elf64-aarch64.c (elf64_aarch64_check_relocs): Likewise.
	* elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
	* elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_check_relocs): Likewise.
	* elf64-mmix.c (mmix_elf_check_relocs): Likewise.
	* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
	* elf64-s390.c (elf_s390_check_relocs): Likewise.
	* elf64-sh64.c (sh_elf64_check_relocs): Likewise.
	* elfnn-ia64.c (elfNN_ia64_check_relocs): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
	* elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.  Don't
	test indirect/warning links for NULL.
ld/testsuite/
	* ld-plugin/lto.exp (pr15323a.c): Compile without -flto rather
	than using -r to effectively strip out lto info.
2013-03-30 10:14:15 +00:00
H.J. Lu 61315175ad Set non_ir_ref if a symbol is referenced by a non-shared object
bfd/

	PR ld/15323
	* elf32-i386.c (elf_i386_check_relocs): Set non_ir_ref if a
	symbol is referenced by a non-shared object.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.

ld/testsuite/

	PR ld/15323
	* ld-plugin/lto.exp (lto_link_tests): Add pr15323a-r.o.
	(lto_run_tests): Add a test for PR ld/15323.

	* ld-plugin/pr15323.out: New file.
	* ld-plugin/pr15323a.c: Likewise.
	* ld-plugin/pr15323b.c: Likewise.
2013-03-30 00:38:39 +00:00
Nick Clifton 861319c9dd PR ld/13812
* scripttempl/avr.sc: Place trampolines before .progmem section.
2013-03-27 13:21:38 +00:00
Kai Tietz 676ee43ba9 * ld.texinfo (--disable-runtime-pseudo-reloc): Adjust default. 2013-03-25 18:09:04 +00:00
Nick Clifton 84a2b3d8be * ld-elf/init0.s: Add alloc attribute to .section directive.
* ld-elf/fini1.s: Likewise.
	* ld-elf/fini2.s: Likewise.
	* ld-elf/fini3.s: Likewise.
	* ld-elf/finin.s: Likewise.
	* ld-elf/init0.s: Likewise.
	* ld-elf/init1.s: Likewise.
	* ld-elf/init2.s: Likewise.
	* ld-elf/init3.s: Likewise.
	* ld-elf/initn.s: Likewise.
2013-03-22 09:40:06 +00:00
Nick Clifton 81f5558e3d * elf32-h8300 (h8_relax_section): Add new relaxation of mov
@(disp:32,ERx) to mov @(disp:16,ERx).
	(R_H8_DISP32A16): New reloc.
	Comments added and corrected.
	* reloc.c (BFD_RELOC_H8_DISP32A16): New reloc.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.

	* ld.texinfo (H8/300): Add description of relaxation of
	mov @(disp:32,ERx) to mov @(disp:16,ERx).

	* ld-h8300/h8300.exp: Add new relax-7 test on ELF.
	* ld-h8300/relax-2.s: Add other direction and .w/.l variants of
	mov insns.
	* ld-h8300/relax-2.d: Update expected disassembly.
	* ld-h8300/relax-7a.s: New: tests for mov @(disp:32,ERx) -> mov
	@(disp:16,ERx).
	* ld-h8300/relax-7b.s: New: Likewise.
	* ld-h8300/relax-7.d: New: expected disassembly.

	* config/tc-h8300.c (do_a_fix_imm): Add relaxation of mov
	@(disp:32,ERx) to mov @(disp:16,ERx) insns by new reloc
	R_H8_DISP32A16.
	* config/tc-h8300.h: Remove duplicated defines.
2013-03-21 16:08:07 +00:00
Kai Tietz 31fd86f1cf * pe-dll.c (process_def_file_and_drectve): Don't handle VC
generated C++-symbols as stdcall/fastcall.
2013-03-21 14:05:29 +00:00
Marcus Shawcroft 33e32ca032 Enable --gc-sections test cases for aarch64*-*-* 2013-03-20 14:57:38 +00:00
Will Newton b59369fcbb ld/testsuite/ChangeLog:
2013-03-20  Will Newton  <will.newton@linaro.org>

        * ld-elfvers/vers.exp (objdump_symstuff): Sort objdump output
	based on the symbol name rather than address.
	* ld-elfvers/vers1.sym: Reorder contents to match changes to vers.exp.
	* ld-elfvers/vers15.sym: Likewise.
	* ld-elfvers/vers18.sym: Likewise.
	* ld-elfvers/vers21.sym: Likewise.
	* ld-elfvers/vers9.sym: Likewise.
2013-03-20 12:46:27 +00:00
Alan Modra 8877b5e517 bfd/
* elflink.c (_bfd_elf_make_dynamic_reloc_section): Override
	sh_type according to is_rela.
ld/testsuite/
	* ld-elf/rel.c, ld-elf/relmain.c, ld-elf/relmain.out: New test.
	* ld-elf/shared.exp: Build and run it.
2013-03-20 03:44:56 +00:00
Alan Modra 75c8d84d74 * ld-elfvers/vers.exp: Add -Wl,--no-as-needed to all tests
linking against shared libraries.
	* ld-elfweak/elfweak.exp: Likewise.  Enable for x86_64-linux.
	Build main1.o using $picflag.
2013-03-20 02:28:17 +00:00
Alan Modra ffa9430db1 PR ld/12549
bfd/
	* elflink.c (elf_link_add_object_symbols): Exclude weak refs when
	considering whether an --as-needed library is needed.
ld/
	* ld.texinfo (--as-needed): Update.
ld/testsuite/
	* ld-elf/pr14862.out: Expect no output.
2013-03-18 02:47:03 +00:00
Will Newton 0085488ac8 gas/testsuite/ChangeLog:
2013-03-15  Will Newton  <will.newton@linaro.org>

	* gas/arm/any-idiv.d: Expand *-*eabi test to cover *-*eabi*.
	* gas/arm/arch4t-eabi.d: Likewise.
	* gas/arm/arch4t.d: Likewise.
	* gas/arm/attr-any-armv4t.d: Likewise.
	* gas/arm/attr-any-thumbv6.d: Likewise.
	* gas/arm/attr-cpu-directive.d: Likewise.
	* gas/arm/attr-default.d: Likewise.
	* gas/arm/attr-march-all.d: Likewise.
	* gas/arm/attr-march-armv1.d: Likewise.
	* gas/arm/attr-march-armv2.d: Likewise.
	* gas/arm/attr-march-armv2a.d: Likewise.
	* gas/arm/attr-march-armv2s.d: Likewise.
	* gas/arm/attr-march-armv3.d: Likewise.
	* gas/arm/attr-march-armv3m.d: Likewise.
	* gas/arm/attr-march-armv4.d: Likewise.
	* gas/arm/attr-march-armv4t.d: Likewise.
	* gas/arm/attr-march-armv4txm.d: Likewise.
	* gas/arm/attr-march-armv4xm.d: Likewise.
	* gas/arm/attr-march-armv5.d: Likewise.
	* gas/arm/attr-march-armv5t.d: Likewise.
	* gas/arm/attr-march-armv5te.d: Likewise.
	* gas/arm/attr-march-armv5tej.d: Likewise.
	* gas/arm/attr-march-armv5texp.d: Likewise.
	* gas/arm/attr-march-armv5txm.d: Likewise.
	* gas/arm/attr-march-armv6-m+os.d: Likewise.
	* gas/arm/attr-march-armv6-m.d: Likewise.
	* gas/arm/attr-march-armv6.d: Likewise.
	* gas/arm/attr-march-armv6j.d: Likewise.
	* gas/arm/attr-march-armv6k+sec.d: Likewise.
	* gas/arm/attr-march-armv6k.d: Likewise.
	* gas/arm/attr-march-armv6kt2.d: Likewise.
	* gas/arm/attr-march-armv6s-m.d: Likewise.
	* gas/arm/attr-march-armv6t2.d: Likewise.
	* gas/arm/attr-march-armv6z.d: Likewise.
	* gas/arm/attr-march-armv6zk.d: Likewise.
	* gas/arm/attr-march-armv6zkt2.d: Likewise.
	* gas/arm/attr-march-armv6zt2.d: Likewise.
	* gas/arm/attr-march-armv7-a+idiv.d: Likewise.
	* gas/arm/attr-march-armv7-a+mp.d: Likewise.
	* gas/arm/attr-march-armv7-a+sec+virt.d: Likewise.
	* gas/arm/attr-march-armv7-a+sec.d: Likewise.
	* gas/arm/attr-march-armv7-a+virt.d: Likewise.
	* gas/arm/attr-march-armv7-a.d: Likewise.
	* gas/arm/attr-march-armv7-m.d: Likewise.
	* gas/arm/attr-march-armv7-r+mp.d: Likewise.
	* gas/arm/attr-march-armv7-r.d: Likewise.
	* gas/arm/attr-march-armv7.d: Likewise.
	* gas/arm/attr-march-armv7a.d: Likewise.
	* gas/arm/attr-march-armv7em.d: Likewise.
	* gas/arm/attr-march-armv7m.d: Likewise.
	* gas/arm/attr-march-armv7r.d: Likewise.
	* gas/arm/attr-march-armv8-a+crypto.d: Likewise.
	* gas/arm/attr-march-armv8-a+fp.d: Likewise.
	* gas/arm/attr-march-armv8-a+simd.d: Likewise.
	* gas/arm/attr-march-armv8-a.d: Likewise.
	* gas/arm/attr-march-iwmmxt.d: Likewise.
	* gas/arm/attr-march-iwmmxt2.d: Likewise.
	* gas/arm/attr-march-xscale.d: Likewise.
	* gas/arm/attr-mcpu.d: Likewise.
	* gas/arm/attr-mfpu-arm1020e.d: Likewise.
	* gas/arm/attr-mfpu-arm1020t.d: Likewise.
	* gas/arm/attr-mfpu-arm1136jf-s.d: Likewise.
	* gas/arm/attr-mfpu-arm1136jfs.d: Likewise.
	* gas/arm/attr-mfpu-arm7500fe.d: Likewise.
	* gas/arm/attr-mfpu-fpa.d: Likewise.
	* gas/arm/attr-mfpu-fpa10.d: Likewise.
	* gas/arm/attr-mfpu-fpa11.d: Likewise.
	* gas/arm/attr-mfpu-fpe.d: Likewise.
	* gas/arm/attr-mfpu-fpe2.d: Likewise.
	* gas/arm/attr-mfpu-fpe3.d: Likewise.
	* gas/arm/attr-mfpu-maverick.d: Likewise.
	* gas/arm/attr-mfpu-neon-fp16.d: Likewise.
	* gas/arm/attr-mfpu-neon.d: Likewise.
	* gas/arm/attr-mfpu-softfpa.d: Likewise.
	* gas/arm/attr-mfpu-softvfp+vfp.d: Likewise.
	* gas/arm/attr-mfpu-softvfp.d: Likewise.
	* gas/arm/attr-mfpu-vfp.d: Likewise.
	* gas/arm/attr-mfpu-vfp10-r0.d: Likewise.
	* gas/arm/attr-mfpu-vfp10.d: Likewise.
	* gas/arm/attr-mfpu-vfp3.d: Likewise.
	* gas/arm/attr-mfpu-vfp9.d: Likewise.
	* gas/arm/attr-mfpu-vfpv2.d: Likewise.
	* gas/arm/attr-mfpu-vfpv3-d16.d: Likewise.
	* gas/arm/attr-mfpu-vfpv3.d: Likewise.
	* gas/arm/attr-mfpu-vfpv4-d16.d: Likewise.
	* gas/arm/attr-mfpu-vfpv4.d: Likewise.
	* gas/arm/attr-mfpu-vfpxd.d: Likewise.
	* gas/arm/attr-names.d: Likewise.
	* gas/arm/attr-order.d: Likewise.
	* gas/arm/attr-override-cpu-directive.d: Likewise.
	* gas/arm/attr-override-mcpu.d: Likewise.
	* gas/arm/got_prel.d: Likewise.
	* gas/arm/mapdir.d: Likewise.
	* gas/arm/mapmisc.d: Likewise.
	* gas/arm/mapsecs.d: Likewise.
	* gas/arm/mapshort-eabi.d: Likewise.
	* gas/arm/mapshort-elf.d: Likewise.
	* gas/arm/mov-highregs-any.d: Likewise.
	* gas/arm/mov-lowregs-any.d: Likewise.
	* gas/arm/pr12198-1.d: Likewise.
	* gas/arm/pr12198-2.d: Likewise.
	* gas/arm/thumb-eabi.d: Likewise.
	* gas/arm/thumb.d: Likewise.
	* gas/arm/thumbrel.d: Likewise.

ld/testsuite/ChangeLog:

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

	* ld-arm/arm-elf.exp: Expand *-*eabi test to cover *-*eabi*.
	* ld-arm/gc-hidden-1.d: Likewise.
	* ld-elfvsb/elfvsb.exp: Likewise.
	* ld-shared/shared.exp: Likewise.
2013-03-15 17:55:03 +00:00
Jakub Jelinek 6f2ef5f590 * emulparams/aarch64linux.sh (LIBPATH_SUFFIX): Set to 64 for
aarch64linux* emulations.
2013-03-14 08:56:05 +00:00
Nick Clifton 59c108f731 * elf64-aarch64.c (elf_backend_can_gc_sections): Enable
gc-section support.
        (elf64_aarch64_gc_sweep_hook): Handle GOT, TLS and PLT related relocs.

        * lib/ld-lib.exp (check_gc_sections_available): Remove aarch64
from list of
        targets that don't support gc-section.
2013-03-08 17:37:30 +00:00
Alan Modra 3ab6909a0c * ldfile.c (ldfile_open_command_file_1): Return after einfo
to avoid warning.
2013-03-06 13:48:46 +00:00
Corinna Vinschen a07ee50e95 * configure.host: Add x86_64-*-cygwin* as valid host.
* configure.tgt: Add x86_64-*-cygwin* as valid target.
	* emultempl/pep.em: Handle different requirements for Cygwin in terms
	of start addresses for executables and DLLs, based on memory model in
	http://cygwin.com/ml/cygwin-developers/2013-02/msg00027.html
2013-03-05 11:54:29 +00:00
Alan Modra 13762d2ee4 PR ld/15222
ld/
	* ldlang.c (lang_size_sections_1): When given an lma_region align
	LMA as per VMA only if lma_region is the same as region.
ld/testsuite/
	* ld-scripts/rgn-at6.s, * ld-scripts/rgn-at6.t, * ld-scripts/rgn-at6.d,
	* ld-scripts/rgn-at7.t, * ld-scripts/rgn-at7.d: New tests.
2013-03-05 02:55:27 +00:00
Julian Brown 3064e1ff79 bfd/
* elf32-arm.c (elf32_arm_size_dynamic_sections): Don't call
    elf32_arm_allocate_dynrelocs for source reloc for non-dynamic link.

    ld/testsuite/
    * ld-arm/tls-local-static.s: New test.
    * ld-arm/tls-local-static.d: New.
    * ld-arm/arm-elf.exp (tls-local-static): Add test.
2013-02-28 10:31:34 +00:00
Nick Clifton 727f703102 * scripttempl/elf32msp430.sc: Add placement of .data.* sections.
Add alignment of .bss section.
	* scripttempl/elf32msp430_3.sc: Likewise.
2013-02-27 11:15:39 +00:00
Nick Clifton 56dd11f0f4 PR ld/15188
* ld.texinfo: Fix typos.
2013-02-26 13:06:51 +00:00
H.J. Lu 35399224a1 Set unique_global only for definition
bfd/

	PR ld/15167
	* elf64-ia64-vms.c (elf64_vms_link_add_object_symbols): Set
	unique_global only for definition.
	* elflink.c (_bfd_elf_merge_symbol): Don't set unique_global
	here.
	(elf_link_add_object_symbols): Set unique_global only
	for definition.

ld/testsuite/

	PR ld/15167
	* ld-unique/unique.exp: Add a test for shared library with
	reference.
2013-02-22 01:20:48 +00:00
Alan Modra 7c00cf684e * scripttempl/elf.sc (.init_array, .fini_array): Don't sort all
.init_array/.fini_array input sections before .ctors/.dtors input
	sections.
	(CTORS_IN_INIT_ARRAY, DTORS_IN_INIT_ARRAY): Adjust to suit.
2013-02-21 05:10:28 +00:00
Alan Modra c03551323c bfd/
* elf-bfd.h (struct elf_build_id): Extracted from..
	(struct elf_build_id_info): ..here.  Delete.
	(struct output_elf_obj_tdata): New, extracted from..
	(struct elf_obj_tdata): ..here.  Reorganize for better packing.
	Add "o" field.
	(elf_program_header_size): Reference tdata->o.
	(elf_seg_map, elf_next_file_pos, elf_eh_frame_hdr, elf_linker,
	elf_stack_flags, elf_shstrtab, elf_strtab_sec, elf_shstrtab_sec,
	elf_section_syms, elf_num_section_syms, elf_flags_init): Likewise.
	* elf.c (bfd_elf_allocate_object): Allocate output_elf_obj_tdata
	when opening bfd in any mode that might write.
	(_bfd_elf_write_object_contents): Use build_id field in
	output_elf_obj_tdata.
	(_bfd_elf_close_and_cleanup): Tweak elf_shstrtab test.
	(elfobj_grok_gnu_build_id): Adjust for elf_tdata changes.
gdb/
	* elfread.c (build_id_bfd_get): Adjust for elf_tdata changes.
ld/
	* emultempl/elf32.em (write_build_id, setup_build_id): Adjust
	for elf_tdata changes.
2013-02-21 04:35:22 +00:00
Alan Modra 12bd695738 bfd/
* elf-bfd.h (struct elf_obj_tdata): Rename segment_map to seg_map.
	Delete num_locals and num_globals.
	(elf_num_locals, elf_num_globals): Don't define.
	(elf_seg_map, elf_next_file_pos, elf_eh_frame_hdr, elf_linker,
	elf_stack_flags, elf_strtab_sec, elf_shstrtab_sec): Define.
	* bfd.c, * elf-eh-frame.c, * elf-nacl.c, * elf-vxworks.c, * elf.c,
	* elf32-arm.c, * elf32-lm32.c, * elf32-ppc.c, * elf32-rx.c,
	* elf32-spu.c, * elf64-hppa.c, * elfcode.h, * elflink.c,
	* elfnn-ia64.c, * elfxx-mips.c: Use newly defined elf_obj_tdata
	accessor macros.
	* elf.c (elf_map_symbols): Add pnum_locals param.  Return
	number of locals syms via new param.
	(swap_out_syms): Adjust to suit elf_map_symbols change.
ld/
	* emultempl/elf-generic.em: Use newly defined elf_obj_tdata
	accessor macros.
2013-02-21 02:29:11 +00:00
Alan Modra a582ed93f9 * Makefile.am: Use $(ELF_DEPS) on a number of eelf*.c rules.
* Makefile.in: Regenerate.
2013-02-20 10:24:11 +00:00
Sandra Loosemore 46fed7f7c2 2013-02-19 Sandra Loosemore <sandra@codesourcery.com>
PR ld/15146

	ld/
	* plugin.c (plugin_notice): Add null check before dereferencing
	pointer.
2013-02-19 03:59:08 +00:00
Maciej W. Rozycki 897aea504d * lib/ld-lib.exp (run_ld_link_tests): Add another argument, pass
its contents to ar_simple_create and ld_simple_link after
	objfiles.
	* ld-aarch64/aarch64-elf.exp: Adjust accordingly.
	* ld-alpha/alpha.exp: Likewise.
	* ld-arm/arm-elf.exp: Likewise.
	* ld-arm/export-class.exp: Likewise.
	* ld-elf/comm-data.exp: Likewise.
	* ld-elf/eh-group.exp: Likewise.
	* ld-elf/elf.exp: Likewise.
	* ld-elf/export-class.exp: Likewise.
	* ld-elfvers/vers.exp: Likewise.
	* ld-frv/tls.exp: Likewise.
	* ld-i386/export-class.exp: Likewise.
	* ld-i386/i386.exp: Likewise.
	* ld-ia64/ia64.exp: Likewise.
	* ld-libs/libs.exp: Likewise.
	* ld-m68k/m68k.exp: Likewise.
	* ld-metag/metag.exp: Likewise.
	* ld-mips-elf/comm-data.exp: Likewise.
	* ld-mips-elf/export-class.exp: Likewise.
	* ld-mips-elf/mips-elf.exp: Likewise.
	* ld-mn10300/mn10300.exp: Likewise.
	* ld-pe/pe-compile.exp: Likewise.
	* ld-pe/pe.exp: Likewise.
	* ld-plugin/plugin.exp: Likewise.
	* ld-powerpc/aix52.exp: Likewise.
	* ld-powerpc/export-class.exp: Likewise.
	* ld-powerpc/powerpc.exp: Likewise.
	* ld-s390/s390.exp: Likewise.
	* ld-sh/sh-vxworks.exp: Likewise.
	* ld-sh/sh64/sh64.exp: Likewise.
	* ld-sparc/sparc.exp: Likewise.
	* ld-tic6x/tic6x.exp: Likewise.
	* ld-tilegx/tilegx.exp: Likewise.
	* ld-tilepro/tilepro.exp: Likewise.
	* ld-undefined/entry.exp: Likewise.
	* ld-vax-elf/vax-elf.exp: Likewise.
	* ld-x86-64/dwarfreloc.exp: Likewise.
	* ld-x86-64/export-class.exp: Likewise.
	* ld-x86-64/x86-64.exp: Likewise.
	* ld-xc16x/xc16x.exp: Likewise.
	* ld-xstormy16/xstormy16.exp: Likewise.
	* ld-xtensa/xtensa.exp: Likewise.
2013-02-19 01:10:06 +00:00
Alan Modra 30e8ee25e3 include/
* bfdlink.h (struct bfd_link_info): Delete emit_note_gnu_build_id.
bfd/
	* configure.in: Bump version to 2.23.52.
	* elf-bfd.h (struct elf_build_id_info): New.
	(struct elf_obj_tdata): Delete after_write_object_contents,
	after_write_object_contents_info and build_id_size.  Make build_id
	a pointer to struct elf_build_id_info.
	* elf.c (_bfd_elf_write_object_contents): Style.  Update
	after_write_ibject_contents invocation.
	(elfobj_grok_gnu_build_id): Update for new build_id struct.  Don't
	allow zero size notes.
	* configure: Regenerate.
gdb/
	* elfread.c (struct build_id): Delete.  Use struct elf_build_id
	throughout file instead.
	(build_id_bfd_get): Update to use new elf_tdata build_id field.
	Don't xmalloc return value.
	(build_id_verify): Similarly.  Don't xfree.
	(build_id_to_debug_filename): Update.
	(find_separate_debug_file_by_buildid): Update, don't xfree.
ld/
	* emultempl/elf32.em (emit_note_gnu_build_id): New static var.
	Replace all info->emit_note_gnu_build_id refs.
	(id_note_section_size): Rename from
	gld${EMULATION_NAME}_id_note_section_size.
	(struct build_id_info): Delete.
	(write_build_id): Rename from
	gld${EMULATION_NAME}_write_build_id_section.
	Update elf_tdata usage.  Style, formatting.
	(setup_build_id): New function.
	(gld${EMULATION_NAME}_after_open): Use setup_build_id.
2013-02-18 23:50:32 +00:00
Maciej W. Rozycki 273e4eecfe * ld-mips-elf/jalx-2.ld: Include .rel.plt in output, give .plt a
mapping.
	* ld-mips-elf/jalx-2.dd: Adjust disassembly accordingly.
2013-02-18 23:35:17 +00:00
Alan Modra 53c3509d86 * ld-plugin/lto.exp (Build pr15146b.so) Add -Wl,--no-as-needed.
(PR ld/15146 (1), (2)): Likewise.
	(LTO 7): Likewise.
2013-02-18 09:13:11 +00:00
Alan Modra 3e6f168c5e missed from last commit 2013-02-18 04:44:16 +00:00
H.J. Lu 3d5bef4c08 Don't add DT_NEEDED for references from the dummy bfd
bfd/

	PR ld/15146
	* elflink.c (elf_link_add_object_symbols): Don't add DT_NEEDED
	for references from the dummy bfd.

ld/

	PR ld/15146
	* plugin.c (plugin_notice): Replace the undefined dummy bfd with
	the real one.

ld/testsuite/

	PR ld/15146
	* ld-plugin/pr15146.d: New file.
	* ld-plugin/pr15146a.c: Likewise.
	* ld-plugin/pr15146b.c: Likewise.
	* ld-plugin/pr15146c.c: Likewise.
	* ld-plugin/pr15146d.c: Likewise.

	* ld-plugin/lto.exp: Add tests for PR ld/15146.
2013-02-16 17:54:37 +00:00
H.J. Lu 4a2b04a7e5 Also trace symbol from the IR bfd
PR ld/15141
	* plugin.c (plugin_notice): Also trace symbol from the IR bfd.
2013-02-16 17:50:20 +00:00
Nick Clifton 9d1df426e2 * metag-dis.c: Initialize outf->bytes_per_chunk to 4
which also makes the disassembler output be in little
	endian like it should be.

	* metag/labelarithmetic.d: Fix the expected disassembler
	output to be in little endian format
	* metag/metacore12.d: likewise
	* metag/metacore21.d: likewise
	* metag/metacore21ext.d: likewise
	* metag/metadsp21.d: likewise
	* metag/metadsp21ext.d: likewise
	* metag/metafpu.d: likewise
	* metag/metafpuext.d: likewise
	* metag/tls.d: likewise

	* ld-metag/pcrel.d: Fix the expected disassembler
	output to be in little endian format
	* ld-metag/shared.d: likewise
	* ld-metag/stub.d: likewise
	* ld-metag/stub_pic_app.d: likewise
	* ld-metag/stub_pic_shared.d: likewise
	* ld-metag/stub_shared.d: likewise
2013-02-15 14:54:28 +00:00
Kai Tietz b138e9bffd * scripttempl/pep.sc (.xdata): Merge .xdata* into .xdata section.
(.pdata): Merge .pdata* into .pdata section.
2013-02-15 11:08:01 +00:00
Richard Sandiford 13db6b44ea bfd/
* elfxx-mips.c (mips_got_page_ref): New structure.
	(mips_got_page_entry): Use a section rather than a (bfd, symndx)
	pair to represent the anchor point.
	(mips_got_info): Add a got_page_refs field.
	(mips_elf_link_hash_table): Add a sym_cache field.
	(mips_got_page_ref_hash, mips_got_page_ref_eq): New functions.
	(mips_got_page_entry_hash, mips_got_page_entry_eq): Update for
	new anchor representation.
	(mips_elf_create_got_info): Create got_page_refs rather than
	got_page_entries.
	(mips_elf_record_got_page_ref): New function.
	(mips_elf_pages_for_range): Move further down file.
	(mips_elf_record_got_page_entry): Likewise.  Take a got as argument.
	Use a section rather than a (bfd, symndx) pair to represent the
	anchor point.
	(mips_elf_resolve_got_page_ref): New function.
	(mips_elf_resolve_final_got_entries): Use it to populate
	got_page_entries.
	(_bfd_mips_elf_check_relocs): Call mips_elf_record_got_page_ref
	rather than mips_elf_record_got_page_entry.  Only nullify h
	afterwards.
	(mips_elf_lay_out_got): Call mips_elf_resolve_final_got_entries
	earlier.

ld/testsuite/
	* ld-mips-elf/mips16-pic-2.dd,
	ld-mips-elf/mips16-pic-2.gd: Remove 3 unused local GOT entries.
	* ld-mips-elf/got-page-4a.s, ld-mips-elf/got-page-4b.s,
	ld-mips-elf/got-page-4a.d, ld-mips-elf/got-page-4a.got,
	ld-mips-elf/got-page-4b.d, ld-mips-elf/got-page-4b.got,
	ld-mips-elf/got-page-5.s, ld-mips-elf/got-page-5.d,
	ld-mips-elf/got-page-5.got, ld-mips-elf/got-page-6.s,
	ld-mips-elf/got-page-6.d, ld-mips-elf/got-page-6.got,
	ld-mips-elf/got-page-7a.s, ld-mips-elf/got-page-7b.s,
	ld-mips-elf/got-page-7c.s, ld-mips-elf/got-page-7d.s,
	ld-mips-elf/got-page-7e.s, ld-mips-elf/got-page-7.d,
	ld-mips-elf/got-page-7.got: New tests.
	* ld-mips-elf/mips-elf.exp: Run them.
2013-02-13 14:08:58 +00:00
Richard Sandiford 3dff0dd1e3 bfd/
* elfxx-mips.c (mips_got_entry): Update comments.
	(mips_elf_multi_got_entry_eq): Rename to...
	(mips_elf_got_entry_eq): ...this, deleting the old definition.
	(mips_elf_create_got_info): Remove master_got_p argument.
	Always use mips_elf_got_entry_eq.
	(mips_elf_bfd_got, mips_elf_multi_got, mips_elf_create_got_section):
	Update calls accordingly.

ld/testsuite/
	* 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/tls-hidden3.d, ld-mips-elf/tls-hidden3.got: Update
	for new hash table order.
2013-02-11 18:09:24 +00:00
Richard Sandiford d720656991 bfd/
* elfxx-mips.c (mips_got_info): Remove bfd2got.
	(mips_elf_bfd2got_hash): Delete.
	(mips_elf_got_per_bfd_arg): Remove bfd2got.
	(mips_elf_replace_bfd_got, mips_elf_count_got_entries): New functions.
	(mips_elf_global_got_index, mips_elf_create_local_got_entry): Use
	g->next to test for the multigot case.  Use mips_elf_bfd_got rather
	than mips_elf_got_for_ibfd.
	(mips_elf_bfd2got_entry_hash, mips_elf_bfd2got_entry_eq)
	(mips_elf_got_for_ibfd, mips_elf_get_got_for_bfd): Delete.
	(mips_elf_make_got_per_bfd): Replace with...
	(mips_elf_add_got_entry): ...this new function.
	(mips_elf_make_got_pages_per_bfd): Replace with...
	(mips_elf_add_got_page_entry): ...this new function.
	(mips_elf_merge_got_with): Replace bfd2got argument with separate
	bfd and GOT arguments.  Use mips_elf_add_got_entry and
	mips_elf_add_got_page_entry instead of mips_elf_make_got_per_bfd
	and mips_elf_make_got_pages_per_bfd.  Use mips_elf_replace_bfd_got
	to set the BFD's GOT and free the old table.
	(mips_elf_merge_got): Replace bfd2got argument with separate
	bfd and GOT arguments.  Apply mips_elf_resolve_final_got_entries.
	Use mips_elf_count_got_entries to count the number of entries in
	each GOT.  Update the calls to mips_elf_merge_got_with.
	(mips_elf_adjust_gp): Use g->next to test for the multigot case.
	Use mips_elf_bfd_got rather than mips_elf_got_for_ibfd.
	(mips_elf_multi_got): Don't create the bfd2got hash table.
	Replace hash table traversal with a walk over the input bfds,
	updating the call to mips_elf_merge_got.  Use mips_elf_replace_bfd_got
	to set the output bfd's GOT.
	(mips_elf_lay_out_got): Rename "sub" to "ibfd".  Record that all
	bfds use the master GOT in the single-GOT case.
	(_bfd_mips_elf_finish_dynamic_sections): Use mips_elf_bfd_got
	rather than mips_elf_got_for_ibfd.

ld/testsuite/
	* ld-mips-elf/tls-hidden4.got, ld-mips-elf/tls-multi-got-1.d,
	ld-mips-elf/tls-multi-got-1.got: Update for changes in the order
	that symbols are added to per-bfd GOTs.
2013-02-11 18:06:10 +00:00
Richard Sandiford d9bf376d09 bfd/
* elfxx-mips.c (mips_elf_multi_got_entry_hash): Rename to...
	(mips_elf_got_entry_hash): ...this, deleting the old version.
	(mips_elf_create_got_info): Use mips_elf_got_entry_hash for
	both types of GOT.

ld/testsuite/
	* ld-mips-elf/tls-hidden3.d, ld-mips-elf/tls-hidden3.got,
	ld-mips-elf/tls-multi-got-1.got, ld-mips-elf/tlsbin-o32.d,
	ld-mips-elf/tlsbin-o32.got, 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.d,
	ld-mips-elf/tlslib-o32.got, ld-mips-elf/tlslib-o32-hidden.got,
	ld-mips-elf/tlslib-o32-ver.got: Adjust GOT layout for new
	got_entry hash function.
2013-02-11 17:46:02 +00:00
Richard Sandiford 1fd20d7055 bfd/
* elfxx-mips.c (mips_elf_count_global_tls_entries)
	(mips_elf_count_global_tls_relocs): Don't count indirect or
	warning symbols.
	(mips_elf_multi_got, mips_elf_lay_out_got): Assert that the right
	number of TLS entries were allocated.

ld/testsuite/
	* ld-mips-elf/tlsdyn-o32-2.got, ld-mips-elf/tlsdyn-o32-3.got: Remove
	unused GOT entries.
2013-02-11 17:29:35 +00:00
Alan Modra 61087d8c32 * ldlang.c (get_init_priority): Comment typo.
(lang_finish): Free link_info.hash and lang_definedness_table.
	(lang_end): Delete lang_definedness_table comment.
2013-02-11 02:07:20 +00:00
Alan Modra a1b8d8434e PR ld/15130
* ld.texinfo (-rpath-link): Typo fix.
2013-02-10 23:52:51 +00:00
Nick Clifton 20855e86bf * emultempl/metagelf.em (build_section_lists): Use sec_info_type
rather than userdata->flags.just_syms.
2013-02-08 17:46:31 +00:00
H.J. Lu 02acbe2250 Set STB_GNU_UNIQUE only if symbol is defined in regular object
bfd/

	PR ld/15107
	* elflink.c (elf_link_output_extsym): Set STB_GNU_UNIQUE only if
	symbol is defined in regular object.

ld/testsuite/

	PR ld/15107
	* ld-unique/unique_empty.s: Add reference to "b".
2013-02-08 01:33:01 +00:00
H.J. Lu 20e52bd2b8 Don't resolve size relocation against non-zero TLS symbol
bfd/

	* elf32-i386.c (elf_i386_allocate_dynrelocs): Don't clear pc_count
	for non-zero TLS symbol.
	(elf_i386_relocate_section): Don't resolve size relocation against
	non-zero TLS symbol.
	* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Don't clear
	pc_count for non-zero TLS symbol.
	(elf_x86_64_relocate_section): Don't resolve size relocation
	against non-zero TLS symbol.

ld/testsuite/

	* ld-size/size-10.rd: Updated.
	* ld-size/size-8.rd: Likewise.
	* ld-size/size32-2-i386.d: Likewise.
	* ld-size/size32-2-x32.d: Likewise.
	* ld-size/size32-2-x86-64.d: Likewise.
	* ld-size/size64-2-x32.d: Likewise.
	* ld-size/size64-2-x86-64.d: Likewise.

	* ld-size/size.exp (run_time_tests): Pass --hash-styl=gnu to
	linker for size-8 test.
2013-02-07 02:15:30 +00:00
Sandra Loosemore 36591ba149 2013-02-06 Sandra Loosemore <sandra@codesourcery.com>
Andrew Jenner <andrew@codesourcery.com>

	Based on patches from Altera Corporation.

	bfd/
	* Makefile.am (ALL_MACHINES): Add cpu-nios2.lo.
	(ALL_MACHINES_CFILES): Add cpu-nios2.c.
	(BFD_BACKENDS): Add elf32-nios2.lo.
	(BFD32_BACKENDS_CFILES): Add elf32-nios2.c.
	* Makefile.in: Regenerated.
	* configure.in: Add entries for bfd_elf32_bignios2_vec and
	bfd_elf32_littlenios2_vec.
	* configure: Regenerated.
	* config.bfd: Add cases for nios2.
	* archures.c (enum bfd_architecture): Add bfd_arch_nios2.
	(bfd_mach_nios2): Define.
	(bfd_nios2_arch): Declare.
	(bfd_archures_list): Add bfd_nios2_arch.
	* targets.c (bfd_elf32_bignios2_vec): Declare.
	(bfd_elf32_littlenios2_vec): Declare.
	(_bfd_target_vector): Add entries for bfd_elf32_bignios2_vec and
	bfd_elf32_littlenios2_vec.
	* elf-bfd.h (enum elf_target_id): Add NIOS2_ELF_DATA.
	* reloc.c (enum bfd_reloc_code_real): Add Nios II relocations.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Regenerated.
	* cpu-nios2.c: New file.
	* elf32-nios2.c: New file.

	opcodes/
	* Makefile.am (TARGET_LIBOPCODES_CFILES): Add nios2-dis.c and
	nios2-opc.c.
	* Makefile.in: Regenerated.
	* configure.in: Add case for bfd_nios2_arch.
	* configure: Regenerated.
	* disassemble.c (ARCH_nios2): Define.
	(disassembler): Add case for bfd_arch_nios2.
	* nios2-dis.c: New file.
	* nios2-opc.c: New file.

	include/
	* dis-asm.h (print_insn_big_nios2): Declare.
	(print_insn_little_nios2): Declare.

	include/elf
	* nios2.h: New file.

	include/opcode/
	* nios2.h: New file.

	gas/
	* Makefile.am (TARGET_CPU_CFILES): Add config/tc-nios2.c.
	(TARGET_CPU_HFILES): Add config/tc-nios2.h.
	* Makefile.in: Regenerated.
	* configure.tgt: Add case for nios2*-linux*.
	* config/obj-elf.c: Conditionally include elf/nios2.h.
	* config/tc-nios2.c: New file.
	* config/tc-nios2.h: New file.
	* doc/Makefile.am (CPU_DOCS): Add c-nios2.texi.
	* doc/Makefile.in: Regenerated.
	* doc/all.texi: Set NIOSII.
	* doc/as.texinfo (Overview): Add Nios II options.
	(Machine Dependencies): Include c-nios2.texi.
	* doc/c-nios2.texi: New file.
	* NEWS: Note Altera Nios II support.

	gas/testsuite/
	* gas/nios2/add.d: New.
	* gas/nios2/add.s: New.
	* gas/nios2/align_fill.d: New.
	* gas/nios2/align_fill.s: New.
	* gas/nios2/align_text.d: New.
	* gas/nios2/align_text.s: New.
	* gas/nios2/and.d: New.
	* gas/nios2/and.s: New.
	* gas/nios2/branch.d: New.
	* gas/nios2/branch.s: New.
	* gas/nios2/break.d: New.
	* gas/nios2/break.s: New.
	* gas/nios2/bret.d: New.
	* gas/nios2/bret.s: New.
	* gas/nios2/cache.d: New.
	* gas/nios2/cache.s: New.
	* gas/nios2/call26.d: New.
	* gas/nios2/call26.s: New.
	* gas/nios2/call.d: New.
	* gas/nios2/call.s: New.
	* gas/nios2/cmp.d: New.
	* gas/nios2/cmp.s: New.
	* gas/nios2/comments.d: New.
	* gas/nios2/comments.s: New.
	* gas/nios2/complex.d: New.
	* gas/nios2/complex.s: New.
	* gas/nios2/ctl.d: New.
	* gas/nios2/ctl.s: New.
	* gas/nios2/custom.d: New.
	* gas/nios2/custom.s: New.
	* gas/nios2/etbt.d: New.
	* gas/nios2/etbt.s: New.
	* gas/nios2/flushda.d: New.
	* gas/nios2/flushda.s: New.
	* gas/nios2/illegal.l: New.
	* gas/nios2/illegal.s: New.
	* gas/nios2/jmp.d: New.
	* gas/nios2/jmp.s: New.
	* gas/nios2/ldb.d: New.
	* gas/nios2/ldb.s: New.
	* gas/nios2/ldh.d: New.
	* gas/nios2/ldh.s: New.
	* gas/nios2/ldw.d: New.
	* gas/nios2/ldw.s: New.
	* gas/nios2/lineseparator.d: New.
	* gas/nios2/lineseparator.s: New.
	* gas/nios2/mov.d: New.
	* gas/nios2/movia.d: New.
	* gas/nios2/movia.s: New.
	* gas/nios2/movi.d: New.
	* gas/nios2/movi.s: New.
	* gas/nios2/mov.s: New.
	* gas/nios2/mul.d: New.
	* gas/nios2/mul.s: New.
	* gas/nios2/nios2.exp: New.
	* gas/nios2/nor.d: New.
	* gas/nios2/nor.s: New.
	* gas/nios2/or.d: New.
	* gas/nios2/or.s: New.
	* gas/nios2/ret.d: New.
	* gas/nios2/ret.s: New.
	* gas/nios2/rol.d: New.
	* gas/nios2/rol.s: New.
	* gas/nios2/rotate.d: New.
	* gas/nios2/rotate.s: New.
	* gas/nios2/stb.d: New.
	* gas/nios2/stb.s: New.
	* gas/nios2/sth.d: New.
	* gas/nios2/sth.s: New.
	* gas/nios2/stw.d: New.
	* gas/nios2/stw.s: New.
	* gas/nios2/sub.d: New.
	* gas/nios2/sub.s: New.
	* gas/nios2/sync.d: New.
	* gas/nios2/sync.s: New.
	* gas/nios2/trap.d: New.
	* gas/nios2/trap.s: New.
	* gas/nios2/tret.d: New.
	* gas/nios2/tret.s: New.
	* gas/nios2/warn_noat.l: New.
	* gas/nios2/warn_noat.s: New.
	* gas/nios2/warn_nobreak.l: New.
	* gas/nios2/warn_nobreak.s: New.
	* gas/nios2/xor.d: New.
	* gas/nios2/xor.s: New.

	ld/
	* Makefile.am (enios2elf.c): New rule.
	* Makefile.in: Regenerated.
	* configure.tgt: Add case for nios2*-*-*.
	* emulparams/nios2elf.sh: New file.
	* NEWS: Note Altera Nios II support.

	ld/testsuite/
	* ld-nios2/emit-relocs-1a.s: New.
	* ld-nios2/emit-relocs-1b.s: New.
	* ld-nios2/emit-relocs-1.d: New.
	* ld-nios2/emit-relocs-1.ld: New.
	* ld-nios2/gprel.d: New.
	* ld-nios2/gprel.s: New.
	* ld-nios2/hilo16.d: New.
	* ld-nios2/hilo16.s: New.
	* ld-nios2/hilo16_symbol.s: New.
	* ld-nios2/imm5.d: New.
	* ld-nios2/imm5.s: New.
	* ld-nios2/imm5_symbol.s: New.
	* ld-nios2/nios2.exp: New.
	* ld-nios2/pcrel16.d: New.
	* ld-nios2/pcrel16_label.s: New.
	* ld-nios2/pcrel16.s: New.
	* ld-nios2/relax_callr.d: New.
	* ld-nios2/relax_callr.ld: New.
	* ld-nios2/relax_callr.s: New.
	* ld-nios2/relax_cjmp.d: New.
	* ld-nios2/relax_cjmp.s: New.
	* ld-nios2/relax_jmp.ld: New.
	* ld-nios2/relax_section.d: New.
	* ld-nios2/relax_section.s: New.
	* ld-nios2/relax_ujmp.d: New.
	* ld-nios2/relax_ujmp.s: New.
	* ld-nios2/reloc.d: New.
	* ld-nios2/reloc.s: New.
	* ld-nios2/reloc_symbol.s: New.
	* ld-nios2/s16.d: New.
	* ld-nios2/s16.s: New.
	* ld-nios2/s16_symbol.s: New.
	* ld-nios2/u16.d: New.
	* ld-nios2/u16.s: New.
	* ld-nios2/u16_symbol.s: New.
	* ld-elf/indirect.exp: Skip on targets that don't support
	-shared -fPIC.
	* ld-elfcomm/elfcomm.exp: Build with -G0 for nios2.
	* ld-plugin/lto.exp: Skip shared library tests on targets that
	don't support them.  Skip execution tests on non-native targets.

	binutils/
	* readelf.c: Include elf/nios2.h.
	(dump_relocations): Add case for EM_ALTERA_NIOS2.
	(get_nios2_dynamic_type): New.
	(get_dynamic_type): Add case for EM_ALTERA_NIOS2.
	(is_32bit_abs_reloc): Fix EM_ALTERA_NIOS2 case.
	(is_16bit_abs_reloc): Likewise.
	(is_none_reloc): Add EM_ALTERA_NIOS2 and EM_NIOS32 cases.
	* NEWS: Note Altera Nios II support.
	* MAINTAINERS: Add Nios II maintainers.
2013-02-06 23:22:26 +00:00
H.J. Lu 7acbc3a0f6 Add tests for ELF DT_XXX
* ld-elf/now-1.d: New file.
	* ld-elf/now-2.d: Likewise.
	* ld-elf/now-3.d: Likewise.
	* ld-elf/now-4.d: Likewise.
	* ld-elf/rpath-1.d: Likewise.
	* ld-elf/rpath-2.d: Likewise.
	* ld-elf/runpath-1.d: Likewise.
	* ld-elf/runpath-2.d: Likewise.
2013-02-06 16:21:51 +00:00
Alan Modra 4d4ef6fd75 * emultempl/avrelf.em (avr_elf_before_parse): New function.
(LDEMUL_BEFORE_PARSE): Define.
2013-02-05 22:38:34 +00:00
Alan Modra eeaa4577b6 Revert 2013-02-04, 2013-01-22 and 2013-01-21 changes. 2013-02-05 21:47:32 +00:00
H.J. Lu 663fa5434e Don't enable new dtags by default with -rpath
ld/

2013-02-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/15096
	* emultempl/alphaelf.em (alpha_after_parse): Call
	gld${EMULATION_NAME}_after_parse instead of after_parse_default.
	* emultempl/cr16elf.em (cr16elf_after_parse): Likewise.
	* emultempl/crxelf.em (crxelf_after_parse): Likewise.
	* emultempl/hppaelf.em (hppaelf_after_parse): Likewise.
	* emultempl/mipself.em (mips_after_parse): Likewise.

	* emultempl/ia64elf.em (gld${EMULATION_NAME}_after_parse): Renamed
	to ...
	(gld_${EMULATION_NAME}_after_parse): This.  Call
	gld${EMULATION_NAME}_after_parse instead of after_parse_default.
	(LDEMUL_AFTER_PARSE): Set to gld_${EMULATION_NAME}_after_parse.

	* emultempl/elf32.em (new_dtags_set): New variable.
	(gld${EMULATION_NAME}_before_parse): Don't set link_info.new_dtags
	here.
	(gld${EMULATION_NAME}_after_parse): New function.
	(ld_${EMULATION_NAME}_emulation): Replace after_parse_default'
	with gld${EMULATION_NAME}_after_parse.
	(gld${EMULATION_NAME}_handle_option): Set new_dtags_set to TRUE
	when setting link_info.new_dtags.

ld/testsuite/

2013-02-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/15096
	* ld-elf/new-dtags-1.d: New test.
	* ld-elf/new-dtags-2.d: Likewise.
	* ld-elf/new-dtags-3.d: Likewise.
	* ld-elf/new-dtags-4.d: Likewise.
	* ld-elf/new-dtags-5.d: Likewise.
	* ld-elf/new-dtags-6.d: Likewise.
	* ld-elf/new-dtags-7.d: Likewise.
	* ld-elf/new-dtags-8.d: Likewise.
2013-02-05 01:36:05 +00:00
Hans-Peter Nilsson 393dab1504 * ld-cris/libdso-13.d: Adjust for --enable-new-dtags now
default for *-*-linux-* by passing explicitly for all targets.
2013-01-31 09:55:23 +00:00
Alan Modra bcaa2f8235 bfd/
* elf64-ppc.c (ppc_stub_name): Trim off trailing "+0".
ld/testsuite/
	* ld-powerpc/tlsexe.d: Update for changed stub names.
	* ld-powerpc/tlsexe.r: Likewise.
	* ld-powerpc/tlsexetoc.d: Likewise.
	* ld-powerpc/tlsexetoc.r: Likewise.
	* ld-powerpc/tlsso.d: Likewise.
	* ld-powerpc/tlsso.r: Likewise.
	* ld-powerpc/tlstocso.d: Likewise.
	* ld-powerpc/tlstocso.r: Likewise.
2013-01-31 06:28:48 +00:00
Hans-Peter Nilsson 9de83df819 Tweak last entry. 2013-01-31 00:44:56 +00:00
Hans-Peter Nilsson 0d358fd5c7 * ld-cris/libdso-13.d: Adjust for --enable-new-dtags now default. 2013-01-31 00:35:24 +00:00
Kai Tietz 0a4e6638da * deffilep.y (def_image_name): Adjust type of base-address
argument.
        (%union): Add new type bfd_vma as vma.
        (VMA):  New rule.
        (opt_base): Use VMA instead of NUMBER rule to evaluate value.
        (def_file_print): Use bfd's fprintf_vma to output base-address.
2013-01-25 11:39:42 +00:00
Nick Clifton 78c8d46ca4 Add support for V850E3V5 architecture 2013-01-24 11:14:05 +00:00
Nick Clifton f5c66ab0f8 PR ld/15041
* scripttempl/pep.sc (.pdata): Only accept .pdata sections.
	(.xdata): Similarly.
	(.debug_frame): Similarly.
2013-01-23 15:12:01 +00:00
Nick Clifton b176ded116 PR ld/15037
* scripttempl/avr.sc (.eeprom): Keep it.
2013-01-23 11:56:02 +00:00
Alan Modra a6dea726b0 * Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf64rdos.c.
(eelf64rdos.c): New rule.
	* emulparams/elf64rdos.sh: New file.
	* configure.tgt (x86_64-*-rdos*): Use above.
	* Makefile.in: Regenerate.
2013-01-23 10:31:13 +00:00
Roland McGrath f0fe23c2b4 ld/
* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
	new_dtags to TRUE for *-*-nacl* targets.
2013-01-22 22:07:34 +00:00
Mike Frysinger 822b8bf46b ld: enable new dtags by default for linux/gnu targets
The "new" dtags options have been around for 14+ years now, so for Linux
and GNU targets, enable them by default.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-21 08:21:46 +00:00
Alan Modra e16fc3da23 * ld-size/size.exp (build_tests <size-7, size-8>): Pass
--no-as-needed in cflags.
2013-01-21 02:38:37 +00:00
H.J. Lu 6738cadcc7 Add HOSTING_SCRT0 for PIE test
ld/

	* Makefile.am (HOSTING_SCRT0): New.

	* configure.host (HOSTING_SCRT0): New.  Used for PIE.

	* configure.in (HOSTING_SCRT0): New AC_SUBST.

	* Makefile.in: Regenerated.
	* configure: Likewise.

ld/testsuite/

	* config/default.exp (get_target_emul): Also set HOSTING_SCRT0.

	* lib/ld-lib.exp (default_ld_link): Use HOSTING_SCRT0 for -pie.
2013-01-19 19:36:37 +00:00
H.J. Lu 3bea1fcb8b Resolve size relocation against non-zero TLS symbol
bfd/

	* elf32-i386.c (elf_i386_allocate_dynrelocs): Clear pc_count for
	non-zero TLS symbol.
	(elf_i386_relocate_section): Resolve size relocation against
	non-zero TLS symbol.
	* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Clear pc_count
	for non-zero TLS symbol.
	(elf_x86_64_relocate_section): Resolve size relocation against
	non-zero TLS symbol.

ld/testsuite/

	* ld-size/size-10.rd: Updated.
	* ld-size/size-8.rd: Likewise.
	* ld-size/size32-2-i386.d: Likewise.
	* ld-size/size32-2-x32.d: Likewise.
	* ld-size/size32-2-x86-64.d: Likewise.
	* ld-size/size64-2-x32.d: Likewise.
	* ld-size/size64-2-x86-64.d: Likewise.
2013-01-18 22:50:30 +00:00
Mike Frysinger b1b00fcc61 ld: change --enable-new-dtags to only generate new dtags
The "new" dtags options have been around for 14+ years, so there
shouldn't be a need to generate both new & old tags anymore.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-18 17:43:58 +00:00
H.J. Lu 9a645e5c0d Verify run-time size relocations if supported
* ld-size/size-7.out: New file.
	* ld-size/size-8.out: Likewise.
	* ld-size/size-9.out: Likewise.
	* ld-size/size-9.rd: Likewise.
	* ld-size/size-9a.c: Likewise.
	* ld-size/size-9b.c: Likewise.
	* ld-size/size-10.out: Likewise.
	* ld-size/size-10.rd: Likewise.
	* ld-size/size-10a.c: Likewise.
	* ld-size/size-10b.c: Likewise.

	* ld-size/size.exp (build_tests): Build libsize-9.so and
	libsize-10.so.
	Run-time size relocation tests if supported.
	(run_time_tests): New.
2013-01-18 00:21:52 +00:00
H.J. Lu 1cf48f4842 Add size-1 and size-2 tests
* ld-size/size-1.c: New file.
	* ld-size/size-1.out: Likewise.
	* ld-size/size-1a.c: Likewise.
	* ld-size/size-1b.c: Likewise.
	* ld-size/size-2.c: Likewise.
	* ld-size/size-2.out: Likewise.
	* ld-size/size-2a.c: Likewise.
	* ld-size/size-2b.c: Likewise.

	* ld-size/size.exp (build_tests): Build libsize-1.so and
	libsize-2.so.
	(run_tests): Run size-1 and size-2.
2013-01-18 00:01:52 +00:00
H.J. Lu af55cbae94 Add missing files 2013-01-17 23:39:05 +00:00
H.J. Lu 06a6a421f2 Count size relocation as PC-relative relocation
bfd/

	* elf32-i386.c (elf_i386_check_relocs): Count size relocation as
	PC-relative relocation.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Count size relocation
	as PC-relative relocation.

ld/testsuite/

	* ld-size/size32-3-i386.d: New file.
	* ld-size/size32-3-x32.d: Likewise.
	* ld-size/size32-3-x86-64.d: Likewise.
	* ld-size/size32-3.s: Likewise.
2013-01-17 23:36:10 +00:00
H.J. Lu 8fd4256dd0 Add x86 size relocation support to gas
gas/

	* config/tc-i386.c (reloc): Support BFD_RELOC_SIZE32.
	(tc_i386_fix_adjustable): Keep symbol for BFD_RELOC_32_SIZE and
	BFD_RELOC_64_SIZE relocations.
	(lex_got): Support "symbol@SIZE" and don't create GOT symbol
	for it.
	(tc_gen_reloc): Resolve BFD_RELOC_SIZE32 and BFD_RELOC_SIZE64
	relocations against local symbols.

gas/testsuite/

	* gas/i386/i386.exp: Run size-1, size-2, size-3, size-4,
	x86-64-size-1, x86-64-size-2, x86-64-size-3, x86-64-size-4,
	x86-64-size-5 and x86-64-size-inval-1.

	* gas/i386/size-1.d: New file.
	* gas/i386/size-1.s: Likewise.
	* gas/i386/size-2.d: Likewise.
	* gas/i386/size-2.s: Likewise.
	* gas/i386/size-3.d: Likewise.
	* gas/i386/size-3.s: Likewise.
	* gas/i386/size-4.d: Likewise.
	* gas/i386/size-4.s: Likewise.
	* gas/i386/x86-64-size-1.d: Likewise.
	* gas/i386/x86-64-size-2.d: Likewise.
	* gas/i386/x86-64-size-3.d: Likewise.
	* gas/i386/x86-64-size-4.d: Likewise.
	* gas/i386/x86-64-size-5.d: Likewise.
	* gas/i386/x86-64-size-5.s: Likewise.
	* gas/i386/x86-64-size-inval-1.l: Likewise.
	* gas/i386/x86-64-size-inval-1.s: Likewise.
	* gas/i386/ilp32/x86-64-size-1.d: Likewise.
	* gas/i386/ilp32/x86-64-size-2.d: Likewise.
	* gas/i386/ilp32/x86-64-size-3.d: Likewise.
	* gas/i386/ilp32/x86-64-size-4.d: Likewise.
	* gas/i386/ilp32/x86-64-size-5.d: Likewise.

ld/testsuite/

	* ld-size/size.exp: New file.
	* ld-size/size32-1-i386.d: Likewise.
	* ld-size/size32-1-x32.d: Likewise.
	* ld-size/size32-1-x86-64.d: Likewise.
	* ld-size/size32-1.s: Likewise.
	* ld-size/size32-2-i386.d: Likewise.
	* ld-size/size32-2-x32.d: Likewise.
	* ld-size/size32-2-x86-64.d: Likewise.
	* ld-size/size32-2.s: Likewise.
	* ld-size/size64-1-x32.d: Likewise.
	* ld-size/size64-1-x86-64.d: Likewise.
	* ld-size/size64-1.s: Likewise.
	* ld-size/size64-2-x32.d: Likewise.
	* ld-size/size64-2-x86-64.d: Likewise.
	* ld-size/size64-2.s: Likewise.
	* ld-size/size-3.c: Likewise.
	* ld-size/size-3.out: Likewise.
	* ld-size/size-3a.c: Likewise.
	* ld-size/size-3b.c: Likewise.
	* ld-size/size-3c.c: Likewise.
	* ld-size/size-4.out: Likewise.
	* ld-size/size-4a.c: Likewise.
	* ld-size/size-4b.c: Likewise.
	* ld-size/size-5.out: Likewise.
	* ld-size/size-5a.c: Likewise.
	* ld-size/size-5b.c: Likewise.
	* ld-size/size-6.out: Likewise.
	* ld-size/size-6a.c: Likewise.
	* ld-size/size-6b.c: Likewise.
	* ld-size/size-7.rd: Likewise.
	* ld-size/size-7a.c: Likewise.
	* ld-size/size-7b.c: Likewise.
	* ld-size/size-8.rd: Likewise.
	* ld-size/size-8a.c: Likewise.
	* ld-size/size-8b.c: Likewise.
2013-01-17 04:28:48 +00:00
Alan Modra 1178606e2b * ld-plugin/lto.exp (lto-9.o, pr13229.o): Pass -finline. 2013-01-16 08:14:35 +00:00
Alan Modra e245874365 bfd/
* elf64-ppc.c (ppc64_elf_size_stubs): Default shared libs to
	plt-thread-safe.
gold/
	* powerpc.cc (Target_powerpc::do_relax): Default shared libs to
	plt-thread-safe.
ld/testsuite/
	* ld-powerpc/tlsso.d: Adjust for plt-thread-safe stubs.
	* ld-powerpc/tlsso.g: Likewise.
	* ld-powerpc/tlsso.r: Likewise.
	* ld-powerpc/tlstocso.d: Likewise.
	* ld-powerpc/tlstocso.g: Likewise.
2013-01-15 06:13:26 +00:00
Alan Modra 4d490e4206 * ld-plugin/lto-16a.d: Match powerpc64 function symbol type.
* ld-plugin/lto-16b.d: Likewise.
	* ld-plugin/lto-17a.d: Likewise.
	* ld-plugin/lto-17b-2.d: Likewise.
2013-01-15 05:05:26 +00:00
Alan Modra 0d705e9f94 * ld.texinfo (-Tldata-segment): Describe.
* ldlex.h (OPTION_TLDATA_SEGMENT): New enum value.
	* lexsup.c (ld_options): Add -Tldata-segment.
	(parse_args): Handle OPTION_TLDATA_SEGMENT.
	* scripttempl/elf.sc: Support LARGE_DATA_ADDR.
2013-01-14 13:37:10 +00:00
Alan Modra d6391ce5a6 * ld-elf/pr14926.d: Disable for d10v, msp, xstormy.
* ld-elf/sec-to-seg.exp: Choose correct variant output to suit
	updated microblaze page size.
2013-01-14 13:23:05 +00:00
Nick Clifton 2624489484 oops - omitted from previous delta 2013-01-11 09:53:22 +00:00
H.J. Lu e4492aa0d8 Remove trailing white spaces in ld
* deffilep.y: Remove trailing white spaces.
	* elf-hints-local.h: Likewise.
	* ldexp.c: Likewise.
	* ldlang.h: Likewise.
	* ldmisc.c: Likewise.
	* ldwrite.c: Likewise.
	* pe-dll.c: Likewise.
	* emulparams/criself.sh: Likewise.
	* emulparams/crislinux.sh: Likewise.
	* emulparams/elf32_tic6x_le.sh: Likewise.
	* emulparams/elf32bmipn32-defs.sh: Likewise.
	* emulparams/elf32mb_linux.sh: Likewise.
	* emulparams/elf32mep.sh: Likewise.
	* emulparams/elf32microblaze.sh: Likewise.
	* emulparams/elf32ppc.sh: Likewise.
	* emulparams/elf64_s390.sh: Likewise.
	* emulparams/elf64alpha.sh: Likewise.
	* emulparams/elf_s390.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/tic80coff.sh: Likewise.
	* emultempl/aix.em: Likewise.
	* emultempl/avrelf.em: Likewise.
	* emultempl/cr16elf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/spuelf.em: Likewise.
	* emultempl/tic6xdsbt.em: Likewise.
2013-01-10 20:08:03 +00:00
Nick Clifton a3c629886c * common.h: Fix case of "Meta".
* metag.h: New file.

	* dis-asm.h (print_insn_metag): New declaration.

	* metag.h: New file.

	* Makefile.am: Add Meta.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.in: Add Meta.
	* disassemble.c: Add Meta support.
	* metag-dis.c: New file.

	* Makefile.am: Add Meta.
	* Makefile.in: Regenerate.
	* archures.c (bfd_mach_metag): New.
	* bfd-in2.h: Regenerate.
	* config.bfd: Add Meta.
	* configure: Regenerate.
	* configure.in: Add Meta.
	* cpu-metag.c: New file.
	* elf-bfd.h: Add Meta.
	* elf32-metag.c: New file.
	* elf32-metag.h: New file.
	* libbfd.h: Regenerate.
	* reloc.c: Add Meta relocations.
	* targets.c: Add Meta.

	* Makefile.am: Add Meta.
	* Makefile.in: Regenerate.
	* config/tc-metag.c: New file.
	* config/tc-metag.h: New file.
	* configure.tgt: Add Meta.
	* doc/Makefile.am: Add Meta.
	* doc/Makefile.in: Regenerate.
	* doc/all.texi: Add Meta.
	* doc/as.texiinfo: Document Meta options.
	* doc/c-metag.texi: New file.

	* gas/metag/labelarithmetic.d: New file.
	* gas/metag/labelarithmetic.s: New file.
	* gas/metag/metacore12.d: New file.
	* gas/metag/metacore12.s: New file.
	* gas/metag/metacore21-invalid.l: New file.
	* gas/metag/metacore21-invalid.s: New file.
	* gas/metag/metacore21.d: New file.
	* gas/metag/metacore21.s: New file.
	* gas/metag/metacore21ext.d: New file.
	* gas/metag/metacore21ext.s: New file.
	* gas/metag/metadsp21-invalid.l: New file.
	* gas/metag/metadsp21-invalid.s: New file.
	* gas/metag/metadsp21.d: New file.
	* gas/metag/metadsp21.s: New file.
	* gas/metag/metadsp21ext.d: New file.
	* gas/metag/metadsp21ext.s: New file.
	* gas/metag/metafpu21.d: New file.
	* gas/metag/metafpu21.s: New file.
	* gas/metag/metafpu21ext.d: New file.
	* gas/metag/metafpu21ext.s: New file.
	* gas/metag/metag.exp: New file.
	* gas/metag/tls.d: New file.
	* gas/metag/tls.s: New file.

	* Makefile.am: Add Meta.
	* Makefile.in: Regenerate.
	* configure.tgt: Add Meta.
	* emulparams/elf32metag.sh: New file.
	* emultempl/metagelf.em: New file.

	* ld-elf/merge.d: Mark Meta as xfail.
	* ld-gc/start.d: Skip this test on Meta.
	* ld-gc/personality.d: Skip this test on Meta.
	* ld-metag/external.s: New file.
	* ld-metag/metag.exp: New file.
	* ld-metag/pcrel.d: New file.
	* ld-metag/pcrel.s: New file.
	* ld-metag/shared.d: New file.
	* ld-metag/shared.r: New file.
	* ld-metag/shared.s: New file.
	* ld-metag/stub.d: New file.
	* ld-metag/stub.s: New file.
	* ld-metag/stub_pic_app.d: New file.
	* ld-metag/stub_pic_app.r: New file.
	* ld-metag/stub_pic_app.s: New file.
	* ld-metag/stub_pic_shared.d: New file.
	* ld-metag/stub_pic_shared.s: New file.
	* ld-metag/stub_shared.d: New file.
	* ld-metag/stub_shared.r: New file.
	* ld-metag/stub_shared.s: New file.

	* binutils/readelf.c: (guess_is_rela): Add EM_METAG.
	(dump_relocations): Add EM_METAG.
	(get_machine_name): Correct case for Meta.
	(is_32bit_abs_reloc): Add support for Meta ADDR32 reloc.
	(is_none_reloc): Add support for Meta NONE reloc.
2013-01-10 09:49:22 +00:00
Alan Modra 134960cc27 * emulparams/elf_x86_64.sh (LARGE_BSS_AFTER_BSS): Define.
* emulparams/elf32_x86_64.sh: Likewise.
	* emulparams/elf_k1om.sh: Likewise.
	* emulparams/elf_l1om.sh: Likewise.
	* scripttempl/elf.sc (LARGE_BSS): Define rather than appending to
	OTHER_BSS_SECTIONS.  Substitute in script.
2013-01-09 05:51:32 +00:00
Thomas Schwinge 98dbe4a783 ld/testsuite/
* ld-i386/export-class.exp: Restore (and reword) comment about
	excluded targets.
2013-01-08 10:24:46 +00:00
Alan Modra 34d560337b * scripttempl/elf.sc (RODATA_ADDR): Typo fix. 2013-01-08 09:23:07 +00:00
Alan Modra 98e385126e fix typo 2013-01-08 06:33:12 +00:00
Alan Modra d5c8b1f856 * emultempl/elf32.em (gld${EMULATION_NAME}_check_ld_so_conf): Replace
"name" param with a bfd_link_needed_list pointer.  Update caller.
	(gld${EMULATION_NAME}_check_ld_elf_hints): Likewise.
2013-01-08 06:10:39 +00:00
Alan Modra cc382d466c * Makefile.am (ALL_EMULATION_SOURCES): Correct eavrxmega entries.
* Makefile.in: Regenerate.
2013-01-08 02:02:34 +00:00
H.J. Lu add2432034 Add fuse-ld= for GCC linker option compatibility
* lexsup.c (ld_options): Add fuse-ld= for GCC linker option
	compatibility.
2013-01-07 16:58:59 +00:00
Nick Clifton 7ca01ed925 * ld.texinfo: Replace @ with @@ when it is part of the text.
Correct ordering of M68HC11 entry.

	* doc/binutils.texi: Fix ordering of top level nodes.
	Replace erroneous uses of @itemx with @item.

	* bfd.texinfo: Replace @ with @@ when it is part of the text.
2013-01-07 12:11:13 +00:00
Nick Clifton e407c74b5b * archures.c: Add support for MIPS r5900
* bfd-in2.h: Add support for MIPS r5900
	* config.bfd: Add support for Sony Playstation 2
	* cpu-mips.c: Add support for MIPS r5900
	* elfxx-mips.c: Add support for MIPS r5900 (extension of r4000)

	* config/tc-mips.c: Add support for MIPS r5900
	Add M_LQ_AB and M_SQ_AB to support large values for instructions lq and sq.
	* config/tc-mips.c (can_swap_branch_p, get_append_method): Detect some conditional short loops to fix a bug on the r5900 by NOP in the branch delay slot.
	* config/tc-mips.c (M_MUL): Support 3 operands in multu on r5900.
	* config/tc-mips.c (M_TRUNCWS): Support trunc.w.s on r5900 in MIPS ISA I.
	* config/tc-mips.c (s_mipsset): Force 32 bit floating point on r5900.
	* configure.in: Detect CPU type when target string contains r5900 (e.g. mips64r5900el-linux-gnu).

	* config/tc-mips.c (mips_ip): Check parameter range of instructions mfps and mtps on r5900.

	* elf/mips.h: Add MIPS machine variant number for r5900 which is compatible with old Playstation 2 software.
	* opcode/mips.h: Add support for r5900 instructions including lq and sq.

	* configure.tgt: Support ELF files for Sony Playstation 2 (for ps2dev and ps2sdk).
	* emulparams/elf32lr5900n32.sh: Create linker script for Sony Playstation 2 ELF files using MIPS ABI n32.
	* emulparams/elf32lr5900.sh: Create linker script for Sony Playstation 2 ELF files using MIPS ABI o32.
	* Makefile.am: Add linker scripts for Sony Playstation 2 ELF files.

	* opcodes/mips-dis.c: Add names for CP0 registers of r5900.
	* opcodes/mips-opc.c: Add M_SQ_AB and M_LQ_AB to support larger range for instructions sq and lq.

	* opcodes/mips-opc.c: Add support for MIPS r5900 CPU.
	Add support for 128 bit MMI (Multimedia Instructions).
	Add support for EE instructions (Emotion Engine).
	Disable unsupported floating point instructions (64 bit and undefined compare operations).
	Enable instructions of MIPS ISA IV which are supported by r5900.
	Disable 64 bit co processor instructions.
	Disable 64 bit multiplication and division instructions.
	Disable instructions for co-processor 2 and 3, because these are not supported (preparation for later VU0 support (Vector Unit)).
	Disable cvt.w.s because this behaves like trunc.w.s and the correct execution can't be ensured on r5900.
	Add trunc.w.s using the opcode encoding of cvt.w.s on r5900. This will confuse less developers and compilers.
2013-01-04 17:22:53 +00:00
Yufeng Zhang fb098a1efc opcodes/
2013-01-04  Yufeng Zhang  <yufeng.zhang@arm.com>

	* aarch64-opc.c (aarch64_print_operand): Change to print
	AARCH64_OPND_IMM_MOV in hexadecimal in the instruction and in decimal
	in comment.
	* aarch64-tbl.h (aarch64_opcode_table): Remove the 'F_PSEUDO' flag
	from the opcode entries of OP_MOV_IMM_LOG, OP_MOV_IMM_WIDEN and
	OP_MOV_IMM_WIDE.

gas/testsuite/

2013-01-04  Yufeng Zhang  <yufeng.zhang@arm.com>

	* gas/aarch64/int-insns.d: Update.
	* gas/aarch64/mov.d: Update.
	* gas/aarch64/reloc-insn.d: Update.

ld/testsuite/

2013-01-04  Yufeng Zhang  <yufeng.zhang@arm.com>

	* ld-aarch64/emit-relocs-264.d: Append the '-Mno-aliases' option to
	the objdump directive.
	* ld-aarch64/emit-relocs-266.d: Ditto.
	* ld-aarch64/emit-relocs-268.d: Ditto.
	* ld-aarch64/emit-relocs-269.d: Ditto.
	* ld-aarch64/emit-relocs-270.d: Ditto.
	* ld-aarch64/emit-relocs-271.d: Ditto.
	* ld-aarch64/emit-relocs-272.d: Ditto.
2013-01-04 14:59:33 +00:00
H.J. Lu 6265840747 Update copyright year to 2013
binutils/

2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>

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

gas/

2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>

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

ld/

2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>

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

opcodes/

2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>

	* i386-gen.c (process_copyright): Update copyright year to 2013.
2013-01-02 17:15:38 +00:00
H.J. Lu 4e5f3f9d1d Rotate binutils ChangeLog for 2013 2013-01-02 17:06:32 +00:00
Hans-Peter Nilsson 349028aae4 * ld-scripts/pr14962.d: Don't run for mmix-knuth-mmixware. Add
comment punctuation.
2012-12-30 20:15:07 +00:00
H.J. Lu a5479e5ff4 Properly adjust h->plt.refcount
bfd/

	PR ld/14980
	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Properly
	adjust h->plt.refcount.
	* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.

ld/testsuite/

	PR ld/14980
	* ld-ifunc/ifunc-14c.s: New file.
	* ld-ifunc/ifunc-14e-i386.d: Likewise.
	* ld-ifunc/ifunc-14e-x86-64.d: Likewise.
	* ld-ifunc/ifunc-14f-i386.d: Likewise.
	* ld-ifunc/ifunc-14f-x86-64.d: Likewise.
2012-12-21 18:15:22 +00:00
Roland McGrath 9d5777a34c ld/
* ld.texinfo (Options): Describe -Trodata-segment.
	* ldlex.h (enum option_values): Add OPTION_TRODATA_SEGMENT.
	* lexsup.c (ld_options, parse_args): Handle -Trodata-segment.
	* scripttempl/elf.sc (RODATA_ADDR, SHLIB_RODATA_ADDR): Wrap
	SEGMENT_START("rodata-segment", ...) + SIZEOF_HEADERS around the value.
2012-12-18 20:42:43 +00:00
Alan Modra 8d708c8cad PR ld/14962
* ld-scripts/pr14962.d, * ld-scripts/pr14962.t,
	* ld-scripts/pr14962a.s, * ld-scripts/pr14962b.s: New test.
	* ld-scripts/expr.exp: Run it.
2012-12-18 13:38:10 +00:00
Roland McGrath b3adb10f86 ld/testsuite/
* ld-elf/elf.exp (stack exec, stack size): Run for *-*-nacl* targets.
	* ld-i386/export-class.exp: Run for i?86-*-nacl* targets.
2012-12-17 19:32:52 +00:00
H.J. Lu 4cf0f7850b Remove the leading zero
* ld-elf/var1.d: Remove the leading zero.
2012-12-17 17:20:07 +00:00
Nick Clifton 5bf135a788 Add copyright notices 2012-12-17 16:56:12 +00:00
H.J. Lu 387894ff90 Update PR ld/14962 testcase 2012-12-17 15:37:40 +00:00
H.J. Lu 06fc0e2238 Add a testcase for PR ld/14962
PR ld/14962
	* ld-elf/var1.d: New file.
	* ld-elf/var1.s: Likewise.
	* ld-elf/var1.t: Likewise.
2012-12-17 14:53:35 +00:00
Alan Modra 4194268f43 PR ld/14962
* ldexp.h (struct ldexp_control): Add "assign_name".
	* ldexp.c (fold_name <NAME>): Compare and clear assign_name on match.
	(exp_fold_tree_1): Remove existing code testing for self assignment.
	Instead set and test expld.assign_name.
	* ldlang.c (scan_for_self_assignment): Delete.
	(print_assignment): Instead set and test expld.assign_name.
2012-12-17 00:16:49 +00:00
H.J. Lu 73bcf23385 Also check local IFUNC references
bfd/

	PR ld/14968
	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Also check
	local IFUNC references.
	* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.

ld/testsuite/

	PR ld/14968
	* ld-ifunc/ifunc-18a-i386.d: New file.
	* ld-ifunc/ifunc-18a-x86-64.d: Likewise.
	* ld-ifunc/ifunc-18a.s: Likewise.
	* ld-ifunc/ifunc-18b-i386.d: Likewise.
	* ld-ifunc/ifunc-18b-x86-64.d: Likewise.
	* ld-ifunc/ifunc-18b.s: Likewise.
	* ld-ifunc/ifunc-19a-i386.d: Likewise.
	* ld-ifunc/ifunc-19a-x86-64.d: Likewise.
	* ld-ifunc/ifunc-19a.s: Likewise.
	* ld-ifunc/ifunc-19b-i386.d: Likewise.
	* ld-ifunc/ifunc-19b-x86-64.d: Likewise.
	* ld-ifunc/ifunc-19b.s: Likewise.
2012-12-16 20:31:08 +00:00
Thomas Schwinge 6b00ac5ace Fix copy'n'paste-o. 2012-12-15 10:34:14 +00:00
Thomas Schwinge 9cc420b64c ld/testsuite/
* ld-elf/elf.exp (stack exec, stack size): Run for any GNU target.
	* ld-elf/maxpage3c.d: Run for any x86 GNU target.
	* ld-elf/maxpage4.d: Likewise.
	* ld-elf/maxpage5.d: Likewise.
	* ld-i386/export-class.exp: Likewise.
2012-12-15 10:28:17 +00:00
Yufeng Zhang 83a2341852 ld/testsuite/
2012-12-13  Yufeng Zhang  <yufeng.zhang@arm.com>

	* ld-elf/indirect.exp: Disable if -shared is not supported.
	* lib/ld-lib.exp (check_shared_lib_support): Add aarch64*-*-elf and
	arm*-*-elf to the exclude list.
2012-12-14 11:58:59 +00:00
H.J. Lu 5ca5bb3545 Check local IFUNC calls
bfd/

2012-12-13  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/14956
	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Check local
	IFUNC calls.
	* elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.

ld/testsuite/

2012-12-13  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/14956
	* ld-ifunc/ifunc-14-i386.d: Renamed to ...
	* ld-ifunc/ifunc-14a-i386.d: This.

	* ld-ifunc/ifunc-14-x86-64.d: Renamed to ...
	* ld-ifunc/ifunc-14a-x86-64.d: This.

	* ld-ifunc/ifunc-14b-i386.d: New file.
	* ld-ifunc/ifunc-14b-x86-64.d: Likewise.
	* ld-ifunc/ifunc-14c-i386.d: Likewise.
	* ld-ifunc/ifunc-14c-x86-64.d: Likewise.
	* ld-ifunc/ifunc-14d-i386.d: Likewise.
	* ld-ifunc/ifunc-14d-x86-64.d: Likewise.
2012-12-13 21:07:16 +00:00
Roland McGrath 8634c1b4cb ld/
* emulparams/elf_nacl.sh (nacl_rodata_addr): New shell function.
	(RODATA_ADDR, SHLIB_RODATA_ADDR): Use it to base the calculation
	on SEGMENT_START("text-segment", ...) rather than ... alone.
	* Makefile.am (earmelf_nacl.c, earmelfb_nacl.c): Add missing
	dependency on $(srcdir)/emulparams/elf_nacl.sh.
	* Makefile.in: Regenerate.
2012-12-11 22:23:14 +00:00
Nick Clifton 752937aa0c Add copyright notices 2012-12-10 12:48:03 +00:00
H.J. Lu 861b2eaac2 Use "readelf -S --wide" on ld-elf/pr14926.d
* ld-elf/pr14926.d: Use "readelf -S --wide".
2012-12-07 22:30:19 +00:00
H.J. Lu 7708f7ef37 Mention PRs in ChangeLog entries for LTO tests 2012-12-07 19:56:25 +00:00
H.J. Lu af55061b18 Add LTO tests
* ld-plugin/dummy.c: New file.
	* ld-plugin/dummy.s: Likewise.
	* ld-plugin/lto-11.out: Likewise.
	* ld-plugin/lto-11a.c: Likewise.
	* ld-plugin/lto-11b.c: Likewise.
	* ld-plugin/lto-11c.c: Likewise.
	* ld-plugin/lto-12.out: Likewise.
	* ld-plugin/lto-12a.c: Likewise.
	* ld-plugin/lto-12b.c: Likewise.
	* ld-plugin/lto-12c.c: Likewise.
	* ld-plugin/lto-13.out: Likewise.
	* ld-plugin/lto-13a.c: Likewise.
	* ld-plugin/lto-13b.c: Likewise.
	* ld-plugin/lto-13c.c: Likewise.
	* ld-plugin/lto-14.out: Likewise.
	* ld-plugin/lto-14a.c: Likewise.
	* ld-plugin/lto-14b.c: Likewise.
	* ld-plugin/lto-14c.c: Likewise.
	* ld-plugin/lto-15.out: Likewise.
	* ld-plugin/lto-15a.c: Likewise.
	* ld-plugin/lto-15b.c: Likewise.
	* ld-plugin/lto-16a.c: Likewise.
	* ld-plugin/lto-16a.d: Likewise.
	* ld-plugin/lto-16b.c: Likewise.
	* ld-plugin/lto-16b.d: Likewise.
	* ld-plugin/lto-17a.c: Likewise.
	* ld-plugin/lto-17a.d: Likewise.
	* ld-plugin/lto-17b-1.d: Likewise.
	* ld-plugin/lto-17b-2.d: Likewise.
	* ld-plugin/lto-17b.c: Likewise.
	* ld-plugin/lto-1a.c: Likewise.
	* ld-plugin/lto-1b.c: Likewise.
	* ld-plugin/lto-2.c: Likewise.
	* ld-plugin/lto-3.d: Likewise.
	* ld-plugin/lto-3.out: Likewise.
	* ld-plugin/lto-3a.c: Likewise.
	* ld-plugin/lto-3b.c: Likewise.
	* ld-plugin/lto-3c.c: Likewise.
	* ld-plugin/lto-3r.d: Likewise.
	* ld-plugin/lto-5.d: Likewise.
	* ld-plugin/lto-5.out: Likewise.
	* ld-plugin/lto-5a.c: Likewise.
	* ld-plugin/lto-5b.c: Likewise.
	* ld-plugin/lto-5r.d: Likewise.
	* ld-plugin/lto-6.c: Likewise.
	* ld-plugin/lto-7.out: Likewise.
	* ld-plugin/lto-7a.c: Likewise.
	* ld-plugin/lto-7b.c: Likewise.
	* ld-plugin/lto-7c.c: Likewise.
	* ld-plugin/lto-7d.c: Likewise.
	* ld-plugin/lto-8.out: Likewise.
	* ld-plugin/lto-8a.c: Likewise.
	* ld-plugin/lto-8b.c: Likewise.
	* ld-plugin/lto-9.cc: Likewise.
	* ld-plugin/lto-9.d: Likewise.
	* ld-plugin/lto.exp: Likewise.
	* ld-plugin/pr12696-1.cc: Likewise.
	* ld-plugin/pr12758a.s: Likewise.
	* ld-plugin/pr12758b.c: Likewise.
	* ld-plugin/pr12760a.c: Likewise.
	* ld-plugin/pr12760b.c: Likewise.
	* ld-plugin/pr12942.out: Likewise.
	* ld-plugin/pr12942a.cc: Likewise.
	* ld-plugin/pr12942a.h: Likewise.
	* ld-plugin/pr12942b.cc: Likewise.
	* ld-plugin/pr12942c.cc: Likewise.
	* ld-plugin/pr12975.c: Likewise.
	* ld-plugin/pr12975.d: Likewise.
	* ld-plugin/pr12975.t: Likewise.
	* ld-plugin/pr12982.c: Likewise.
	* ld-plugin/pr12982.d: Likewise.
	* ld-plugin/pr13066.cc: Likewise.
	* ld-plugin/pr13066.out: Likewise.
	* ld-plugin/pr13183.d: Likewise.
	* ld-plugin/pr13183a.c: Likewise.
	* ld-plugin/pr13183b.c: Likewise.
	* ld-plugin/pr13201.c: Likewise.
	* ld-plugin/pr13201.out: Likewise.
	* ld-plugin/pr13229.cc: Likewise.
	* ld-plugin/pr13229.d: Likewise.
	* ld-plugin/pr13244.c: Likewise.
	* ld-plugin/pr13244.d: Likewise.
	* ld-plugin/pr13287.cc: Likewise.
	* ld-plugin/run-ie.c: Likewise.
	* ld-plugin/run-ie.out: Likewise.
2012-12-07 19:23:50 +00:00
H.J. Lu c413941892 Add plugin visibility test
* ld-plugin/func1p.c: New file.
	* ld-plugin/func2i.c: Likewise.
	* ld-plugin/func3h.c: Likewise.

	* ld-plugin/plugin.exp (plugin_extra_elf_tests): Add plugin
	visibility test.
2012-12-07 19:14:41 +00:00
H.J. Lu 3bd58fbe75 Add check_lto_available
* lib/ld-lib.exp (check_lto_available): New.  Check if compiler
	supports LTO.
2012-12-07 17:56:09 +00:00
H.J. Lu 741e012828 Properly check linker warnings
* lib/ld-lib.exp (run_cc_link_tests): Properly check linker
	warnings.
2012-12-07 17:53:04 +00:00
H.J. Lu d52a4dca58 Pass -rc to ar
* lib/ld-lib.exp (ar_simple_create): Pass -rc to ar.
2012-12-07 17:51:35 +00:00
H.J. Lu 133c2bb257 Add a testase for PR ld/14926
PR ld/14926
	* ld-elf/pr14926.d: New file.
	* ld-elf/pr14926.s: Likewise.
2012-12-07 12:32:50 +00:00
Alan Modra 71f058efca * ld-elf/comm-data.exp: Revert last change.
* ld-elf/comm-data5.d: xfail frv-linux.
2012-12-07 06:00:06 +00:00
Alan Modra 2eb64a9f4b * ld-elf/shared.exp (libneeded1a.so): Override any system
supplied --as-needed or --add-needed flag.
2012-12-07 05:26:39 +00:00
H.J. Lu 8fbb09e83e Extend --copy-dt-needed-entries to creating DSO
ld/

	PR ld/14915
	* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Also
	check DT_NEEDED entries when creating shared object with
	--copy-dt-needed-entries.

ld/testsuite/

	PR ld/14915
	* ld-elf/shared.exp (build_tests): Test --add-needed,
	--copy-dt-needed-entries, --no-add-needed and
	--no-copy-dt-needed-entries with -shared.
	Add tests for --no-add-needed and --no-copy-dt-needed-entries
	with -shared.
2012-12-06 00:25:19 +00:00
Alan Modra 5c3ab52b3b * ld-elf/comm-data4.d, ld-elf/comm-data4.s: New test.
* ld-elf/comm-data5.d, ld-elf/comm-data5.s: New test.
	* ld-elf/comm-data.exp: Run them.
2012-12-06 00:10:41 +00:00
Alan Modra 79056107ed Add x86_64-*-rdos. 2012-12-05 05:48:19 +00:00
H.J. Lu 63406f0ab7 Add tests for --add-needed/--copy-dt-needed-entries
* ld-elf/shared.exp (build_tests): Build libneeded1b.so,
	libneeded1a.so and libneeded1c.o.
	(run_tests): Test --add-needed and --copy-dt-needed-entries.
	Add tests for --no-add-needed and --no-copy-dt-needed-entries.

	* ld-elf/needed1.out: New file.
	* ld-elf/needed1a.c: Likewise.
	* ld-elf/needed1b.c: Likewise.
	* ld-elf/needed1c.c: Likewise.
2012-12-04 17:44:43 +00:00