Age | Commit message (Collapse) | Author | Files | Lines |
|
This commit gives DWARF register numbers to the RISC-V CSRs inline
with the RISC-V ELF specification here:
https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md
The CSRs are defined being numbered from 4096 to 8191.
This adds support to the assembler, required in order to reference
CSRs in, for example .cfi directives.
I have then extended dwarf.c in order to support printing CSR names in
the dumped DWARF output. As the CSR name space is quite large and
only sparsely populated, I have provided a new function to perform
RISC-V DWARF register name lookup which uses a switch statement rather
than the table base approach that other architectures use.
Any CSR that does not have a known name will return a name based on
'csr%d' with the %d being replaced by the offset of the CSR from 4096.
gas/ChangeLog:
* config/tc-riscv.c (tc_riscv_regname_to_dw2regnum): Lookup CSR
names too.
* testsuite/gas/riscv/csr-dw-regnums.d: New file.
* testsuite/gas/riscv/csr-dw-regnums.s: New file.
binutils/ChangeLog:
* dwarf.c (regname_internal_riscv): New function.
(init_dwarf_regnames_riscv): Use new function.
Change-Id: I3f70bc24fa8b3c75744e6775eeeb87db70c7ecfb
|
|
Add a layer of indirection for DWARF register name lookup by
introducing a function pointer. Right now all targets use the same
table based implementation that they always have, however, this will
change in a later commit.
binutils/ChangeLog:
* dwarf.c (typedef dwarf_regname_lookup_ftype): New typedef.
(dwarf_regnames_lookup_func): New static global.
(init_dwarf_regnames_i386): Set dwarf_regnames_lookup_func.
(init_dwarf_regnames_iamcu): Likewise.
(init_dwarf_regnames_x86_64): Likewise.
(init_dwarf_regnames_aarch64): Likewise.
(init_dwarf_regnames_s390): Likewise.
(init_dwarf_regnames_riscv): Likewise.
(init_dwarf_regnames_by_elf_machine_code): Reset
dwarf_regnames_lookup_func to NULL.
(init_dwarf_regnames_by_bfd_arch_and_mach): Likewise.
(regname_internal_by_table_only): New function.
(regname): Make use of dwarf_regnames_lookup_func.
Change-Id: Ibbff61c0abea32927f35c9e478793039ab8bb57d
|
|
The architecture specific register name initialisation routines no
longer need to be externally visible, so make them static.
binutils/ChangeLog:
* dwarf.c (init_dwarf_regnames_i386): Make static.
(init_dwarf_regnames_iamcu): Make static.
(init_dwarf_regnames_x86_64): Make static.
(init_dwarf_regnames_aarch64): Make static.
(init_dwarf_regnames_s390): Make static.
(init_dwarf_regnames_riscv): Make static.
* dwarf.h (init_dwarf_regnames_i386): Delete declaration.
(init_dwarf_regnames_iamcu): Delete declaration.
(init_dwarf_regnames_x86_64): Delete declaration.
(init_dwarf_regnames_aarch64): Delete declaration.
(init_dwarf_regnames_s390): Delete declaration.
(init_dwarf_regnames_riscv): Delete declaration.
Change-Id: I9e350f76f98f46e9e3dd88d502f2a2a83e44cb36
|
|
Adds a new API function init_dwarf_regnames_by_bfd_arch_and_mach to
initialise the register name state from a BFD architecture and machine
type.
There should be no user visible changes after this commit.
binutils/ChangeLog:
* dwarf.c (init_dwarf_regnames_by_bfd_arch_and_mach): New
function.
* dwarf.h (init_dwarf_regnames_by_bfd_arch_and_mach): Declare.
* objdump.c (dump_dwarf): Call new function instead of calling
specific initialization routines. Restrucure so that eh_addr_size
is still calculated correctly.
Change-Id: I346d665d2079a18ec4d04bd41893d0e9dc05e4b3
|
|
As part of a process to change how dwarf.c figures out the correct
name for a register I wanted to clean up how we initialise the
register name tracking state.
As part of this I rename init_dwarf_regnames to
init_dwarf_regnames_by_elf_machine_code, later commits will add a
different entry point to initialise the register name state.
There should be no user visible changes after this commit.
binutils/ChangeLog:
* dwarf.c (init_dwarf_regnames): Renamed to...
(init_dwarf_regnames_by_elf_machine_code): ...this.
* dwarf.h (init_dwarf_regnames): Renamed to...
(init_dwarf_regnames_by_elf_machine_code): ...this.
* readelf.c (process_file_header): Update call to use new name.
Change-Id: Ic8d2ef5fb62a8590ecd8cbb7e6258e11c6263594
|
|
Currently if a target has a large ( > 1024 ) number of registers then
we get a warning when dumping the DWARF whenever a register over the
1024 limit is referenced, this occurs in dwarf.c:frame_need_space.
This check was initially introduced to guard against corrupted DWARF
referencing stupidly large numbers of registers.
The frame_need_space function already has a check in place so that, if
a target specifies a set of known DWARF register names then we must
only reference a register within this set, it is only after this check
that we check for the 1024 limit.
What this means is that if a target DOES NOT define a set of known
register names and if we reference more than 1024 registers
frame_need_space will give a warning.
If a target DOES define a set of known registers and there are more
than 1024 defined registers, and we try to reference a register beyond
1024 we will again get an error.
This second case feels wrong to me. My thinking is that if a target
defines a set of registers then it is not unreasonable to assume the
tools can cope with that number of registers. And so, if the target
defines 2000 named DWARF registers, frame_need_space should allow
access to all of these registers.
If a target does not define a set of named registers then the 1024
limit should remain. This is pretty arbitrary, but we do need to have
some limit in place I think, so for now that seems as good as any.
This is an entirely theoretical fix - there are no targets that define
such large numbers of registers, but while experimenting with adding
support for RISC-V CSRs I ran into this issue and felt like it was a
good improvement.
binutils/ChangeLog:
* dwarf.c (frame_need_space): Compare dwarf_regnames_count against
0, and only warn about large numbers of registers if the number is
more than the dwarf_regnames_count.
Change-Id: Ifac1a999ff0677676e81ee373c4c044b6a700827
|
|
Pointer comparisons after adding an offset just don't work to catch
overflow when the offset is a larger type than the pointer.
PR 25018
* dwarf.c (get_type_signedness): Delete ineffective pointer
comparison check. Properly range check uvalue offset on
recursive call.
(read_and_display_attr_value): Range check uvalue offset before
calling get_type_signedness.
|
|
I don't see a need to calculate "ptr = start + uvalue" then compare
"ptr" with "start" and "end". Given "start <= end" on entry, the
"uvalue" comparison with "max_uvalue" ought to be sufficient to ensure
"start + uvalue" is bounded by "start" and "end" regardless of the
size of pointers and the unsigned dwarf_vma integer type.
* dwarf.c (check_uvalue): Remove unnecessary pointer checks.
|
|
PR 24510
* dwarf.c (MAX_CU_NESTING): New constant.
(level_type_signed): New static array.
(skip_attr_bytes): New function.
(get_type_signedness): New function.
(read_and_print_leb128): New function.
(display_discr_list): New function.
(read_and_display_attr_value): Add start parameter.
Use new functions when handling DW_AT_type and DW_AT_discr_list.
(read_and_display_attr): Add start parameter. Pass to
read_and_display_attr_value.
(process_debug_info): Update call to read_and_display_attr.
(display_formatted_table): Likewise.
(display_debug_lines_decoded): Likewise. Also add start
parameter.
(display_debug_lines): Likewise.
* testsuite/binutils-all/dwarf-attributes.S: Update discrimination
lists.
* testsuite/binutils-all/dwarf-attributes.W: Update expected
output.
|
|
processing a corrupt file.
PR 24829
* dwarf.c (check_uvalue): New function. Ensures that a block's
size is valid.
(read_and_display_attr_value): Use check_value when processsing
DW_FORM_block<n> attributes.
|
|
does not have any columns.
PR 24921
* dwarf.c (process_cu_tu_index): Handle the case where a table
does not have any columns.
|
|
Given 32-bit pointers and a 64-bit bfd_size_type, it is relatively
easy to construct a value of augmentation_data_len (eg. 0x100000000)
that won't fail pointer checks but will print without bounds.
PR 24898
* dwarf.c (display_debug_frames): Use the read_cie check and error
for augmentation data length.
|
|
The actual args to this function are "pointers to pointers to
debug_info".
PR 24911
* dwarf.c (comp_addr_base): Dereference args.
|
|
PR 24798
* dwarf.c (process_cu_tu_index): Avoid integer overflow on 64-bit
systems by casting ncols and nslots expressions to size_t. Display
number of columns and slots before giving up due to buffer overflow.
Use %u to display unsigned ints. Perform more pointer wrap tests.
|
|
as a string, if it is printable.
PR 24809
* dwarf.c (display_debug_names): Display the contents of the
augmentation string, if it is printable.
|
|
by the link following code.
PR 24818
* objdump.c (is_relocateable): Delete.
(load_specific_debug_section): Test the abfd for relocations
directly, rather than relying upon is_relocateable.
(dump_dwarf): Delete initlialization of is_relocateable.
|
|
The SVE DRAWF register names are missing from binutils, this may cause objdump
and readelf to ignore certain DRAWF output as the registers are unknown (most
notably CIEs).
This patch adds the registers in accordance to the "DWARF for ARM(r) 64-bit
Architecture (AARch64) with SVE support" documentation [1].
[1] https://developer.arm.com/docs/100985/latest/dwarf-for-the-arm-64-bit-architecture-aarch64-with-sve-support
binutils/ChangeLog:
* dwarf.c (dwarf_regnames_aarch64): Add SVE registers.
* testsuite/binutils-all/aarch64/sve-dwarf-registers.d: New test.
* testsuite/binutils-all/aarch64/sve-dwarf-registers.s: New test.
|
|
files will also be affected by other dump function, and symbol tables from separate debug info files will be used when disassembling the main file.
* objdump.c (sym_ok): New function.
(find_symbol_for_address): Use new function.
(disassemble_section): Compare sections by name, not pointer.
(dump_dwarf): Move code to initialise byte_get pointer and iterate
over separate debug files from here to ...
(dump_bfd): ... here. Add parameter indicating that a separate
debug info file is being dumped. For main file, pull in the
symbol tables from all separate debug info files.
(display_object): Update call to dump_bfd.
* doc/binutils.texi: Document extened behaviour of the
--dwarf=follow-links option.
* NEWS: Mention this new feature.
* testsuite/binutils-all/objdump.WK2: Update expected output.
* testsuite/binutils-all/objdump.exp (test_follow_debuglink): Add
options and dump file parameters.
Add extra test.
* testsuite/binutils-all/objdump.WK3: New file.
* testsuite/binutils-all/readelf.exp: Change expected output for
readelf -wKis test.
* testsuite/binutils-all/readelf.wKis: New file.
|
|
links to separate debug information files.
PR 23843
* dwarf.h (struct separate_info): New structure for containing
information on separate debug info files.
* dwarf.c (struct dwo_info): New structure for containing dwo
links.
(first_dwo_info): Chain of dwo_info structures.
(first_separate_file): Chain of separate_info structures.
(separate_debug_file, separate_debug_filename): Delete.
(fetch_alt_indirect_string): Scan all separate debug info files
for the requested string.
(add_dwo_info): New function.
(add_dwo_name): New function.
(add_dwo_dir): New function.
(add_dwo_id: New function.
(free_dwo_info): New function.
(read_and_display_attr_value): Store DWO data using the new
functions.
(load_debug_section_with_follow): If necessary, scan the list of
separate debug info files for the requested section.
(add_separate_debug_file): New function.
(load_separate_debug_info): Call add_separate_debug_file to store
the information on the newly loaded file.
(load_dwo_file): Likewise.
(load_separate_debif_file): Rename to load_separate_debug_files.
Change return type to boolean. If following links then attempt to
load all separate debug info files, not just the first one.
(free_debug_memory): Release memory in dwo_info and separate_info
chains.
* objdump.c (dump_dwarf): Iterate over all loaded debg info files.
* readelf.c (process_object): Likewise.
* doc/debug.options.texi: Update descriptions of links and
follow-links options.
* testsuite/binutils-all/objdump.WK2: Update expected output.
* testsuite/binutils-all/readelf.k2: Likewise.
* NEWS: Announce the new feature.
|
|
|
|
This commit moves all aarch64-specific code to deal with CIE structure
introduced in 3a67e1a6b4430374f3073e51bb19347d4c421cfe from
target-independent files to the aarch64 backend.
2018-12-13 Sam Tebbs <sam.tebbs@arm.com>
binutils/
* dwarf.c (read_cie): Add check for 'B'.
gas/
* config/tc-aarch64.h (enum pointer_auth_key,
tc_fde_entry_extras, tc_cie_entry_extras, tc_fde_entry_init_extra,
tc_output_cie_extra, tc_cie_fde_equivalent_extra,
tc_cie_entry_init_extra): Define.
* dw2gencfi.c (struct cie_entry): Add tc_cie_entry_extras invocation.
(alloc_fde_entry, select_cie_for_fde): Add tc_fde_entry_init_extra
invocation.
(output_cie): Add tc_output_cie_extra invocation.
(select_cie_for_fde): Add tc_cie_fde_equivalent_extra invocation.
* dw2gencfi.h (enum pointer_auth_key): Move to config/tc-aarch64.h.
(struct fde_entry): Add tc_fde_entry_extras invocation
|
|
binutils/
* dwarf.c (display_debug_lines_decoded): Add display of is_stmt.
* testsuite/binutils-all/dw5.W: Deal with the consequences.
* testsuite/binutils-all/objdump.WL: Deal with the consequences.
|
|
As indicated by the subject, this patch adds support for the DWARF
expression opcode DW_OP_GNU_variable_value to readelf.
It's pretty much a copy/paste of DW_OP_call_ref with the obvious name
changes for the printf statements. The FIXME comment comes from that
copy/paste.
binutils/ChangeLog:
* dwarf.c (decode_location_expresion): Add case for
DW_OP_GNU_variable_value.
|
|
PR 23431
* dwarf.c (display_formatted_table): Replace "what" parameter
with "is_dir". Expand messages. Fix capitalisation.
* testsuite/binutils-all/dw5.W: Update expected output.
|
|
* objcopy.c (add_specific_symbols): Free buffer on exit.
(add_redefine_syms_file): Close file handle on exit.
(copy_object): Close file handle on early exit.
Free buffer on early exit.
Free gaps buffers once they are no longer needed.
* dwarf.c (display_debug_frames): Free allocated memory on exit.
(load_separate_debug_info): Free allocate memory on early exit.
|
|
* dwarf.c (read_cie): Free allocated memory before returning with
a failure result.
|
|
information.
PR 23062
* dwarf.c (read_and_display_attr_value): Replace assertions with
test and warning message.
|
|
PR 23064
* dwarf.c (process_cu_tu_index): Test for a potential buffer
overrun before copying signature pointer.
|
|
I happened to notice that objdump was not printing "Rust" when showing
the DW_AT_language for a CU:
<10> DW_AT_language : 28 (Unknown: 1c)
This patch adds all the new language constants from DWARF 5 to
binutils/dwarf.c.
2018-04-06 Tom Tromey <tom@tromey.com>
* dwarf.c (read_and_display_attr_value): Add missing DW_LANG
constants from DWARF 5.
|
|
corrupt DWARF information on a 32-bit host.
PR 22905
* dwarf.c (display_debug_ranges): Check that the offset loaded
from the range_entry structure is valid.
|
|
has requested that they be displayed/followed.
PR 22802
* dwarf.c (load_separate_debug_file): Return early if the user is
not interested in debug links.
|
|
Adds a register name table for RiscV so that objdump and readelf can
both use better register names.
binutils/ChangeLog:
* dwarf.c (dwarf_regnames_riscv): New register name table.
(init_dwarf_regnames_riscv): New function.
(init_dwarf_regnames): Add call to initialise RiscV register
names.
* dwarf.h (init_dwarf_regnames_riscv): Declare.
* objdump.c (dump_dwarf): Add call to initialise RiscV register
names.
|
|
|
|
PR 22532
* dwarf.c (read_and_display_attr_value): Add attributes that might
use the DW_FORM_exprloc form, and if so, display the decoded
location expression list.
|
|
This fixed the build with GCC 4.2:
cc1: warnings being treated as errors
binutils-gdb/binutils/dwarf.c: In function ‘load_separate_debug_info’:
binutils-gdb/binutils/dwarf.c:9650: warning: declaration of ‘link’ shadows a global declaration
/usr/include/unistd.h:757: warning: shadowed declaration is here
* dwarf.c (load_separate_debug_info): Rename argument name from
link to xlink.
|
|
* dwarf.c (dwo_name, dwo_dir, dwo_id, dwo_id_len): New variables.
(read_and_display_attr_value): Record dwo variables if requested.
(display_augmentation_data): Rename to display_data and make
generic.
(load_dwo_file): New function. Loads a separate dwarf object
file.
(load_separate_debug_file): Add reporting and loading of separate
dwarf objet files.
* readelf.c (process_section_headers): Add do_debug_links to list
of flags requiring a debug dump.
(display_debug_section): Tidy up code.
* doc/debug.options.texi: Add note that dwo links will also be
followed.
* testsuite/binutils-all/debuglink.s: Tidy code.
* testsuite/binutils-all/dwo.s: New test file.
* testsuite/binutils-all/readelf.wk2: New file - expected output
from readelf.
* testsuite/binutils-all/readelf.exp: Run the new test.
|
|
information files.
Hi Guys,
I am applying the rather large patch attached to this email to enhance
the readelf and objdump programs so that they now have the ability to
follow links to separate debug info files. (As requested by PR
15152). So for example whereas before we had this output:
$ readelf -wi main.exe
Contents of the .debug_info section:
[...]
<15> DW_AT_comp_dir : (alt indirect string, offset: 0x30c)
[...]
With the new option enabled we get:
$ readelf -wiK main.exe
main.exe: Found separate debug info file: dwz.debug
Contents of the .debug_info section (loaded from main.exe):
[...]
<15> DW_AT_comp_dir : (alt indirect string, offset: 0x30c) /home/nickc/Downloads/dwzm
[...]
The link following feature also means that we can get two lots of
output if the same section exists in both the main file and the
separate debug info file:
$ readelf -wiK main.exe
main.exe: Found separate debug info file: dwz.debug
Contents of the .debug_info section (loaded from main.exe):
[...]
Contents of the .debug_info section (loaded from dwz.debug):
[...]
The patch also adds the ability to display the contents of debuglink
sections:
$ readelf -wk main.exe
Contents of the .gnu_debugaltlink section:
Separate debug info file: dwz.debug
Build-ID (0x14 bytes):
c4 a8 89 8d 64 cf 70 8a 35 68 21 f2 ed 24 45 3e 18 7a 7a 93
Naturally there are long versions of these options (=follow-links and
=links). The documentation has been updated as well, and since both
readelf and objdump use the same set of debug display options, I have
moved the text into a separate file. There are also a couple of new
binutils tests to exercise the new behaviour.
There are a couple of missing features in the current patch however,
although I do intend to address them in follow up submissions:
Firstly the code does not check the build-id inside separate debug
info files when it is searching for a file specified by a
.gnu_debugaltlink section. It just assumes that if the file is there,
then it contains the information being sought.
Secondly I have not checked the DWARF-5 version of these link
features, so there will probably be code to add there.
Thirdly I have only implemented link following for the
DW_FORM_GNU_strp_alt format. Other alternate formats (eg
DW_FORM_GNU_ref_alt) have yet to be implemented.
Lastly, whilst implementing this feature I found it necessary to move
some of the global variables used by readelf (eg section_headers) into
a structure that can be passed around. I have moved all of the global
variables that were necessary to get the patch working, but I need to
complete the operation and move the remaining, file-specific variables
(eg dynamic_strings).
Cheers
Nick
binutils PR 15152
* dwarf.h (enum dwarf_section_display_enum): Add gnu_debuglink,
gnu_debugaltlink and separate_debug_str.
(struct dwarf_section): Add filename field.
Add prototypes for load_separate_debug_file, close_debug_file and
open_debug_file.
* dwarf.c (do_debug_links): New.
(do_follow_links): New.
(separate_debug_file, separate_debug_filename): New.
(fetch_alt_indirect_string): New function. Retrieves a string
from the debug string table in the separate debug info file.
(read_and_display_attr_value): Use it with DW_FORM_GNU_strp_alt.
(load_debug_section_with_follow): New function. Like
load_debug_section, but if the first attempt fails, then tries
again in the separate debug info file.
(introduce): New function.
(process_debug_info): Use load_debug_section_with_follow and
introduce.
(load_debug_info): Likewise.
(display_debug_lines_raw): Likewise.
(display_debug_lines_decoded): Likewise.
(display_debug_macinfo): Likewise.
(display_debug_macro): Likewise.
(display_debug_abbrev): Likewise.
(display_debug_loc): Likewise.
(display_debug_str): Likewise.
(display_debug_aranges): Likewise.
(display_debug_addr); Likewise.
(display_debug_frames): Likewise.
(display_gdb_index): Likewise.
(process_cu_tu_index): Likewise.
(load_cu_tu_indexes): Likewise.
(display_debug_links): New function. Displays the contents of a
.gnu_debuglink or .gnu_debugaltlink section.
(calc_gnu_debuglink_ctc32):New function. Calculates a CRC32
value.
(check_gnu_debuglink): New function. Checks the CRC of a
potential separate debug info file.
(parse_gnu_debuglink): New function. Reads a CRC value out of a
.gnu_debuglink section.
(check_gnu_debugaltlink): New function.
(parse_gnu_debugaltlink): New function. Reads the build-id value
out of a .gnu_debugaltlink section.
(load_separate_debug_info): New function. Finds and loads a
separate debug info file.
(load_separate_debug_file): New function. Attempts to find and
follow a link to a separate debug info file.
(free_debug_memory): Free the separate debug info file
information.
(opts_table): Add "follow-links" and "links".
(dwarf_select_sections_by_letters): Add "k" and "K".
(debug_displays): Reformat. Add .gnu-debuglink and
.gnu_debugaltlink.
Add an extra entry for .debug_str in a separate debug info file.
* doc/binutils.texi: Move description of debug dump features
common to both readelf and objdump into...
* objdump.c (usage): Add -Wk and -WK.
(load_specific_debug_section): Initialise the filename field in
the dwarf_section structure.
(close_debug_file): New function.
(open_debug_file): New function.
(dump_dwarf): Load and dump the separate debug info sections.
* readelf.c (struct filedata): New structure. Contains various
variables that used to be global:
(current_file_size, string_table, string_table_length, elf_header)
(section_headers, program_headers, dump_sects, num_dump_sects):
Move into filedata structure.
(cmdline): New global variable. Contains list of sections to dump
by number, as specified on the command line.
Add filedata parameter to most functions.
(load_debug_section): Load the string table if it has not already
been retrieved.
(close_file): New function.
(close_debug_file): New function.
(open_file): New function.
(open_debug_file): New function.
(process_object): Process sections in any separate debug info files.
* doc/debug.options.texi: New file. Add description of =links and
=follow-links options.
* NEWS: Mention the new feature.
* elfcomm.c: Have the byte gte functions take a const pointer.
* elfcomm.h: Update prototypes.
* testsuite/binutils-all/dw5.W: Update expected output.
* testsuite/binutils-all/objdump.WL: Update expected output.
* testsuite/binutils-all/objdump.exp: Add test of -WK and -Wk.
* testsuite/binutils-all/readelf.exp: Add test of -wK and -wk.
* testsuite/binutils-all/readelf.k: New file.
* testsuite/binutils-all/objdump.Wk: New file.
* testsuite/binutils-all/objdump.WK2: New file.
* testsuite/binutils-all/linkdebug.s: New file.
* testsuite/binutils-all/debuglink.s: New file.
gas * testsuite/gas/avr/large-debug-line-table.d: Update expected
output.
* testsuite/gas/elf/dwarf2-11.d: Likewise.
* testsuite/gas/elf/dwarf2-12.d: Likewise.
* testsuite/gas/elf/dwarf2-13.d: Likewise.
* testsuite/gas/elf/dwarf2-14.d: Likewise.
* testsuite/gas/elf/dwarf2-15.d: Likewise.
* testsuite/gas/elf/dwarf2-16.d: Likewise.
* testsuite/gas/elf/dwarf2-17.d: Likewise.
* testsuite/gas/elf/dwarf2-18.d: Likewise.
* testsuite/gas/elf/dwarf2-5.d: Likewise.
* testsuite/gas/elf/dwarf2-6.d: Likewise.
* testsuite/gas/elf/dwarf2-7.d: Likewise.
ld * testsuite/ld-avr/gc-section-debugline.d: Update expected
output.
|
|
This patch is a first pass at fixing readelf message pluralization.
I've deliberately not fixed the "out of memory" errors since it's very
unlikely that they will ever be complaining about not being able to
allocate for a single entry, and a few others where the size is very
unlikely to be 1 byte.
Then there are messages like this one:
"Out of %lu items there are %zu bucket clashes (longest of %zu entries).\n"
I suppose this could be split into three parts, "Of %lu items ",
"there are %zu bucket clashes ", and "(longest of %zu entries).\n",
each part being printed separately, but that might not be ideal for
sentence construction in other languages. For now I'm punting on this
one.
Changes to readelf output require lots of testsuite adjustment..
binutils/
* dwarf.c (read_uleb128): Properly pluralize messages.
(display_debug_lines_raw, display_debug_loc): Likewise.
(display_debug_names, process_cu_tu_index): Likewise.
* od-macho.c (dump_code_signature_superblob): Likewise.
* readelf.c (process_program_headers): Likewise.
(process_section_header, process_relocs): Likewise.
(hppa_process_unwind, arm_process_unwind): Likewise.
(process_dynamic_section, process_version_sections): Likewise.
(process_symbol_table, process_syminfo): Likewise.
(apply_relocations, process_mips_specific): Likewise.
(process_gnu_liblist, process_notes_at): Likewise.
(process_archive): Likewise.
* testsuite/binutils-all/dw2-1.W,
* testsuite/binutils-all/dw2-3.W,
* testsuite/binutils-all/dw2-3gabi.W,
* testsuite/binutils-all/dw5.S,
* testsuite/binutils-all/dw5.W,
* testsuite/binutils-all/i386/compressed-1a.d,
* testsuite/binutils-all/libdw2-compressedgabi.out,
* testsuite/binutils-all/objdump.W,
* testsuite/binutils-all/readelf.r,
* testsuite/binutils-all/readelf.r-64,
* testsuite/binutils-all/x86-64/compressed-1a.d: Update
for pluralization fixes.
gas/
* testsuite/gas/arm/got_prel.d,
* testsuite/gas/elf/dwarf2-1.d,
* testsuite/gas/elf/dwarf2-2.d,
* testsuite/gas/elf/dwarf2-3.d,
* testsuite/gas/elf/dwarf2-5.d,
* testsuite/gas/elf/dwarf2-6.d,
* testsuite/gas/i386/debug1.d,
* testsuite/gas/i386/dw2-compress-1.d,
* testsuite/gas/i386/dw2-compress-3a.d,
* testsuite/gas/i386/dw2-compress-3b.d,
* testsuite/gas/i386/dw2-compressed-1.d,
* testsuite/gas/i386/dw2-compressed-3a.d,
* testsuite/gas/i386/dw2-compressed-3b.d,
* testsuite/gas/i386/ilp32/x86-64-localpic.d,
* testsuite/gas/i386/localpic.d,
* testsuite/gas/i386/x86-64-localpic.d,
* testsuite/gas/ia64/pr13167.d,
* testsuite/gas/mips/loc-swap-2.d,
* testsuite/gas/mips/loc-swap.d,
* testsuite/gas/mips/micromips@loc-swap-2.d,
* testsuite/gas/mips/micromips@loc-swap.d,
* testsuite/gas/mips/mips16-dwarf2-n32.d,
* testsuite/gas/mips/mips16-dwarf2.d,
* testsuite/gas/mips/mips16@loc-swap-2.d,
* testsuite/gas/mips/mips16@loc-swap.d,
* testsuite/gas/mips/mips16e@loc-swap.d,
* testsuite/gas/mmix/bspec-1.d,
* testsuite/gas/mmix/bspec-2.d,
* testsuite/gas/tic6x/unwind-1.d,
* testsuite/gas/tic6x/unwind-2.d,
* testsuite/gas/tic6x/unwind-3.d: Update for pluralization
fixes.
ld/
* testsuite/ld-aarch64/ifunc-13.d,
* testsuite/ld-aarch64/ifunc-15.d,
* testsuite/ld-aarch64/ifunc-20.d,
* testsuite/ld-alpha/tlsbin.rd,
* testsuite/ld-alpha/tlspic.rd,
* testsuite/ld-arm/ifunc-3.rd,
* testsuite/ld-arm/ifunc-9.rd,
* testsuite/ld-arm/unwind-mix.d,
* testsuite/ld-arm/unwind-rel.d,
* testsuite/ld-cris/hiddef1.d,
* testsuite/ld-cris/libdso-13.d,
* testsuite/ld-cris/libdso-2.d,
* testsuite/ld-cris/pr16044.d,
* testsuite/ld-cris/tls-local-63.d,
* testsuite/ld-cris/tls-local-64.d,
* testsuite/ld-cris/tls-und-38.d,
* testsuite/ld-cris/tls-und-42.d,
* testsuite/ld-cris/tls-und-46.d,
* testsuite/ld-cris/tls-und-50.d,
* testsuite/ld-cris/weakref3.d,
* testsuite/ld-cris/weakref4.d,
* testsuite/ld-elf/comm-data2r.rd,
* testsuite/ld-elf/discard1.d,
* testsuite/ld-elf/discard2.d,
* testsuite/ld-elf/pr19539.d,
* testsuite/ld-elf/pr22374-1.r,
* testsuite/ld-elf/pr22374-2.r,
* testsuite/ld-i386/combreloc.d,
* testsuite/ld-i386/emit-relocs-nacl.rd,
* testsuite/ld-i386/emit-relocs.rd,
* testsuite/ld-i386/pr13302.d,
* testsuite/ld-i386/pr17709-nacl.rd,
* testsuite/ld-i386/pr17709.rd,
* testsuite/ld-i386/pr19539.d,
* testsuite/ld-i386/pr19615.d,
* testsuite/ld-i386/pr19636-1a.d,
* testsuite/ld-i386/pr19636-1e.d,
* testsuite/ld-i386/pr19636-1f.d,
* testsuite/ld-i386/pr19636-2a.d,
* testsuite/ld-i386/pr19636-2b.d,
* testsuite/ld-i386/pr19636-2d-nacl.d,
* testsuite/ld-i386/pr19636-2e-nacl.d,
* testsuite/ld-i386/pr19636-3a.d,
* testsuite/ld-i386/pr19636-3d.d,
* testsuite/ld-i386/pr19636-3e.d,
* testsuite/ld-i386/pr19636-4a.d,
* testsuite/ld-i386/pr19645.d,
* testsuite/ld-i386/pr19827-nacl.rd,
* testsuite/ld-i386/pr19827.rd,
* testsuite/ld-i386/pr20253-4a.d,
* testsuite/ld-i386/pr20253-4b.d,
* testsuite/ld-i386/pr20253-5.d,
* testsuite/ld-i386/tlsbin-nacl.rd,
* testsuite/ld-i386/tlsbin.rd,
* testsuite/ld-i386/tlspic-nacl.rd,
* testsuite/ld-i386/tlspic.rd,
* testsuite/ld-i386/undefweakb.d,
* testsuite/ld-ia64/tlsbin.rd,
* testsuite/ld-ia64/tlspic.rd,
* testsuite/ld-ifunc/ifunc-13-i386.d,
* testsuite/ld-ifunc/ifunc-13-x86-64.d,
* testsuite/ld-ifunc/ifunc-15-i386.d,
* testsuite/ld-ifunc/ifunc-15-x86-64.d,
* testsuite/ld-ifunc/ifunc-20-i386.d,
* testsuite/ld-ifunc/ifunc-20-x86-64.d,
* testsuite/ld-ifunc/ifunc-23a-x86.d,
* testsuite/ld-ifunc/ifunc-23b-x86.d,
* testsuite/ld-ifunc/ifunc-23c-x86.d,
* testsuite/ld-ifunc/ifunc-24a-x86.d,
* testsuite/ld-ifunc/ifunc-24b-x86.d,
* testsuite/ld-ifunc/ifunc-24c-x86.d,
* testsuite/ld-ifunc/ifunc-25a-x86.d,
* testsuite/ld-ifunc/ifunc-25b-x86.d,
* testsuite/ld-ifunc/ifunc-25c-x86.d,
* testsuite/ld-m68k/got-1.d,
* testsuite/ld-mips-elf/vxworks1.rd,
* testsuite/ld-powerpc/ambiguousv1.d,
* testsuite/ld-powerpc/ambiguousv1b.d,
* testsuite/ld-powerpc/ambiguousv2.d,
* testsuite/ld-powerpc/ambiguousv2b.d,
* testsuite/ld-powerpc/tlsexe.r,
* testsuite/ld-powerpc/tlsexe32.r,
* testsuite/ld-powerpc/tlsexetoc.r,
* testsuite/ld-powerpc/tlsso.r,
* testsuite/ld-powerpc/tlsso32.r,
* testsuite/ld-powerpc/tlstocso.r,
* testsuite/ld-powerpc/vle-multiseg-1.d,
* testsuite/ld-powerpc/vle-multiseg-2.d,
* testsuite/ld-powerpc/vle-multiseg-3.d,
* testsuite/ld-s390/tlsbin.rd,
* testsuite/ld-s390/tlsbin_64.rd,
* testsuite/ld-s390/tlspic.rd,
* testsuite/ld-s390/tlspic_64.rd,
* testsuite/ld-sh/ld-r-1.d,
* testsuite/ld-sh/sh64/gotplt.d,
* testsuite/ld-sh/shared-1.d,
* testsuite/ld-sh/tlsbin-2.d,
* testsuite/ld-sh/tlspic-2.d,
* testsuite/ld-sparc/gotop32.rd,
* testsuite/ld-sparc/gotop64.rd,
* testsuite/ld-sparc/tlssunpic32.rd,
* testsuite/ld-sparc/tlssunpic64.rd,
* testsuite/ld-sparc/vxworks1-lib.rd,
* testsuite/ld-tic6x/shlib-app-1.rd,
* testsuite/ld-tic6x/shlib-app-1b.rd,
* testsuite/ld-tic6x/shlib-app-1r.rd,
* testsuite/ld-tic6x/shlib-app-1rb.rd,
* testsuite/ld-tic6x/shlib-noindex.rd,
* testsuite/ld-vax-elf/export-class-data.rd,
* testsuite/ld-x86-64/pr13082-1a.d,
* testsuite/ld-x86-64/pr13082-1b.d,
* testsuite/ld-x86-64/pr13082-2a.d,
* testsuite/ld-x86-64/pr13082-2b.d,
* testsuite/ld-x86-64/pr13082-3a.d,
* testsuite/ld-x86-64/pr13082-3c.d,
* testsuite/ld-x86-64/pr13082-4a.d,
* testsuite/ld-x86-64/pr13082-5a.d,
* testsuite/ld-x86-64/pr13082-5b.d,
* testsuite/ld-x86-64/pr13082-6a.d,
* testsuite/ld-x86-64/pr13082-6b.d,
* testsuite/ld-x86-64/pr17709-nacl.rd,
* testsuite/ld-x86-64/pr17709.rd,
* testsuite/ld-x86-64/pr19539a.d,
* testsuite/ld-x86-64/pr19539b.d,
* testsuite/ld-x86-64/pr19615.d,
* testsuite/ld-x86-64/pr19636-1a.d,
* testsuite/ld-x86-64/pr19636-1d.d,
* testsuite/ld-x86-64/pr19636-1e.d,
* testsuite/ld-x86-64/pr19636-2a.d,
* testsuite/ld-x86-64/pr19636-2e.d,
* testsuite/ld-x86-64/pr19636-2f.d,
* testsuite/ld-x86-64/pr19636-3a.d,
* testsuite/ld-x86-64/pr19645.d,
* testsuite/ld-x86-64/pr19807-2b.d,
* testsuite/ld-x86-64/pr19807-2d.d,
* testsuite/ld-x86-64/pr19827-nacl.rd,
* testsuite/ld-x86-64/pr19827.rd,
* testsuite/ld-x86-64/pr20253-4a.d,
* testsuite/ld-x86-64/pr20253-4b.d,
* testsuite/ld-x86-64/pr20253-4d.d,
* testsuite/ld-x86-64/pr20253-4e.d,
* testsuite/ld-x86-64/pr20253-5a.d,
* testsuite/ld-x86-64/pr20253-5b.d,
* testsuite/ld-x86-64/tlsbin-nacl.rd,
* testsuite/ld-x86-64/tlsbin.rd,
* testsuite/ld-x86-64/tlspic-nacl.rd,
* testsuite/ld-x86-64/tlspic.rd,
* testsuite/ld-x86-64/tlspic2-nacl.rd: Update for
pluralization fixes.
|
|
augmentation data.
PR 22386
* dwarf.c (read_cie): Use bfd_size_type for
augmentation_data_len.
(display_augmentation_data): New function.
(display_debug_frames): Use it.
Check for integer overflow when testing augmentation_data_len.
|
|
When displaying the .debug_frame section, the register numbers in the
DW_CFA_def_cfa* statements are read as signed numbers. I have come
across a target that has register 121, encoded as 0x79 in unsigned LEB128.
Interpreting this as signed results in -7, which makes readelf display
"r-7".
The DWARF5 standard (6.4.2.2) states that the register numbers should be
treated as unsigned LEB128.
Simply replacing READ_SLEB with READ_ULEB resulted in warnings like
these:
/home/emaisin/src/binutils-gdb/binutils/dwarf.c: In function ‘display_debug_frames’:
/home/emaisin/src/binutils-gdb/binutils/dwarf.c:355:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if ((var) != _val) \
^
/home/emaisin/src/binutils-gdb/binutils/dwarf.c:7866:8: note: in expansion of macro ‘READ_ULEB’
READ_ULEB (fc->cfa_reg);
^
... so I also changed Frame_Chunk::cfa_reg to an unsigned int.
binutils/ChangeLog:
* dwarf.c (struct Frame_Chunk) <cfa_reg>: Change type to
unsigned int.
(display_debug_frames): Read CFA reg as an unsigned number.
|
|
DW_AT_defaulted and DW_AT_discr_list DWARF attributes.
* dwarf.c (read_and_display_attr_value): Handle DW_AT_endianity,
DW_END_default, DW_END_big, DW_END_little, DW_ATE_UCS,
DW_ATE_ASCII, DW_CC_pass_by_reference, DW_CC_pass_by_value,
DW_CC_GNU_renesas_sh, DW_CC_GNU_borland_fastcall_i386,
DW_AT_decimal_sign, DW_AT_defaulted, DW_AT_discr_list.
(get_TAG_name): Report user generated tag values.
* testsuite/binutils-all/dwarf-attributes.S: New test.
* testsuite/binutils-all/dwarf-attributes.W. Expected output from
readelf.
* testsuite/binutils-all/readelf.exp: Run the new test.
|
|
comp unit that ends before the specified start address.
PR 22249
* dwarf.c (process_debug_info): Skip any comp unit that ends
before dwarf_start_die.
|
|
This patch tidies DWARF header checks, consolidating the "negative"
checks (which are really overflow checks) with the section size
check. In a number of cases this also ensures that small negative
lengths are caught. For instance
hdrptr = start + arange.ar_length + initial_length_size;
if (hdrptr < start || hdrptr > end)
does not detect ar_length in the range [-initial_length_size,-1].
* dwarf.c (process_debug_info): Consolidate header length checks.
(display_debug_pubnames_worker): Use "start" to read header.
Properly check header length and report errors earlier.
Simplify loop printing pubnames.
(get_line_filename_and_dirname): Catch small negative "length"
values.
(display_debug_aranges): Likewise. Report header errors
earlier using standardized message.
(display_debug_names): Likewise.
|
|
Pointer comparisons have traps for the unwary. After adding a large
unknown value to "start", the test "start < end" depends on where
"start" is originally in memory.
PR 22239
* dwarf.c (read_cie): Don't compare "start" and "end" pointers
after adding a possibly wild length to "start", compare the length
to the difference of the pointers instead. Remove now redundant
"negative" length test.
|
|
structure with a small negative size.
PR 22219
* dwarf.c (process_debug_info): Add a check for a negative
cu_length field.
|
|
PR 22154
* dwarf.c (get_line_filename_and_dirname): Add extra checks for
buffer overruns.
|
|
Preprocessor tokens like DWARF_VMA_FMT and BFD_VMA_FMT are not
understood by gettext, and cause the translation string to be
truncated. Even if it were not truncated, we wouldn't want a value
that changes depending on host or configure options to be put in a
translation string.
PR 21732
* dwarf.c (READ_ULEB): Don't use DWARF_VMA_FMT in translated string.
(READ_SLEB): Likewise.
* readelf.c (bfd_vmatoa): New function.
(get_data, get_dynamic_data): Use it for printing error messages.
|
|
When dumping location lists, also dump locview lists that may be
interspersed with them, and bring view pairs next to the corresponding
location list entries.
This patch supports DW_AT_GNU_locviews as a separate attribute for
DWARF4- loc_lists and split (dwo) loclists, as well as DWARF5
loclists.
It also supports, in DWARF5 loclists, the proposed
DW_LLE_GNU_view_pair loclist entry type proposed for DWARF6.
The tests use 32-bit DWARF, even on 64-bit targets, resolving offsets
to constants so as to reduce the risk that relocations be created for
them, or that the offsets be rejected as nonconstants.
The patch also adds an xfail to an unrelated test, namely dw5, so that
no unexpected fails remain on nds32*-elf, one of the tested targets.
Reviewed-by: Alan Modra <amodra@gmail.com>
for include/ChangeLog
* dwarf2.def (DW_AT_GNU_locviews): New.
* dwarf2.h (enum dwarf_location_list_entry_type): Add
DW_LLE_GNU_view_pair.
(DW_LLE_view_pair): Define.
for binutils/ChangeLog
* dwarf.h (debug_info): Add loc_views and num_loc_views.
* dwarf.c (vm1): New constant.
(print_dwarf_view): New function.
(read_and_display_attr_value): Support DW_AT_GNU_locviews.
(process_debug_info): Keep num_loc_offsets and num_loc_views
in sync.
(display_view_pair_list): New function.
(display_loc_list_dwo): Take vstart_ptr; update it. Dump
location view pairs before the range they apply to, when a
viewlist augments the loc list.
(display_loc_list): Likewise. Check view numbers in range
tests.
(display_loclists_list): Likewise. Handle view pair entries,
and warn on trailing ones.
(loc_views): New variable.
(loc_offsets_compar): Compare loc_views if loc_offsets are the
same.
(display_debug_loc): Check and sort loc_views too. Accept
loc_view as expected_start. Skip if lists and views are the
same. Dump locview list separately in order, and pass the
locview list base to each list dump function. Warn and skip
overlap and hole checking if we find loclists and locviews to
not be adjacent.
* testsuite/binutils-all/locview-1.s: New.
* testsuite/binutils-all/readelf.locview-1: New.
* testsuite/binutils-all/locview-2.s: New.
* testsuite/binutils-all/readelf.locview-2: New.
* testsuite/binutils-all/readelf.exp: Run new tests. Fix
option spelling in pr18374 fail message. XFAIL dw5 test on
nds32*-elf.
|
|
PR 21810
* dwarf.c (display_gdb_index): Fix typo in warning message.
|
|
* dwarf.c (last_pointer_size, warned_about_missing_comp_units):
Remove.
(load_debug_info): Remove assignments to those two variables.
|