Commit Graph

4205 Commits

Author SHA1 Message Date
Nick Clifton
5e23c545b9 reset development to true. update version number 2022-08-05 14:02:43 +01:00
Nick Clifton
add65775cc This is the 2.39 release 2022-08-05 11:26:37 +01:00
Nick Clifton
41b6fc466c Stop the linker from complaining about RWX segments on sparc-solaris targets.
PR 29411
	* configure.tgt (ac_default_ld_warn_rwx_segments): Disable for
	sparc-solaris configurations.
2022-07-26 14:31:13 +01:00
Alan Modra
2d300cb937 PR29390, DW_CFA_AARCH64_negate_ra_state vs. DW_CFA_GNU_window_save
PR 29390
binutils/
	* dwarf.c (is_aarch64, DW_CFA_GNU_window_save_name): New.
	(display_debug_frames): Use them.
	(init_dwarf_regnames_aarch64): Set is_aarch64.
	(init_dwarf_regnames_by_elf_machine_code): Clear is_aarch64.
	(init_dwarf_regnames_by_bfd_arch_and_mach): Likewise.
gas/
	* testsuite/gas/aarch64/pac_ab_key.d: Adjust expected output.
	* testsuite/gas/aarch64/pac_negate_ra_state.d: Likewise.

(cherry picked from commit e4e340a3ff)
2022-07-21 16:37:53 +09:30
Alan Modra
aabc43be52 PR29337, readelf CU/TU mixup in .gdb_index
Commit 244e19c791 changed a number of variables in display_gdb_index
to count entries rather than words.

	PR 29337
	* dwarf.c (display_gdb_index): Correct use of cu_list_elements.

(cherry picked from commit e82295b23d)
2022-07-21 15:04:03 +09:30
Nick Clifton
efbecf1e95 Update version number 2022-07-08 11:12:53 +01:00
Nick Clifton
0bd0932314 Add markers for 2.39 branch 2022-07-08 10:41:07 +01:00
Bhuvanendra Kumar N
ad349f2493 Descriptive DWARF operations dump support for DW_AT_rank
DW_AT_rank is a dwarf-5 feature.
2022-07-06 16:27:47 +05:30
Bhuvanendra Kumar N
4694a0e5fe Support for location and range lists for split-dwarf and dwarf-5.
Adding support for location and range lists for split-dwarf and dwarf-5.
Following issues are taken care.
1. Display of the index values for DW_FORM_loclistx and DW_FORM_rnglistx.
2. Display of .debug_loclists.dwo and .debug_rnglists.dwo sections.

        * dwarf.c(read_and_display_attr_value): Handle DW_FORM_loclistx
        and DW_FORM_rnglistx for .dwo files.
        (process_debug_info): Load .debug_loclists.dwo and
        .debug_rnglists.dwo if exists.
        (load_separate_debug_files): Load .debug_loclists and
        .debug_rnglists if exists.
        Include 2 entries in debug_displays table.
        * dwarf.h (enum dwarf_section_display_enum): Include 2 entries.
2022-07-05 16:56:13 +05:30
Alan Modra
0772daccb3 objcopy: bfd_alloc orelocation
This fixes an inconsequential objcopy memory leak.  I'd normally
ignore reports of leaks like this one, that are merely one block or
fewer per section processed, since objcopy soon exits and frees all
memory.  However I thought it worth providing support for allocating
memory on a bfd objalloc in objcopy and other utils.

	PR 29233
	* bucomm.c (bfd_xalloc): New function.
	* bucomm.h (bfd_xalloc): Declare.
	* objcopy.c (copy_relocations_in_section): Use it to allocate
	array of reloc pointers.  Rewrite code stripping relocs to do
	without extra memory allocation.
2022-07-04 22:51:56 +09:30
Bhuvanendra Kumar N
407115429b Modified changes for split-dwarf and dwarf-5.
* dwarf.c(process_debug_info): Include DW_TAG_skeleton_unit.
        (display_debug_str_offsets): While dumping .debug_str_offsets.dwo,
        pass proper str_offsets_base to fetch_indexed_string().
        (load_separate_debug_files): Skip DWO ID dump for dwarf-5.
2022-07-04 16:42:35 +05:30
Nick Clifton
1dd024239b Add newline to the end of the rnglists displsy. 2022-07-01 15:08:44 +01:00
Nick Clifton
aa40d66bb1 Fix implementation of readelf's -wE and -wN options,
* dwarf.c (dwarf_select_sections_by_name): If the entry's value is
	zero then clear the corresponding variable.
	(dwarf_select_sections_by_letters): Likewise.
	* testsuite/binutils-all/debuginfo.exp: Expect -WE and -wE
	debuginfod tests to fail.
