function symbols and weak data symbols.
-2000-01-27 Thomas de Lellis <tdel@wrs.com>
+2000-01-27 Thomas de Lellis <tdel@windriver.com>
+
+ * syms.c (bfd_decode_symclass)
+ Two new class characters were added - 'V' and 'v'. The
+ meaning of 'W' is now restricted to just weak non-object
+ symbols. This allows differentiation between, for example,
+ weak functions vs weak objects. nm for example now dumps:
+ 'W' = weak global
+ 'w' = weak unresolved
+ 'V' = weak global object
+ 'v' = weak unresolved object
+
+ (bfd_is_undefined_symclass): New function. Return true if the
+ given symbol class represents and undefined/unresolved symbol.
+
+ (bfd_symbol_info): Use bfd_is_undefined_symclass to check for
+ unresolved symbols.
+ * bfd-in2.h: Add prototype for bfd_is_undefined_symbol().
+
* elf32-arm.h (elf32_arm_get_symbol_type): If a symbol has the
STT_ARM_16BIT flag set, but it is not attached to a data object
return STT_ARM_16BIT so that it will be treated as code by the
int
bfd_decode_symclass PARAMS ((asymbol *symbol));
+boolean
+bfd_is_undefined_symclass PARAMS ((int symclass));
+
void
bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
if (bfd_is_und_section (symbol->section))
{
if (symbol->flags & BSF_WEAK)
- return 'w';
+ {
+ /* If weak, determine if it's specifically an object
+ or non-object weak. */
+ if (symbol->flags & BSF_OBJECT)
+ return 'v';
+ else
+ return 'w';
+ }
else
return 'U';
}
if (bfd_is_ind_section (symbol->section))
return 'I';
if (symbol->flags & BSF_WEAK)
- return 'W';
+ {
+ /* If weak, determine if it's specifically an object
+ or non-object weak. */
+ if (symbol->flags & BSF_OBJECT)
+ return 'V';
+ else
+ return 'W';
+ }
if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL)))
return '?';
*/
}
+/*
+FUNCTION
+ bfd_is_undefined_symclass
+
+DESCRIPTION
+ Returns non-zero if the class symbol returned by
+ bfd_decode_symclass represents an undefined symbol.
+ Returns zero otherwise.
+
+SYNOPSIS
+ boolean bfd_is_undefined_symclass (int symclass);
+*/
+
+boolean
+bfd_is_undefined_symclass (symclass)
+ int symclass;
+{
+ return symclass == 'U' || symclass == 'w' || symclass == 'v';
+}
+
/*
FUNCTION
bfd_symbol_info
symbol_info *ret;
{
ret->type = bfd_decode_symclass (symbol);
- if (ret->type != 'U' && ret->type != 'w')
- ret->value = symbol->value + symbol->section->vma;
- else
+
+ if (bfd_is_undefined_symclass (ret->type))
ret->value = 0;
+ else
+ ret->value = symbol->value + symbol->section->vma;
+
ret->name = symbol->name;
}
+2000-27-01 Thomas de Lellis <tdel@windriver.com>
+
+ * nm.c (print_symbol_info_bsd): Use bfd_is_undefined_symclass to
+ check to unresolved symbols.
+ (print_symbol_info_sysv): Ditto.
+ (print_symbol_info_posix): Ditto.
+
+ * binutils.texi: Document new 'V' symclass flag for nm.
+
2000-01-27 Nick Clifton <nickc@redhat.com>
* binutils.texi (objdump): Document new ARM specific
@item U
The symbol is undefined.
+@item V
+The symbol is a weak object. When a weak defined symbol is linked with
+a normal defined symbol, the normal defined symbol is used with no error.
+When a weak undefined symbol is linked and the symbol is not defined,
+the value of the weak symbol becomes zero with no error.
+
@item W
-The symbol is weak. When a weak defined symbol is linked with a normal
-defined symbol, the normal defined symbol is used with no error. When a
-weak undefined symbol is linked and the symbol is not defined, the value
-of the weak symbol becomes zero with no error.
+The symbol is a weak symbol that has not been specifically tagged as a
+weak object symbol. When a weak defined symbol is linked with a normal
+defined symbol, the normal defined symbol is used with no error.
+When a weak undefined symbol is linked and the symbol is not defined,
+the value of the weak symbol becomes zero with no error.
@item -
The symbol is a stabs symbol in an a.out object file. In this case, the
symbol_info *info;
bfd *abfd;
{
- if (info->type == 'U' || info->type == 'w')
+ if (bfd_is_undefined_symclass (info->type))
{
printf ("%*s",
#ifdef BFD64
bfd *abfd;
{
print_symname ("%-20s|", info->name, abfd); /* Name */
- if (info->type == 'U' || info->type == 'w')
+ if (bfd_is_undefined_symclass (info->type))
printf (" "); /* Value */
else
print_value (info->value);
{
print_symname ("%s ", info->name, abfd);
printf ("%c ", info->type);
- if (info->type == 'U' || info->type == 'w')
+ if (bfd_is_undefined_symclass (info->type))
printf (" ");
else
print_value (info->value);