From fad6fcbb0080ab85b3c911b5b8b59852b7a5bfc7 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 28 Jan 2000 01:06:37 +0000 Subject: Apply patch from Thomas de Lellis to allow nm to distinguish between weak function symbols and weak data symbols. --- bfd/syms.c | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'bfd/syms.c') 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; } -- cgit v1.1