This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR ld/4409: --unresolved-symbols=ignore-all issues on ia64


On Tue, Jul 03, 2007 at 04:07:30PM +0200, Andreas Schwab wrote:
> "H.J. Lu" <hjl@lucon.org> writes:
> 
> > On Tue, Jul 03, 2007 at 03:30:36PM +0200, Andreas Schwab wrote:
> >> There is a problem with the ia64 linker that it crashes when seeing a
> >> R_IA64_PCREL21B relocation against an unresolved symbol, because no PLT
> >> has been allocated for it.  This can be fixed with the patch below, but
> >> I'm not sure whether that combination should be allowed in the first
> >> place.
> >> 
> >
> > Is this the same as
> >
> > http://sourceware.org/bugzilla/show_bug.cgi?id=4409
> >
> > Does the Linux binutils 2.17.50.0.17 crash?
> 
> It silently generates a shared library that crashes at runtime, so I'd
> rather ban the combination of -shared with -pie regardless of how the
> crash is resolved.
> 

This is the updated patch for PR ld/4409 and will be in the next
Linux binutils.


H.J.
-----
bfd/

2007-07-03  H.J. Lu  <hongjiu.lu@intel.com>

	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-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-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-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
	* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
	* elf32-mt.c (mt_elf_relocate_section): Likewise.
	* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-s390.c (elf_s390_relocate_section): Likewise.
	* elf32-spu.c (spu_elf_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-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-ia64.c (elfNN_ia64_relocate_section): Skip if error
	from RELOC_FOR_GLOBAL_SYMBOL in executable is ignored.

ld/

2007-07-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/4409
	* ldmain.c (how_to_report_unresolved_symbols): New.
	(main): Set link_info.unresolved_syms_in_objects and
	link_info.unresolved_syms_in_shared_libs if they aren't set
	yet.

	* ldmain.h (how_to_report_unresolved_symbols): New.

	* lexsup.c (how_to_report_unresolved_symbols): Removed.
	(parse_args): Set link_info.pie to FALSE for -shared. Don't
	set default values for link_info.unresolved_syms_in_objects nor
	link_info.unresolved_syms_in_shared_libs.

ld/testsuite/

2007-07-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/4409
	* ld-ia64/error1.d: New file.
	* ld-ia64/error1.s: Likewise.
	* ld-ia64/error2.d: Likewise.
	* ld-ia64/error3.d: Likewise.
	* ld-ia64/error4.d: Likewise.

--- binutils/bfd/elf-bfd.h.error	2007-07-02 09:14:15.000000000 -0700
+++ binutils/bfd/elf-bfd.h	2007-07-02 09:14:15.000000000 -0700
@@ -2082,7 +2082,7 @@ extern bfd_boolean _sh_elf_set_mach_from
 #define RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel,	\
 				r_symndx, symtab_hdr, sym_hashes,	\
 				h, sec, relocation,			\
-				unresolved_reloc, warned)		\
+				unresolved_reloc, warned, ignored)	\
   do									\
     {									\
       /* It seems this can happen with erroneous or unsupported		\
@@ -2097,6 +2097,7 @@ extern bfd_boolean _sh_elf_set_mach_from
 	h = (struct elf_link_hash_entry *) h->root.u.i.link;		\
 									\
       warned = FALSE;							\
+      ignored = FALSE;							\
       unresolved_reloc = FALSE;						\
       relocation = 0;							\
       if (h->root.type == bfd_link_hash_defined				\
@@ -2119,7 +2120,7 @@ extern bfd_boolean _sh_elf_set_mach_from
 	;								\
       else if (info->unresolved_syms_in_objects == RM_IGNORE		\
 	       && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)		\
-	;								\
+	ignored = TRUE;							\
       else if (!info->relocatable)					\
 	{								\
 	  bfd_boolean err;						\
--- binutils/bfd/elf-m10200.c.error	2007-04-26 08:57:29.000000000 -0700
+++ binutils/bfd/elf-m10200.c	2007-07-02 09:14:15.000000000 -0700
@@ -391,12 +391,12 @@ mn10200_elf_relocate_section (output_bfd
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf-m10300.c.error	2007-05-15 10:29:15.000000000 -0700
+++ binutils/bfd/elf-m10300.c	2007-07-02 09:14:15.000000000 -0700
@@ -1416,13 +1416,13 @@ mn10300_elf_relocate_section (output_bfd
       else
 	{
 	  bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  struct elf_link_hash_entry *hh;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   hh, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  h = (struct elf32_mn10300_link_hash_entry *) hh;
 
--- binutils/bfd/elf32-arm.c.error	2007-06-29 11:40:54.000000000 -0700
+++ binutils/bfd/elf32-arm.c	2007-07-02 09:14:15.000000000 -0700
@@ -6446,12 +6446,12 @@ elf32_arm_relocate_section (bfd *       
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  sym_type = h->type;
 	}
--- binutils/bfd/elf32-avr.c.error	2007-04-26 08:57:29.000000000 -0700
+++ binutils/bfd/elf32-avr.c	2007-07-02 09:14:15.000000000 -0700
@@ -1204,12 +1204,12 @@ elf32_avr_relocate_section (bfd *output_
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
--- binutils/bfd/elf32-bfin.c.error	2007-06-29 11:40:54.000000000 -0700
+++ binutils/bfd/elf32-bfin.c	2007-07-02 09:14:15.000000000 -0700
@@ -2197,13 +2197,13 @@ bfinfdpic_relocate_section (bfd * output
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  bfd_boolean unresolved_reloc;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  osec = sec;
 	}
 
@@ -2895,12 +2895,12 @@ bfin_relocate_section (bfd * output_bfd,
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-cr16c.c.error	2007-04-26 08:57:29.000000000 -0700
+++ binutils/bfd/elf32-cr16c.c	2007-07-02 09:14:15.000000000 -0700
@@ -717,12 +717,12 @@ elf32_cr16c_relocate_section (bfd *outpu
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-cris.c.error	2007-05-15 10:29:16.000000000 -0700
+++ binutils/bfd/elf32-cris.c	2007-07-02 09:14:15.000000000 -0700
@@ -995,13 +995,13 @@ cris_elf_relocate_section (output_bfd, i
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  bfd_boolean unresolved_reloc;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if (unresolved_reloc
 	      /* Perhaps we should detect the cases that
--- binutils/bfd/elf32-crx.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-crx.c	2007-07-02 09:14:15.000000000 -0700
@@ -868,12 +868,12 @@ elf32_crx_relocate_section (bfd *output_
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-d10v.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-d10v.c	2007-07-02 09:14:15.000000000 -0700
@@ -456,12 +456,12 @@ elf32_d10v_relocate_section (bfd *output
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-fr30.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-fr30.c	2007-07-02 09:14:15.000000000 -0700
@@ -566,12 +566,12 @@ fr30_elf_relocate_section (output_bfd, i
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
--- binutils/bfd/elf32-frv.c.error	2007-06-29 11:40:54.000000000 -0700
+++ binutils/bfd/elf32-frv.c	2007-07-02 09:14:15.000000000 -0700
@@ -2812,13 +2812,13 @@ elf32_frv_relocate_section (output_bfd, 
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  bfd_boolean unresolved_reloc;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  osec = sec;
 	}
 
--- binutils/bfd/elf32-h8300.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-h8300.c	2007-07-02 09:14:15.000000000 -0700
@@ -451,12 +451,12 @@ elf32_h8_relocate_section (bfd *output_b
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-hppa.c.error	2007-05-15 10:29:16.000000000 -0700
+++ binutils/bfd/elf32-hppa.c	2007-07-02 09:14:15.000000000 -0700
@@ -3675,13 +3675,14 @@ elf32_hppa_relocate_section (bfd *output
       else
 	{
 	  struct elf_link_hash_entry *eh;
-	  bfd_boolean unresolved_reloc;
+	  bfd_boolean unresolved_reloc, ignored;
 	  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rela,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   eh, sym_sec, relocation,
-				   unresolved_reloc, warned_undef);
+				   unresolved_reloc, warned_undef,
+				   ignored);
 
 	  if (!info->relocatable
 	      && relocation == 0
--- binutils/bfd/elf32-i386.c.error	2007-07-02 09:14:15.000000000 -0700
+++ binutils/bfd/elf32-i386.c	2007-07-02 09:14:15.000000000 -0700
@@ -2361,12 +2361,12 @@ elf_i386_relocate_section (bfd *output_b
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-i860.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-i860.c	2007-07-02 09:14:15.000000000 -0700
@@ -1119,12 +1119,12 @@ elf32_i860_relocate_section (bfd *output
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-ip2k.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-ip2k.c	2007-07-02 09:14:15.000000000 -0700
@@ -1449,13 +1449,13 @@ ip2k_elf_relocate_section (bfd *output_b
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  bfd_boolean unresolved_reloc;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
--- binutils/bfd/elf32-iq2000.c.error	2007-06-29 11:40:54.000000000 -0700
+++ binutils/bfd/elf32-iq2000.c	2007-07-02 09:14:15.000000000 -0700
@@ -586,12 +586,12 @@ iq2000_elf_relocate_section (bfd *		    
       else
 	{
 	  bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
--- binutils/bfd/elf32-m68hc1x.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-m68hc1x.c	2007-07-02 09:14:15.000000000 -0700
@@ -944,12 +944,12 @@ elf32_m68hc11_relocate_section (bfd *out
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation, unresolved_reloc,
-				   warned);
+				   warned, ignored);
 
 	  is_far = (h && (h->other & STO_M68HC12_FAR));
 	  stub_name = h->root.root.string;
--- binutils/bfd/elf32-m68k.c.error	2007-05-15 10:29:17.000000000 -0700
+++ binutils/bfd/elf32-m68k.c	2007-07-02 09:14:15.000000000 -0700
@@ -1645,12 +1645,12 @@ elf_m68k_relocate_section (output_bfd, i
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-mcore.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-mcore.c	2007-07-02 09:14:15.000000000 -0700
@@ -457,12 +457,12 @@ mcore_elf_relocate_section (bfd * output
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-msp430.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-msp430.c	2007-07-02 09:14:15.000000000 -0700
@@ -449,12 +449,12 @@ elf32_msp430_relocate_section (bfd * out
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-mt.c.error	2007-06-29 11:40:54.000000000 -0700
+++ binutils/bfd/elf32-mt.c	2007-07-02 09:14:15.000000000 -0700
@@ -343,12 +343,12 @@ mt_elf_relocate_section
       else
 	{
 	  bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  name = h->root.root.string;
 	}
--- binutils/bfd/elf32-openrisc.c.error	2007-04-26 08:57:30.000000000 -0700
+++ binutils/bfd/elf32-openrisc.c	2007-07-02 09:14:15.000000000 -0700
@@ -365,12 +365,12 @@ openrisc_elf_relocate_section (bfd *outp
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-ppc.c.error	2007-06-30 21:00:19.000000000 -0700
+++ binutils/bfd/elf32-ppc.c	2007-07-02 09:14:15.000000000 -0700
@@ -5713,10 +5713,12 @@ ppc_elf_relocate_section (bfd *output_bf
 	}
       else
 	{
+	  bfd_boolean ignored;
+
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  sym_name = h->root.root.string;
 	}
--- binutils/bfd/elf32-s390.c.error	2007-05-15 10:29:18.000000000 -0700
+++ binutils/bfd/elf32-s390.c	2007-07-02 09:14:15.000000000 -0700
@@ -2311,11 +2311,12 @@ elf_s390_relocate_section (output_bfd, i
       else
 	{
 	  bfd_boolean warned ATTRIBUTE_UNUSED;
+	  bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-spu.c.error	2007-06-29 11:40:55.000000000 -0700
+++ binutils/bfd/elf32-spu.c	2007-07-02 09:14:15.000000000 -0700
@@ -2724,10 +2724,12 @@ spu_elf_relocate_section (bfd *output_bf
 	}
       else
 	{
+	  bfd_boolean ignored;
+
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  sym_name = h->root.root.string;
 	}
 
--- binutils/bfd/elf32-v850.c.error	2007-04-26 08:57:31.000000000 -0700
+++ binutils/bfd/elf32-v850.c	2007-07-02 09:14:15.000000000 -0700
@@ -1623,7 +1623,7 @@ v850_elf_relocate_section (bfd *output_b
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  /* Note - this check is delayed until now as it is possible and
 	     valid to have a file without any symbols but with relocs that
@@ -1640,7 +1640,7 @@ v850_elf_relocate_section (bfd *output_b
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-vax.c.error	2007-05-15 10:29:18.000000000 -0700
+++ binutils/bfd/elf32-vax.c	2007-07-02 09:14:15.000000000 -0700
@@ -1414,12 +1414,12 @@ elf_vax_relocate_section (bfd *output_bf
       else
 	{
 	  bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if ((h->root.type == bfd_link_hash_defined
 	      || h->root.type == bfd_link_hash_defweak)
--- binutils/bfd/elf32-xc16x.c.error	2007-04-26 08:57:31.000000000 -0700
+++ binutils/bfd/elf32-xc16x.c	2007-07-02 09:14:15.000000000 -0700
@@ -373,12 +373,12 @@ elf32_xc16x_relocate_section (bfd *outpu
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-xstormy16.c.error	2007-04-26 08:57:31.000000000 -0700
+++ binutils/bfd/elf32-xstormy16.c	2007-07-02 09:14:15.000000000 -0700
@@ -821,12 +821,12 @@ xstormy16_elf_relocate_section (bfd *   
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc, warned;
+	  bfd_boolean unresolved_reloc, warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf32-xtensa.c.error	2007-06-12 08:49:17.000000000 -0700
+++ binutils/bfd/elf32-xtensa.c	2007-07-02 09:14:15.000000000 -0700
@@ -2055,10 +2055,12 @@ elf_xtensa_relocate_section (bfd *output
 	}
       else
 	{
+	  bfd_boolean ignored;
+
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if (relocation == 0
 	      && !unresolved_reloc
--- binutils/bfd/elf64-alpha.c.error	2007-04-26 08:57:31.000000000 -0700
+++ binutils/bfd/elf64-alpha.c	2007-07-02 09:14:15.000000000 -0700
@@ -4174,7 +4174,7 @@ elf64_alpha_relocate_section (bfd *outpu
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  bfd_boolean unresolved_reloc;
 	  struct elf_link_hash_entry *hh;
 	  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
@@ -4182,7 +4182,7 @@ elf64_alpha_relocate_section (bfd *outpu
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   hh, sec, value,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if (warned)
 	    continue;
--- binutils/bfd/elf64-mmix.c.error	2007-04-26 08:57:31.000000000 -0700
+++ binutils/bfd/elf64-mmix.c	2007-07-02 09:14:15.000000000 -0700
@@ -1400,12 +1400,13 @@ mmix_elf_relocate_section (output_bfd, i
 	}
       else
 	{
-	  bfd_boolean unresolved_reloc;
+	  bfd_boolean unresolved_reloc, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, undefined_signalled);
+				   unresolved_reloc, undefined_signalled,
+				   ignored);
 	  name = h->root.root.string;
 	}
 
--- binutils/bfd/elf64-ppc.c.error	2007-05-15 10:29:19.000000000 -0700
+++ binutils/bfd/elf64-ppc.c	2007-07-02 09:14:15.000000000 -0700
@@ -9899,10 +9899,12 @@ ppc64_elf_relocate_section (bfd *output_
 	}
       else
 	{
+	  bfd_boolean ignored;
+
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h_elf, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  sym_name = h_elf->root.root.string;
 	  sym_type = h_elf->type;
 	}
--- binutils/bfd/elf64-s390.c.error	2007-05-15 10:29:19.000000000 -0700
+++ binutils/bfd/elf64-s390.c	2007-07-02 09:14:15.000000000 -0700
@@ -2285,11 +2285,12 @@ elf_s390_relocate_section (output_bfd, i
       else
 	{
 	  bfd_boolean warned ATTRIBUTE_UNUSED;
+	  bfd_boolean ignored ATTRIBUTE_UNUSED;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elf64-x86-64.c.error	2007-07-02 09:14:15.000000000 -0700
+++ binutils/bfd/elf64-x86-64.c	2007-07-02 09:14:15.000000000 -0700
@@ -2123,12 +2123,12 @@ elf64_x86_64_relocate_section (bfd *outp
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	}
 
       if (sec != NULL && elf_discarded_section (sec))
--- binutils/bfd/elfxx-ia64.c.error	2007-07-02 09:14:15.000000000 -0700
+++ binutils/bfd/elfxx-ia64.c	2007-07-02 09:14:15.000000000 -0700
@@ -4741,17 +4741,17 @@ elfNN_ia64_relocate_section (output_bfd,
       else
 	{
 	  bfd_boolean unresolved_reloc;
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sym_sec, value,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if (h->root.type == bfd_link_hash_undefweak)
 	    undef_weak_ref = TRUE;
-	  else if (warned)
+	  else if (warned || (ignored && info->executable))
 	    continue;
 	}
 
--- binutils/bfd/elfxx-sparc.c.error	2007-05-15 10:29:20.000000000 -0700
+++ binutils/bfd/elfxx-sparc.c	2007-07-02 09:14:15.000000000 -0700
@@ -2531,12 +2531,12 @@ _bfd_sparc_elf_relocate_section (bfd *ou
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 
 	  RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 				   r_symndx, symtab_hdr, sym_hashes,
 				   h, sec, relocation,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 	  if (warned)
 	    {
 	      /* To avoid generating warning messages about truncated
--- binutils/ld/ldmain.c.error	2007-07-02 09:14:15.000000000 -0700
+++ binutils/ld/ldmain.c	2007-07-03 10:40:21.000000000 -0700
@@ -103,6 +103,9 @@ bfd_boolean add_needed = TRUE;
 /* TRUE if we should demangle symbol names.  */
 bfd_boolean demangling;
 
+/* How to report unresolved symbols.  */
+enum report_method how_to_report_unresolved_symbols = RM_GENERATE_ERROR;
+
 args_type command_line;
 
 ld_config_type config;
@@ -388,6 +391,27 @@ main (int argc, char **argv)
   if (! link_info.shared || link_info.pie)
     link_info.executable = TRUE;
 
+  /* When creating a shared library, the default behaviour is to
+     ignore any unresolved references.  */
+
+  if (link_info.unresolved_syms_in_objects == RM_NOT_YET_SET)
+    {
+      if (link_info.shared && !link_info.pie)
+	link_info.unresolved_syms_in_objects = RM_IGNORE;
+      else
+	link_info.unresolved_syms_in_objects
+	  = how_to_report_unresolved_symbols;
+    }
+
+  if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET)
+    {
+      if (link_info.shared && !link_info.pie)
+	link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
+      else
+	link_info.unresolved_syms_in_shared_libs
+	  = how_to_report_unresolved_symbols;
+    }
+
   /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols).  I
      don't see how else this can be handled, since in this case we
      must preserve all externally visible symbols.  */
