aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-08-17 07:50:30 +0000
committerIan Lance Taylor <ian@airs.com>1999-08-17 07:50:30 +0000
commit0035bd7bdae8fe325e8ad63ef07896f5594e229b (patch)
treec1dd98035145695bf01372975b07abc0deabf064 /bfd
parentc31fd3fe9f6ba788a09e64c6523bd5d2f79e31f6 (diff)
downloadgdb-0035bd7bdae8fe325e8ad63ef07896f5594e229b.zip
gdb-0035bd7bdae8fe325e8ad63ef07896f5594e229b.tar.gz
gdb-0035bd7bdae8fe325e8ad63ef07896f5594e229b.tar.bz2
* 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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-mips.c4
-rw-r--r--bfd/elflink.h31
3 files changed, 38 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d838a75..4516748 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index b7191b1..f18f1fd 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 c325c3e..f6727a6 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. */