2022-06-30 14:53:02 +01:00
Clément Chigot
fadaf8f7f9 windres: add quotes around preprocessor cmd if needed
This patch ensures that the gcc binary called by windres is quoted if
needed. Otherwise, errors can occur if the gcc is under a folder having
a name containing a space (eg "Program Files").

binutils/
	* resrc.c (DEFAULT_PREPROCESSOR): Split into...
	(DEFAULT_PREPROCESSOR_CMD): that...
	(DEFAULT_PREPROCESSOR_ARGS): and that.
	(look_for_default): Add quotes around the command if needed.
	(read_rc_file): Adapt to new defines.
2022-06-28 16:53:23 +02:00
Nick Clifton
dbcbf67ca5 Fix the display of the idnex values for DW_FORM_loclistx and DW_FORM_rnglistx. Correct the display of .debug.loclists sections.
PR 29267
	* dwarf.c (display_debug_rnglists): New function, broken out of..
	(display_debug_ranges): ... here.
	(read_and_display_attr_value): Correct calculation of index
	displayed for DW_FORM_loclistx and DW_FORM_rnglistx.
	* testsuite/binutils-all/x86-64/pr26808.dump: Update expected
	output.
2022-06-28 12:30:19 +01:00
Nick Clifton
e3e5ae0493 Replace a run-time assertion failure with a warning message when parsing corrupt DWARF data.
PR 29289
	* dwarf.c (display_debug_names): Replace assert with a warning
	message.
2022-06-27 13:43:02 +01:00
Nick Clifton
e98e7d9a70 Fix NULL pointer indirection when parsing corrupt DWARF data.
PR 29290
	* dwarf.c (read_and_display_attr_value): Check that debug_info_p
	is set before dereferencing it.
2022-06-27 13:30:35 +01:00
Nick Clifton
a3f1431a50 Stop bogus warnings about DWARF indexed string offsets being too big.
* dwarf.c (fetch_indexed_string): Do not use length of first table
	in string section as the length of every table in the section.
	* testsuite/binutils-all/pr26112.r: Update expected output.
