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.
This commit is contained in:
Ian Lance Taylor 1996-01-29 22:04:32 +00:00
parent 53787b2316
commit 052b35d2e7
3 changed files with 30 additions and 10 deletions

View 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.

View File

@ -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);
}

View 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' : ' '))));
}