binutils-gdb/ld/emultempl
Alan Modra 7b958a48e1 PR25993, read of freed memory
ldmain.c:add_archive_element copies file name pointers from the bfd to
a lang_input_statement_type.
  input->filename = abfd->filename;
  input->local_sym_name = abfd->filename;
This results in stale pointers when twiddling the bfd filename in
places like the pe ld after_open.  So don't free the bfd filename,
and make copies using bfd_alloc memory that won't result in small
memory leaks that annoy memory checkers.

	PR 25993
bfd/
	* archive.c (_bfd_get_elt_at_filepos): Don't strdup filename,
	use bfd_set_filename.
	* elfcode.h (_bfd_elf_bfd_from_remote_memory): Likewise.
	* mach-o.c (bfd_mach_o_fat_member_init): Likewise.
	* opncls.c (bfd_fopen, bfd_openstreamr, bfd_openr_iovec, bfd_openw),
	(bfd_create): Likewise.
	(_bfd_delete_bfd): Don't free filename.
	(bfd_set_filename): Copy filename param to bfd_alloc'd memory,
	return pointer to the copy or NULL on alloc fail.
	* vms-lib.c (_bfd_vms_lib_get_module): Free newname and test
	result of bfd_set_filename.
	* bfd-in2.h: Regenerate.
gdb/
	* solib-darwin.c (darwin_bfd_open): Don't strdup pathname for
	bfd_set_filename.
	* solib-aix.c (solib_aix_bfd_open): Use std::string for name
	passed to bfd_set_filename.
	* symfile-mem.c (add_vsyscall_page): Likewise for string
	passed to symbol_file_add_from_memory.
	(symbol_file_add_from_memory): Make name param a const char* and
	don't strdup.
ld/
	* emultempl/pe.em (gld_${EMULATION_NAME}_after_open): Don't copy
	other_bfd_filename for bfd_set_filename, and test result of
	bfd_set_filename call.  Don't create a new is->filename, simply
	copy from bfd filename.  Free new_name after bfd_set_filename.
	* emultempl/pep.em (gld_${EMULATION_NAME}_after_open): Likewise.
2020-05-20 11:43:50 +09:30
..
aarch64elf.em
aix.em Show AIX gc'd symbol address adjustments in map file 2020-05-18 22:41:32 +09:30
alphaelf.em
arclinux.em
armcoff.em Show AIX gc'd symbol address adjustments in map file 2020-05-18 22:41:32 +09:30
armelf.em
astring.sed
avrelf.em
beos.em Use bfd_get_filename throughout ld 2020-05-19 12:57:15 +09:30
bfin.em
cr16elf.em
crxelf.em
cskyelf.em
elf-generic.em
elf-x86.em
elf.em Show AIX gc'd symbol address adjustments in map file 2020-05-18 22:41:32 +09:30
epiphanyelf_4x4.em
genelf.em
generic.em Show AIX gc'd symbol address adjustments in map file 2020-05-18 22:41:32 +09:30
hppaelf.em
ia64elf.em
irix.em
linux.em Show AIX gc'd symbol address adjustments in map file 2020-05-18 22:41:32 +09:30
m68hc1xelf.em
m68kelf.em
metagelf.em
mipself.em
mmix-elfnmmo.em
mmixelf.em
mmo.em
msp430.em Show AIX gc'd symbol address adjustments in map file 2020-05-18 22:41:32 +09:30
nds32elf.em
needrelax.em
netbsd.em
nios2elf.em
ostring.sed
pdp11.em Fixes for the magic number used in PDP11 AOUT binaries. 2020-04-14 14:41:27 +01:00
pe.em PR25993, read of freed memory 2020-05-20 11:43:50 +09:30
pep.em PR25993, read of freed memory 2020-05-20 11:43:50 +09:30
ppc32elf.em
ppc64elf.em
pruelf.em
README
riscvelf.em
rxelf.em
rxlinux.em ld: Add rx-linux emulation. gas: Change ELF flags initial value in rx-linux 2020-04-30 13:35:37 +01:00
s390.em
scoreelf.em
solaris2-x86.em
solaris2.em
spu_icache.o_c
spu_icache.S
spu_ovl.o_c
spu_ovl.S
spuelf.em Use bfd_get_filename throughout ld 2020-05-19 12:57:15 +09:30
tic6xdsbt.em
ticoff.em Show AIX gc'd symbol address adjustments in map file 2020-05-18 22:41:32 +09:30
v850elf.em
vanilla.em Show AIX gc'd symbol address adjustments in map file 2020-05-18 22:41:32 +09:30
vms.em
vxworks.em
xtensaelf.em Non-contiguous memory regions support: Avoid calls to abort 2020-03-18 10:09:43 +00:00
z80.em

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

The files in this directory are sourced by genscripts.sh, after
setting some variables to substitute in, to produce
C source files that contain jump tables for each emulation.

Copyright (C) 2012-2020 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.