This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/5] remove deleted BFDs from the archive cache


On Thu, Aug 16, 2012 at 10:28 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 16, 2012 at 10:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Thu, Aug 16, 2012 at 8:53 PM, Hans-Peter Nilsson
>> <hans-peter.nilsson@axis.com> wrote:
>>> (Just replying to the last message in the thread)
>>>
>>>> xcalloc shouldn't be called from within bfd.  I've already committed a
>>>> kneejerk patch to revert Tom's last change, instead using bfd_zmalloc
>>>> here.  Tom said he'd look into fixing the leak this causes, so I'm
>>>> happy to leave that to him.  :)
>>>
>>> The last I see is (2012-08-17-02:39:34 UTC)
>>>
>>> bfd:
>>> 2012-08-17  Yuri Chornoivan  <yurchor@ukr.net>
>>>
>>>         * elf-bfd.h, * elf32-ppc.c, * elf64-ia64-vms.c, * elfnn-ia64.c,
>>>         * elfxx-mips.c, * vms-alpha.c: Typo fixes.
>>>
>>> 2012-08-17  Alan Modra  <amodra@gmail.com>
>>>
>>>         PR binutils/14475:
>>>         * archive.c (bfd_ar_hdr_from_filesystem): Revert last change.
>>>         Instead malloc areltdata.
>>>
>>> binutils:
>>> 2012-08-17  Yuri Chornoivan  <yurchor@ukr.net>
>>>
>>>         * doc/binutils.texi, * objdump.c, * od-xcoff.c: Typo fixes.
>>>
>>> 2012-08-16  H.J. Lu  <hongjiu.lu@intel.com>
>>>
>>>         PR binutils/14481
>>>         * Makefile.am (BFDTEST1_PROG): New.
>>>         (TEST_PROGS): Likewise.
>>>         (bfdtest1_DEPENDENCIES): Likewise.
>>>         (noinst_PROGRAMS): Add $(TEST_PROGS).
>>>         * Makefile.in: Regenerated.
>>>
>>>         * bfdtest1.c: New file.
>>>
>>> With this I still see FAILS for cris-elf and cris-linux-gnu (but
>>> not for arm-unknown-eabi, mipsisa32r2el-unknown-linux-gnu,
>>> mmix-knuth-mmixware):
>
> This should be a clue.
>
>>> Running /tmp/hpautotest-binutils/bsrc/src/binutils/testsuite/binutils-all/ar.exp ...
>>> FAIL: ar long file names (bfdtest1)
>>> FAIL: ar thin archive (bfdtest1)
>
> This fixes it.
>
>
> --
> H.J.
> ---
> diff --git a/bfd/aoutx.h b/bfd/aoutx.h
> index 1e0ad38..8e3f476 100644
> --- a/bfd/aoutx.h
> +++ b/bfd/aoutx.h
> @@ -2846,26 +2846,26 @@ NAME (aout, bfd_free_cached_info) (bfd *abfd)
>  {
>    asection *o;
>
> -  if (bfd_get_format (abfd) != bfd_object
> -      || abfd->tdata.aout_data == NULL)
> -    return TRUE;
> -
> +  if (bfd_get_format (abfd) == bfd_object
> +      && abfd->tdata.aout_data != NULL)
> +    {
>  #define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; }
> -  BFCI_FREE (obj_aout_symbols (abfd));
> +      BFCI_FREE (obj_aout_symbols (abfd));
>  #ifdef USE_MMAP
> -  obj_aout_external_syms (abfd) = 0;
> -  bfd_free_window (&obj_aout_sym_window (abfd));
> -  bfd_free_window (&obj_aout_string_window (abfd));
> -  obj_aout_external_strings (abfd) = 0;
> +      obj_aout_external_syms (abfd) = 0;
> +      bfd_free_window (&obj_aout_sym_window (abfd));
> +      bfd_free_window (&obj_aout_string_window (abfd));
> +      obj_aout_external_strings (abfd) = 0;
>  #else
> -  BFCI_FREE (obj_aout_external_syms (abfd));
> -  BFCI_FREE (obj_aout_external_strings (abfd));
> +      BFCI_FREE (obj_aout_external_syms (abfd));
> +      BFCI_FREE (obj_aout_external_strings (abfd));
>  #endif
> -  for (o = abfd->sections; o != NULL; o = o->next)
> -    BFCI_FREE (o->relocation);
> +      for (o = abfd->sections; o != NULL; o = o->next)
> +       BFCI_FREE (o->relocation);
>  #undef BFCI_FREE
> +    }
>
> -  return TRUE;
> +  return _bfd_generic_close_and_cleanup (abfd);
>  }
>
>
>  /* a.out link code.  */

Patch is wrong.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]