aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix initiali state of DWARF v5 line number table in BFD libraryNick Clifton2024-04-291-4/+3
| | | | PR 30783
* memory leak in bfd/dwarf2.cAlan Modra2024-04-191-0/+2
| | | | | * dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free dwarf_addr_buffer and dwarf_str_offsets_buffer.
* bfd: make _bfd_section_size_insane part of the public APIAndrew Burgess2024-03-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a BFD user is making use of a function like bfd_get_section_contents to read a section into a pre-allocated buffer, then that BFD user might also want to make use of _bfd_section_size_insane prior to allocating the buffer they intend to use in order to validate that the buffer size that plan to allocate is sane. This commit makes _bfd_section_size_insane public, by renaming it to bfd_section_size_insane. I've updated the existing uses within bfd/, I don't believe this function is used outside of bfd/ currently. One place that I plan to make use of this function is in gdb/gdb_bfd.c, in the function gdb_bfd_get_full_section_contents. This change isn't included in this commit, but will come later if/when this has been merged into bfd. There should be no change in behaviour after this commit. bfd/ * bfd-in2.h (bfd_section_size_insane): Add declaration. * compress.c (bfd_get_full_section_contents): Update for new name of _bfd_section_size_insane. (bfd_init_section_compress_status): Likewise. * dwarf2.c (read_section): Likewise. (_bfd_dwarf2_slurp_debug_info): Likewise. * libbfd.h (_bfd_section_size_insane): Remove declaration. * section.c (_bfd_section_size_insane): Rename to ... (bfd_section_size_insane): ... this. binutils/ * readelf.c (uncompress_section_contents): Update comment to account for new name of _bfd_section_size_insane.
* Re: PR29785, memory bloat after b43771b045fbAlan Modra2024-02-211-4/+6
| | | | | | | | | | | | | Commit 7bd1e04a3532 introduced "dwarf2.c:2152:29: runtime error: shift exponent 64 is too large". This is on the bucket_high_pc calculation which was moved to the top of insert_arange_in_trie where previously it was later, at a point where the overflow could not occur. Move it back and arrange for a duplicate calculation of bucket_high_pc which is also protected from overflow. PR 29785 * dwarf2.c (insert_arange_in_trie): Split bucket_high_pc. Move trie_pc_bits < VMA_BITS into splitting_leaf_will_help.
* PR29785, memory bloat after b43771b045fbSteinar H. Gunderson2024-02-151-5/+25
| | | | | | | | | | Pathological cases of dwarf info with overlapping duplicate memory ranges can cause splitting of trie leaf nodes, which in the worst case will cause memory to increase without bounds. PR 29785 * dwarf2.c (insert_arange_in_trie): Don't split leaf nodes unless that reduces number of elements in at least one node.
* Update year range in copyright notice of binutils filesAlan Modra2024-01-041-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.
* bfd_find_nearest_line leaks dwarf_rnglists_bufferKonstantin Isakov2023-12-111-0/+1
| | | | * dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free dwarf_rnglists_buffer.
* Fix read_ranges for 32-bit longJoseph Myers2023-11-171-1/+1
| | | | | | | | bfd/dwarf2.c:read_ranges compares bfd_vma values against -1UL, which doesn't work correctly when long is 32-bit and bfd_vma is 64-bit (observed as "nm -l" being very slow for mingw64 host; probably causes issues on 32-bit hosts as well as IL32LLP64 cases such as mingw64). Fix by using (bfd_vma) -1 in place of -1UL, as done elsewhere.
* ubsan: dwarf2.c:2232:7: runtime error: index 16 out of boundsAlan Modra2023-04-121-5/+5
| | | | | | | | Except it isn't out of bounds because space for a larger array has been allocated. * dwarf2.c (struct trie_leaf): Make ranges a C99 flexible array. (alloc_trie_leaf, insert_arange_in_trie): Adjust sizing.
* Duplicate DW_AT_call_file leakAlan Modra2023-03-271-2/+5
| | | | | | | | When given two or more DW_AT_call_file for a given function we currently leak the concat memory. * dwarf2.c (scan_unit_for_symbols): Don't leak on duplicate DW_AT_call_file.
* Enhance better_fit() function to prefer function symbols over non-function ↵Nick Clifton2023-02-241-15/+37
| | | | symbols.
* Fix _bfd_elf_find_function so that it can cope with overlapping symbolsNick Clifton2023-02-231-22/+82
|
* Fix the BFD library's find_nearest_line feature to produce consistent results.Nick Clifton2023-02-231-15/+11
| | | | | | | PR 30150 * dwarf2.c (comp_unit_contains_address): Renamed to ... (comp_unit_may_contain_address): this, and added code to return true if the CU's ranges have not yet been computed. (_bfd_dwarf2_find_nearest_line_with_alt): Use the renamed function, simplifying code in the process.
* Re: Resetting section vma after _bfd_dwarf2_find_nearest_lineAlan Modra2023-02-081-1/+1
| | | | | | | | f.bfd_ptr is set too early to be a reliable indicator of good debug info. * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Correct test for debug info being previously found.
* Resetting section vma after _bfd_dwarf2_find_nearest_lineAlan Modra2023-02-061-42/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are failure paths in _bfd_dwarf2_slurp_debug_info that can result in altered section vmas. Also, when setting ET_REL section vmas it's not too difficult to handle cases where the original vma was non-zero, so do that too. This patch was really in response to an addr2line buffer overflow processing a fuzzed mips relocatable object file. The file had a number of .debug_info sections with relocations that included lo16 and hi16 relocs, and in that order. At least one section VMA was non-zero. This resulted in processing of DWARF info twice, once via the call to _bfd_dwarf2_find_nearest_line in _bfd_mips_elf_find_nearest_line, and because that failed leaving VMAs altered, the second via the call in _bfd_elf_find_nearest_line. The first call left entries on mips_hi16_list pointing at buffers allocated during the first call, the second call processed the mips_hi16_list after the buffers had been freed. (At least when running with asan and under valgrind. Under gdb with a non-asan addr2line the second call allocated exactly the same buffer and the bug didn't show.) Now I don't really care too much what happens with fuzzed files, but the logic in _bfd_dwarf2_find_nearest_line is meant to result in only one read of .debug_info, not multiple reads of the same info when there are errors. This patch fixes that problem. * dwarf2.c (struct adjusted_section): Add orig_vma. (unset_sections): Reset vma to it. (place_sections): Handle non-zero vma too. Save orig_vma. (_bfd_dwarf2_slurp_debug_info): Tidy. Correct outdated comment. On error returns after calling place_sections, call unset_sections. (_bfd_dwarf2_find_nearest_line_with_alt): Simplify call to unset_sections.
* Fix a potential illegal memory access in the BFD library when parsing a ↵Nick Clifton2023-01-111-1/+1
| | | | | | | | corrupt DWARF file. PR 29988 * dwarf2.c (read_indexed_address): Fix check for an out of range offset.
* Set dwarf2 stash pointer earlierAlan Modra2023-01-101-2/+1
| | | | | | | | | | | This fixes a memory leak in the vanishingly rare cases (found by fuzzers of course) when something goes wrong in the save_section_vma, htab_create_alloc or alloc_trie_leaf calls before *pinfo is written. If *pinfo is not written, _bfd_dwarf2_cleanup_debug_info won't be able to free that memory. * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Save stash pointer on setting up stash.
* addr2line out of memory on fuzzed fileAlan Modra2023-01-041-0/+8
| | | | | | | | Another case of fuzzers finding the section size sanity checks are avoided with SHT_NOBITS sections. * dwarf2.c (read_section): Check that the DWARF section being read has contents.
* Update year range in copyright notice of binutils filesAlan Modra2023-01-011-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.
* bfd/dwarf2.c: allow use of DWARF5 directory entry 0Alan Modra2022-12-261-13/+10
| | | | | | | | | | | | | | | I think the test for table->files[file].dir being non-zero is wrong for DWARF5 where index zero is allowed and is the current directory of the compilation. Most times this will be covered by the use of table->comp_dir (from DW_AT_comp_dir) in concat_filename but the point of putting the current dir in .debug_line was so the section could stand alone without .debug_info. Also, there is no need to check for table->dirs non-NULL, the table->num_dirs test is sufficient. * dwarf2.c (concat_filename): Correct and simplify tests of directory index.
* Fix illegal memory access parsing corrupt DWARF information.Nick Clifton2022-12-231-1/+2
| | | | | | PR 29936 * dwarf2.c (concat_filename): Fix check for a directory index off the end of the directory table.
* PR29925, Memory leak in find_abstract_instanceAlan Modra2022-12-221-12/+19
| | | | | | | | | | | | | | | | | The testcase in the PR had a variable with both DW_AT_decl_file and DW_AT_specification, where the DW_AT_specification also specified DW_AT_decl_file. This leads to a memory leak as the file name is malloced and duplicates are not expected. I've also changed find_abstract_instance to not use a temp for "name", because that can result in a change in behaviour from the usual last of duplicate attributes wins. PR 29925 * dwarf2.c (find_abstract_instance): Delete "name" variable. Free *filename_ptr before assigning new file name. (scan_unit_for_symbols): Similarly free func->file and var->file before assigning.
* PR29922, SHT_NOBITS section avoids section size sanity checkAlan Modra2022-12-211-3/+9
| | | | | | PR 29922 * dwarf2.c (find_debug_info): Ignore sections without SEC_HAS_CONTENTS.
* PR28834, PR26946 sanity checking section sizeAlan Modra2022-11-111-13/+7
| | | | | | | | | | | | | | | | | | | | | | | This patch provides a new function to sanity check section sizes. It's mostly extracted from what we had in bfd_get_full_section_contents but also handles compressed debug sections. Improvements are: - section file offset is taken into account, - added checks that a compressed section can be read from file. The function is then used when handling multiple .debug_* sections that need to be read into a single buffer, to sanity check sizes before allocating the buffer. PR 26946, PR 28834 * Makefile.am (LIBBFD_H_FILES): Add section.c. * compress.c (bfd_get_full_section_contents): Move section size sanity checks.. * section.c (_bfd_section_size_insane): ..to here. New function. * dwarf2.c (read_section): Use _bfd_section_size_insane. (_bfd_dwarf2_slurp_debug_info): Likewise. * Makefile.in: Regenerate. * libbfd.h: Regenerate.
* ignore DWARF debug information for -gsplit-dwarf with dwarf-5Potharla, Rupesh2022-10-041-1/+11
| | | | | | Skip dwo_id for split dwarf. * dwarf2.c (parse_comp_unit): Skip DWO_id for DW_UT_skeleton.
* PR29573, addr2line doesn't display file/line for local symbolsAlan Modra2022-09-211-18/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | The DWARF standard is clear that DW_AT_linkage_name is optional. Compilers may not provide the attribute on functions and variables, even though the language mangles names. g++ does not for local variables and functions. Without DW_AT_linkage_name, mangled object file symbols can't be directly matched against the source-level DW_AT_name in DWARF info. One possibility is demangling the object file symbols, but that comes with its own set of problems: 1) A demangler might not be available for the compiler/language. 2) Demangling doesn't give the source function name as stored in DW_AT_name. Class and template parameters must be stripped at least. So this patch takes a simpler approach. A symbol matches DWARF info if the DWARF address matches the symbol address, and if the symbol name contains the DWARF name as a sub-string. Very likely the name matching is entirely superfluous. PR 29573 * dwarf.c (lookup_symbol_in_function_table): Match a symbol containing the DWARF source name as a substring. (lookup_symbol_in_variable_table): Likewise. (_bfd_dwarf2_find_nearest_line_with_alt): If stash_find_line_fast returns false, fall back to comp_unit_find_line.
* dwarf2.c: simplify best_fit_len testsAlan Modra2022-09-211-32/+22
| | | | | | | | | * dwarf2.c (lookup_address_in_function_table): Simplify best_fit_len test. (info_hash_lookup_funcinfo): Likewise. (lookup_symbol_in_function_table): Likewise, also reorder tests and check "file" is set. (lookup_symbol_in_variable_table): Reorder tests.
* dwarf2.c: mangle_styleAlan Modra2022-09-211-11/+33
| | | | | | | | | | non_mangled incorrectly returned "true" for Ada. Correct that, and add a few more non-mangled entries. Return a value suitable for passing to cplus_demangle to control demangling. * dwarf2.c: Include demangle.h. (mangle_style): Rename from non_mangled. Return DMGL_* value to suit lang. Adjust all callers.
* dwarf2.c remove varinfo and funcinfo sec fieldAlan Modra2022-09-211-19/+3
| | | | | | | | | | | | | | The "sec" field in these structures is only set and used in lookup functions. It always starts off as NULL. So the only possible effect of the field is to modify the return of the lookup, which was its purpose back in 2005 when HJ fixed PR990. Since then we solved the problem of relocatable object files with the fix for PR2338, so this field is now redundant. * dwarf.c (struct funcinfo, struct varinfo): Remove "sec" field. (lookup_symbol_in_function_table): Don't set or test "sec". (lookup_symbol_in_variable_table): Likewise. (info_hash_lookup_funcinfo, info_hash_lookup_varinfo): Likewise.
* bfd: Add bfd_find_nearest_line_with_altAaron Merey2022-09-061-12/+55
| | | | | | | | | | bfd_find_nearest_line_with_alt functions like bfd_find_nearest_line with the addition of a parameter for specifying the filename of a supplementary debug file such as one referenced by .gnu_debugaltlink or .debug_sup. This patch focuses on implementing bfd_find_nearest_line_with_alt support for ELF/DWARF2 .gnu_debugaltlink. For other targets this function simply sets the invalid_operation bfd_error.
* BFD library: Use entry 0 in directory and filename tables of DWARF-5 debug info.Nick Clifton2022-08-301-28/+58
| | | | | | | | | | | | PR 29529 * dwarf2.c (struct line_info_table): Add new field: use_dir_and_file_0. (concat_filename): Use new field to help select the correct table slot. (read_formatted_entries): Do not skip entry 0. (decode_line_info): Set new field depending upon the version of DWARF being parsed. Initialise filename based upon the setting of the new field.
* bfd: Fix minor bug in read_indexed_address function.rupothar2022-08-271-3/+3
| | | | | read_indexed_address function is using offset_size instead of addr_size while reading addrx forms.
* add splay tree for info_ptr -> CU mappingMartin Liska2022-08-081-10/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While using perf top for MozillaThunderbird I noticed quite some slow dissably call with source code involved. E.g. time ./objdump --start-address=0x0000000004e0dcd0 --stop-address=0x0000000004e0df8b -l -d --no-show-raw-insn -S -C /usr/lib64/thunderbird/libxul.so took 2.071s and I noticed quite some time is spent in find_abstract_instance: 33.46% objdump objdump [.] find_abstract_instance 18.22% objdump objdump [.] arange_add 13.77% objdump objdump [.] read_attribute_value 4.82% objdump objdump [.] comp_unit_maybe_decode_line_info 3.10% objdump libc.so.6 [.] __memset_avx2_unaligned_erms where linked list of CU is iterated when searing for where info_ptr belongs to: : 3452 for (u = unit->prev_unit; u != NULL; u = u->prev_unit) 0.00 : 4c61f7: mov 0x10(%rbx),%rax 0.00 : 4c61fb: test %rax,%rax 0.00 : 4c61fe: je 4c6215 <find_abstract_instance+0x365> : 3453 if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr) 0.00 : 4c6200: cmp 0x60(%rax),%rdx 83.20 : 4c6204: jb 4c620c <find_abstract_instance+0x35c> 0.00 : 4c6206: cmp 0x78(%rax),%rdx 6.89 : 4c620a: jb 4c6270 <find_abstract_instance+0x3c0> : 3452 for (u = unit->prev_unit; u != NULL; u = u->prev_unit) 0.00 : 4c620c: mov 0x10(%rax),%rax 7.90 : 4c6210: test %rax,%rax 0.00 : 4c6213: jne 4c6200 <find_abstract_instance+0x350> The following scan can be replaced with search in a splay tree and with that I can get to 1.5s and there are other symbols where the difference is even bigger. bfd/ChangeLog: PR 29081 * dwarf2.c (struct addr_range): New. (addr_range_intersects): Likewise. (splay_tree_compare_addr_range): Likewise. (splay_tree_free_addr_range): Likewise. (struct dwarf2_debug_file): Add comp_unit_tree. (find_abstract_instance): Use the splay tree when searching for a info_ptr. (stash_comp_unit): Insert to the splay tree. (_bfd_dwarf2_cleanup_debug_info): Clean up the splay tree.
* dwarf: use find_abstract_instance for vars and DW_AT_specificationMartin Liska2022-08-081-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following simple test case fails when dwz is used: $ cat demo.C namespace std { enum { _S_fixed, _S_floatfield = _S_fixed }; struct { struct {}; } __ioinit; } int main() { return 0; } $ g++ demo.C -g && cp a.out b.out && dwz -m xxx.so a.out b.out && objdump -S a.out >/dev/null objdump: DWARF error: could not find variable specification at offset 0x3d3 As seen the reference is defined in xxx.so shared part: $ eu-readelf -w -N a.out | grep -A3 -B3 3d3 decl_column (data1) 11 sibling (ref_udata) [ 387] [ 387] variable abbrev: 30 specification (GNU_ref_alt) [ 3d3] location (exprloc) [ 0] addr 0x404019 [ 396] subprogram abbrev: 32 $ eu-readelf -w -N a.out | less ... Compilation unit at offset 920: Version: 5, Abbreviation section offset: 0, Address size: 8, Offset size: 4 Unit type: partial (3) ... [ 3d3] variable abbrev: 31 name (strp) "__ioinit" decl_file (data1) demo.C (10) decl_line (data1) 6 decl_column (data1) 3 type (ref_udata) [ 3c4] declaration (flag_present) yes With the patch the same output is emitted as before usage of dwz. bfd/ChangeLog: PR 29442 * dwarf2.c (struct varinfo): Use const char * type. (scan_unit_for_symbols): Call find_abstract_instance for DW_AT_specification for variables that can be in a different CU (e.g. done by dwz)
* Stop the linker from complaining about unrecognised DW_FORM-rnglistx and ↵Nick Clifton2022-07-291-0/+5
| | | | | | | | DW_FORM_loclistx format attributes. PR 29424 * dwarf2.c (read_attribute_value): Handle DW_FORM_rnglistx and DW_FORM_loclistx.
* PR29230, segv in lookup_symbol_in_variable_tableAlan Modra2022-06-151-9/+42
| | | | | | | | | | | | | | | The PR23230 testcase uses indexed strings without specifying SW_AT_str_offsets_base. In this case we left u.str with garbage (from u.val) which then led to a segfault when attempting to access the string. Fix that by clearing u.str. The patch also adds missing sanity checks in the recently committed read_indexed_address and read_indexed_string functions. PR 29230 * dwarf2.c (read_indexed_address): Return uint64_t. Sanity check idx. (read_indexed_string): Use uint64_t for str_offset. Sanity check idx. (read_attribute_value): Clear u.str for indexed string forms when DW_AT_str_offsets_base is not yet read or missing.
* asan: NULL deref in scan_unit_for_symbolsAlan Modra2022-06-021-24/+23
| | | | | | | | | | | | | Since commit b43771b045 it has been possible to look up addresses that match a unit with errors, since ranges are added to a trie while the unit is being parsed. On error, parse_comp_unit leaves first_child_die_ptr NULL which results in a NULL info_ptr being passed to scan_unit_for_symbols. Fix this by setting unit->error. Also wrap some overlong lines, and fix some formatting errors. * dwarf2.c: Formatting. (parse_comp_unit): Set unit->error on err_exit path.
* Remove use of bfd_uint64_t and similarAlan Modra2022-05-271-43/+40
| | | | | | | Requiring C99 means that uses of bfd_uint64_t can be replaced with uint64_t, and similarly for bfd_int64_t, BFD_HOST_U_64_BIT, and BFD_HOST_64_BIT. This patch does that, removes #ifdef BFD_HOST_* and tidies a few places that print 64-bit values.
* bfd: Add Support for DW_FORM_strx* and DW_FORM_addrx*Potharla, Rupesh2022-05-261-14/+268
|
* add a trie to map quickly from address range to compilation unitSteinar H. Gunderson2022-05-201-19/+367
| | | | | | | | | | | | | | | | | | | When using perf to profile large binaries, _bfd_dwarf2_find_nearest_line() becomes a hotspot, as perf wants to get line number information (for inline-detection purposes) for each and every sample. In Chromium in particular (the content_shell binary), this entails going through 475k address ranges, which takes a long time when done repeatedly. Add a radix-256 trie over the address space to quickly map address to compilation unit spaces; for content_shell, which is 1.6 GB when some (but not full) debug information turned is on, we go from 6 ms to 0.006 ms (6 µs) for each lookup from address to compilation unit, a 1000x speedup. There is a modest RAM increase of 180 MB in this binary (the existing linked list over ranges uses about 10 MB, and the entire perf job uses between 2–3 GB for a medium-size profile); for smaller binaries with few ranges, there should be hardly any extra RAM usage at all.
* Revert commit 240d6706c6a2Alan Modra2022-04-031-62/+22
| | | | | | | | | | | PR 28592 PR 15994 PR 15935 * dwarf2.c (lookup_address_in_line_info_table): Return bool rather than a range. (comp_unit_find_nearest_line): Likewise. Return true if function info found without line info. (_bfd_dwarf2_find_nearest_line): Revert range handling code.
* bfd/Dwarf2: gas doesn't mangle namesJan Beulich2022-03-291-0/+1
| | | | | | Include the language identifier emitted by gas in the set of ones where no mangled names are expected. Even if there could be "hand-mangled" names, gas doesn't emit DW_AT_linkage_name in the first place.
* bfd/Dwarf2: make find-nearest-line returned function name consistentJan Beulich2022-03-291-2/+3
| | | | | | | | | | | | | | Prior to entering the enclosing "else if()" the earlier associated if() checks function->is_linkage and, if set, uses function->name. The comment in patch context precedes (and explains) the setting function->is_linkage. Yet with the flag set, we should then also return the function name, just like said earlier if() would do when we came here a 2nd time for the same "addr". And indeed passing the same address twice on addr2line's command line would resolve the function for the 2nd instance, but not for the 1st (if this code path is taken). (This, obviously, is particularly relevant when there's no ELF symbol table in the first place, like would be the case - naturally - in PE/COFF binaries, for example.)
* Fix return code in _bfd_dwarf2_find_nearest_line().Steiner H Gunderson2022-03-221-1/+5
| | | | | * dwarf2.c (_bfd_dwarf2_find_nearest_line): if a function name is found, but no line number info, then return a result of 2.
* Reduce O(n2) performance overhead when parsing DWARF unit information.Steiner H Gunderson2022-03-211-33/+60
| | | | | | | PR 28978 * dwarf2.c (scan_unit_for_symbols): When performing second pass, check to see if the function or variable being processed is the same as the previous one.
* Stop the BFD library complaining about compressed dwarf debug string ↵Nick Clifton2022-02-021-2/+6
| | | | | | | | sections being too big. PR 28834 * dwarf2.c (read_section): Change the heuristic that checks for overlarge dwarf debug info sections.
* Update year range in copyright notice of binutils filesAlan Modra2022-01-021-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.
* PR28691, validate dwarf attribute formAlan Modra2021-12-161-56/+128
| | | | | | | | | | | | | | | | | | | | | PR28691 is a fuzzing PR that triggers a non-problem of "output changes per run" with PIEs and/or different compilers. I've closed similar PRs before as wontfix, but I guess there will be no end of this type of PR. The trigger is an attribute that usually takes one of the offset/constant reference DW_FORMs being given an indexed string DW_FORM. The bfd reader doesn't support indexed strings and returns an error string instead. The address of the string varies with PIE runs and/or compiler, and we allow that address to appear in output. Fix this by validating integer attribute forms, as we do for string form attributes. PR 28691 * dwarf2.c (is_str_attr): Rename to.. (is_str_form): ..this. Change param type. Update calls. (is_int_form): New function. (read_attribute_value): Handle DW_FORM_addrx2. (find_abstract_instance): Validate form when using attr.u.val. (scan_unit_for_symbols, parse_comp_unit): Likewise.
* PR28674, objdump crashAlan Modra2021-12-101-1/+1
| | | | | | | | | Not returning an error indication here leaves the attribute uninitialised, which then leads to intemperate behaviour. PR 28674 * dwarf2.c (read_attribute_value): Return NULL on trying to read past end of attributes.
* Tidy commit 49910fd88dcdAlan Modra2021-07-101-6/+3
| | | | | | | | Pointer range checking is UB if the values compared are outside the underlying array elements (plus one). * dwarf2.c (read_address): Remove accidental commit. (read_ranges): Compare offset rather than pointers.