From 052b35d2e72af7da1fadbc2a4afa416195435b63 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 29 Jan 1996 22:04:32 +0000 Subject: Based on patches from Ronald F. Guilmette : * 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. --- bfd/elf.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'bfd/elf.c') 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); } -- cgit v1.1