From 62f47674222a798da072fc2242e630cbbf08c5e1 Mon Sep 17 00:00:00 2001 From: hjl Date: Wed, 1 Mar 2000 19:40:53 +0000 Subject: [PATCH] 2000-03-01 H.J. Lu * aoutx.h (aout_link_input_section_std): Pass "true" to the undefined_symbol callback. (aout_link_input_section_ext): Likewise. * bout.c (get_value): Likewise. * coff-a29k.c (coff_a29k_relocate_section): Likewise. * coff-alpha.c (alpha_ecoff_get_relocated_section_conten): Likewise. (alpha_relocate_section): Likewise. * coff-arm.c (coff_arm_relocate_section): Likewise. * coff-i960.c (coff_i960_relocate_section): Likewise. * coff-mcore.c (coff_mcore_relocate_section): Likewise. * coff-mips.c (mips_relocate_section): Likewise. * coff-ppc.c (coff_ppc_relocate_section): Likewise. * coff-sh.c (sh_relocate_section): Likewise. * coff-tic80.c (coff_tic80_relocate_section): Likewise. * cofflink.c (_bfd_coff_generic_relocate_section): Likewise. * elf-m10200.c (mn10200_elf_relocate_section): Likewise. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-v850.c (v850_elf_relocate_section): Likewise. * elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise. * elflink.h (elf_link_output_extsym): Likewise. * pe-mips.c (coff_pe_mips_relocate_section): Likewise. * reloc.c (bfd_generic_get_relocated_section_conten): Likewise. * reloc16.c (_bfd_ppc_xcoff_relocate_section): Likewise. * elf-hppa.h (elf_hppa_relocate_section): Pass "false" to the undefined_symbol callback when building shared library with -Bsymbolic and undefined symbols are allowed. Otherwise, pass "true". * elf32-arm.h (elf32_arm_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mips.c (mips_elf_calculate_relocation): Likewise. (elf32_mips_get_relocated_section_content): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. --- bfd/ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ bfd/aoutx.h | 6 ++++-- bfd/bout.c | 3 ++- bfd/coff-a29k.c | 2 +- bfd/coff-alpha.c | 6 +++--- bfd/coff-arm.c | 2 +- bfd/coff-i960.c | 2 +- bfd/coff-mcore.c | 2 +- bfd/coff-mips.c | 2 +- bfd/coff-ppc.c | 2 +- bfd/coff-sh.c | 2 +- bfd/coff-tic80.c | 2 +- bfd/cofflink.c | 2 +- bfd/elf-hppa.h | 9 +++++++-- bfd/elf-m10200.c | 4 ++-- bfd/elf-m10300.c | 4 ++-- bfd/elf32-arm.h | 5 +++-- bfd/elf32-d10v.c | 4 ++-- bfd/elf32-fr30.c | 5 +++-- bfd/elf32-hppa.c | 4 ++-- bfd/elf32-i370.c | 3 ++- bfd/elf32-i386.c | 3 ++- bfd/elf32-m32r.c | 4 ++-- bfd/elf32-m68k.c | 3 ++- bfd/elf32-mcore.c | 2 +- bfd/elf32-mips.c | 13 ++++++++----- bfd/elf32-ppc.c | 7 +++++-- bfd/elf32-sh.c | 2 +- bfd/elf32-sparc.c | 3 ++- bfd/elf32-v850.c | 4 ++-- bfd/elf64-alpha.c | 3 ++- bfd/elf64-sparc.c | 3 ++- bfd/elflink.c | 2 +- bfd/elflink.h | 6 ++++-- bfd/pe-mips.c | 2 +- bfd/reloc.c | 3 ++- bfd/reloc16.c | 3 ++- bfd/xcofflink.c | 2 +- 38 files changed, 129 insertions(+), 55 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 97c0eefa37..631c7e8901 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,51 @@ +2000-03-01 H.J. Lu + + * aoutx.h (aout_link_input_section_std): Pass "true" to + the undefined_symbol callback. + (aout_link_input_section_ext): Likewise. + * bout.c (get_value): Likewise. + * coff-a29k.c (coff_a29k_relocate_section): Likewise. + * coff-alpha.c (alpha_ecoff_get_relocated_section_conten): + Likewise. + (alpha_relocate_section): Likewise. + * coff-arm.c (coff_arm_relocate_section): Likewise. + * coff-i960.c (coff_i960_relocate_section): Likewise. + * coff-mcore.c (coff_mcore_relocate_section): Likewise. + * coff-mips.c (mips_relocate_section): Likewise. + * coff-ppc.c (coff_ppc_relocate_section): Likewise. + * coff-sh.c (sh_relocate_section): Likewise. + * coff-tic80.c (coff_tic80_relocate_section): Likewise. + * cofflink.c (_bfd_coff_generic_relocate_section): Likewise. + * elf-m10200.c (mn10200_elf_relocate_section): Likewise. + * elf-m10300.c (mn10300_elf_relocate_section): Likewise. + * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. + * elf32-fr30.c (fr30_elf_relocate_section): Likewise. + * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. + * elf32-i370.c (i370_elf_relocate_section): Likewise. + * elf32-m32r.c (m32r_elf_relocate_section): Likewise. + * elf32-mcore.c (mcore_elf_relocate_section): Likewise. + * elf32-sh.c (sh_elf_relocate_section): Likewise. + * elf32-v850.c (v850_elf_relocate_section): Likewise. + * elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise. + * elflink.h (elf_link_output_extsym): Likewise. + * pe-mips.c (coff_pe_mips_relocate_section): Likewise. + * reloc.c (bfd_generic_get_relocated_section_conten): Likewise. + * reloc16.c (_bfd_ppc_xcoff_relocate_section): Likewise. + + * elf-hppa.h (elf_hppa_relocate_section): Pass "false" to the + undefined_symbol callback when building shared library with + -Bsymbolic and undefined symbols are allowed. Otherwise, pass + "true". + * elf32-arm.h (elf32_arm_relocate_section): Likewise. + * elf32-i386.c (elf_i386_relocate_section): Likewise. + * elf32-m68k.c (elf_m68k_relocate_section): Likewise. + * elf32-mips.c (mips_elf_calculate_relocation): Likewise. + (elf32_mips_get_relocated_section_content): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. + * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. + * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. + 2000-02-28 Nick Clifton * Makefile.am: Add rules to build pe[i]-{sh|mips}.lo objects. diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 895a3215d7..fa107a7cb9 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -5029,7 +5029,8 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, else name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, name, input_bfd, input_section, r_addr))) + (finfo->info, name, input_bfd, input_section, + r_addr, true))) return false; } @@ -5431,7 +5432,8 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, else name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, name, input_bfd, input_section, r_addr))) + (finfo->info, name, input_bfd, input_section, + r_addr, true))) return false; } diff --git a/bfd/bout.c b/bfd/bout.c index dd1754af25..c230e18c0e 100644 --- a/bfd/bout.c +++ b/bfd/bout.c @@ -1047,7 +1047,8 @@ get_value (reloc, link_info, input_section) { if (! ((*link_info->callbacks->undefined_symbol) (link_info, bfd_asymbol_name (symbol), - input_section->owner, input_section, reloc->address))) + input_section->owner, input_section, reloc->address, + true))) abort (); value = 0; } diff --git a/bfd/coff-a29k.c b/bfd/coff-a29k.c index 9eb68448a2..0374b20b47 100644 --- a/bfd/coff-a29k.c +++ b/bfd/coff-a29k.c @@ -416,7 +416,7 @@ coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; } } diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index bc25319f4a..6bbc279aee 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -1133,7 +1133,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, case bfd_reloc_undefined: if (! ((*link_info->callbacks->undefined_symbol) (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr), - input_bfd, input_section, rel->address))) + input_bfd, input_section, rel->address, true))) goto error_return; break; case bfd_reloc_dangerous: @@ -1719,7 +1719,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, relocated. */ if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, (bfd_vma) 0))) + input_section, (bfd_vma) 0, true))) return false; addend = 0; } @@ -1921,7 +1921,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - r_vaddr - input_section->vma))) + r_vaddr - input_section->vma, true))) return false; relocation = 0; } diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index f0a109e719..5bb7be6f6a 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -1535,7 +1535,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; } } diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c index 2a7ebfbe96..4c37fab697 100644 --- a/bfd/coff-i960.c +++ b/bfd/coff-i960.c @@ -458,7 +458,7 @@ coff_i960_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; } } diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index 90b7667dfe..1bc231226c 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c @@ -492,7 +492,7 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; } diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index 1f687fb527..bb4b15e96c 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -1781,7 +1781,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - int_rel.r_vaddr - input_section->vma))) + int_rel.r_vaddr - input_section->vma, true))) return false; relocation = 0; } diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index f2e8cb8711..c5e695d311 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -1197,7 +1197,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; } } diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 2fdde67301..de5d657a31 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -2938,7 +2938,7 @@ sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; } } diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c index 1132ea6e84..a8ade33ba9 100644 --- a/bfd/coff-tic80.c +++ b/bfd/coff-tic80.c @@ -576,7 +576,7 @@ coff_tic80_relocate_section (output_bfd, info, input_bfd, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; } } diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 1ad7c986e1..609f6653e0 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -2933,7 +2933,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; } } diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 99cc17e51f..b55e1c4e5b 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1079,8 +1079,13 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section, relocation = 0; } /* Allow undefined symbols in shared libraries. */ - else if (info->shared && !info->symbolic && !info->no_undefined) + else if (info->shared && !info->no_undefined) { + if (info->symbolic) + (*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, false); + /* If this symbol has an entry in the PA64 dynamic hash table, then get it. */ dyn_name = get_dyn_name (input_bfd, h, rel, @@ -1104,7 +1109,7 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section, { if (!((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; break; } diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index 88556fbc7a..1939635cb2 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -408,7 +408,7 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; relocation = 0; } @@ -447,7 +447,7 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section, case bfd_reloc_undefined: if (! ((*info->callbacks->undefined_symbol) (info, name, input_bfd, input_section, - rel->r_offset))) + rel->r_offset, true))) return false; break; diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 5dbd2d6d4d..bb86497bc9 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -623,7 +623,7 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; relocation = 0; } @@ -662,7 +662,7 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section, case bfd_reloc_undefined: if (! ((*info->callbacks->undefined_symbol) (info, name, input_bfd, input_section, - rel->r_offset))) + rel->r_offset, true))) return false; break; diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 7b78fd6c81..eaaf9763b4 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -1806,7 +1806,8 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, { if (!((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, + (!info->shared || info->no_undefined)))) return false; relocation = 0; } @@ -1844,7 +1845,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, case bfd_reloc_undefined: if (!((*info->callbacks->undefined_symbol) (info, name, input_bfd, input_section, - rel->r_offset))) + rel->r_offset, true))) return false; break; diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index 29deb7c70c..dd2e892ad0 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -449,7 +449,7 @@ elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section, { if (!((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; relocation = 0; } @@ -485,7 +485,7 @@ elf32_d10v_relocate_section (output_bfd, info, input_bfd, input_section, case bfd_reloc_undefined: if (!((*info->callbacks->undefined_symbol) (info, name, input_bfd, input_section, - rel->r_offset))) + rel->r_offset, true))) return false; break; diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index 04c7d378b7..6b295d3e52 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -617,7 +617,7 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; #if 0 fprintf (stderr, "unknown: name: %s\n", name); @@ -643,7 +643,8 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section, case bfd_reloc_undefined: r = info->callbacks->undefined_symbol - (info, name, input_bfd, input_section, rel->r_offset); + (info, name, input_bfd, input_section, rel->r_offset, + true); break; case bfd_reloc_outofrange: diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 874fd6e89e..683a308515 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -443,7 +443,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section, { if (!((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; break; } @@ -479,7 +479,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section, case bfd_reloc_notsupported: if (!((*info->callbacks->undefined_symbol) (info, "$global$", input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; return false; case bfd_reloc_dangerous: diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 6dc993d26e..4d66bcfe29 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -1425,7 +1425,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, h->root.root.string, input_bfd, input_section, - rel->r_offset); + rel->r_offset, + true); ret = false; continue; } diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 0153fa872e..90efba8dc9 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1319,7 +1319,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, + (!info->shared || info->no_undefined)))) return false; relocation = 0; } diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index e9ce55b198..be6af6c95b 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1018,7 +1018,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, offset))) + input_section, offset, true))) return false; relocation = 0; } @@ -1149,7 +1149,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, case bfd_reloc_undefined: if (! ((*info->callbacks->undefined_symbol) (info, name, input_bfd, input_section, - offset))) + offset, true))) return false; break; diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 06ba12c998..518b6bcfd0 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1485,7 +1485,8 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, { if (!(info->callbacks->undefined_symbol (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, + (!info->shared || info->no_undefined)))) return false; relocation = 0; } diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 6a8b70a443..c8e66dfa18 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -538,7 +538,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; ret = false; diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index d9832b67b9..2fd04cc9f4 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -5835,10 +5835,12 @@ mips_elf_calculate_relocation (abfd, } else { - (*info->callbacks->undefined_symbol) - (info, h->root.root.root.string, input_bfd, - input_section, relocation->r_offset); - return bfd_reloc_undefined; + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.root.string, input_bfd, + input_section, relocation->r_offset, + (!info->shared || info->no_undefined)))) + return bfd_reloc_undefined; + symbol = 0; } target_is_16_bit_code_p = (h->root.other == STO_MIPS16); @@ -8715,7 +8717,8 @@ elf32_mips_get_relocated_section_contents (abfd, link_info, link_order, data, case bfd_reloc_undefined: if (!((*link_info->callbacks->undefined_symbol) (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), - input_bfd, input_section, (*parent)->address))) + input_bfd, input_section, (*parent)->address, + true))) goto error_return; break; case bfd_reloc_dangerous: diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 7c5f589cd1..242cfb730a 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -3109,7 +3109,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, h->root.root.string, input_bfd, input_section, - rel->r_offset)) + rel->r_offset, + (!info->shared + || info->no_undefined))) return false; relocation = 0; } @@ -3139,7 +3141,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, h->root.root.string, input_bfd, input_section, - rel->r_offset)) + rel->r_offset, + true)) return false; continue; } diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index ea0426e24b..19042871ae 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -1789,7 +1789,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; relocation = 0; } diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index f39fc1b5ec..e61a82fabe 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -1219,7 +1219,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, + (!info->shared || info->no_undefined)))) return false; relocation = 0; } diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 119e598085..4fe28fc92b 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -1625,7 +1625,7 @@ fprintf (stderr, "undefined: sec: %s, name: %s\n", { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, true))) return false; #if 0 fprintf (stderr, "unknown: name: %s\n", h->root.root.string); @@ -1669,7 +1669,7 @@ fprintf (stderr, "unknown: name: %s\n", h->root.root.string); case bfd_reloc_undefined: if (! ((*info->callbacks->undefined_symbol) (info, name, input_bfd, input_section, - rel->r_offset))) + rel->r_offset, true))) return false; break; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index a21d1b9f32..3d17b54463 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -3476,7 +3476,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, { if (!((*info->callbacks->undefined_symbol) (info, h->root.root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, + (!info->shared || info->no_undefined)))) return false; relocation = 0; } diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 4420cbcf25..46e777552f 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -2055,7 +2055,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, - input_section, rel->r_offset))) + input_section, rel->r_offset, + (!info->shared || info->no_undefined)))) return false; relocation = 0; } diff --git a/bfd/elflink.c b/bfd/elflink.c index 91a00e7b31..6534d84b18 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -234,7 +234,7 @@ _bfd_elf_link_record_dynamic_symbol (info, h) const char * name = h->root.root.string; (*info->callbacks->undefined_symbol) - (info, name, abfd, bfd_und_section_ptr, 0); + (info, name, abfd, bfd_und_section_ptr, 0, true); } h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; diff --git a/bfd/elflink.h b/bfd/elflink.h index 6acb790196..394f1c8256 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -4395,7 +4395,9 @@ elf_bfd_final_link (abfd, info) } /* That wrote out all the local symbols. Finish up the symbol table - with the global symbols. */ + with the global symbols. Even if we want to strip everything we + can, we still need to deal with those global symbols that got + converted to local in a version script. */ if (info->shared) { @@ -4904,7 +4906,7 @@ elf_link_output_extsym (h, data) { if (! ((*finfo->info->callbacks->undefined_symbol) (finfo->info, h->root.root.string, h->root.u.undef.abfd, - (asection *) NULL, 0))) + (asection *) NULL, 0, true))) { eoinfo->failed = true; return false; diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c index 51e3b1da57..8f6e454cc6 100644 --- a/bfd/pe-mips.c +++ b/bfd/pe-mips.c @@ -777,7 +777,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; } } diff --git a/bfd/reloc.c b/bfd/reloc.c index 79d602a2ef..7edeeaa1f2 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2874,7 +2874,8 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, case bfd_reloc_undefined: if (!((*link_info->callbacks->undefined_symbol) (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), - input_bfd, input_section, (*parent)->address))) + input_bfd, input_section, (*parent)->address, + true))) goto error_return; break; case bfd_reloc_dangerous: diff --git a/bfd/reloc16.c b/bfd/reloc16.c index 7e7952ed50..fd8758aec4 100644 --- a/bfd/reloc16.c +++ b/bfd/reloc16.c @@ -81,7 +81,8 @@ bfd_coff_reloc16_get_value (reloc, link_info, input_section) { if (! ((*link_info->callbacks->undefined_symbol) (link_info, bfd_asymbol_name (symbol), - input_section->owner, input_section, reloc->address))) + input_section->owner, input_section, reloc->address, + true))) abort (); value = 0; } diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 9ec75bd01d..3f488d7f38 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -6421,7 +6421,7 @@ _bfd_ppc_xcoff_relocate_section (output_bfd, info, input_bfd, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_vaddr - input_section->vma))) + rel->r_vaddr - input_section->vma, true))) return false; /* Don't try to process the reloc. It can't help, and -- 2.11.0