aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/elf.c18
-rw-r--r--bfd/syms.c13
3 files changed, 30 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f18d32e..9e58123 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
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);
}
diff --git a/bfd/syms.c b/bfd/syms.c
index 8024a2b..138979c 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -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' : ' '))));
}