From: diz rael <dizraelus@yahoo.com>
To: binutils@sourceware.org
Subject: reading elf file (avr target)
Date: Tue, 11 Apr 2006 16:37:00 -0000 [thread overview]
Message-ID: <20060411144330.54523.qmail@web52705.mail.yahoo.com> (raw)
I'm trying to get the symbol table out of an object
file. I built libbfd from binutils 2.16.1 (tried 2.15
as well) using --enable-target=avr
--enable-install-libbfd, etc. For some reason it does
not read the sym table correctly and the number of
syms seems wrong (ridiculously large). Dereferencing
any element of the symtab raises a seg. fault. Any
ideas as to why this is happening? The weird thing is
that this code used to work for me before a year ago!
- had an earlier version of the toolchain then.
main program:
vmobj = load_obj(obj_name);
...
nvmsym = get_stab(vmobj, &vmstab);
-------------
bfd *load_obj(char *f)
{
bfd *file;
file = bfd_openr(f, "binary");
if (!file || bfd_check_format(file, bfd_object) ==
0 || bfd_get_file_flags(file) & HAS_SYMS == 0)
return NULL;
return file;
}
int get_stab(bfd *file, asymbol ***stab)
{
long storage;
int nsym;
storage = bfd_get_symtab_upper_bound(file);
if (storage < 0)
return UNKNOWN_SYMTAB_SIZE;
*stab = (asymbol **) malloc(storage *
sizeof(**stab));
nsym = bfd_canonicalize_symtab(file, *stab); //
MESSES UP HERE. nsym IS HUGE AND *STAB ENTRIES ARE
INVALID
return nsym;
}
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
next reply other threads:[~2006-04-11 14:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-11 16:37 diz rael [this message]
2006-04-25 17:31 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060411144330.54523.qmail@web52705.mail.yahoo.com \
--to=dizraelus@yahoo.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).