From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6277 invoked by alias); 1 Apr 2005 02:36:23 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 6249 invoked from network); 1 Apr 2005 02:36:20 -0000 Received: from unknown (HELO gizmo05bw.bigpond.com) (144.140.70.40) by sourceware.org with SMTP; 1 Apr 2005 02:36:20 -0000 Received: (qmail 15030 invoked from network); 1 Apr 2005 02:36:18 -0000 Received: from unknown (HELO bwmam12.bigpond.com) (144.135.24.103) by gizmo05bw.bigpond.com with SMTP; 1 Apr 2005 02:36:18 -0000 Received: from cpe-144-136-221-26.sa.bigpond.net.au ([144.136.221.26]) by bwmam12.bigpond.com(MAM REL_3_4_2a 189/44716489) with SMTP id 44716489; Fri, 01 Apr 2005 12:36:18 +1000 Received: by bubble.modra.org (Postfix, from userid 500) id 18DC81A0966; Fri, 1 Apr 2005 12:06:18 +0930 Date: Fri, 01 Apr 2005 02:36:00 -0000 From: Alan Modra To: binutils@sources.redhat.com Subject: tidy ppc64_elf_get_synthetic_symtab return value Message-ID: <20050401023618.GC27909@bubble.modra.org> Mail-Followup-To: binutils@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2005-04/txt/msg00006.txt.bz2 Allows callers to distinguish an error return from the no symbols case. * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Return -1 on errors rather than 0. Applying mainline and branch. Index: bfd/elf64-ppc.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-ppc.c,v retrieving revision 1.194 diff -u -p -r1.194 elf64-ppc.c --- bfd/elf64-ppc.c 5 Mar 2005 11:44:14 -0000 1.194 +++ bfd/elf64-ppc.c 1 Apr 2005 02:00:21 -0000 @@ -2687,7 +2687,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abf syms = bfd_malloc ((symcount + 1) * sizeof (*syms)); if (syms == NULL) - return 0; + return -1; if (!relocatable && static_count != 0 && dyn_count != 0) { @@ -2758,11 +2758,15 @@ ppc64_elf_get_synthetic_symtab (bfd *abf slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table; relcount = (opd->flags & SEC_RELOC) ? opd->reloc_count : 0; - - if (! relcount - || ! (*slurp_relocs) (abfd, opd, static_syms, FALSE)) + if (relcount == 0) goto done; + if (!(*slurp_relocs) (abfd, opd, static_syms, FALSE)) + { + count = -1; + goto done; + } + size = 0; for (i = secsymend, r = opd->relocation; i < opdsymend; ++i) { @@ -2794,7 +2798,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abf s = *ret = bfd_malloc (size); if (s == NULL) { - count = 0; + count = -1; goto done; } @@ -2847,6 +2851,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abf free_contents_and_exit: free (contents); } + count = -1; goto done; } @@ -2866,10 +2871,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abf s = *ret = bfd_malloc (size); if (s == NULL) - { - count = 0; - goto free_contents_and_exit; - } + goto free_contents_and_exit; names = (char *) (s + count); -- Alan Modra IBM OzLabs - Linux Technology Centre