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


This patch fixes "-fpie -pie --unresolved-symbols=ignore-all" segfault
on Linux/ia64.  The original submission is at

http://sourceware.org/ml/binutils/2007-05/msg00129.html

I have been using this for several years.  OK to install?

Thanks.

H.J.
---
bfd/

2012-04-25  H.J. Lu  <hongjiu.lu@intel.com>

	* elf64-ia64-vms.c (elf64_ia64_relocate_section): Add an
	argument for error ignored.

2012-01-12  Bernhard Rosenkränzer <bernhard.rosenkranzer@linaro.org>

	* elf32-epiphany.c (epiphany_elf_relocate_section): Add an
	argument for error ignored.
	* elf32-rl78.c (rl78_elf_relocate_section): Likewise.
	* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
	* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
	
2010-07-01  H.J. Lu  <hongjiu.lu@intel.com>

	* elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Silence unused warning
	on ignored.

	* elf32-tic6x.c (elf32_tic6x_relocate_section): Add an argument for
	error ignored.
	
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-cr16.c (elf32_cr16_relocate_section): Likewise.
	* elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise.
	* elf32-cris.c (cris_elf_relocate_section): Likewise.
	* elf32-crx.c (elf32_crx_relocate_section): Likewise.
	* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
	* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
	* elf32-frv.c (elf32_frv_relocate_section): Likewise.
	* elf32-h8300.c (elf32_h8_relocate_section): Likewise.
	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	* elf32-i860.c (elf32_i860_relocate_section): Likewise.
	* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
	* elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
	* elf32-lm32.c (lm32_elf_relocate_section): Likewise.
	* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-microblaze.c (microblaze_elf_relocate_section): Likewise.
	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
	* elf32-mep.c (mep_elf_relocate_section): Likewise.
	* elf32-moxie.c (moxie_elf_relocate_section): Likewise.
	* elf32-msp430.c (elf32_msp430_relocate_section): Likewise.
	* elf32-mt.c (mt_elf_relocate_section): Likewise.
	* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-rx.c (rx_elf_relocate_section): Likewise.
	* elf32-s390.c (elf_s390_relocate_section): Likewise.
	* elf32-v850.c (v850_elf_relocate_section): Likewise.
	* elf32-vax.c (elf_vax_relocate_section): Likewise.
	* elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise.
	* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
	* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
	* elf64-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.

	* elfnn-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.

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 4821eaf..f9caf61 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2342,7 +2342,7 @@ extern asection _bfd_elf_large_com_section;
 #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		\
@@ -2357,6 +2357,7 @@ extern asection _bfd_elf_large_com_section;
 	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				\
@@ -2379,7 +2380,7 @@ extern asection _bfd_elf_large_com_section;
 	;								\
       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;						\
@@ -2395,6 +2396,7 @@ extern asection _bfd_elf_large_com_section;
 	}								\
       (void) unresolved_reloc;						\
       (void) warned;							\
+      (void) ignored;							\
     }									\
   while (0)
 
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index 4c6564b..d623abb 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -393,12 +393,12 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	}
       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 && discarded_section (sec))
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index adbb009..9b577cb 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -2013,7 +2013,7 @@ mn10300_elf_relocate_section (bfd *output_bfd,
       bfd_reloc_status_type r;
       int tls_r_type;
       bfd_boolean unresolved_reloc = FALSE;
-      bfd_boolean warned;
+      bfd_boolean warned, ignored;
       struct elf_link_hash_entry * hh;
 
       relocation = 0;
@@ -2036,7 +2036,7 @@ mn10300_elf_relocate_section (bfd *output_bfd,
 	  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 = elf_mn10300_hash_entry (hh);
 
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 9560906..58a26d2 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -10471,12 +10471,12 @@ elf32_arm_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);
 
 	  sym_type = h->type;
 	}
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 41ab3f6..0e80b6a 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -1180,12 +1180,12 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 	}
       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;
 	}
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index e5d9401..285a91b 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1436,12 +1436,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 && discarded_section (sec))
@@ -2655,13 +2655,13 @@ bfinfdpic_relocate_section (bfd * 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;
 	}
 
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index a162191..bf0cdbd 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -1423,12 +1423,12 @@ elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
         }
       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 && discarded_section (sec))
diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c
index 9dcbdde..8020c9a 100644
--- a/bfd/elf32-cr16c.c
+++ b/bfd/elf32-cr16c.c
@@ -715,12 +715,12 @@ elf32_cr16c_relocate_section (bfd *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 && discarded_section (sec))
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 370bf1a..27958af 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1106,13 +1106,13 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 	}
       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);
 
 	  symname = h->root.root.string;
 
diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c
index d36c0ea..a94ea87 100644
--- a/bfd/elf32-crx.c
+++ b/bfd/elf32-crx.c
@@ -865,12 +865,12 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	}
       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 && discarded_section (sec))
diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c
index e0e93c8..c571dc8 100644
--- a/bfd/elf32-d10v.c
+++ b/bfd/elf32-d10v.c
@@ -455,12 +455,12 @@ elf32_d10v_relocate_section (bfd *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 && discarded_section (sec))
diff --git a/bfd/elf32-epiphany.c b/bfd/elf32-epiphany.c
index 7330204..70c907e 100644
--- a/bfd/elf32-epiphany.c
+++ b/bfd/elf32-epiphany.c
@@ -515,11 +515,12 @@ epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 	{
 	  bfd_boolean warned ATTRIBUTE_UNUSED;
 	  bfd_boolean unresolved_reloc 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);
 
 	  name = h->root.root.string;
 	}
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c
index 462e51b..cff5c50 100644
--- a/bfd/elf32-fr30.c
+++ b/bfd/elf32-fr30.c
@@ -568,12 +568,12 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	}
       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;
 	}
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 57de3c0..95a25a3 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -2801,13 +2801,13 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
 	}
       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;
 	  name = h->root.root.string;
 	}
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 28fab32..4b6c79b 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -452,12 +452,12 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	}
       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 && discarded_section (sec))
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 82a0db6..d6c16d4 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -3706,13 +3706,14 @@ elf32_hppa_relocate_section (bfd *output_bfd,
       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
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 832ad89..44a48ad 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -3183,11 +3183,12 @@ elf_i386_relocate_section (bfd *output_bfd,
       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 && discarded_section (sec))
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index b890384..875a6a0 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -1121,12 +1121,12 @@ elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 	}
       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 && discarded_section (sec))
diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c
index fe94615..35485e2 100644
--- a/bfd/elf32-ip2k.c
+++ b/bfd/elf32-ip2k.c
@@ -1425,13 +1425,13 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 	}
       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;
 	}
diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c
index fd3b263..247e99a 100644
--- a/bfd/elf32-iq2000.c
+++ b/bfd/elf32-iq2000.c
@@ -623,12 +623,12 @@ iq2000_elf_relocate_section (bfd *		     output_bfd ATTRIBUTE_UNUSED,
       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;
 	}
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index bd560e1..d94ae9f 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -884,12 +884,12 @@ lm32_elf_relocate_section (bfd *output_bfd,
         {
           /* It's a global symbol.  */
           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;
         }
 
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index f1d4586..30dcbdf 100644
--- a/bfd/elf32-m68hc1x.c
+++ b/bfd/elf32-m68hc1x.c
@@ -974,12 +974,12 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 	}
       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));
 	}
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 47dece2..9cc4f9d 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -3702,12 +3702,12 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
 	}
       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 && discarded_section (sec))
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index c0769a8..c22722f 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -458,12 +458,12 @@ mcore_elf_relocate_section (bfd * 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 && discarded_section (sec))
diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c
index 9c53f3d..ce949e7 100644
--- a/bfd/elf32-mep.c
+++ b/bfd/elf32-mep.c
@@ -490,12 +490,12 @@ mep_elf_relocate_section
 	}
       else
 	{
-	  bfd_boolean warned, unresolved_reloc;
+	  bfd_boolean warned, unresolved_reloc, 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;
 	}
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index a58f7b3..9e22dee 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -815,11 +815,12 @@ microblaze_elf_relocate_section (bfd *output_bfd,
 	    {
 	      /* External symbol.  */
 	      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);
 	      sym_name = h->root.root.string;
 	    }
 
diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c
index bc1d4c7..6dd69b7 100644
--- a/bfd/elf32-moxie.c
+++ b/bfd/elf32-moxie.c
@@ -240,12 +240,12 @@ moxie_elf_relocate_section (bfd *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);
 
 	  name = h->root.root.string;
 	}
diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index c79c474..1fde2d4 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -446,12 +446,12 @@ elf32_msp430_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
 	}
       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 && discarded_section (sec))
diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c
index 7d18774..8a1238c 100644
--- a/bfd/elf32-mt.c
+++ b/bfd/elf32-mt.c
@@ -344,12 +344,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;
 	}
diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c
index 1c9e14a..a01aeaa 100644
--- a/bfd/elf32-openrisc.c
+++ b/bfd/elf32-openrisc.c
@@ -365,12 +365,12 @@ openrisc_elf_relocate_section (bfd *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 && discarded_section (sec))
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index ca6df26..518ddf2 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -6871,10 +6871,12 @@ ppc_elf_relocate_section (bfd *output_bfd,
 	}
       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;
 	}
diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c
index 2806cd3..97e28a6 100644
--- a/bfd/elf32-rl78.c
+++ b/bfd/elf32-rl78.c
@@ -461,12 +461,13 @@ rl78_elf_relocate_section
 	}
       else
 	{
-	  bfd_boolean warned;
+	  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);
+				   warned, ignored);
 
 	  name = h->root.root.string;
 	}
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index 942d4e0..d281a6f 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -511,12 +511,12 @@ rx_elf_relocate_section
 	}
       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);
