aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2025-02-10Fix typo in objdump info/man pageAlan Modra1-1/+1
2025-02-04Update with latest changes to src-release.shNick Clifton1-32/+42
2025-01-30Remove a couple of entries in the binutils MAINTAINERS fileNick Clifton1-2/+0
2025-01-21More updated translationsNick Clifton2-4079/+4096
2025-01-21run_dump_test warning/error regexpAlan Modra1-6/+10
This allows you to specify a run_dump_test warning that may or may not be present using warning: (warning_text_goes_here)? ie. the regexp matches an empty string.
2025-01-20Update translations for various sub-directoriesNick Clifton4-9455/+10520
2025-01-20Update release readme for gold-in-branches changeNick Clifton1-5/+21
2025-01-20Update how-to-make-a-release document after creating the 2.44 branchNick Clifton1-8/+8
2025-01-19Change version to 2.44.50 and regenerate filesNick Clifton3-2040/+2041
2025-01-19Add name of 2.44 branchNick Clifton1-0/+1
2025-01-19Add markers for bihnutils 2.44 branchNick Clifton2-0/+6
2025-01-17gprofng: update binutils/NEWS for 2.44Vladimir Mezentsev1-0/+4
ChangeLog 2025-01-16 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * binutils/NEWS: Updated.
2025-01-16Have readelf sanitize the program interpreter string before displaying it.Nick Clifton1-41/+68
2025-01-15Fix known minor objdump leakAlan Modra1-2/+4
* objdump.c (main): Free disassembler_options.
2025-01-15PR32560 stack-buffer-overflow at objdump disassemble_bytesAlan Modra1-4/+6
There's always someone pushing the boundaries. PR 32560 * objdump.c (MAX_INSN_WIDTH): Define. (insn_width): Make it an unsigned long. (disassemble_bytes): Use MAX_INSN_WIDTH to size buffer. (main <OPTION_INSN_WIDTH>): Restrict size of insn_width.
2025-01-14ld: Add --enable-memory-seal configure optionAdhemerval Zanella1-0/+22
Add --enable-memory-seal linker configure option to enable memory sealing (GNU_PROPERTY_MEMORY_SEAL) by default. Change-Id: I4ce4ff33657f0f09b1ceb06210b6fcaa501f1799
2025-01-14elf: Add GNU_PROPERTY_MEMORY_SEAL gnu propertyAdhemerval Zanella1-0/+6
The GNU_PROPERTY_MEMORY_SEAL gnu property is a way to mark binaries to be memory sealed by the loader, to avoid further changes of PT_LOAD segments (such as unmapping or change permission flags). This is done along with Linux kernel (the mseal syscall [1]), and C runtime supports to instruct the kernel on the correct time during program startup (for instance, after RELRO handling). This support is added along the glibc support to handle the new gnu property [2]. This is a opt-in security features, like other security hardening ones like NX-stack or RELRO. The new property is ignored if present on ET_REL objects, and only added on ET_EXEC/ET_DYN if the linker option is used. A gnu property is used instead of DT_FLAGS_1 flag to allow memory sealing to work with ET_EXEC without PT_DYNAMIC support (at least on glibc some ports still do no support static-pie). [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8be7258aad44b5e25977a98db136f677fa6f4370 [2] https://sourceware.org/pipermail/libc-alpha/2024-September/160291.html Change-Id: Id47fadabecd24be0e83cff45653f7ce9a900ecf4
2025-01-14aarch64 DWARF: add new CFI directive for PAuth_LRMatthieu Longo1-0/+5
This patch adds a new CFI directive (cfi_negate_ra_state_with_pc) which set an additional bit in the RA state to inform that RA was signed with SP but also PC as an additional diversifier. RA state | Description 0b00 | Return address not signed (default if no cfi_negate_ra_state*) 0b01 | Return address signed with SP (cfi_negate_ra_state) 0b10 | Invalid state 0b11 | Return address signed with SP+PC (cfi_negate_ra_state_with_pc) Approved-by: Indu Bhagat <indu.bhagat@oracle.com> Approved-by: Jan Beulich <jbeulich@suse.com>
2025-01-14ld: Add LTO and none-LTO output support for ld -rH.J. Lu2-30/+3
Link with mixed IR/non-IR objects * 2 kinds of object files o non-IR object file has * non-IR sections o IR object file has * IR sections * non-IR sections * The output of "ld -r" with mixed IR/non-IR objects should work with: o Compilers/linkers with IR support. o Compilers/linkers without IR support. * Add the mixed object file which has o IR sections o non-IR sections: * Object codes from IR sections. * Object codes from non-IR object files. o Object-only section: * With section name ".gnu_object_only" and SHT_GNU_OBJECT_ONLY type on ELF: https://gitlab.com/x86-psABIs/Linux-ABI #define SHT_GNU_OBJECT_ONLY 0x6ffffff8 /* Object only */ * Contain non-IR object file. * Input is discarded after link. * Linker action: o Classify each input object file: * If there is a ".gnu_object_only" section, it is a mixed object file. * If there is a IR section, it is an IR object file. * Otherwise, it is a non-IR object file. o Relocatable non-IR link: * Prepare for an object-only output. * Prepare for a regular output. * For each mixed object file: * Add IR and non-IR sections to the regular output. * For object-only section: * Extract object only file. * Add it to the object-only output. * Discard object-only section. * For each IR object file: * Add IR and non-IR sections to the regular output. * For each non-IR object file: * Add non-IR sections to the regular output. * Add non-IR sections to the object-only output. * Final output: * If there are IR objects, non-IR objects and the object-only output isn't empty: * Put the object-only output into the object-only section. * Add the object-only section to the regular output. * Remove the object-only output. o Normal link and relocatable IR link: * Prepare for output. * IR link: * For each mixed object file: * Compile and add IR sections to the output. * Discard non-IR sections. * Object-only section: * Extract object only file. * Add it to the output. * Discard object-only section. * For each IR object file: * Compile and add IR sections to the output. * Discard non-IR sections. * For each non-IR object file: * Add non-IR sections to the output. * Non-IR link: * For each mixed object file: * Add non-IR sections to the output. * Discard IR sections and object-only section. * For each IR object file: * Add non-IR sections to the output. * Discard IR sections. * For each non-IR object file: * Add non-IR sections to the output. This is useful for Linux kernel build with LTO. bfd/ PR ld/12291 PR ld/12430 PR ld/13298 * bfd.c (bfd_lto_object_type): Add lto_mixed_object. (bfd): Add object_only_section. (bfd_group_signature): New. * elf.c (special_sections_g): Add .gnu_object_only. * format.c: Include "plugin-api.h" and "plugin.h" if BFD_SUPPORTS_PLUGINS is defined. (bfd_set_lto_type): Set type to lto_mixed_object for GNU_OBJECT_ONLY_SECTION_NAME section. (bfd_check_format_matches): Don't check the plugin target twice if the plugin target is explicitly specified. * opncls.c (bfd_extract_object_only_section): New. * plugin.c (bfd_plugin_fake_text_section): New. (bfd_plugin_fake_data_section): Likewise. (bfd_plugin_fake_bss_section): Likewise. (bfd_plugin_fake_common_section): Likewise. (bfd_plugin_get_symbols_in_object_only): Likewise. * plugin.c (add_symbols): Call bfd_plugin_get_symbols_in_object_only and count plugin_data->object_only_nsyms. (bfd_plugin_get_symtab_upper_bound): Count plugin_data->object_only_nsyms. bfd_plugin_get_symbols_in_object_only and add symbols from object only section. (bfd_plugin_canonicalize_symtab): Remove fake_section, fake_data_section, fake_bss_section and fake_common_section. Set udata.p to NULL. Use bfd_plugin_fake_text_section, bfd_plugin_fake_data_section, bfd_plugin_fake_bss_section and bfd_plugin_fake_common_section. Set udata.p to NULL. * plugin.h (plugin_data_struct): Add object_only_nsyms and object_only_syms. * section.c (GNU_OBJECT_ONLY_SECTION_NAME): New. * bfd-in2.h: Regenerated. binutils/ PR ld/12291 PR ld/12430 PR ld/13298 * objcopy.c (group_signature): Removed. (is_strip_section): Replace group_signature with bfd_group_signature. (setup_section): Likewise. * readelf.c (get_os_specific_section_type_name): Handle SHT_GNU_OBJECT_ONLY. gas/ PR ld/12291 PR ld/12430 PR ld/13298 * testsuite/gas/elf/section9.s: Add the .gnu_object_only test. * testsuite/gas/elf/section9.d: Updated. include/ PR ld/12291 PR ld/12430 PR ld/13298 * elf/common.h (SHT_GNU_OBJECT_ONLY): New. ld/ PR ld/12291 PR ld/12430 PR ld/13298 * ld.h (ld_config_type): Add emit_gnu_object_only and emitting_gnu_object_only. * ldelf.c (orphan_init_done): Make it file scope. (ldelf_place_orphan): Rename hold to orig_hold. Initialize hold from orig_hold at run-time. (ldelf_finish): New. * ldelf.h (ldelf_finish): New. * ldexp.c (ldexp_init): Take a bfd_boolean argument to supprt object-only output. (ldexp_finish): Likewise. * ldexp.h (ldexp_init): Take a bfd_boolean argument. (ldexp_finish): Likewise. * ldfile.c (ldfile_try_open_bfd): Call cmdline_check_object_only_section. * ldlang.c: Include "ldwrite.h" and elf-bfd.h. * ldlang.c (cmdline_object_only_file_list): New. (cmdline_object_only_archive_list): Likewise. (cmdline_temp_object_only_list): Likewise. (cmdline_lists_init): Likewise. (cmdline_list_new): Likewise. (cmdline_list_append): Likewise. (print_cmdline_list): Likewise. (cmdline_on_object_only_archive_list_p): Likewise. (cmdline_object_only_list_append): Likewise. (cmdline_get_object_only_input_files): Likewise. (cmdline_arg): Likewise. (setup_section): Likewise. (copy_section): Likewise. (cmdline_fopen_temp): Likewise. (cmdline_add_object_only_section): Likewise. (cmdline_emit_object_only_section): Likewise. (cmdline_extract_object_only_section): Likewise. (cmdline_check_object_only_section): Likewise. (cmdline_remove_object_only_files): Likewise. (lang_init): Take a bfd_boolean argument to supprt object-only output. Call cmdline_lists_init. (load_symbols): Call cmdline_on_object_only_archive_list_p to check if an archive member should be loaded. (lang_process): Handle object-only link. * ldlang.h (lang_init): Take a bfd_boolean argument. (cmdline_enum_type): New. (cmdline_header_type): Likewise. (cmdline_file_type): Likewise. (cmdline_bfd_type): Likewise. (cmdline_union_type): Likewise. (cmdline_list_type): Likewise. (cmdline_emit_object_only_section): Likewise. (cmdline_check_object_only_section): Likewise. (cmdline_remove_object_only_files): Likewise. * ldmain.c (main): Call xatexit with cmdline_remove_object_only_files. Pass FALSE to lang_init, ldexp_init and ldexp_finish. Use ld_parse_linker_script. Set link_info.output_bfd to NULL after close. Call cmdline_emit_object_only_section if needed. (add_archive_element): Call cmdline_check_object_only_section. (ld_parse_linker_script): New. * ldmain.h (ld_parse_linker_script): New. * plugin.c (plugin_maybe_claim): Call cmdline_check_object_only_section on claimed IR files. * scripttempl/elf.sc: Also discard .gnu_object_only sections. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/pe.sc: Likewise. * scripttempl/pep.sc: Likewise. * emultempl/aarch64elf.em (gld${EMULATION_NAME}_finish): Replace finish_default with ldelf_finish. * emultempl/alphaelf.em (alpha_finish): Likewise. * emultempl/avrelf.em (avr_finish): Likewise. * emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise. * emultempl/ppc32elf.em (ppc_finish): Likewise. * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Likewise. * emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Likewise. * testsuite/ld-plugin/lto-10.out: New file. * testsuite/ld-plugin/lto-10a.c: Likewise. * testsuite/ld-plugin/lto-10b.c: Likewise. * testsuite/ld-plugin/lto-10r.d: Likewise. * testsuite/ld-plugin/lto-4.out: Likewise. * testsuite/ld-plugin/lto-4a.c: Likewise. * testsuite/ld-plugin/lto-4b.c: Likewise. * testsuite/ld-plugin/lto-4c.c: Likewise. * testsuite/ld-plugin/lto-4r-a.d: Likewise. * testsuite/ld-plugin/lto-4r-b.d: Likewise. * testsuite/ld-plugin/lto-4r-c.d: Likewise. * testsuite/ld-plugin/lto-4r-d.d: Likewise. * testsuite/ld-plugin/lto.exp (lto_link_tests): Prepare for "LTO 4[acd]", "lto-4r-[abcd]" and "LTO 10" tests. (lto_run_tests): Add "LTO 4[acd]" and "LTO 10" tests. Build liblto-4.a. Run "lto-4r-[abcd]" tests. Run lto-10r and create tmpdir/lto-10.o. Add test for nm on mixed LTO/non-LTO object. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-01-06ar and foreign object filesAlan Modra4-22/+64
ar is supposed to make archives containing any sort of file, and it generally does that. It also tries to make archives suited to target object files stored. Some targets have peculiar archives. In one particular case we get into trouble trying to suit archives to object files: where the target object file is recognised but that target doesn't happen to support archives, and the default target has a special archive format. For example, we'll get failures on rs6000-aix if trying to add tekhex objects to a new archive. What happens in that the tekhex object is recognised and its target vector used to create an empty archive, ie. with _bfd_generic_mkarchive and _bfd_write_archive_contents. An attempt is then made to open the newly created archive. The tekhex target vector does not have a check_format function to recognise generic archives, nor as it happens do any of the xcoff or other targets built for rs6000-aix. It seems to me the simplest fix is to not use any target vector to create archives where that vector can't also recognise them. That's what this patch does, and to reinforce that I've removed target vector support for creating empty archives from such targets. bfd/ * i386msdos.c (i386_msdos_vec): Remove support for creating empty archives. * ihex.c (ihex_vec): Likewise. * srec.c (srec_vec, symbolsrec_vec): Likewise. * tekhex.c (tekhex_vec): Likewise. * wasm-module.c (wasm_vec): Likewise. * ptrace-core.c (core_ptrace_vec): Tidy. * targets.c (bfd_target_supports_archives): New inline function. * bfd-in2.h: Regenerate. binutils/ * ar.c (open_inarch): Don't select a target from the first object file that can't read archives. Set output_filename earlier. * testsuite/binutils-all/ar.exp (thin_archive_with_nested): Don't repeat --thin test using T. (foreign_object): New test. * testsuite/binutils-all/tek1.obj, * testsuite/binutils-all/tek2.obj: New files.
2025-01-01readelf memory leaksAlan Modra2-12/+23
This fixes multiple readelf memory leaks: - The check functions used to validate separate debug info files opened and read file data but didn't release the memory nor close the file. - A string table was being re-read into a buffer, leaking the old contents. - Decompressed section contents leaked. * dwarf.c (check_gnu_debuglink): Always call close_debug_file. (check_gnu_debugaltlink): Likewise. * readelf.c (process_section_headers): Don't read string_table again if we already have it. (maybe_expand_or_relocate_section): Add decomp_buf param to return new uncompressed buffer. (dump_section_as_strings, filedata->string_table): Free any uncompressed buffer. (process_file): Call close_debug_file rather than freeing various filedata components.
2025-01-01objdump sym memory leakAlan Modra1-0/+2
The sym array should be freed even with a symcount of zero. * objdump.c (dump_bfd): Free syms before replacing with extra_syms. Free extra_syms after adding to syms.
2025-01-01Close elements of output archiveAlan Modra2-11/+1
When cleaning up an archive, close all its elements. This fixes a number of ar memory leaks. bfd/ * archive.c (_bfd_archive_close_and_cleanup): Close elements of an archive open for writing. binutils/ * objcopy.c (copy_archive): Don't close output archive elements here. * dlltool.c (gen_lib_file): Likewise. ld/ * pe-dll.c (pe_dll_generate_implib): Don't close output archive elements here.
2025-01-01ar.c memory leak fixmeAlan Modra1-16/+41
Cure the leak by always mallocing the string in output_filename, and freeing the old one any time we assign output_filename.
2025-01-01bfdtest1 loop checkAlan Modra1-0/+4
Add a check that next_archived_file doesn't return the same element. Seen with the following, which I think shows a bug with "ar r" and thin archives as you get two copies of artest.a in artest2.a. $ rm tmpdir/artest* $ ./ar rc tmpdir/artest.a tmpdir/bintest.o $ ./ar rcT tmpdir/artest2.a tmpdir/artest.a $ ./bfdtest1 tmpdir/artest.a $ ./bfdtest1 tmpdir/artest2.a $ ./ar rcT tmpdir/artest2.a tmpdir/artest.a $ ./bfdtest1 tmpdir/artest2.a oops: next_archived_file
2025-01-01Update year range in copyright notice of binutils filesAlan Modra150-152/+152
2024-12-17nm: Avoid potential segmentation fault when displaying symbols without ↵Nick Clifton1-8/+16
version info. PR 32467
2024-12-14display_lang: Add descriptions for post DWARF5 constantsAlexandra Hájková1-0/+25
Describe all the new post DWARF5 language codes from the latest sync of include/dwarf.h with gcc.
2024-12-14Delete asection.symbol_ptr_ptrAlan Modra2-3/+3
This field is always set to point to asection.symbol, and no code ever changes it from its initial value. With one exception. elfxx-mips.c creates two sections with separate pointers to their symbols, and uses those as asection.symbol_ptr_ptr. Those pointers aren't modified, so they disappear in this patch too.
2024-12-13objdump: Delete close optimisationAlan Modra1-15/+4
In commit cd6581da62c3, Nick made an optimisation that was reasonable at the time, but then pr22032 came along and commit 7c0ed39626e3 made bfd_close_all_done free memory. So Nick's optimisation is now ineffective, and the comment wrong. * objdump.c (display_file): Delete last_file param. Update caller. Call bfd_close always.
2024-12-12close last arfile before processing current arfileAlan Modra4-66/+38
This also reduces peak memory a little. * dlltool.c (identify_search_archive): Close last_arfile earlier. Report an error if bfd_openr_next_archived_file returns the same bfd. Localise variables. * nm.c (display_archive): Likewise. * objdump.c (display_any_bfd): Likewise. * size.c (display_archive): Likewise.
2024-12-12nm.c free_lineno_cacheAlan Modra1-8/+3
free_lineno_cache frees symbol and relocation data used when displaying line number info for symbols (nm -l). Currently that is done when closing the bfd, but that's not ideal for archives since that results in two bfds worth of memory in use. * nm.c (display_rel_file): Call free_lineno_cache here.. (display_archive, display_file): ..not here.
2024-12-09LoongArch: Assign DWARF register numbers to register aliasesLulu Cai1-0/+29
.cfi directives only support the use of register numbers and not register names or aliases. This commit adds support for 4 formats, for example: .cfi_offset r1, 8 .cfi_offset ra, 8 .cfi_offset $r1,8 .cfi_offset $ra,8 The above .cfi directives are equivalent and all represent dwarf register number 1. Display register aliases as specified in the psABI during disassembly.
2024-12-02aarch64: GCS feature check in GNU note properties for input objectsSrinath Parvathaneni1-0/+4
This patch adds support for Guarded Control Stack in AArch64 linker. This patch implements the following: 1) Defines GNU_PROPERTY_AARCH64_FEATURE_1_GCS bit for GCS in GNU_PROPERTY_AARCH64_FEATURE_1_AND macro. 2) Adds readelf support to read and print the GCS feature in GNU properties in AArch64. Displaying notes found in: .note.gnu.property [ ]+Owner[ ]+Data size[ ]+Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: AArch64 feature: GCS 3) Adds support for the "-z gcs" linker option and document all the values allowed with this option (-z gcs[=always|never|implicit]) where "-z gcs" is equivalent to "-z gcs=always". When '-z gcs' option is omitted from the command line, it defaults to "implicit" and relies on the GCS feature marking in GNU properties. 4) Adds support for the "-z gcs-report" linker option and document all the values allowed with this option (-z gcs-report[=none|warning|error]) where "-z gcs-report" is equivalent to "-z gcs-report=warning". When this option is omitted from the command line, it defaults to "warning". The ABI changes adding GNU_PROPERTY_AARCH64_FEATURE_1_GCS to the GNU property GNU_PROPERTY_AARCH64_FEATURE_1_AND is merged into main and can be found in [1]. [1] https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst Co-authored-by: Matthieu Longo <matthieu.longo@arm.com> Co-authored-by: Yury Khrustalev <yury.khrustalev@arm.com>
2024-12-01Remove more remnants of old Mach-O workaroundoltolm1-1/+0
Remove another adjustment for section address, this time for the offset into .debug_str{,.dwo} read from .debug_str_offsets{,.dwo} by fetch_indexed_string. Signed-off-by: oltolm <oleg.tolmatcev@gmail.com>
2024-11-29MAINTAINERS: Update Peter Bergner's e-mail addressSurya Kumari Jangala1-1/+1
2024-11-26nios2: Remove binutils support for Nios II target.Sandra Loosemore2-2/+3
The Nios II architecture has been EOL'ed by the vendor. This patch removes all binutils, bfd, gas, binutils, and opcodes support for this target with the exception of the readelf utility. (The ELF EM_* number remains valid and the relocation definitions from the Nios II ABI will never change in future, so retaining the readelf support seems consistent with its purpose as a utility that tries to parse the headers in any ELF file provided as an argument regardless of target.)
2024-11-20Remove Debian from SECURITY.txtNick Clifton1-1/+0
2024-11-18gas/ELF: also reject merge entity size being zeroJan Beulich1-1/+1
This won't have any useful effect, so is at best marginally less bogus than a negative value. The change actually points out a flawed (for Arm) testcase: @ is a comment character there.
2024-11-18binutils: fix -std=gnu23 compatibility wrt _BoolSam James1-1/+1
GCC trunk now defaults to -std=gnu23. We return false in a few places which can't work when true/false are a proper type (_Bool). Return NULL where appropriate instead of false. All callers handle this appropriately. ChangeLog: PR ld/32372 * prdbg.c (visibility_name): Return NULL.
2024-10-31RISC-V: Dump instruction without checking architecture support as usual.Nelson Chu1-0/+3
Since QEMU have supported -Max option to to enable all normal extensions, the dis-assembler should also add an option, -M,max to do the same thing. For the instruction, which have overlapped encodings like zfinx, will not be considered by the -M,max option. opcodes/ * riscv-dis.c (all_ext): New static boolean. If set, disassemble without checking architectire string. (riscv_disassemble_insn): Likewise. (parse_riscv_dis_option_without_args): Recognized -M,max option. binutils/ * NEWS: Updated.
2024-10-24Replace uses of asprintf with xasprintfAlan Modra8-71/+17
xasprintf has a nicer interface and behaves like xmalloc as far as memory is concerned, ie. no need to check a return status and the program exits with an error on OOM. binutils/ * dwarf.c (load_debug_sup_file): Replace asprintf with xasprintf. * nm.c (get_elf_symbol_type, get_coff_symbol_type): Likewise. * objdump.c (dump_ctf_indent_lines): Likewise. * readelf.c (display_lto_symtab, dump_ctf_indent_lines): Likewise. * windres.c (main): Likewise. * configure.ac: Remove asprintf from AC_CHECK_DECLS. * config.in: Regenerate. * configure: Regenerate. gas/ * config/tc-kvx.c (kvx_emit_single_noop): Simplify. * config/tc-riscv.c (md_assemblef): Replace asprintf with xasprintf. * read.c (s_nop, do_s_func): Likewise. * stabs.c (stabs_generate_asm_func): Likewise. (stabs_generate_asm_endfunc): Likewise. * configure.ac: Remove asprintf from AC_CHECK_DECLS. * config.in: Regenerate. * configure: Regenerate. ld/ * ldlang.c (lang_leave_overlay_section): Replace xmalloc+sprintf with xasprintf. Localise vars. * lexsup.c (parse_args): Replace asprintf with xasprintf. * pe-dll.c (make_head, make_tail, make_one): Likewise. (make_singleton_name_thunk, make_import_fixup_entry): Likewise. (make_runtime_pseudo_reloc): Likewise. (pe_create_runtime_relocator_reference): Likewise. * configure.ac: Remove asprintf from AC_CHECK_DECLS. * config.in: Regenerate. * configure: Regenerate.
2024-10-16Add noxfail option to run_dump_testAlan Modra1-0/+11
The noxfail option is useful in situations like pr23658-1e which fails on all microblaze ELF targets except microblaze-linux. This was possible to handle by writing a small proc and use that as an xfail predicate, or painstakingly listing all microblaze ELF targets, but this is simpler. The patch also fixes some other FAILs and XPASSes of the pr23658 tests. binutils/ * testsuite/lib/binutils-common.exp (run_dump_test): Support noxfail. ld/ * testsuite/ld-elf/pr23658-1a.d: Don't xfail m68hc12. * testsuite/ld-elf/pr23658-1e.d: Likewise. xfail xstormy16 and correct microblaze xfails.
2024-10-11bfd/ELF: restrict file alignment for object filesJan Beulich3-9/+9
While for executables properly aligning sections within the file can be quite relevant, the same is of pretty little importance for relocatable object files. Avoid passing "true" into _bfd_elf_assign_file_position_for_section() when dealing with object files, but compensate minimally by applying log_file_align in such cases as a cap to the alignment put in place.
2024-10-09PR32243, NAME_MAX does not exist on mingw-w64 without _POSIX_Alan Modra1-15/+17
PR 32243 * dlltool.c: Move forward decls. Delete unnecessary ones. (bfd_errmsg): Delete macro, define as inline function. (PATHMAX): Delete. (NAME_MAX): Define.
2024-10-08Revised "Don't return (null) from bfd_elf_sym_name"Alan Modra1-5/+5
Commit 68bbe1183379 results in a lot of follow up work, much of which likely is still to be done. (And yes, since this is all for corrupted or fuzzed object files, a whole lot of work doesn't much benefit anyone. It was a bad idea to put NULL in asymbol->name.) So I'm changing the approach to instead put a unique empty string for symbols with a corrupted st_name. An empty string won't require much work to ensure nm, objcopy, objdump etc. won't crash, since these tools already must work with unnamed local symbols. The unique empty string is called bfd_symbol_error_name. This patch uses that name string for corrupted symbols in the ELF and COFF backends. Such symbols are displayed by nm and objdump as the translated string "<corrupt>", which is what the COFF backend used to put directly into corrupted symbols. ie. it's the way I should have written the original patch, plus a few tides and cleanups I retained from the reverted patches.
2024-10-08Revert "dlltool fixes for commit 68bbe1183379"Alan Modra1-5/+4
This reverts commit 06116013f80e474800cfb122924bc2a6f060606a.
2024-10-08Revert "objcopy fixes for commit 68bbe1183379"Alan Modra1-11/+5
This reverts commit ef166f451fbc2c7b251a251ab23cd35b36c5ee23.
2024-10-05objcopy fixes for commit 68bbe1183379Alan Modra1-5/+11
* objcopy.c (is_specified_symbol): Handle NULL name. (filter_symbols): Drop syms with a NULL name.
2024-10-04dlltool fixes for commit 68bbe1183379Alan Modra1-4/+5
For some reason, dlltool supports mcore-elf input files. * dlltool.c (filter_symbols): Drop symbols with NULL names. (identify_member_contains_symname): Don't consider symbols with NULL names.