From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sources.redhat.com
Subject: tidy ppc64_elf_get_synthetic_symtab return value
Date: Fri, 01 Apr 2005 02:36:00 -0000 [thread overview]
Message-ID: <20050401023618.GC27909@bubble.modra.org> (raw)
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
reply other threads:[~2005-04-01 2:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20050401023618.GC27909@bubble.modra.org \
--to=amodra@bigpond.net.au \
--cc=binutils@sources.redhat.com \
/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).