--- binutils/ld/ldmain.h.error	2005-05-12 00:32:03.000000000 -0700
+++ binutils/ld/ldmain.h	2007-07-03 10:31:08.000000000 -0700
@@ -35,6 +35,7 @@ extern bfd_boolean whole_archive;
 extern bfd_boolean as_needed;
 extern bfd_boolean add_needed;
 extern bfd_boolean demangling;
+extern enum report_method how_to_report_unresolved_symbols;
 extern int g_switch_value;
 extern const char *output_filename;
 extern struct bfd_link_info link_info;
--- binutils/ld/lexsup.c.error	2007-05-03 17:57:28.000000000 -0700
+++ binutils/ld/lexsup.c	2007-07-03 10:31:08.000000000 -0700
@@ -567,7 +567,6 @@ parse_args (unsigned argc, char **argv)
   struct option *longopts;
   struct option *really_longopts;
   int last_optind;
-  enum report_method how_to_report_unresolved_symbols = RM_GENERATE_ERROR;
 
   shortopts = xmalloc (OPTION_COUNT * 3 + 2);
   longopts = xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
@@ -1113,12 +1112,7 @@ parse_args (unsigned argc, char **argv)
 	  if (config.has_shared)
 	    {
 	      link_info.shared = TRUE;
-	      /* When creating a shared library, the default
-		 behaviour is to ignore any unresolved references.  */
-	      if (link_info.unresolved_syms_in_objects == RM_NOT_YET_SET)
-		link_info.unresolved_syms_in_objects = RM_IGNORE;
-	      if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET)
-		link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
+	      link_info.pie = FALSE;
 	    }
 	  else
 	    einfo (_("%P%F: -shared not supported\n"));
