aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2002-06-07 11:02:48 +0000
committerNick Clifton <nickc@redhat.com>2002-06-07 11:02:48 +0000
commit6ab6b380eecb3092915f38564d300bc282d5f979 (patch)
tree0471b19b36bb307ba5e6ffefc509c2723501ceae /binutils
parent1634475f71a906cfbf0d1b182319869b42c16300 (diff)
downloadgdb-6ab6b380eecb3092915f38564d300bc282d5f979.zip
gdb-6ab6b380eecb3092915f38564d300bc282d5f979.tar.gz
gdb-6ab6b380eecb3092915f38564d300bc282d5f979.tar.bz2
When computing size of symbols for an ELF target use the internal size field.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/nm.c15
2 files changed, 14 insertions, 6 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index acf7d73..db06f91 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2002-06-07 Elias Athanasopoulos <eathan@otenet.gr>
+
+ * nm.c: When computing size of symbols for an ELF target use the
+ internal size field.
+
2002-06-06 John David Anglin <dave@hiauly1.hia.nrc.ca>
* testsuite/binutils-all/objcopy.exp: clear xfail for
diff --git a/binutils/nm.c b/binutils/nm.c
index f7e3cd1..e260a83 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -1,6 +1,6 @@
/* nm.c -- Describe symbol table of a rel file.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001
+ 2001, 2002
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -28,6 +28,7 @@
#include "aout/ranlib.h"
#include "demangle.h"
#include "libiberty.h"
+#include "elf-bfd.h"
/* When sorting by size, we use this structure to hold the size and a
pointer to the minisymbol. */
@@ -839,10 +840,10 @@ size_forward2 (P_x, P_y)
return sorters[0][reverse_sort] (x->minisym, y->minisym);
}
-/* Sort the symbols by size. We guess the size by assuming that the
- difference between the address of a symbol and the address of the
- next higher symbol is the size. FIXME: ELF actually stores a size
- with each symbol. We should use it. */
+/* Sort the symbols by size. ELF provides a size but for other formats
+ we have to make a guess by assuming that the difference between the
+ address of a symbol and the address of the next higher symbol is the
+ size. */
static long
sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
@@ -904,7 +905,9 @@ sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
sec = bfd_get_section (sym);
- if (bfd_is_com_section (sec))
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ sz = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
+ else if (bfd_is_com_section (sec))
sz = sym->value;
else
{