diff options
author | Tristan Gingold <gingold@adacore.com> | 2011-08-03 08:12:07 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2011-08-03 08:12:07 +0000 |
commit | 092d27ff4797e721d10b5de0394a2725ff8a966e (patch) | |
tree | d120294c57db180f924399044b9164b79692dca0 /bfd/mach-o.c | |
parent | 6a1214e843b475aca1b38d4930f775eea7d9d372 (diff) | |
download | gdb-092d27ff4797e721d10b5de0394a2725ff8a966e.zip gdb-092d27ff4797e721d10b5de0394a2725ff8a966e.tar.gz gdb-092d27ff4797e721d10b5de0394a2725ff8a966e.tar.bz2 |
2011-08-03 Tristan Gingold <gingold@adacore.com>
* mach-o.c (bfd_mach_o_canonicalize_symtab): Handle no symbols case.
(bfd_mach_o_read_symtab_symbols): Return if no symbols.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r-- | bfd/mach-o.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c index fe196c7..069414a 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -376,6 +376,13 @@ bfd_mach_o_canonicalize_symtab (bfd *abfd, asymbol **alocation) if (nsyms < 0) return nsyms; + if (nsyms == 0) + { + /* Do not try to read symbols if there are none. */ + alocation[0] = NULL; + return 0; + } + if (bfd_mach_o_read_symtab_symbols (abfd) != 0) { (*_bfd_error_handler) (_("bfd_mach_o_canonicalize_symtab: unable to load symbols")); @@ -1830,8 +1837,11 @@ bfd_mach_o_read_symtab_symbols (bfd *abfd) unsigned long i; int ret; - if (sym->symbols) - return 0; + if (sym == NULL || sym->symbols) + { + /* Return now if there are no symbols or if already loaded. */ + return 0; + } sym->symbols = bfd_alloc (abfd, sym->nsyms * sizeof (bfd_mach_o_asymbol)); |