2022-06-27 11:49:14 +01:00
Jan Beulich
ddd7bf3e28 drop XC16x bits
Commit 04f096fb9e ("Move the xc16x target to the obsolete list") moved
the architecture from the "obsolete but still available" to the
"obsolete / support removed" list in config.bfd, making the architecture
impossible to enable (except maybe via "enable everything" options").

Note that I didn't touch */po/*.po{,t} on the assumption that these
would be updated by some (half)automatic means.
2022-06-27 11:11:46 +02:00
Bhuvanendra Kumar N
2d1388e73c Fix location list offset address dump under DW_AT_location (dwarf-5)
For clang compiled objects with dwarf-5, location list offset address dump
under DW_AT_location is corrected, where DW_FORM_loclistx is used. While
dumping the location list offset, the address dumped is wrong where it was
refering to .debug_addr instead of .debug_loclists

      * dwarf.c (fetch_indexed_value): Add base_address as parameter and
      use it to access the section offset.
      (read_and_display_attr_value): Handle DW_FORM_loclistx form separately.
      Pass loclists_base to fetch_indexed_value().
2022-06-27 13:34:09 +05:30
Kumar N, Bhuvanendra
f18acc9c4e Binutils support for split-dwarf and dwarf-5
* dwarf.c (fetch_indexed_string): Added new parameter
	str_offsets_base to calculate the string offset.
	(read_and_display_attr_value): Read DW_AT_str_offsets_base
	attribute.
	(process_debug_info): While allocating memory and initializing
	debug_information, do it for do_debug_info also, if its true.
	(load_separate_debug_files): Load .debug_str_offsets if exists.
	* dwarf.h (struct debug_info): Add str_offsets_base field.
2022-06-22 17:07:25 +01:00
Marcus Nilsson
4491a7c1aa readelf: replace xmalloc with malloc in slurp_relr_relocs
Using xmalloc makes the null check redundant since failing allocation
will exit the program. Instead use malloc and let the error be
conveyed up the call chain.
2022-06-22 10:36:03 +02:00
Alan Modra
581db2a29b PR29270, DW_FORM_udata signed output
PR 29270
	* dwarf.c (read_and_display_attr_value): Output DW_FORM_udata
	as unsigned.
2022-06-22 12:36:51 +09:30
Nick Clifton
ec41dd75c8 Binutils support for dwarf-5 (location and range lists related)
* dwarf.h (struct debug_info): Add rnglists_base field.
	* dwarf.c (read_and_display_attr_value): Read attribute DW_AT_rnglists_base.
	(display_debug_rnglists_list): While handling DW_RLE_base_addressx,
  	DW_RLE_startx_endx, DW_RLE_startx_length items, pass the proper parameter
	value to fetch_indexed_addr(), i.e. fetch the proper entry in .debug_addr section.
	(display_debug_ranges): Add rnglists_base to the .debug_rnglists base address.
	(load_separate_debug_files): Load .debug_addr section, if exists.
2022-06-21 16:37:27 +01:00
Alan Modra
0d02e70b19 PR29262, memory leak in pr_function_type
PR 29262
	* prdbg.c (pr_function_type): Free "s" on failure path.
2022-06-20 10:40:50 +09:30
Alan Modra
8a24927bc8 PR29261, memory leak in parse_stab_struct_fields
PR 29261
	* stabs.c (parse_stab_struct_fields): Free "fields" on failure path.
2022-06-20 10:39:52 +09:30
Alan Modra
d6e1d48c83 PR29255, memory leak in make_tempdir
PR 29255
	* bucomm.c (make_tempdir, make_tempname): Free template on all
	failure paths.
2022-06-17 21:09:06 +09:30
Alan Modra
0ebc886149 PR29254, memory leak in stab_demangle_v3_arg
PR 29254
	* stabs.c (stab_demangle_v3_arg): Free dt on failure path.
2022-06-17 21:08:41 +09:30
Alan Modra
370426d0da Always free matching vector from bfd_check_format_matches
At least one place calling list_matching_formats failed to free the
"matching" vector from bfd_check_format_matches afterwards.  Fix that
by calling free inside list_matching_formats.

binutils/
	* bucomm.c (list_matching_formats): Free arg.
	* addr2line.c (process_file): Adjust to suit.
	* ar.c (open_inarch, ranlib_touch): Likewise.
	* coffdump.c (main): Likewise.
	* nm.c (display_archive, display_file): Likewise.
	* objcopy.c (copy_file): Likewise.
	* objdump.c (display_object_bfd): Likewise.
	* size.c (display_bfd): Likewise.
	* srconv.c (main): Likewise.
ld/
	* ldlang.c (load_symbols): Free "matching".
2022-06-16 15:01:14 +09:30
Alan Modra
68f7e451e5 Restore readelf -wF
Commit 94585d6d44 resulted in readelf -wF failing with
Unrecognized debug letter option 'F'

binutils/
	* dwarf.c (debug_dump_long_opts): Add letter.
	(debug_option_table): New, replacing..
	(opts_table, letter_table): ..these.
	(dwarf_select_sections_by_names): Adjust to suit.  Set
	do_debug_frames outside of loop.
	(dwarf_select_sections_by_letters): Similarly.
gas/
	* testsuite/gas/i386/ehinterp.d: Use readelf -wF.
2022-06-16 09:56:39 +09:30
Alan Modra
45bf072b34 PR29250, readelf erases CIE initial register state
PR 29250
binutils/
	* dwarf.c (display_debug_frames): Set col_type[reg] on sizing
	pass over FDE to cie->col_type[reg] if CIE specifies reg.
	Handle DW_CFA_restore and DW_CFA_restore_extended on second
	pass using the same logic.  Remove unnecessary casts.  Don't
	call frame_need_space on second pass over FDE.
gas/
	* testsuite/gas/i386/ehinterp.d,
	* testsuite/gas/i386/ehinterp.s: New test.
	* testsuite/gas/i386/i386.exp: Run it.
2022-06-16 09:54:55 +09:30
Alan Modra
22b8da0ae7 asan: applying zero offset to NULL pointer
* dwarf.c (fetch_indexed_string): Move initialisation of "curr"
	and "end" after checking for missing section.
2022-06-14 09:56:45 +09:30
Alan Modra
99f647e200 Trailing spaces in objdump -r header
git commit 202be274a4 went a little wild in removing trailing spaces
in gas/testsuite/gas/i386/{secidx.d,secrel.d}, causing
x86_64-w64-mingw32  +FAIL: i386 secrel reloc
x86_64-w64-mingw32  +FAIL: i386 secidx reloc

I could have just replaced the trailing space, but let's fix the
objdump output instead.  Touches lots of testsuite files.
2022-05-31 11:25:09 +09:30
Alan Modra
0e3c1eebb2 Remove use of bfd_uint64_t and similar
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.
2022-05-27 22:08:59 +09:30
Natarajan, Kavitha
f85c0e1e20 Re: Add bionutils support for DWARF v5's DW_OP_addrx
Testsuite files belonging to commit 3ac9da4937.
2022-05-26 09:12:09 +09:30
Natarajan, Kavitha
3ac9da4937 Add bionutils support for DWARF v5's DW_OP_addrx. 2022-05-25 16:10:38 +01:00
Alan Modra
be38442dda PR29171, invalid read causing SIGSEGV
The fix here is to pass "section" down to read_and_display_attr_value.
The test in read_and_display_attr_value is a little bit of hardening.

	PR 29171
	* dwarf.c (display_debug_macro, display_debug_names): Pass section
	to read_and_display_attr_value2.
	(read_and_display_attr_value): Don't attempt to check for .dwo
	section name when section is NULL.
2022-05-24 12:05:39 +09:30
Alan Modra
5fbb38fcc5 PR29170, divide by zero displaying fuzzed .debug_names
PR 29170
	* dwarf.c (display_debug_names): Don't attempt to display bucket
	clashes when bucket count is zero.
2022-05-24 10:52:05 +09:30
Alan Modra
244e19c791 PR29169, invalid read displaying fuzzed .gdb_index
PR 29169
	* dwarf.c (display_gdb_index): Combine sanity checks.  Calculate
	element counts, not word counts.
2022-05-24 09:50:17 +09:30
Nick Clifton
94585d6d44 Stop readekf and objdump from aggressively following links.
* dwarf.c (dwarf_select_sections_by_names): Return zero if no
	sections were selected.
	(dwarf_select_sections_by_letters): Likewise.
	* dwarf.h: (dwarf_select_sections_by_names): Update prototype.
	(dwarf_select_sections_by_letters): Update prototype.
	* objdump.c (might_need_separate_debug_info): New function.
	(dump_bfd): Call new function before attempting to load separate
	debug info files.
	(main): Do not enable dwarf section dumping for -WK or -WN.
	* readelf.c (parse_args): Do not enable dwarf section dumping for
	-wK or -wN.
	(might_need_separate_debug_info): New function.
	(process_object): Call new function before attempting to load
	separate debug info files.
	* testsuite/binutils-all/debuginfo.exp: Expect -WE and -wE
	debuginfod tests to pass.
	* testsuite/binutils-all/objdump.Wk: Add extra regexps.
	* testsuite/binutils-all/readelf.k: Add extra regexps.
2022-05-20 16:55:36 +01:00
Nick Clifton
95086e1e54 Fix potentially uninitialised variables in the Windows tools 2022-05-19 15:05:12 +01:00
Jan Beulich
6db1e45d7b COFF/PE: don't leave zero timestamp after objcopy / strip
Fill the timestamp field suitably for _bfd_XXi_only_swap_filehdr_out().
Instead of re-arranging the present if(), fold this logic with that of
copying the optional header.
2022-05-19 12:44:32 +02:00
Nick Clifton
2c3cc81e06 Add a --no-weak option to nm.
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-18 13:15:22 +01:00
Alan Modra
fa44522195 PR29142, segv in ar with empty archive and libdeps specified
PR 29142
	* ar.c (main): Properly handle libdeps for zero file_count.
2022-05-12 11:49:45 +09:30
Nick Clifton
aa02037b08 nm: use -U as an alias for --defines-only, in line with llvm-nm 2022-05-11 13:54:30 +01:00
Nick Clifton
b773a1808d Fix compiling binutils/resbin.c with Clang version 14 2022-05-10 12:41:56 +01:00
Jan Beulich
3569f4ab7e Dwarf: rename yet another instance of "index"
As before, on sufficiently old glibc this conflicts with a global
identifier in the library headers. While there also zap the unusual
padding by blanks.
2022-05-04 08:36:14 +02:00
Nick Clifton
ba951afb99 Add a linker warning when creating potentially dangerous executable segments. Add tests, options to disabke and configure switches to choose defaults. 2022-05-03 11:42:24 +01:00
Andrew Burgess
4bb461e42c objdump: fix styled printing of addresses
Previous work to add styled disassembler output missed a case in
objdump_print_addr, which is fixed in this commit.
2022-05-03 10:51:21 +01:00
Nick Clifton
0d38576a34 Emit a note warning the user that creating an executable stack because of a missing .note.GNU-stack section is deprecated.
PR 29072
bfd	* elflink.c (bfd_elf_size_dynamic_sections): Display a note to the
	user that the current ehaviour of creating an executable stack
	because of a missing .note.GNU-stack section is deprecated and
	will be changed in a future release.

binutils* testsuite/lib/binutils-common.exp (prune_warnings_extra): Filter
	out notes about the executable stacjk behaviour beign deprecated.

ld	* testsuite/ld-elf/pr29072.b.warn: Update to include the note
	about the linker's behaviour being depreccated.
2022-04-25 12:53:08 +01:00