aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-01-29 22:04:32 +0000
committerIan Lance Taylor <ian@airs.com>1996-01-29 22:04:32 +0000
commit052b35d2e72af7da1fadbc2a4afa416195435b63 (patch)
tree121adc68419ea0495ba783ca318950791a1bdf79 /bfd/elf.c
parent53787b2316b0e9b4f166efc87f88748c46263096 (diff)
downloadgdb-052b35d2e72af7da1fadbc2a4afa416195435b63.zip
gdb-052b35d2e72af7da1fadbc2a4afa416195435b63.tar.gz
gdb-052b35d2e72af7da1fadbc2a4afa416195435b63.tar.bz2
Based on patches from Ronald F. Guilmette <rfg@monkeys.com>:
* syms.c (BSF_OBJECT): Define. (bfd_print_symbol_vandf): Print 'O' for BSF_OBJECT. * bfd-in2.h: Rebuild. * elfcode.h (elf_slurp_symbol_table): Set BSF_OBJECT for an STT_OBJECT symbol. * elf.c (swap_out_syms): Only set type to STT_OBJECT if BSF_OBJECT is set.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 95181c6..be1cbc8 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2837,6 +2837,7 @@ swap_out_syms (abfd, sttp)
bfd_vma value = syms[idx]->value;
elf_symbol_type *type_ptr;
flagword flags = syms[idx]->flags;
+ int type;
if (flags & BSF_SECTION_SYM)
/* Section symbols have no names. */
@@ -2931,15 +2932,20 @@ swap_out_syms (abfd, sttp)
sym.st_shndx = shndx;
}
+ if ((flags & BSF_FUNCTION) != 0)
+ type = STT_FUNC;
+ else if ((flags & BSF_OBJECT) != 0)
+ type = STT_OBJECT;
+ else
+ type = STT_NOTYPE;
+
if (bfd_is_com_section (syms[idx]->section))
- sym.st_info = ELF_ST_INFO (STB_GLOBAL, STT_OBJECT);
+ sym.st_info = ELF_ST_INFO (STB_GLOBAL, type);
else if (bfd_is_und_section (syms[idx]->section))
sym.st_info = ELF_ST_INFO (((flags & BSF_WEAK)
? STB_WEAK
: STB_GLOBAL),
- ((flags & BSF_FUNCTION)
- ? STT_FUNC
- : STT_NOTYPE));
+ type);
else if (flags & BSF_SECTION_SYM)
sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
else if (flags & BSF_FILE)
@@ -2947,7 +2953,6 @@ swap_out_syms (abfd, sttp)
else
{
int bind = STB_LOCAL;
- int type = STT_OBJECT;
if (flags & BSF_LOCAL)
bind = STB_LOCAL;
@@ -2956,9 +2961,6 @@ swap_out_syms (abfd, sttp)
else if (flags & BSF_GLOBAL)
bind = STB_GLOBAL;
- if (flags & BSF_FUNCTION)
- type = STT_FUNC;
-
sym.st_info = ELF_ST_INFO (bind, type);
}