From: H.J. Lu Date: Tue, 29 Aug 2017 18:28:10 +0000 (-0700) Subject: x86: Simplify bad return in get_synthetic_symtab X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=823cb06774ad6a2aee0afcf6f011c3a134f25747;p=binutils-gdb.git x86: Simplify bad return in get_synthetic_symtab * elf32-i386.c (elf_i386_get_synthetic_symtab): Simplify bad return. * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 21b01b7f398..71b96dddbd2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2017-08-29 H.J. Lu + + * elf32-i386.c (elf_i386_get_synthetic_symtab): Simplify bad + return. + * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise. + 2017-08-29 H.J. Lu * elf32-i386.c (elf_i386_get_synthetic_symtab): Check valid PLT diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 31ef02a568e..2826272e064 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -6504,14 +6504,7 @@ elf_i386_get_synthetic_symtab (bfd *abfd, s = *ret = (asymbol *) bfd_zmalloc (size); if (s == NULL) - { -bad_return: - for (j = 0; plts[j].name != NULL; j++) - if (plts[j].contents != NULL) - free (plts[j].contents); - free (dynrelbuf); - return -1; - } + goto bad_return; if (got_addr) { @@ -6639,9 +6632,12 @@ bad_return: /* PLT entries with R_386_TLS_DESC relocations are skipped. */ if (n == 0) - goto bad_return; - - count = n; + { +bad_return: + count = -1; + } + else + count = n; for (j = 0; plts[j].name != NULL; j++) if (plts[j].contents != NULL) diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index ba7c5953c3c..847a1828024 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -6896,14 +6896,7 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd, s = *ret = (asymbol *) bfd_zmalloc (size); if (s == NULL) - { -bad_return: - for (j = 0; plts[j].name != NULL; j++) - if (plts[j].contents != NULL) - free (plts[j].contents); - free (dynrelbuf); - return -1; - } + goto bad_return; /* Check for each PLT section. */ names = (char *) (s + count); @@ -7014,9 +7007,12 @@ bad_return: /* PLT entries with R_X86_64_TLSDESC relocations are skipped. */ if (n == 0) - goto bad_return; - - count = n; + { +bad_return: + count = -1; + } + else + count = n; for (j = 0; plts[j].name != NULL; j++) if (plts[j].contents != NULL)