aboutsummaryrefslogtreecommitdiff
path: root/bfd/syms.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-01-28 01:06:37 +0000
committerNick Clifton <nickc@redhat.com>2000-01-28 01:06:37 +0000
commitfad6fcbb0080ab85b3c911b5b8b59852b7a5bfc7 (patch)
tree7e6819127cafce8caa11e89b464ec24d20a5a894 /bfd/syms.c
parent58efb6c0fdeb4fa7ed1aace3bd1fa5068e5fcc9a (diff)
downloadgdb-fad6fcbb0080ab85b3c911b5b8b59852b7a5bfc7.zip
gdb-fad6fcbb0080ab85b3c911b5b8b59852b7a5bfc7.tar.gz
gdb-fad6fcbb0080ab85b3c911b5b8b59852b7a5bfc7.tar.bz2
Apply patch from Thomas de Lellis to allow nm to distinguish between weak
function symbols and weak data symbols.
Diffstat (limited to 'bfd/syms.c')
-rw-r--r--bfd/syms.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/bfd/syms.c b/bfd/syms.c
index 676f067..6546f58 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -584,14 +584,28 @@ bfd_decode_symclass (symbol)
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 '?';
@@ -617,6 +631,26 @@ bfd_decode_symclass (symbol)
/*
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
DESCRIPTION
@@ -634,10 +668,12 @@ bfd_symbol_info (symbol, ret)
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;
}