aboutsummaryrefslogtreecommitdiff
path: root/binutils/doc/binutils.texi
AgeCommit message (Collapse)AuthorFilesLines
2024-05-08Fix typo in binutils manualTom Tromey1-1/+1
I happened to notice that the binutils manual has a typo in the name of a command-line option.
2024-04-11Add -j/--display-section option to readelf.Nick Clifton1-0/+22
2024-04-02Update objcopy's --section-alignment option so that it sets the alignment ↵Nick Clifton1-4/+25
flag on PE sections. Add a check for aligned sections not matching their VMAs.
2024-02-09PowerPC: Add support for Power11 optionsPeter Bergner1-5/+6
binutils/ * doc/binutils.texi (PowerPC -M option): Mention power11 and pwr11. gas/ * config/tc-ppc.c: (md_show_usage): Mention -mpower11 and -mpwr11. * doc/c-ppc.texi: Likewise. opcodes/ * ppc-dis.c (ppc_opts): Add "power11" and "pwr11" entries. (powerpc_init_dialect): Default to "power11".
2024-01-04Update year range in copyright notice of binutils filesAlan Modra1-1/+1
Adds two new external authors to etc/update-copyright.py to cover bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then updates copyright messages as follows: 1) Update cgen/utils.scm emitted copyrights. 2) Run "etc/update-copyright.py --this-year" with an extra external author I haven't committed, 'Kalray SA.', to cover gas testsuite files (which should have their copyright message removed). 3) Build with --enable-maintainer-mode --enable-cgen-maint=yes. 4) Check out */po/*.pot which we don't update frequently.
2023-12-02binutils: Fix documentation typo in the --set-sect-name optionPetr Tesarik1-1/+1
Fix a --set-sect-name typo in the description of objcopy --rename-section.
2023-11-14Improve objdump's handling of compressed sections.Nick Clifton1-1/+14
PR 31062 * objdump.c (decompressed_dumps): New local variable. (usage): Mention the -z/--decompress option. (long_options): Add --decompress. (dump_section_header): Add "COMPRESSED" to the Flags field of any compressed section. (dump_section): Warn users when dumping a compressed section. (display_any_bfd): Decompress the section if decompressed_dumps is true. (main): Handle the -z/--decompress option. * NEWS: Mention the new feature. * doc/binutils.texi: Document the new feature. * testsuite/binutils-all/objdump.s: Update expected output. * testsuite/binutils-all/objdump.exp: Add test of -Z -s. * testsuite/binutils-all/objdump.Zs: New file. * readelf.c (maybe_expand_or_relocate_section): New function. Contains common code found in dump functions. Adds a note message if a compressed section is not being decompressed. (dump_section_as_strings): Use new function. (dump_section_as_bytes): Likewise.
2023-10-23objcopy: fix typo in --heap and --stack parserClément Chigot1-2/+2
The help says that <reserve> and <commit> should be separated by a "," but the implementation is checking for ".". Having two numbers being separated by a "." could be confusing, thus adjust the implementation to match the help syntax. binutils/ChangeLog: * objcopy.c (copy_main): Set separator to "," between <reserve> and <commit> for --heap and --stack. * doc/binutils.texi: Add <commit> for --heap and --stack.
2023-09-26Allow the use of SOURCE_DATE_EPOCH in the timestamps for members of static ↵Nick Clifton1-0/+4
archives. (For some reason this commit was not applied at the time that the patch was approved).
2023-09-05readelf: Add option to display the names of sections referenced by symbols.Nick Clifton1-0/+15
PR 30684 * readelf.c (extra_sym_info): New variable. (section_name_valid): Also check for filedata being NULL. (section_name_print): Delete. (section_index_real): New function. Returns true if the given section index references a real section. (print_symbol): Rename to print_sumbol_name. (printable_section_name): Use a rotating array of static buffers for the return string. (printable_section_name_from_index): Merge code from dump_relocations and get_symbol_index_type into here. (long_option_values): Add OPTION_NO_EXTRA_SYM_INFO. (options): Add "extra-sym-info" and "no-extra-sym-info". (usage): Mention new options. (parse_args): Parse new options. (get_symbol_index_type): Delete. (print_dynamic_symbol_size): Rename to print_symbol_size. (print_dynamic_symbol): Rename to print_symbol. (print_symbol_table_heading): New function. (process_symbol_table): Use new function. * doc/binutils.texi: Document the new option. * NEWS: Mention the new feature.
2023-08-02Revert "2.41 Release sources"Sam James1-7/+13
This reverts commit 675b9d612cc59446e84e2c6d89b45500cb603a8d. See https://sourceware.org/pipermail/binutils/2023-August/128761.html.
2023-08-022.41 Release sourcesbinutils-2_41-releaseNick Clifton1-13/+7
2023-07-24objcopy embeds the current time and ignores SOURCE_DATE_EPOCH making the ↵Johannes Schauer Marin Rodrigues1-0/+5
output unreproducible. bfd * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): If inserting a timestamp, use the value held in the SOURCE_DATE_EPOCH environment variable, if it is defined. binutils * doc/binutils.texi (objcopy): Document change in behaviour of objcopy's --preserve-dates command line option. ld * pe-dll.c (fill_edata): If inserting a timestamp, use the value held in the SOURCE_DATE_EPOCH environment variable, if it is defined. * ld.texi (--insert-timestamp): Document change in behaviour.
2023-07-09PR30592 objcopy: allow --set-section-flags to add or remove SHF_X86_64_LARGEFangrui Song1-7/+8
For example, objcopy --set-section-flags .data=alloc,large will add SHF_X86_64_LARGE to the .data section. Omitting "large" will drop the SHF_X86_64_LARGE flag. The bfd_section flag is named generically, SEC_ELF_LARGE, in case other processors want to follow SHF_X86_64_LARGE. SEC_ELF_LARGE has the same value as SEC_TIC54X_BLOCK used by coff. bfd/ * section.c: Define SEC_ELF_LARGE. * bfd-in2.h: Regenerate. * elf64-x86-64.c (elf_x86_64_section_flags, elf_x86_64_fake_sections, elf_x86_64_copy_private_section_data): New. binutils/ * NEWS: Mention the new feature for objcopy. * doc/binutils.texi: Mention "large". * objcopy.c (parse_flags): Parse "large". (check_new_section_flags): Error if "large" is used with a non-x86-64 ELF target. * testsuite/binutils-all/x86-64/large-sections.d: New. * testsuite/binutils-all/x86-64/large-sections.s: New. * testsuite/binutils-all/x86-64/large-sections-i386.d: New. * testsuite/binutils-all/x86-64/large-sections-2.d: New. * testsuite/binutils-all/x86-64/large-sections-2-x32.d: New.
2023-06-29ELF: Strip section header in ELF objectsKaylee Blake1-0/+10
Section header isn't mandatory on ELF executable nor shared library. This patch adds a new linker option, -z nosectionheader, to omit ELF section header, a new objcopy and strip option, --strip-section-headers, to remove ELF section headers. bfd/ 2023-06-06 H.J. Lu <hongjiu.lu@intel.com> Kaylee Blake <klkblake@gmail.com> PR ld/25617 * bfd.c (BFD_NO_SECTION_HEADER): New. (BFD_FLAGS_SAVED): Add BFD_NO_SECTION_HEADER. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * elfcode.h (elf_swap_ehdr_out): Omit section header with BFD_NO_SECTION_HEADER. (elf_write_shdrs_and_ehdr): Likewise. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_NO_SECTION_HEADER to object_flags. (TARGET_LITTLE_SYM): Likewise. * bfd-in2.h: Regenerated. binutils/ 2023-06-06 H.J. Lu <hongjiu.lu@intel.com> PR ld/25617 * NEWS: Mention --strip-section-headers for objcopy and strip. * objcopy.c (strip_section_headers): New. (command_line_switch): Add OPTION_STRIP_SECTION_HEADERS. (strip_options): Add --strip-section-headers. (copy_options): Likewise. (copy_usage): Add --strip-section-headers. (strip_usage): Likewise. (copy_object): Handle --strip-section-headers for ELF files. (strip_main): Handle OPTION_STRIP_SECTION_HEADERS. (copy_main): Likewise. * doc/binutils.texi: Document --strip-section-headers for objcopy and strip. ld/ 2023-06-06 H.J. Lu <hongjiu.lu@intel.com> Kaylee Blake <klkblake@gmail.com> PR ld/25617 * NEWS: Mention -z nosectionheader. * emultempl/elf.em: Support -z sectionheader and -z nosectionheader. * ld.h (ld_config_type): Add no_section_header. * ld.texi: Document -z sectionheader and -z nosectionheader. * ldlang.c (ldlang_open_output): Handle config.no_section_header. * lexsup.c (parse_args): Enable --strip-all with -z nosectionheader. Disallow -r with -z nosectionheader. (elf_static_list_options): Add -z sectionheader and -z nosectionheader.
2023-05-26Enhance objdump's --private option so that it can display the contents of PE ↵Nick Clifton1-0/+6
format files. * od-pe.c: New file: Dumps fields in PE format headers. * configure.ac (od_vectors): Add objdump_private_desc_pe for PE format targets. (od_files): Add od-pe for PE format targets. * configure: Regenerate. * Makefile.am (CFILES): Add od-pe.c (EXTRA_objdump_SOURCE): Likewise. * Makefile.in: Generate. * NEWS: Mention the new feature. * doc/binutils.texi: Document the new support. * objdump.c (wide_output): Change from local to global. * objdump.h (wide_output): Prototype. (objdump_private_desc_pe): Prototype. * testsuite/binutils-all/objdump.exp: Add a test of the new feature.
2023-02-11objdump -D of bss sections and -s with -jAlan Modra1-5/+8
There is some inconsistency between the behaviour of objdump -D and objdump -s, both supposedly operating on all sections by default. objdump -s ignores bss sections, while objdump -D dissassembles the zeros. Fix this by making objdump -D ignore bss sections too. Furthermore, "objdump -s -j .bss" doesn't dump .bss as it should, since the user is specifically asking to look at all those zeros. This change does find some tests that used objdump -D with expected output in bss-style sections. I've updated all the msp430 tests that just wanted to find a non-empty section to look at section headers instead, making the tests slightly more stringent. The ppc xcoff and spu tests are fixed by adding -j options to objdump, which makes the tests somewhat more lenient. binutils/ * objdump.c (disassemble_section): Ignore sections without contents, unless overridden by -j. (dump_section): Allow -j to override the default of not displaying sections without contents. * doc/binutils.texi (objdump options): Update -D, -s and -j description. gas/ * testsuite/gas/ppc/xcoff-tls-32.d: Select wanted objdump sections with -j. * testsuite/gas/ppc/xcoff-tls-64.d: Likewise. ld/ * testsuite/ld-msp430-elf/main-bss-lower.d, * testsuite/ld-msp430-elf/main-bss-upper.d, * testsuite/ld-msp430-elf/main-const-lower.d, * testsuite/ld-msp430-elf/main-const-upper.d, * testsuite/ld-msp430-elf/main-text-lower.d, * testsuite/ld-msp430-elf/main-text-upper.d, * testsuite/ld-msp430-elf/main-var-lower.d, * testsuite/ld-msp430-elf/main-var-upper.d: Expect -wh output. * testsuite/ld-msp430-elf/msp430-elf.exp: Use objdump -wh rather than objdump -D or objdump -d with tests checking for non-empty given sections. * testsuite/ld-spu/ear.d, * testsuite/ld-spu/icache1.d, * testsuite/ld-spu/ovl.d, * testsuite/ld-spu/ovl2.d: Select wanted objdump sections.
2023-02-07Fix documentation of the 'n' symbol type displayed by nm.Nick Clifton1-1/+1
PR 30080 * doc/binutils.texi (nm): Update description of the 'n' symbol type.
2023-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
The newer update-copyright.py fixes file encoding too, removing cr/lf on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
2022-12-16Fix previous delta to allow for compilation on 32-bit systemsNick Clifton1-0/+5
2022-11-28PR10368, ISO 8859 mentioned as 7bit encoding in strings documentationAlan Modra1-1/+1
PR 10368 * doc/binutils.texi (strings): Delete example of 7-bit encoding.
2022-11-21Fix ARM and AArch64 assembler tests to work in a multi-arch environment.Nick Clifton1-0/+6
PR 29764 gas * testsuite/gas/arm/cpu-cortex-a76ae.d: Add arm prefix to the -m option passed to objdump. * testsuite/gas/arm/cpu-cortex-a77.d: Likewise. * testsuite/gas/aarch64/cpu-cortex-a76ae.d: Add aarch64 prefix to the -m option passed to objdump. * testsuite/gas/aarch64/cpu-cortex-a77.d: Likewise. bfd * cpu-arm.c (scan): Accept machine names prefixed with "arm:". * cpu-aarch64.c (scan): Accept machine names prefixed with "aarch64:". bin * doc/binutils.texi (objdump): Note that the -m option supports the <architecture>:<machine> syntax.
2022-11-15readelf/objdump: support for SFrame sectionIndu Bhagat1-0/+4
This patch adds support for SFrame in readelf and objdump. The arguments of --sframe are optional for both readelf and objdump. include/ChangeLog: * sframe-api.h (dump_sframe): New function declaration. ChangeLog: * binutils/Makefile.am: Add dependency on libsframe for readelf and objdump. * binutils/Makefile.in: Regenerate. * binutils/doc/binutils.texi: Document --sframe=[section]. * binutils/doc/sframe.options.texi: New file. * binutils/objdump.c: Add support for SFrame format. * binutils/readelf.c: Likewise. * include/sframe-api.h: Add new API for dumping .sframe section. * libsframe/Makefile.am: Add sframe-dump.c. * libsframe/Makefile.in: Regenerate. * libsframe/sframe-dump.c: New file.
2022-10-31objdump: Add configure time option to enable colored disassembly output by ↵Nick Clifton1-11/+19
default. PR 29457 * configure.ac: Add --enable-colored-disassembly. * objdump.c: Add --disassembler-color=terminal. * doc/binutils.texi (objdump): Document the new option. * NEWS: Mention new feature. * config.in: Regenerate in. * configure: Regenerate.
2022-10-14e200 LSP supportAlan Modra1-4/+5
It has bothered me for a long time that we have disabled LSP (and SPE) tests. Also the LSP test comment indicating there is something wrong with get_powerpc_dialect. I don't think there is. Decoding of a VLE instruction depends on whether the processor is in VLE mode (some processors support both VLE and standard PPC) which we flag per section with SHF_PPC_VLE for decoding when disassembling. Background: Some versions of powerpc e200 have "Lightweight Signal Processing" support, examples being e200z215 and e200z425. As far as I can tell, LSP and SPE are mutually exclusive. This seems to be borne out by insn encoding, for example LSP "zvaddih" and SPE "evaddw" have the same encoding. So none of the processor descriptions in ppc_opts ought to have both PPC_OPCODE_LSP and PPC_OPCODE_SPE/2, if we want disassembly to work. I also could not find anything to suggest that the LSP insns are enabled only in VLE mode, which means the LSP insns should not be in vle_opcodes. Fix all this by moving the LSP insns to their own table, and add a new e200z2 cpu entry with LSP support, removing LSP from -me200z4 and from -mvle. (Yes, I know, as I said above some of the e200z4 processors have LSP. Others have SPE. It's hard to choose good options. Think of z2 as meaning earlier, z4 as later.) Also add -mlsp to allow adding the LSP insn set. include/ * opcode/ppc.h (lsp_opcodes, lsp_num_opcodes): Declare. (LSP_OP_TO_SEG): Define. binutils/ * doc/binutils.texi: Update ppc docs. gas/ * config/tc-ppc.c (ppc_setup_opcodes): Add lsp opcodes to ppc_hash. * doc/c-ppc.texi: Document e200 and lsp. * testsuite/gas/ppc/lsp-checks.d: Assemble with -me200z2. * testsuite/gas/ppc/lsp.d: Likewise, disassembly too. * testsuite/gas/ppc/ppc.exp: Don't xfail lsp test. opcodes/ * ppc-dis.c (ppc_opts): Add e200z2 and lsp. Don't set PPC_OPCODE_LSP for e200z4 or vle. (ppc_parse_cpu): Mutually exclude LSP and SPE. (LSP_OPCD_SEGS): Define. (lsp_opcd_indices): New array. (disassemble_init_powerpc): Init lsp_opcd_indices. (lookup_lsp): New function. (print_insn_powerpc): Call it. * ppc-opc.c: Include libiberty.h for ARRAY_SIZE and use throughout. (vle_opcodes): Move LSP opcodes to.. (lsp_opcodes): ..here, and sort. (lsp_num_opcodes): New.
2022-09-28The help document of size misses an option.Nick Clifton1-0/+10
PR 29628 * size.c (usage): Add -f. * doc/binutils.texi (size): Add -f.
2022-09-26binutils, gdb: support zstd compressed debug sectionsFangrui Song1-7/+9
PR29397 PR29563: Add new configure option --with-zstd which defaults to auto. If pkgconfig/libzstd.pc is found, define HAVE_ZSTD and support zstd compressed debug sections for most tools. * bfd: for addr2line, objdump --dwarf, gdb, etc * gas: support --compress-debug-sections=zstd * ld: support ELFCOMPRESS_ZSTD input and --compress-debug-sections=zstd * objcopy: support ELFCOMPRESS_ZSTD input for --decompress-debug-sections and --compress-debug-sections=zstd * gdb: support ELFCOMPRESS_ZSTD input. The bfd change references zstd symbols, so gdb has to link against -lzstd in this patch. If zstd is not supported, ELFCOMPRESS_ZSTD input triggers an error. We can avoid HAVE_ZSTD if binutils-gdb imports zstd/ like zlib/, but this is too heavyweight, so don't do it for now. ``` % ld/ld-new a.o ld/ld-new: a.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support ... % ld/ld-new a.o --compress-debug-sections=zstd ld/ld-new: --compress-debug-sections=zstd: ld is not built with zstd support % binutils/objcopy --compress-debug-sections=zstd a.o b.o binutils/objcopy: --compress-debug-sections=zstd: binutils is not built with zstd support % binutils/objcopy b.o --decompress-debug-sections binutils/objcopy: zstd.o: section .debug_abbrev is compressed with zstd, but BFD is not built with zstd support ... ```
2022-09-12ppc: Document the -mfuture and -Mfuture options and make them usablePeter Bergner1-1/+1
The -mfuture and -Mfuture options which are used for adding potential new ISA instructions were not documented. They also lacked a bitmask so new instructions could not be enabled by those options. Fixed. binutils/ * doc/binutils.texi: Document -Mfuture. gas/ * config/tc-ppc.c: Document -mfuture * doc/c-ppc.texi: Likewise. include/ * opcode/ppc.h (PPC_OPCODE_FUTURE): Define. opcodes/ * ppc-dis.c (ppc_opts) <future>: Use it. * ppc-opc.c (FUTURE): Define.
2022-08-23Add an option to dlltool to allow the creation of deterministic libraries.Nick Clifton1-0/+9
PR 29489 * dlltool.c (deterministic): New variable. (gen_lib_file): If deterministic is true set the BFD_DETERMINISTIC_OUTPUT flag. (usage): Mention --deterministic-libraries and --non-deterministic-libraries. (long_options): Add new options. (main): Parse new options. * doc/binutils.texi: Document the new options. * NEWS: Mention the new feature.
2022-08-09Default to enabling colored disassembly if output is to a terminal.Nick Clifton1-0/+3
PR 29457 * objdump.c (disassembler_color): Change type to an enum. (disassembler_extended_color): Remove. (usage): Update. (objdump_color_for_assembler_style): Update. (main): Update initialisation of disassembler_color. If not initialised via a command line option, set based upon terminal output. * doc/binutils.texi: Update description of disassmbler-color option. * testsuite/binutils-all/arc/objdump.exp: Add --disassembler-color=off option when disassembling. * testsuite/binutils-all/arm/objdump.exp: Likewise.
2022-05-18Add a --no-weak option to nm.Nick Clifton1-0/+5
PR 29135 * nm.c (non_weak): New variable. (filter_symbols): When non-weak is true, ignore weak symbols. (long_options): Add --no-weak. (usage): Mention --no-weak. (main): Handle -W/--no-weak. * doc/binutils.texi: Document new feature. * NEWS: Mention the new feature. * testsuite/binutils-all/nm.exp: Add test of new feature. * testsuite/binutils-all/no-weak.s: New test source file.
2022-05-11nm: use -U as an alias for --defines-only, in line with llvm-nmNick Clifton1-21/+26
2022-04-04objdump/opcodes: add syntax highlighting to disassembler outputAndrew Burgess1-0/+11
This commit adds the _option_ of having disassembler output syntax highlighted in objdump. This option is _off_ by default. The new command line options are: --disassembler-color=off # The default. --disassembler-color=color --disassembler-color=extended-color I have implemented two colour modes, using the same option names as we use of --visualize-jumps, a basic 8-color mode ("color"), and an extended 8bit color mode ("extended-color"). The syntax highlighting requires that each targets disassembler be updated; each time the disassembler produces some output we now pass through an additional parameter indicating what style should be applied to the text. As updating all target disassemblers is a large task, the old API is maintained. And so, a user of the disassembler (i.e. objdump, gdb) must provide two functions, the current non-styled print function, and a new, styled print function. I don't currently have a plan for converting every single target disassembler, my hope is that interested folk will update the disassemblers they are interested in. But it is possible some might never get updated. In this initial series I intend to convert the RISC-V disassembler completely, and also do a partial conversion of the x86 disassembler. Hopefully having the x86 disassembler at least partial converted will allow more people to try this out easily and provide feedback. In this commit I have focused on objdump. The changes to GDB at this point are the bare minimum required to get things compiling, GDB makes no use of the styling information to provide any colors, that will come later, if this commit is accepted. This first commit in the series doesn't convert any target disassemblers at all (the next two commits will update some targets), so after this commit, the only color you will see in the disassembler output, is that produced from objdump itself, e.g. from objdump_print_addr_with_sym, where we print an address and a symbol name, these are now printed with styling information, and so will have colors applied (if the option is on). Finally, my ability to pick "good" colors is ... well, terrible. I'm in no way committed to the colors I've picked here, so I encourage people to suggest new colors, or wait for this commit to land, and then patch the choice of colors. I do have an idea about using possibly an environment variable to allow the objdump colors to be customised, but I haven't done anything like that in this commit, the color choices are just fixed in the code for now. binutils/ChangeLog: * NEWS: Mention new feature. * doc/binutils.texi (objdump): Describe --disassembler-color option. * objdump.c (disassembler_color): New global. (disassembler_extended_color): Likewise. (disassembler_in_comment): Likewise. (usage): Mention --disassembler-color option. (long_options): Add --disassembler-color option. (objdump_print_value): Use fprintf_styled_func instead of fprintf_func. (objdump_print_symname): Likewise. (objdump_print_addr_with_sym): Likewise. (objdump_color_for_disassembler_style): New function. (objdump_styled_sprintf): New function. (fprintf_styled): New function. (disassemble_jumps): Use disassemble_set_printf, and reset disassembler_in_comment. (null_styled_print): New function. (disassemble_bytes): Use disassemble_set_printf, and reset disassembler_in_comment. (disassemble_data): Update init_disassemble_info call. (main): Handle --disassembler-color option. include/ChangeLog: * dis-asm.h (enum disassembler_style): New enum. (struct disassemble_info): Add fprintf_styled_func field, and created_styled_output field. (disassemble_set_printf): Declare. (init_disassemble_info): Add additional parameter. (INIT_DISASSEMBLE_INFO): Add additional parameter. opcodes/ChangeLog: * dis-init.c (init_disassemble_info): Take extra parameter, initialize the new fprintf_styled_func and created_styled_output fields. * disassembler.c (disassemble_set_printf): New function definition.
2022-03-10Add option to objdump/readelf to disable access to debuginfod servers.Nick Clifton1-1/+10
* dwarf.c (use_debuginfod): New variable. Set to 1. (load_separate_debug_info): Only call debuginfod_fetch_separate_debug_info is use_debuginfod is true. (dwarf_select_sections_by_names): Add do-not-use-debuginfod and use-debuginfod options. (dwarf_select_sections_by_letters): Add D and E options. * dwarf.h (use_debuginfod): New extern. * objdump.c (usage): Mention the new options. * readelf.c (usage): Likewise. * doc/binutils.texi: Document the new options. * doc/debug-options.texi: Describe the new options. * NEWS: Mention the new feature. * testsuite/binutils-all/debuginfod.exp: Add tests of the new options.
2022-02-03Support symbol+offset lookup in addr2lineAndi Kleen1-7/+11
The Linux kernel usually ouputs symbol+offset instead of plain code addresses these days, to avoid leaking ASLR secrets and to handle dynamically loaded modules. Converting those with addr2line is somewhat involved: it requires looking up the symbol first using nm and then manually compute the offset, and then pass it to addr2line. This patch implements the necessary steps directly in addr2line, by looking up the symbol (with demangling if needed) and computing the offset. It's possible that a symbol is ambigious with a hex number. In this case it uses the symbol lookup if the string contains a +. When it isn't ambigious the + is optional.
2022-01-11ar: Add --thin for creating thin archivesFangrui Song1-5/+10
In many ar implementations (FreeBSD, elfutils, etc), -T has the X/Open System Interface specified semantics. Therefore -T for thin archives is not recommended for portability. -T is deprecated without diagnostics. PR binutils/28759 * ar.c (long_options): Add --thin. (usage) Add --thin. Deprecate -T without diagnostics. * doc/binutils.texi: Add doc. * NEWS: Mention --thin. * binutils/testsuite/binutils-all/ar.exp: Add tests.
2022-01-02Update year range in copyright notice of binutils filesAlan Modra1-1/+1
The result of running etc/update-copyright.py --this-year, fixing all the files whose mode is changed by the script, plus a build with --enable-maintainer-mode --enable-cgen-maint=yes, then checking out */po/*.pot which we don't update frequently. The copy of cgen was with commit d1dd5fcc38ead reverted as that commit breaks building of bfp opcodes files.
2021-12-21Typo fixes in binutils docAlan Modra1-4/+4
* doc/binutils.texi: Fix typos.
2021-11-29Update description of string's -n option.Nick Clifton1-2/+7
PR 28632 * strings.c (usage): Update desciption of -n option. * doc/binutils.texi: Likewise.
2021-11-17elfedit: Add --output-abiversion option to update ABIVERSIONH.J. Lu1-0/+12
* NEWS: Mention --output-abiversion. * elfedit.c (input_elf_abiversion): New. (output_elf_abiversion): Likewise. (update_elf_header): Update EI_ABIVERSION. (command_line_switch): Add OPTION_INPUT_ABIVERSION and OPTION_OUTPUT_ABIVERSION. (options): Add --input-abiversion and --output-abiversion. (usage): Likewise. (main): Handle --input-abiversion and --output-abiversion. * doc/binutils.texi: Document --input-abiversion and --output-abiversion. * testsuite/binutils-all/elfedit.exp: Run elfedit-6. * testsuite/binutils-all/elfedit-6.d: New file.
2021-11-09Add --unicode option to control how unicode characters are handled by ↵Nick Clifton1-0/+78
display tools. * nm.c: Add --unicode option to control how unicode characters are handled. * objdump.c: Likewise. * readelf.c: Likewise. * strings.c: Likewise. * binutils.texi: Document the new feature. * NEWS: Document the new feature. * testsuite/binutils-all/unicode.exp: New file. * testsuite/binutils-all/nm.hex.unicode * testsuite/binutils-all/strings.escape.unicode * testsuite/binutils-all/objdump.highlight.unicode * testsuite/binutils-all/readelf.invalid.unicode
2021-05-10Restore old behaviour of windres so that options containing spaces are not ↵Thomas Wolff1-4/+3
enclosed in double quotes. PR 4356 PR 26865 PR 27594 * windres.c (quot): Revert previous delta. Do not use double quotes when spaces are detected in options. * doc/binutils.texi (windres): Remove suggestion that the --preprocessor option can take arguments.
2021-04-29Correct the text describing windres's --processor option.Nick Clifton1-1/+6
PR 27594 * doc/binutils.texi (windres): Correct the description of the default value of the --preprocessor argument.
2021-04-21Add ability to select numeric base when displaying symbol values in readelf.Nick Lott1-0/+13
PR 27672 * readelf.c (sym_base): New variable. (enum print_mode): Add more modes. (print_vma): Add suport for new modes. (options): Add sym-base. (usage): Add sym-base. (parse_args): Add support for --sym-base. (print_dynamic_symbol_size): New function. (print_dynamic_symbol): Use new function. * doc/binutils.texi: Document the new feature. * NEWS: Mention the new feature.
2021-03-15Add a symbols-only mode to nm.Nick Clifton1-14/+31
PR 27487 * nm.c (FORMAT_JUST_SYMBOLS): Define. (struct optput_fns): Add entry for FORMAT_JUST_SYMBOLS. (long_options): Add just-symbols. (set_output_format): Add support for just-symbols. (get_print_format): Likewise. (do_not_print_object_filename): New function. (do_not_print_archive_filename): New function. (do_not_print_archive_member): New function. (do_not_print_symbol_filename): New function. (just_print_symbol_name): New function. (main): Handle --just-symbols. * NEWS: Mention the new feature. * doc/binutils.texi: Document the new feature.
2021-03-04Gate the displaying of non-debug sections in separate debuginfo files.Nick Clifton1-1/+29
PR 27478 * objdump.c (process_links): New variable. (usage): Add --process-links. (long_options): Likewise. (dump_bfd): Stop processing once the bfd has been loaded unless this is the main file or process_links has been enabled. (main): Handle the process-links option. * readelf.c (process_links): New variable. (struct filedata): Add is_separate field. (options): Add --process-links. (usage): Likewise. (parse_args): Likewise. (process_file_header): Include the filename when dumping information for separate debuginfo files. (process_program_headers): Likewise. (process_section_headers): Likewise. (process_section_groups): Likewise. (process_relocs): Likewise. (process_dynamic_section): Likewise. (process_version_sections): Likewise. (display_lto_symtab): Likewise. (process_symbol_table): Likewise. (process_syminfo): Likewise. (initialise_dumps_by_name): Likewise. (process_section_contents): Likewise. (process_notes_at): Likewise. (process_notes): Likewise. (open_file): Add is_separate parameter. Use to initialise the is_separate field in the filedata structure. (open_deug): Update call to open_file. (process_object): Add processing of the contents of separate debuginfo files, gated by the process_links variable. (process_archive): Update call to open_file. (process_file): Initialise the is_separate field in the filedata structure. * dwarf.c (load_separate_debug_info_file): Only report the loading of a separate file if debug links are being dumped. * objcopy.c (keep_section_symbols): New variable. (enum command_line_switch): Add OPTION_KEEP_SYMBOLS. (strip_options): Add keep-section-symbols. (copy_options): Likewise. (copy_usage): Likewise. (strip_usage): Likewise. (copy_object): Keep section symbols if requested by command line option. (strip_main): Handle --keep-section-symbols. (copy_main): Likewise. * doc/binutils.texi: Document the new options. * NEWS: Mention the new features. * testsuite/binutils-all/compress.exp (test_gnu_debuglink): Update options passed to objdump. Use diff rather than cmp to compare the dumped data. * testsuite/binutils-all/objdump.WK2: Update regexp. * testsuite/binutils-all/objdump.WK3: Update regexp. * testsuite/binutils-all/objdump.exp: Use --process-links instead of --dwarf=follow-links. * testsuite/binutils-all/readelf.exp (readelf_test): Include readelf's output in the log when the test fails. Add the -P option to the -wKis test. * testsuite/binutils-all/readelf.wKis: Update expected output.
2021-03-01PR27128, nm -P portable output format regressionAlan Modra1-1/+12
Add nm --without-symbol-versions. binutils/ PR 27128 * doc/binutils.texi: Add nm --with-symbol-versions and --without-symbol-versions documentation. * nm.c (with_symbol_versions): New variable. (enum long_option_values): Delete OPTION_WITH_SYMBOL_VERSIONS. (long_options): Make --with-symbol-versions entry twiddle the flag. Add --without-symbol-versions. (print_symname): Strip version when !with_symbol_versions. Add dynamic version info under control of with_symbol_versions. (main): Remove OPTION_WITH_SYMBOL_VERSIONS case. ld/ * testsuite/ld-elf/pr25708.d: Add --with-symbol-versions to nm. * testsuite/ld-elf/pr27128a.d: Likewise. * testsuite/ld-elf/pr27128b.d: Likewise. * testsuite/ld-elf/pr27128c.d: Likewise. * testsuite/ld-elf/pr27128d.d: Likewise. * testsuite/ld-elf/pr27128e.d: Likewise.
2021-02-26nm: Add --quiet to suppress "no symbols" diagnosticFangrui Song1-0/+5
PR binutils/27408 * readelf.c (quiet): New option flag. (enum long_option_values): New enum to hold long option value. (long_options): Add --quiet. (usage): Mention --quiet. (display_rel_file): If quiet is enabled, suppress "no symbols". (main): Handle the new option. * NEWS: Mention --quiet. * docs/binutils.texi: Document --quiet.
2021-02-12Change the readelf and objdump programs so that they will automatically ↵Nick Clifton1-6/+10
follow links to separate debug info files. * configure.ac (follow-debug-links): Add option to enable or disable the following of debug links by default. Set the default for the option to be 'follow'. * dwarf.c (do_follow_links): Initialise with DEFAULT_FOR_FOLLOW_LINKS. (dwarf_select_sections_by_names): Add no-follow-links option. (dwarf_select_sections_by_letter): Add 'N' option. * objdump.c (usage): Add conditional text describing the follow links option. (slurp_symtab): Ensure that there is a NULL entry at the end of the symbol table. (slurp_dynamic_symtab): Likewise. (dump_bfd): When extending the symbol table, ensure that there is still a NULL entry at the end. * readelf.c (usage): Add conditional text describing the follow links option. * doc/binutils.texi: Update documentation for objcopy and readelf. * doc/debug.options.texi: Update documentation of the follow-links option. * config.in: Regenerate. * configure: Regenerate. * testsuite/binutils-all/compress.exp: Add the -WN option to objdump command lines that are not expecting to follow links. * testsuite/binutils-all/readelf.exp: Add the --debug-dump=no-follow-links option to tests that are not expecting to follow debug links. gas * testsuite/gas/mach-o/sections-1.d: Stop automatic debug link following. * testsuite/gas/xgate/insns-dwarf2.d: Likewise. ld * testsuite/ld-elf/sec64k.exp: Stop readelf from automatically following debug links.
2021-01-01PR27116, Spelling errors found by Debian style checkerAlan Modra1-1/+1
PR 27116 bfd/ * xcofflink.c: Correct spelling in comments. binutils/ * coffgrok.c (do_type): Correct spelling of auxiliary in errors. * doc/binutils.texi: Correct grammar. * readelf.c (process_version_sections): Correct spelling of auxiliary in warning. * testsuite/binutils-all/vax/objdump.exp: Comment grammar fix. config/ * override.m4: Correct comment grammar. gas/ * config/tc-i386.c: Correct comment spelling. * config/tc-riscv.c: Likewise. * config/tc-s390.c: Correct comment grammar. * doc/c-i386.texi: Correct spelling. * doc/c-s390.texi: Correct grammar. gold/ * tilegx.cc: Correct comment spelling. gprof/ * README: Correct grammar. * gprof.texi: Likewise. include/ * coff/internal.h: Correct comment spelling. * coff/sym.h: Likewise. * opcode/aarch64.h: Likewise. ld/ * configure.tgt: Correct comment grammar. * emultempl/m68hc1xelf.em: Likewise. * ld.texi: Correct grammar.