+				   warned, ignored);
 
 	  name = h->root.root.string;
 	}
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 4b2b380..cba61d1 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -2293,11 +2293,12 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
       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 && discarded_section (sec))
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index 4d7f923..80bbce5 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -2319,12 +2319,12 @@ elf32_tic6x_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 && discarded_section (sec))
diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c
index 23073c1..764dc01 100644
--- a/bfd/elf32-tilepro.c
+++ b/bfd/elf32-tilepro.c
@@ -2856,12 +2856,13 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	}
       else
 	{
-	  bfd_boolean warned;
+	  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 (warned)
 	    {
 	      /* To avoid generating warning messages about truncated
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 236a0b2..a517cf9 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -2074,7 +2074,7 @@ v850_elf_relocate_section (bfd *output_bfd,
 	}
       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
@@ -2091,7 +2091,7 @@ v850_elf_relocate_section (bfd *output_bfd,
 	  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 && discarded_section (sec))
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index f1b5d76..9f4574c 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -1403,12 +1403,12 @@ elf_vax_relocate_section (bfd *output_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);
 
 	  if ((h->root.type == bfd_link_hash_defined
 	      || h->root.type == bfd_link_hash_defweak)
diff --git a/bfd/elf32-xc16x.c b/bfd/elf32-xc16x.c
index dc8cab5..c969972 100644
--- a/bfd/elf32-xc16x.c
+++ b/bfd/elf32-xc16x.c
@@ -373,12 +373,12 @@ elf32_xc16x_relocate_section (bfd *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 && discarded_section (sec))
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index 57445ba..d6c1399 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -817,12 +817,12 @@ xstormy16_elf_relocate_section (bfd *                   output_bfd ATTRIBUTE_UNU
 	}
       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 && discarded_section (sec))
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index cfbdff0..ab59e07 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -2643,10 +2643,12 @@ elf_xtensa_relocate_section (bfd *output_bfd,
 	}
       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
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 495b601..2bd8fa9 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -4295,14 +4295,14 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	}
       else
 	{
-	  bfd_boolean warned;
+	  bfd_boolean warned, ignored;
 	  struct elf_link_hash_entry *hh;
 	  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,
 				   hh, sec, value,
-				   unresolved_reloc, warned);
+				   unresolved_reloc, warned, ignored);
 
 	  if (warned)
 	    continue;
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index 9c2cb4c..a3ce905 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -3489,13 +3489,13 @@ elf64_ia64_relocate_section (bfd *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;
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index fd5921a..bf4625b 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -1467,12 +1467,13 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	}
       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;
 	}
 
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 0d6dd99..e910c46 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -12264,10 +12264,12 @@ ppc64_elf_relocate_section (bfd *output_bfd,
 	}
       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;
 	}
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index c3ec24c..67fce07 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2237,11 +2237,12 @@ elf_s390_relocate_section (bfd *output_bfd,
       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 && discarded_section (sec))
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index e913246..23f1737 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3136,11 +3136,12 @@ elf_x86_64_relocate_section (bfd *output_bfd,
       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 && discarded_section (sec))
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index a1294ff..abae85a 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -3897,17 +3897,17 @@ elfNN_ia64_relocate_section (bfd *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;
 	}
 
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index 9a0a1a4..f068a1d 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -2993,12 +2993,12 @@ _bfd_sparc_elf_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 (warned)
 	    {
 	      /* To avoid generating warning messages about truncated
diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c
index d87edf5..cd091a7 100644
--- a/bfd/elfxx-tilegx.c
+++ b/bfd/elfxx-tilegx.c
@@ -3122,12 +3122,13 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
 	}
       else
 	{
-	  bfd_boolean warned;
+	  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 (warned)
 	    {
 	      /* To avoid generating warning messages about truncated
diff --git a/ld/lexsup.c b/ld/lexsup.c
index ea34104..15b1856 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1192,12 +1192,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"));
@@ -1552,14 +1547,6 @@ parse_args (unsigned argc, char **argv)
       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;
-
   if (link_info.relocatable)
     {
       if (command_line.check_section_addresses < 0)
@@ -1616,6 +1603,27 @@ parse_args (unsigned 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.  */
diff --git a/ld/testsuite/ld-ia64/error1.d b/ld/testsuite/ld-ia64/error1.d
new file mode 100644
index 0000000..82142b6
--- /dev/null
+++ b/ld/testsuite/ld-ia64/error1.d
@@ -0,0 +1,7 @@
+#source: error1.s
+#ld: -unresolved-symbols=ignore-all
+#readelf: -s
+
+#...
+[ 	]+[0-9]+:[ 	]+[0]+[ 	]+0[ 	]+NOTYPE[ 	]+GLOBAL DEFAULT[ 	]+UND[ 	]+foo
+#pass
diff --git a/ld/testsuite/ld-ia64/error1.s b/ld/testsuite/ld-ia64/error1.s
new file mode 100644
index 0000000..fd48eae
--- /dev/null
+++ b/ld/testsuite/ld-ia64/error1.s
@@ -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#
diff --git a/ld/testsuite/ld-ia64/error2.d b/ld/testsuite/ld-ia64/error2.d
new file mode 100644
index 0000000..764ba66
--- /dev/null
+++ b/ld/testsuite/ld-ia64/error2.d
@@ -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
diff --git a/ld/testsuite/ld-ia64/error3.d b/ld/testsuite/ld-ia64/error3.d
new file mode 100644
index 0000000..e14d451
--- /dev/null
+++ b/ld/testsuite/ld-ia64/error3.d
@@ -0,0 +1,7 @@
+#source: error1.s
+#ld: -pie -shared
+#readelf: -s
+
+#...
+[ 	]+[0-9]+:[ 	]+[0]+[ 	]+0[ 	]+NOTYPE[ 	]+GLOBAL DEFAULT[ 	]+UND[ 	]+foo
+#pass
diff --git a/ld/testsuite/ld-ia64/error4.d b/ld/testsuite/ld-ia64/error4.d
new file mode 100644
index 0000000..881e671
--- /dev/null
+++ b/ld/testsuite/ld-ia64/error4.d
@@ -0,0 +1,3 @@
+#source: error1.s
+#ld: -shared -pie
+#error: .*undefined reference to `foo'
Reply-To: "H.J. Lu" <hjl.tools@gmail.com>


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