Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
When --no-keep-memory is used, the symbol buffer and the relocation
buffer aren't cached. When packing relative relocations, we may
allocate a new symbol buffer and a new relocation buffer for each
eligible section in an object file. If there are many sections,
memory may be exhausted. In this case, we should free the symbol
buffer and the relocation buffer after use. If symbol buffer entries
are used to track relative relocations against local symbols for later
use, the symbol buffer should be cached.
PR ld/30566
* elfxx-x86.c (elf_x86_relative_reloc_record_add): Add an
argument to inform caller if the symbol buffer should be kept.
(_bfd_x86_elf_link_relax_section): Call
_bfd_elf_link_info_read_relocs instead of
_bfd_elf_link_read_relocs. Free the symbol buffer and the
relocation buffer after use. Cache the symbol buffer if it
is used.
|
|
ARM get_synthetic_symtab reads .plt and caches that data. Caching the
data doesn't make a lot of sense since get_synthetic_symtab is only
called once per bfd, and the memory might be put to better use. It
also leaks on closing the bfd.
* elf32-arm.c (elf32_arm_get_synthetic_symtab): Don't cache
plt contents. Free plt data before returning.
|
|
* mach-o.c (bfd_mach_o_write_symtab_content): Free strtab on
success path.
|
|
|
|
A symbol defined in a section from a shared library will have a NULL
section->output_section during linking.
* elf32-mips.c (gprel32_with_gp): Don't segfault on NULL
symbol->section->output_section.
* elf64-mips.c (mips_elf64_gprel32_reloc): Likewise.
* elfn32-mips.c (mips_elf_gprel16_reloc): Likewise.
(mips_elf_literal_reloc, mips_elf_gprel32_reloc): Likewise.
(gprel32_with_gp, mips16_gprel_reloc): Likewise.
* elfxx-mips.c (_bfd_mips_elf_gprel16_with_gp): Likewise.
(_bfd_mips_elf_generic_reloc): Likewise.
|
|
|
|
PR 30560
* elf64-x86-64.c (elf_x86_64_relocate_section): Add more checks for a valid relocation offset.
|
|
|
|
|
|
|
|
Because _bfd_read_unsigned_leb128 is hidden visibility, so it can't
be referenced out of shared object.
The new function loongarch_get_uleb128_length just used to call
_bfd_read_unsigned_leb128.
bfd/ChangeLog:
* elfxx-loongarch.c (loongarch_get_uleb128_length): New function.
* elfxx-loongarch.h (loongarch_get_uleb128_length): New function.
gas/ChangeLog:
* config/tc-loongarch.c (md_apply_fix): Use
loongarch_get_uleb128_length.
|
|
|
|
The Allegrex CPU was created by Sony Interactive Entertainment to power
their portable console, the PlayStation Portable.
The pspdev organization maintains all sorts of tools to create software
for said device including documentation.
Signed-off-by: David Guillen Fandos <david@davidgf.net>
|
|
This reverts commit be0d391f22fe6009c3be907753975a984cbbcc23. It was
applied unapproved.
|
|
This fixes two memory leaks in the vms archive handling.
* vms-lib.c (_bfd_vms_lib_build_map): Free input symbols.
(_bfd_vms_lib_write_archive_contents): Free archive map symbols.
|
|
|
|
A number of backends want to return bfd_reloc_dangerous messaqes from
relocation special_function, and construct the message using asprintf.
Such messages are not freed anywhere, leading to small memory leaks
inside libbfd. To limit the leaks, I'd implemented a static buffer in
the ppc backends that was freed before use in asprintf output. This
patch extends that scheme to other backends using a shared static
buffer and goes further in freeing the buffer on any bfd_close.
The patch also fixes a few other cases where asprintf output was not
freed after use.
bfd/
* bfd.c (_input_error_msg): Make global and rename to..
(_bfd_error_buf): ..this.
(bfd_asprintf): New function.
(bfd_errmsg): Use bfd_asprintf.
* opncls.c (bfd_close_all_done): Free _buf_error_buf.
* elf32-arm.c (find_thumb_glue, find_arm_glue): Use bfd_asprintf.
* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
* elf32-ppc.c (ppc_elf_unhandled_reloc): Likewise.
* elf64-ppc.c (ppc64_elf_unhandled_reloc): Likewise.
* elfnn-riscv.c (riscv_resolve_pcrel_lo_relocs): Likewise.
(riscv_elf_relocate_section): Likewise.
* libbfd.h: Regenerate.
gas/
* read.c (read_end): Free current_name and current_label.
(do_s_func): Likewise on error path. strdup label.
ld/
* pe-dll.c (make_head, make_tail, make_one),
(make_singleton_name_thunk, make_import_fixup_entry),
(make_runtime_pseudo_reloc),
(pe_create_runtime_relocator_reference: Free oname after use.
|
|
There are other places that leak the strtab.
* elf.c (_bfd_elf_compute_section_file_positions): Free strtab
on error paths.
|
|
|
|
|
|
|
|
|
|
|
|
Freeing ecoff_debug_info "pointers to the unswapped symbolic info"
isn't a simple matter, due to differing allocation strategies. In
_bfd_ecoff_slurp_symbolic_info the pointers are to objalloc memory.
In the ecoff linker they are to separately malloc'd memory. In gas we
have most (obj-elf) or all (obj-ecoff) into a single malloc'd buffer.
This patch fixes the leaks for binutils and ld, leaving the gas leaks
for another day. The mips elf backend already had this covered, and
the ecoff backend had a pointer, raw_syments used as a flag, so most
of the patch is moving these around a little so they are accessible
for both ecoff and elf.
include/
* coff/ecoff.h (struct ecoff_debug_info): Add alloc_syments.
bfd/
* libecoff.h (struct ecoff_tdata): Delete raw_syments.
* elfxx-mips.c (free_ecoff_debug): Delete. Replace uses with
_bfd_ecoff_free_ecoff_debug_info.
(_bfd_mips_elf_final_link): Init debug.alloc_syments.
* ecofflink.c (_bfd_ecoff_free_ecoff_debug_info): New function.
* ecoff.c (_bfd_ecoff_bfd_free_cached_info): Call
_bfd_ecoff_free_ecoff_debug_info.
(_bfd_ecoff_slurp_symbolic_info): Replace uses of raw_syments
with alloc_syments.
(ecoff_final_link_debug_accumulate): Likewise. Use
_bfd_ecoff_free_ecoff_debug_info.
(_bfd_ecoff_bfd_copy_private_bfd_data): Set alloc_syments for
copied output.
* elf64-alpha.c (elf64_alpha_read_ecoff_info): Use
_bfd_ecoff_free_ecoff_debug_info.
* libbfd-in.h (_bfd_ecoff_free_ecoff_debug_info): Declare.
* libbfd.h: Regenerate.
gas/
* config/obj-ecoff.c (ecoff_frob_file): Set alloc_syments.
* config/obj-elf.c (elf_frob_file_after_relocs): Likewise.
|
|
|
|
Oops, another leak caused by not defining the correct macro.
* elf32-mips.c: Define bfd_elf32_bfd_free_cached_info.
* elfn32-mips.c: Likewise.
* elf64-mips.c: Define bfd_elf64_bfd_free_cached_info.
|
|
ELF targets with target-specific free_cache_info functions need to
call _bfd_elf_free_cached_info, not _bfd_generic_bfd_free_cached_info.
* elf64-ppc.c (ppc64_elf_free_cached_info): Call
_bfd_elf_free_cached_info.
* elfnn-aarch64.c (elfNN_aarch64_bfd_free_cached_info): Likewise.
|
|
|
|
common symbols.
PR 30499
bfd * elflink.c (elf_link_add_object_symbols): Add a message indicating that alignment and size discrepancies between the definition of common symbols and normal symbols are serious and should be investigated.
ld * testsuite/ld-elfcomm/elfcomm.exp: Update regexps to match new output from the linker.
|
|
doc/bfdint.texi and comments in the aout and som code about this
function are just wrong, and its name is not very apt. Better would
be _bfd_mostly_destroy, and we certainly should not be saying anything
about the possibility of later recreating anything lost by this
function. What's more, if _bfd_free_cached_info is called when
creating an archive map to reduce memory usage by throwing away
symbols, the target _close_and_cleanup function won't have access to
tdata or section bfd_user_data to tidy memory. This means most of the
target _close_and_cleanup function won't do anything, and therefore
sometimes will result in memory leaks.
This patch fixes the documentation problems and moves most of the
target _close_and_cleanup code to target _bfd_free_cached_info.
Another notable change is that bfd_generic_bfd_free_cached_info is now
defined as _bfd_free_cached_info rather than _bfd_bool_bfd_true,
ie. the default now frees objalloc memory.
|
|
* vms-lib.c (vms_lib_read_index): Free malloc'd memory on error
return paths.
(vms_write_index, _bfd_vms_lib_write_archive_contents): Likewise.
|
|
* elf.c (_bfd_elf_compute_section_file_positions): Free strtab
on set_group_contents failure return path.
|
|
|
|
|
|
When rewriting the program headers, don't warn an empty PT_LOAD with the
program headers.
bfd/
PR binutils/30508
* elf.c (rewrite_elf_program_header): Don't warn if an empty
PT_LOAD contains the program headers.
ld/
PR binutils/30508
* testsuite/ld-elf/pr30508.d: New file.
* testsuite/ld-elf/pr30508.s: Likewise.
|
|
bfd_errmsg uses asprintf for bfd_error_on_input, which means we
currently leak memory. Keep a static pointer to the message and free
it in various places to minimise the leaks.
bfd_set_input_error (NULL, bfd_error_no_error) is a way to free up the
last string if that matters.
* bfd.c (input_error_msg): New static var.
(bfd_set_input_error): Free it here..
(bfd_init): ..and here..
(bfd_errmsg): ..and here. Use it for asprintf output.
|
|
* ecoff.c (_bfd_ecoff_slurp_symbol_table): Sanity check fdr_ptr
csym against remaining space for symbols. Error on out of bounds
fdr_ptr fields.
|
|
This behavior is used by downstream toolchain since 2014.
We also set the default ABI for mips*-img-elf to O32.
The previous value is NO_ABI, which is not good default ABI.
We don't support mips64*-img* due to GCC doesn't support it,
and We believe that the multilib should be used for this case.
|
|
|
|
|
|
Yet another fuzzer fix.
* ecoff.c (ecoff_slurp_symbolic_header <FIX>): Zero counts when
associated pointer is zero.
(_bfd_ecoff_slurp_symbolic_info): Remove now unnecessary check.
|
|
|
|
_bfd_delete_bfd can be called early, before the target xvec is set up.
* opncls.c (_bfd_delete_bfd): Don't segfault on NULL xvec.
|
|
Another fix for fuzzed object files, exhibiting as a segfault in
nm.c filter_symbols when accessing a symbol name.
* ecoff.c (_bfd_ecoff_slurp_symbol_table): Sanity check
fdr_ptr->issBase, and tighten sym.iss check.
|
|
|