* 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.
This commit is contained in:
Ian Lance Taylor 1999-08-17 07:50:30 +00:00
parent c31fd3fe9f
commit 0035bd7bda
3 changed files with 38 additions and 5 deletions

View File

@ -1,3 +1,11 @@
1999-08-17 Ian Lance Taylor <ian@zembu.com>
* 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 <mark@codesourcery.com>
* elf32-mips.c (mips_elf_calculate_relocation): Fix unfortunate

View File

@ -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;

View File

@ -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. */