diff options
52 files changed, 269 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ec62d9128d3..ddb4577872e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,8 +1,63 @@ +2013-03-30 Alan Modra <amodra@gmail.com> + + PR ld/15323 + * 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. + 2013-03-29 H.J. Lu <hongjiu.lu@intel.com> PR ld/15323 * elf32-i386.c (elf_i386_check_relocs): Set non_ir_ref if a - symbol is referenced by a non-shared object. + symbol is referenced by a non-shared object. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. 2013-03-28 Joe Seymour <jseymour@codesourcery.com> diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index ffd873d7b3d..c0a9309b7ff 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -1084,6 +1084,10 @@ mn10300_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } r_type = ELF32_R_TYPE (rel->r_info); diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 8e335e745bd..9fff630d6b0 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -12465,6 +12465,10 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the + same object. */ + h->root.non_ir_ref = 1; } } diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index d956da65a52..d3d0f1c86dd 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1187,7 +1187,13 @@ bfin_check_relocs (bfd * abfd, if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; + } switch (ELF32_R_TYPE (rel->r_info)) { diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 656caffb330..8ed5af1c1b5 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -725,6 +725,10 @@ cr16_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index ff2dfe33684..f40a07963be 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -3177,6 +3177,10 @@ cris_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } r_type = ELF32_R_TYPE (rel->r_info); diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index 246e5f51650..f75c16ae7ec 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -287,6 +287,10 @@ elf32_d10v_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c index 29b89104e9e..1379d3d788f 100644 --- a/bfd/elf32-dlx.c +++ b/bfd/elf32-dlx.c @@ -451,6 +451,10 @@ elf32_dlx_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index fe7cf92152c..3aed435dd95 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -671,6 +671,10 @@ fr30_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index efe731c3f3b..788c2997e8d 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -6046,6 +6046,10 @@ elf32_frv_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 8d21cee53d8..4ffa3d2a78f 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1169,6 +1169,10 @@ elf32_hppa_check_relocs (bfd *abfd, while (hh->eh.root.type == bfd_link_hash_indirect || hh->eh.root.type == bfd_link_hash_warning) hh = hppa_elf_hash_entry (hh->eh.root.u.i.link); + + /* PR15323, ref flags aren't set for references in the same + object. */ + hh->eh.root.non_ir_ref = 1; } r_type = ELF32_R_TYPE (rela->r_info); diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 5998db755a6..48e25f228af 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -825,6 +825,10 @@ i370_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } if (info->shared) diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index 8cf47758e30..3a90a996982 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -478,6 +478,10 @@ iq2000_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 6bbbec8a811..df6f346467d 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -1305,6 +1305,10 @@ lm32_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index 88b8dacac18..5205b7b7ce5 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -621,6 +621,10 @@ m32c_elf_check_relocs while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 385f4cc87ba..789a456ff14 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -3746,6 +3746,10 @@ m32r_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 98c29944621..427e3cd2d93 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -871,6 +871,10 @@ elf32_m68hc11_check_relocs (bfd *abfd, struct bfd_link_info *info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 01b5d67d68d..b72bc83cd6a 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -2584,6 +2584,10 @@ elf_m68k_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 288394f783e..28ee2c49cf5 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -613,6 +613,10 @@ mcore_elf_check_relocs (bfd * abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index 8f08bf6cf94..8851845384b 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -2141,6 +2141,10 @@ elf_metag_check_relocs (bfd *abfd, while (hh->eh.root.type == bfd_link_hash_indirect || hh->eh.root.type == bfd_link_hash_warning) hh = (struct elf_metag_link_hash_entry *) hh->eh.root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + hh->eh.root.non_ir_ref = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 8aafe72da25..4a5e80dd86d 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -2348,7 +2348,13 @@ microblaze_elf_check_relocs (bfd * abfd, if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = sym_hashes [r_symndx - symtab_hdr->sh_info]; + { + h = sym_hashes [r_symndx - symtab_hdr->sh_info]; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; + } switch (r_type) { diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c index 9a031b498f6..d0cbb0fab43 100644 --- a/bfd/elf32-moxie.c +++ b/bfd/elf32-moxie.c @@ -356,6 +356,10 @@ moxie_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } } diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index c08f596d1ac..b46e72ce056 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -266,6 +266,10 @@ elf32_msp430_check_relocs (bfd * abfd, struct bfd_link_info * info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } } diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c index ded95c94dfb..ea05c9117e4 100644 --- a/bfd/elf32-mt.c +++ b/bfd/elf32-mt.c @@ -453,6 +453,10 @@ mt_elf_check_relocs while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } } diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index 91cbce43e86..eb472c16dc2 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -2601,6 +2601,10 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } r_type = ELF32_R_TYPE (rel->r_info); diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c index 2b002abcc73..7abc938bc97 100644 --- a/bfd/elf32-openrisc.c +++ b/bfd/elf32-openrisc.c @@ -486,6 +486,10 @@ openrisc_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index c1b53146a37..f356c959fd6 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -3911,6 +3911,10 @@ ppc_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } /* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got. diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index ea9a0760d58..21303110590 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -1198,6 +1198,10 @@ rl78_elf_check_relocs while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index fae222eefd9..52d4abcca53 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1026,6 +1026,10 @@ elf_s390_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } /* Create got section and local_got_refcounts array if they diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index dae7f69b3ab..47cc98733a0 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -2837,6 +2837,10 @@ s3_bfd_score_elf_check_relocs (bfd *abfd, { while (h->root.type == bfd_link_hash_indirect) h = (struct elf_link_hash_entry *)h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the + same object. */ + h->root.non_ir_ref = 1; } } diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index b9b9f30c7f5..c75c7038489 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -2641,6 +2641,10 @@ s7_bfd_score_elf_check_relocs (bfd *abfd, { while (h->root.type == bfd_link_hash_indirect) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the + same object. */ + h->root.non_ir_ref = 1; } } diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index a4c987ff450..86fe1b3377e 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -6031,6 +6031,10 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, #endif h = (struct elf_link_hash_entry *) h->root.u.i.link; } + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } r_type = sh_elf_optimized_tls_reloc (info, r_type, h == NULL); diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index 8f03003e2fa..04ef708b76e 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -2832,6 +2832,10 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (r_type) diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index 4f13241138e..62b95536478 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -1521,6 +1521,10 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } r_type = tilepro_elf_tls_transition (info, r_type, h == NULL); diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 4590c61755a..c0c649874d8 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -83,6 +83,10 @@ v850_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } r_type = ELF32_R_TYPE (rel->r_info); diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 1208d431e50..f13ec1b78a0 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -585,6 +585,10 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index c657b84a46c..851ebbc631e 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -437,6 +437,10 @@ xstormy16_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index b397422994c..28ed9aa907d 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -1007,6 +1007,10 @@ elf_xtensa_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } eh = elf_xtensa_hash_entry (h); diff --git a/bfd/elf64-aarch64.c b/bfd/elf64-aarch64.c index feb1a006ff1..c3b9fc855c2 100644 --- a/bfd/elf64-aarch64.c +++ b/bfd/elf64-aarch64.c @@ -5192,6 +5192,10 @@ elf64_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } /* Could be done earlier, if h were already available. */ diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 81fe6c18b42..b70505040f6 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -1812,6 +1812,9 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info, || h->root.root.type == bfd_link_hash_warning) h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.root.non_ir_ref = 1; h->root.ref_regular = 1; } diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index b2f0ed150a3..aff87f0d178 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -644,6 +644,9 @@ elf64_hppa_check_relocs (bfd *abfd, || hh->eh.root.type == bfd_link_hash_warning) hh = hppa_elf_hash_entry (hh->eh.root.u.i.link); + /* PR15323, ref flags aren't set for references in the same + object. */ + hh->eh.root.non_ir_ref = 1; hh->eh.ref_regular = 1; } else diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index 20b456e7f08..102cdff8d97 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -2095,6 +2095,9 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info, || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; h->ref_regular = 1; } else diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 3195075f008..499bcd609ad 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -2009,6 +2009,10 @@ mmix_elf_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } switch (ELF64_R_TYPE (rel->r_info)) diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 2826d83f61f..a4d483a9fa5 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -5004,6 +5004,10 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, { h = sym_hashes[r_symndx - symtab_hdr->sh_info]; h = elf_follow_link (h); + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } tls_type = 0; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index d939a3d68b4..f2c396f5dd9 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -950,6 +950,10 @@ elf_s390_check_relocs (bfd *abfd, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } /* Create got section and local_got_refcounts array if they diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 7a9297cf329..e70887bdfc6 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -2424,6 +2424,10 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } /* Some relocs require a global offset table. */ diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index 8de94e4751a..05c2f1b4db8 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -2352,6 +2352,9 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info, || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; h->ref_regular = 1; } else diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index a5ad454a79b..317e7b254fa 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -7814,10 +7814,16 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, else { h = sym_hashes[r_symndx - extsymoff]; - while (h != NULL - && (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning)) - h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h != NULL) + { + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the + same object. */ + h->root.non_ir_ref = 1; + } } /* Set CAN_MAKE_DYNAMIC_P to true if we can convert this diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index 596c8384bbe..ba001056af9 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -1450,6 +1450,10 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } if (h && h->type == STT_GNU_IFUNC) diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index accf34b33ce..74afdf87746 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -1738,6 +1738,10 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* PR15323, ref flags aren't set for references in the same + object. */ + h->root.non_ir_ref = 1; } r_type = tilegx_elf_tls_transition (info, r_type, h == NULL, diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index a4b272f330c..869bb70c9b6 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-03-30 Alan Modra <amodra@gmail.com> + + PR ld/15323 + * ld-plugin/lto.exp (pr15323a.c): Compile without -flto rather + than using -r to effectively strip out lto info. + 2013-03-29 H.J. Lu <hongjiu.lu@intel.com> PR ld/15323 diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index cf1ddf3c3a9..7ffe955409c 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -144,8 +144,8 @@ set lto_link_tests { "-flto -fuse-linker-plugin -Wl,--as-needed" "-flto" {pr13287.cc} {} "pr13287.exe" "c++"} {"PR ld/15323" - "-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto" - {pr15323a.c} {} "pr15323a-r.o" "c"} + "" "-O2" + {pr15323a.c} {} "libdummy.a" "c"} } # Generate input files for complex LTO tests for ELF. @@ -270,7 +270,7 @@ set lto_run_tests { "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr13201.o -lm" "" {dummy.c} "pr13201.exe" "pr13201.out" "" "c"} {"PR ld/15323" - "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr15323a-r.o" "" + "-O2 -flto -fuse-linker-plugin tmpdir/pr15323a.o" "" {pr15323b.c} "pr15323.exe" "pr15323.out" "-flto -O2" "c"} } |