Based on patches from Ronald F. Guilmette <rfg@monkeys.com>:
authorIan Lance Taylor <ian@airs.com>
Mon, 29 Jan 1996 22:04:32 +0000 (22:04 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 29 Jan 1996 22:04:32 +0000 (22:04 +0000)
* 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/ChangeLog
bfd/elf.c
bfd/syms.c

index f18d32e568ef8f249c5781f659e1ac43fa5a24a0..9e5812350d1f371cb298443878333548f6d461f7 100644 (file)
@@ -7,6 +7,15 @@ Mon Jan 29 14:27:24 1996  Kim Knuttila  <krk@cygnus.com>
 
 Mon Jan 29 13:06:28 1996  Ian Lance Taylor  <ian@cygnus.com>
 
+       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.
+
        * elf32-i386.c (elf_i386_relocate_section): If -Bsymbolic, when
        copying relocs into a shared object, treat a defined global symbol
        as a local symbol.
index 95181c6f57ca0b6351cdec8b7514734ba39f1b89..be1cbc88e5774c0a0c353030f0ac7956cbc1e8ea 100644 (file)
--- 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);
          }
 
index 8024a2bc5fcfdf6163fbab95731760efe862cacd..138979c3f4bddbf89e4fa538000fd8e4ae2f3b58 100644 (file)
@@ -280,6 +280,10 @@ CODE_FRAGMENT
 .      {* Symbol is from dynamic linking information.  *}
 .#define BSF_DYNAMIC      0x8000
 .
+.       {* The symbol denotes a data object.  Used in ELF, and perhaps
+.          others someday.  *}
+.#define BSF_OBJECT       0x10000
+.
 .  flagword flags;
 .
 .      {* A pointer to the section to which this symbol is
@@ -417,7 +421,8 @@ bfd_print_symbol_vandf (arg, symbol)
     }
 
   /* This presumes that a symbol can not be both BSF_DEBUGGING and
-     BSF_DYNAMIC, nor both BSF_FUNCTION and BSF_FILE.  */
+     BSF_DYNAMIC, nor more than one of BSF_FUNCTION, BSF_FILE, and
+     BSF_OBJECT.  */
   fprintf (file, " %c%c%c%c%c%c%c",
           ((type & BSF_LOCAL)
            ? (type & BSF_GLOBAL) ? '!' : 'l'
@@ -427,7 +432,11 @@ bfd_print_symbol_vandf (arg, symbol)
           (type & BSF_WARNING) ? 'W' : ' ',
           (type & BSF_INDIRECT) ? 'I' : ' ',
           (type & BSF_DEBUGGING) ? 'd' : (type & BSF_DYNAMIC) ? 'D' : ' ',
-          (type & BSF_FUNCTION) ? 'F' : (type & BSF_FILE) ? 'f' : ' ');
+          ((type & BSF_FUNCTION)
+           ? 'F'
+           : ((type & BSF_FILE)
+              ? 'f'
+              : ((type & BSF_OBJECT) ? 'O' : ' '))));
 }
 
 
This page took 0.044809 seconds and 4 git commands to generate.