Re: [regressions in GCC/libjava testsuite] Re: Patch to make bfd compile with -Wc++-compat

Alan Modra <[email protected]>
Newsgroups gmane.comp.gnu.binutils,gmane.comp.gcc.java.devel
Message-ID <[email protected]>
This is what I'll commit when my testsuite runs complete.

	* addr2line.c (slurp_symtab): Don't use bfd_read_minisymbols.

Index: binutils/addr2line.c
===================================================================
RCS file: /cvs/src/src/binutils/addr2line.c,v
retrieving revision 1.34
diff -u -p -r1.34 addr2line.c
--- binutils/addr2line.c	10 Sep 2009 13:40:44 -0000	1.34
+++ binutils/addr2line.c	1 Oct 2009 05:28:04 -0000
@@ -100,17 +100,27 @@ usage (FILE *stream, int status)
 static void
 slurp_symtab (bfd *abfd)
 {
+  long storage;
   long symcount;
-  unsigned int size;
-  void *minisyms = &syms;
+  bfd_boolean dynamic = FALSE;
 
   if ((bfd_get_file_flags (abfd) & HAS_SYMS) == 0)
     return;
 
-  symcount = bfd_read_minisymbols (abfd, FALSE, &minisyms, &size);
-  if (symcount == 0)
-    symcount = bfd_read_minisymbols (abfd, TRUE /* dynamic */, &minisyms, &size);
+  storage = bfd_get_symtab_upper_bound (abfd);
+  if (storage == 0)
+    {
+      storage = bfd_get_dynamic_symtab_upper_bound (abfd);
+      dynamic = TRUE;
+    }
+  if (storage < 0)
+    bfd_fatal (bfd_get_filename (abfd));
 
+  syms = (asymbol **) xmalloc (storage);
+  if (dynamic)
+    symcount = bfd_canonicalize_dynamic_symtab (abfd, syms);
+  else
+    symcount = bfd_canonicalize_symtab (abfd, syms);
   if (symcount < 0)
     bfd_fatal (bfd_get_filename (abfd));
 }

-- 
Alan Modra
Australia Development Lab, IBM
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.