From 1649ae8fdfb4b0ce2d8ebcbadec5615343ed4368 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 17 Aug 1999 07:50:30 +0000 Subject: [PATCH] * elf32-mips.c (_bfd_mips_elf_add_symbol_hook): Set BSF_DYNAMIC for special section symbols. * elflink.h (elf_merge_symbol): If we have no old BFD, check BSF_DYNAMIC on the section symbol to see whether the old BFD is dynamic. --- bfd/ChangeLog | 8 ++++++++ bfd/elf32-mips.c | 4 ++-- bfd/elflink.h | 31 ++++++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d838a75ec..451674865 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +1999-08-17 Ian Lance Taylor + + * elf32-mips.c (_bfd_mips_elf_add_symbol_hook): Set BSF_DYNAMIC + for special section symbols. + * elflink.h (elf_merge_symbol): If we have no old BFD, check + BSF_DYNAMIC on the section symbol to see whether the old BFD is + dynamic. + 1999-08-15 Mark Mitchell * elf32-mips.c (mips_elf_calculate_relocation): Fix unfortunate diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index b7191b15e..f18f1fd03 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -3877,7 +3877,7 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) mips_elf_text_section.symbol = &mips_elf_text_symbol; mips_elf_text_section.symbol_ptr_ptr = &mips_elf_text_symbol_ptr; mips_elf_text_symbol.name = ".text"; - mips_elf_text_symbol.flags = BSF_SECTION_SYM; + mips_elf_text_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC; mips_elf_text_symbol.section = &mips_elf_text_section; mips_elf_text_symbol_ptr = &mips_elf_text_symbol; mips_elf_text_section_ptr = &mips_elf_text_section; @@ -3901,7 +3901,7 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) mips_elf_data_section.symbol = &mips_elf_data_symbol; mips_elf_data_section.symbol_ptr_ptr = &mips_elf_data_symbol_ptr; mips_elf_data_symbol.name = ".data"; - mips_elf_data_symbol.flags = BSF_SECTION_SYM; + mips_elf_data_symbol.flags = BSF_SECTION_SYM | BSF_DYNAMIC; mips_elf_data_symbol.section = &mips_elf_data_section; mips_elf_data_symbol_ptr = &mips_elf_data_symbol; mips_elf_data_section_ptr = &mips_elf_data_section; diff --git a/bfd/elflink.h b/bfd/elflink.h index c325c3e9c..f6727a6ae 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -384,10 +384,35 @@ elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, else newdyn = false; - if (oldbfd == NULL || (oldbfd->flags & DYNAMIC) == 0) - olddyn = false; + if (oldbfd != NULL) + olddyn = (oldbfd->flags & DYNAMIC) != 0; else - olddyn = true; + { + asection *hsec; + + /* This code handles the special SHN_MIPS_{TEXT,DATA} section + indices used by MIPS ELF. */ + switch (h->root.type) + { + default: + hsec = NULL; + break; + + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + hsec = h->root.u.def.section; + break; + + case bfd_link_hash_common: + hsec = h->root.u.c.p->section; + break; + } + + if (hsec == NULL) + olddyn = false; + else + olddyn = (hsec->symbol->flags & BSF_DYNAMIC) != 0; + } /* NEWDEF and OLDDEF indicate whether the new or old symbol, respectively, appear to be a definition rather than reference. */ -- 2.11.4.GIT