@@ -1444,14 +1438,6 @@ parse_args (unsigned argc, char **argv)
       set_default_dirlist (default_dirlist);
       free (default_dirlist);
     }
-
-  if (link_info.unresolved_syms_in_objects == RM_NOT_YET_SET)
-    /* FIXME: Should we allow emulations a chance to set this ?  */
-    link_info.unresolved_syms_in_objects = how_to_report_unresolved_symbols;
-
-  if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET)
-    /* FIXME: Should we allow emulations a chance to set this ?  */
-    link_info.unresolved_syms_in_shared_libs = how_to_report_unresolved_symbols;
 }
 
 /* Add the (colon-separated) elements of DIRLIST_PTR to the
--- binutils/ld/testsuite/ld-ia64/error1.d.error	2007-07-02 09:14:15.000000000 -0700
+++ binutils/ld/testsuite/ld-ia64/error1.d	2007-07-03 09:56:52.000000000 -0700
@@ -0,0 +1,7 @@
+#source: error1.s
+#ld: -unresolved-symbols=ignore-all
+#readelf: -s
+
+#...
+[ 	]+[0-9]+:[ 	]+[0]+[ 	]+0[ 	]+NOTYPE[ 	]+GLOBAL DEFAULT[ 	]+UND[ 	]+foo
+#pass
--- binutils/ld/testsuite/ld-ia64/error1.s.error	2007-07-02 09:14:15.000000000 -0700
+++ binutils/ld/testsuite/ld-ia64/error1.s	2007-07-03 10:21:46.000000000 -0700
@@ -0,0 +1,30 @@
+	.explicit
+	.pred.safe_across_calls p1-p5,p16-p63
+	.text
+	.align 16
+	.global _start#
+	.proc _start#
+_start:
+	.prologue 12, 32
+	.mii
+	.save ar.pfs, r33
+	alloc r33 = ar.pfs, 0, 3, 0, 0
+	.save rp, r32
+	mov r32 = b0
+	mov r34 = r1
+	.body
+	;;
+	.bbb
+	nop 0
+	nop 0
+	br.call.sptk.many b0 = foo#
+	;;
+	.mmi
+	nop 0
+	mov r1 = r34
+	mov b0 = r32
+	.mib
+	nop 0
+	mov ar.pfs = r33
+	br.ret.sptk.many b0
+	.endp _start#
--- binutils/ld/testsuite/ld-ia64/error2.d.error	2007-07-03 09:41:51.000000000 -0700
+++ binutils/ld/testsuite/ld-ia64/error2.d	2007-07-03 09:56:38.000000000 -0700
@@ -0,0 +1,7 @@
+#source: error1.s
+#ld: -pie -unresolved-symbols=ignore-all
+#readelf: -s
+
+#...
+[ 	]+[0-9]+:[ 	]+[0]+[ 	]+0[ 	]+NOTYPE[ 	]+GLOBAL DEFAULT[ 	]+UND[ 	]+foo
+#pass
--- binutils/ld/testsuite/ld-ia64/error3.d.error	2007-07-03 09:43:00.000000000 -0700
+++ binutils/ld/testsuite/ld-ia64/error3.d	2007-07-03 09:43:17.000000000 -0700
@@ -0,0 +1,7 @@
+#source: error1.s
+#ld: -pie -shared
+#readelf: -s
+
+#...
+[ 	]+[0-9]+:[ 	]+[0]+[ 	]+0[ 	]+NOTYPE[ 	]+GLOBAL DEFAULT[ 	]+UND[ 	]+foo
+#pass
--- binutils/ld/testsuite/ld-ia64/error4.d.error	2007-07-03 09:56:43.000000000 -0700
+++ binutils/ld/testsuite/ld-ia64/error4.d	2007-07-03 10:23:18.000000000 -0700
@@ -0,0 +1,3 @@
+#source: error1.s
+#ld: -shared -pie
+#error: .*undefined reference to `foo'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]