aboutsummaryrefslogtreecommitdiff
path: root/gdb/elfread.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-02-14 01:22:12 +0000
committerFred Fish <fnf@specifix.com>1992-02-14 01:22:12 +0000
commitd35bf52d93df6e4f02525129ba2f115495b29f9e (patch)
treee8523ea1d7ae4146395aa9bed5a155c02fffd4e4 /gdb/elfread.c
parent0c5e345c0ffa3c3c0cf315f9edf539034e840995 (diff)
downloadgdb-d35bf52d93df6e4f02525129ba2f115495b29f9e.zip
gdb-d35bf52d93df6e4f02525129ba2f115495b29f9e.tar.gz
gdb-d35bf52d93df6e4f02525129ba2f115495b29f9e.tar.bz2
Fix code in elf_symtab_read which attempts to read the standard ELF
symbol table and add symbol information to the misc function vector. This allows minimum functionality with non -g compiled code, and is vital for use with shared libraries (non of which are currently compiled with -g). Note to anyone doing any SVR4/gdb work. This bug was introduced into gdb just prior to the gdb 4.4 release, thus any versions currently in the field will have broken shared library support since no symbol information at all will be available for the shared library. This fix, along with one about to go into bfd's elf.c should fix that problem.
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r--gdb/elfread.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 8cabd2f..a24f4c2 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -195,25 +195,28 @@ DEFUN (elf_symtab_read, (abfd, addr, mainline),
for (i = 0; i < number_of_symbols; i++)
{
sym = *symbol_table++;
- /* Select global symbols that are defined in a specific section
- or are absolute. */
- if (sym -> flags & BSF_GLOBAL
- && (sym -> section == &bfd_abs_section))
+ /* Select global/weak symbols that are defined in a specific section.
+ Note that bfd now puts abs symbols in their own section, so
+ all symbols we are interested in will have a section. */
+ if ((sym -> flags & (BSF_GLOBAL | BSF_WEAK))
+ && (sym -> section != NULL))
{
symaddr = sym -> value;
- if (!mainline)
+ /* Relocate all non-absolute symbols by base address.
+ FIXME: Can we eliminate the check for mainline now,
+ since shouldn't addr be 0 in this case? */
+ if (!mainline && (sym -> section != &bfd_abs_section))
{
- /* Relocate all symbols by base address */
symaddr += addr;
}
/* For non-absolute symbols, use the type of the section
they are relative to, to intuit text/data. Bfd provides
no way of figuring this out for absolute symbols. */
- if (sym -> section && (sym -> section -> flags & SEC_CODE))
+ if (sym -> section -> flags & SEC_CODE)
{
mf_type = mf_text;
}
- else if (sym -> section && (sym -> section -> flags & SEC_DATA))
+ else if (sym -> section -> flags & SEC_DATA)
{
mf_type = mf_data;
}