https://sourceware.org/bugzilla/show_bug.cgi?id=23938

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot 
gnu.org> ---
The master branch has been updated by Alan Modra <amo...@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0acc7632bb09cce832a1b3756d31cc3fa93a724a

commit 0acc7632bb09cce832a1b3756d31cc3fa93a724a
Author: Alan Modra <amo...@gmail.com>
Date:   Sat Dec 1 09:37:48 2018 +1030

    PR23938, should not free memory alloced in obstack by free()

    This removes ineffectual and wrong code caching section names in
    gas/stabs.c.  Code like

      seg = subseg_new (name, 0);
      ...
      if (seg->name == name)
        seg->name = xstrdup (name);

    with the idea of being able to unconditionally free "name" later no
    longer works.  "name" is referenced by the section hash table as well
    as in the section->name field.  It would be possible to use
    "bfd_rename_section (stdoutput, seg, xstrdup (name))", but instead I
    opted for a fairly straight-forward approach of adding extra
    parameters to two functions to indicate section name strings should be
    freed if possible.

        PR 23938
        * read.h (get_stab_string_offset): Update prototype.
        * stabs.c (get_stab_string_offset): Add free_stabstr_secname
        parameter.  Free stabstr_secname if unused as section name.
        Don't xstrdup name when used.
        (s_stab_generic): Remove forward declaration.  Add
        stab_secname_obstack_end param.  Reference notes obstack via
        macros.  Delete cached_secname.  Adjust get_stab_string_offset
        call.  Free stab_secname if unused as section name.
        (s_stab): Adjust s_stab_generic call.
        (s_xstab): Likewise.  Delete saved_secname and saved_strsecname.
        * config/obj-elf.c (obj_elf_init_stab_section): Adjust
        get_stab_string_offset call.
        * config/obj-coff.c (obj_coff_init_stab_section): Likewise.
        * config/obj-som.c (obj_som_init_stab_section): Likewise.
        * testsuite/gas/all/pr23938.s: New test.
        * testsuite/gas/all/gas.exp: Run it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to