aboutsummaryrefslogtreecommitdiff
path: root/bfd
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
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')
-rw-r--r--bfd/ChangeLog20
-rw-r--r--bfd/bfd-in2.h3
-rw-r--r--bfd/syms.c46
3 files changed, 63 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9d7c9f6..c2e7498 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,23 @@
-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
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index a9b981c..9db6ec6 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2433,6 +2433,9 @@ bfd_print_symbol_vandf PARAMS ((PTR file, asymbol *symbol));
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));
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;
}