Fix an invalid free called when attempting to link a COFF object against an ELF archive with --no-keep-memory enabled.
PR 22369 * coffgen.c (_bfd_coff_free_symbols): Fail if called on a non-COFF file. * cofflink.c (coff_link_check_archive_element): Skip non-COFF members of an archive.
This commit is contained in:
parent
4070243b5c
commit
ee357486aa
@ -7,6 +7,14 @@
|
|||||||
Expand and move the non_got_ref comment.
|
Expand and move the non_got_ref comment.
|
||||||
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
|
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
|
||||||
|
|
||||||
|
2017-11-01 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR 22369
|
||||||
|
* coffgen.c (_bfd_coff_free_symbols): Fail if called on a non-COFF
|
||||||
|
file.
|
||||||
|
* cofflink.c (coff_link_check_archive_element): Skip non-COFF
|
||||||
|
members of an archive.
|
||||||
|
|
||||||
2017-10-31 Nick Clifton <nickc@redhat.com>
|
2017-10-31 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
PR 22373
|
PR 22373
|
||||||
|
@ -1659,7 +1659,6 @@ _bfd_coff_get_external_symbols (bfd *abfd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
obj_coff_external_syms (abfd) = syms;
|
obj_coff_external_syms (abfd) = syms;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1747,12 +1746,16 @@ _bfd_coff_read_string_table (bfd *abfd)
|
|||||||
bfd_boolean
|
bfd_boolean
|
||||||
_bfd_coff_free_symbols (bfd *abfd)
|
_bfd_coff_free_symbols (bfd *abfd)
|
||||||
{
|
{
|
||||||
|
if (! bfd_family_coff (abfd))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (obj_coff_external_syms (abfd) != NULL
|
if (obj_coff_external_syms (abfd) != NULL
|
||||||
&& ! obj_coff_keep_syms (abfd))
|
&& ! obj_coff_keep_syms (abfd))
|
||||||
{
|
{
|
||||||
free (obj_coff_external_syms (abfd));
|
free (obj_coff_external_syms (abfd));
|
||||||
obj_coff_external_syms (abfd) = NULL;
|
obj_coff_external_syms (abfd) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_coff_strings (abfd) != NULL
|
if (obj_coff_strings (abfd) != NULL
|
||||||
&& ! obj_coff_keep_strings (abfd))
|
&& ! obj_coff_keep_strings (abfd))
|
||||||
{
|
{
|
||||||
@ -1760,6 +1763,7 @@ _bfd_coff_free_symbols (bfd *abfd)
|
|||||||
obj_coff_strings (abfd) = NULL;
|
obj_coff_strings (abfd) = NULL;
|
||||||
obj_coff_strings_len (abfd) = 0;
|
obj_coff_strings_len (abfd) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +212,10 @@ coff_link_check_archive_element (bfd *abfd,
|
|||||||
if (h->type != bfd_link_hash_undefined)
|
if (h->type != bfd_link_hash_undefined)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* PR 22369 - Skip non COFF objects in the archive. */
|
||||||
|
if (! bfd_family_coff (abfd))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
/* Include this element? */
|
/* Include this element? */
|
||||||
if (!(*info->callbacks->add_archive_element) (info, abfd, name, &abfd))
|
if (!(*info->callbacks->add_archive_element) (info, abfd, name, &abfd))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -4661,8 +4661,13 @@ given.
|
|||||||
@itemx --all
|
@itemx --all
|
||||||
Equivalent to specifying @option{--file-header},
|
Equivalent to specifying @option{--file-header},
|
||||||
@option{--program-headers}, @option{--sections}, @option{--symbols},
|
@option{--program-headers}, @option{--sections}, @option{--symbols},
|
||||||
@option{--relocs}, @option{--dynamic}, @option{--notes} and
|
@option{--relocs}, @option{--dynamic}, @option{--notes},
|
||||||
@option{--version-info}.
|
@option{--version-info}, @option{--arch-specific}, @option{--unwind},
|
||||||
|
@option{--section-groups} and @option{--histogram}.
|
||||||
|
|
||||||
|
Note - this option does not enable @option{--use-dynamic} itself, so
|
||||||
|
if that option is not present on the command line then dynamic symbols
|
||||||
|
and dynamic relocs will not be displayed.
|
||||||
|
|
||||||
@item -h
|
@item -h
|
||||||
@itemx --file-header
|
@itemx --file-header
|
||||||
@ -4758,6 +4763,9 @@ When displaying symbols, this option makes @command{readelf} use the
|
|||||||
symbol hash tables in the file's dynamic section, rather than the
|
symbol hash tables in the file's dynamic section, rather than the
|
||||||
symbol table sections.
|
symbol table sections.
|
||||||
|
|
||||||
|
When displaying relocations, this option makes @command{readelf}
|
||||||
|
display the dynamic relocations rather than the static relocations.
|
||||||
|
|
||||||
@item -x <number or name>
|
@item -x <number or name>
|
||||||
@itemx --hex-dump=<number or name>
|
@itemx --hex-dump=<number or name>
|
||||||
Displays the contents of the indicated section as a hexadecimal bytes.
|
Displays the contents of the indicated section as a hexadecimal bytes.
|
||||||
|
Loading…
Reference in New Issue
Block a user