Commit Graph

4855 Commits

Author SHA1 Message Date
Alan Modra
b62b7b641f Re: tekhex test for commit bf0f85df12
* testsuite/binutils-all/objcopy.exp (objcopy_tek2bin): Correct
	isremote to is_remote.
2025-09-06 10:33:16 +09:30
H.J. Lu
3e1716c9fc readelf: Handle 0 sh_entsize of GOT sections
Gold, lld and mold set sh_entsize to 0 on .got and .got.plt sections.
If sh_entsize of GOT sections is 0, assume 8 for ELFCLASS64 and 4 for
ELFCLASS32, except for x32 which uses 8.

	PR binutils/33368
	* readelf.c (process_got_section_contents): Handle 0 sh_entsize
	of GOT sections.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-05 04:56:27 -07:00
Andrew C Aitchison
674628ae3a PR 33360, Correct strings -Ue output
Signed-off-by: Andrew C Aitchison <andrew@aitchison.me.uk>
2025-09-04 07:36:08 +09:30
H.J. Lu
955b8e0939 readelf: Don't change the symbol table
1. Update dump_relr_relocations not to change the symbol table.
2. Update count_relr_relocations and dump_relr_relocations not to
retrieve the same data twice.

binutils/

	PR binutils/33328
	* readelf.c (count_relr_relocations): Add an argument to return
	the retrieved data and remove the FIXME in comments.
	(dump_relr_relocations): Add an argument for the retrieved data.
	Retrieve the data if needed.  Don't change the symbol table and
	remove the FIXME in comments.
	(display_relocations): Get the data from count_relr_relocations
	and pass it to dump_relr_relocations call.
	(process_relocs): Pass NULL to dump_relr_relocations.

ld/

	PR binutils/33328
	* testsuite/ld-i386/dt-relr-2.d: New file.
	* testsuite/ld-i386/dt-relr-2.s: Likewise.
	* testsuite/ld-x86-64/dt-relr-2-x32.d: Likewise.
	* testsuite/ld-x86-64/dt-relr-2.d: Likewise.
	* testsuite/ld-x86-64/dt-relr-2.s: Likewise.
	* testsuite/ld-i386/i386.exp: Run dt-relr-2.
	* testsuite/ld-x86-64/x86-64.exp: Run dt-relr-2 and dt-relr-2-x32.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-03 08:22:33 -07:00
H.J. Lu
5d3a6f777d readelf: Run --got-contents only on ET_DYN/ET_EXEC files
Update "readelf --got-contents" to skip on non-ET_DYN/ET_EXEC files.

	* readelf.c (process_got_section_contents): Skip if not
	ET_DYN/ET_EXEC files.
	* testsuite/binutils-all/readelf-got.d: Removed.
	* testsuite/binutils-all/readelf.exp: Don't run readelf-got.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-03 05:44:54 -07:00
H.J. Lu
8a94d92a46 readelf: Call qsort only if all_relocations_count > 1
Don't call qsort if all_relocations_count < 1.

	PR binutils/33351
	* readelf.c (process_got_section_contents): Call qsort only if
	all_relocations_count > 1.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-03 05:38:23 -07:00
H.J. Lu
eae0da7eb4 readelf: Report if no GOT section found
Update "readelf --got-contents" to report if no GOT section found.

	* readelf.c (process_got_section_contents): Report if no GOT
	section found.
	* testsuite/binutils-all/readelf-got.d: New file.
	* testsuite/binutils-all/readelf.exp: Run readelf-got.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-02 08:29:26 -07:00
H.J. Lu
81e90cf63a readelf: Add --got-contents option
Add --got-contents option to readelf, inspired by the -G option on Solaris,
to display contents of GOT sections:

$ readelf --got-contents libfoo.so

Global Offset Table '.got' contains 1 entry:
 Index:    Address       Reloc         Sym. Name + Addend/Value
     0: 000000200340 R_X86_64_GLOB_DAT foo + 0

Global Offset Table '.got.plt' contains 4 entries:
 Index:    Address       Reloc         Sym. Name + Addend/Value
     0: 000000200348                   200220
     1: 000000200350                   0
     2: 000000200358                   0
     3: 000000200360 R_X86_64_JUMP_SLO bar + 0

When --got-content options are used:

1. Allocate an array, all_relocations, to hold all relocations.
2. Update dump_relr_relocations and dump_relocations to scan relocations
and cache them in all_relocations.  Don't display relocations if not
requested.
3. Add process_got_section_contents to display contents of GOT sections
by matching the GOT entry offset against the cached relocations.
4. Update process_mips_specific to only display the GOT related contents
for --got-contents.

binutils/

	* NEWS: Mention "readelf --got-contents".
	* readelf.c (do_got_section_contents): New.
	(elf_relocation): Likewise.
	(all_relocations_root): Likewise.
	(all_relocations): Likewise.
	(all_relocations_count): Likewise.
	(update_all_relocations): Likewise.
	(dump_relr_relocations): Add a bool argument to indicate if
	relocations should be displayed.  Populate all_relocations if
	do_got_section_contents is true.
	(dump_relocations): Likewise.
	(long_option_values): Add OPTION_GOT_CONTENTS.
	(options): Add --got-contents.
	(usage): Show --got-contents.
	(parse_args): Support --got-contents.
	(display_relocations): Add a bool argument, dump_reloc, to
	indicate if relocations should be displayed.  Call
	update_all_relocations.  Pass dump_reloc to dump_relr_relocations
	and dump_relocations.
	(process_relocs): Check do_got_section_contents.  Handle
	do_got_section_contents for dynamic relocations.
	(process_section_contents): Pass true to display_relocations.
	(process_mips_specific): Add a bool argument, dump_got, to
	indicate if only the GOT related contents should be displayed.
	Display all MIPS specific information if dump_got is false.
	(elf_relocation_cmp): New.
	(display_elf_relocation_at): Likewise.
	(process_got_section_contents): Likewise.
	(process_object): Call process_got_section_contents.
	* doc/binutils.texi: Document --got-contents.

ld/

	* testsuite/ld-i386/binutils.exp: New file.
	* testsuite/ld-i386/got-1.s: Likewise.
	* testsuite/ld-i386/libgot-1a.rd: Likewise.
	* testsuite/ld-i386/libgot-1b.rd: Likewise.
	* testsuite/ld-i386/libgot-1c.rd: Likewise.
	* testsuite/ld-i386/libgot-1d.rd: Likewise.
	* testsuite/ld-x86-64/binutils.exp: Likewise.
	* testsuite/ld-x86-64/got-1.s: Likewise.
	* testsuite/ld-x86-64/libgot-1a-x32.rd: Likewise.
	* testsuite/ld-x86-64/libgot-1a.rd: Likewise.
	* testsuite/ld-x86-64/libgot-1b-x32.rd: Likewise.
	* testsuite/ld-x86-64/libgot-1b.rd: Likewise.
	* testsuite/ld-x86-64/libgot-1c-x32.rd: Likewise.
	* testsuite/ld-x86-64/libgot-1c.rd: Likewise.
	* testsuite/ld-x86-64/libgot-1d-x32.rd: Likewise.
	* testsuite/ld-x86-64/libgot-1d.rd: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-29 06:17:19 -07:00
H.J. Lu
f83ec9ae4a readelf: Update "-D -r" to dump DT_RELR
1. Update dump_relr_relocations to take relr_size, relr_entsize and
relr_offset, instead of a pointer to Elf_Internal_Shdr, as function
arguments.
2. Update process_relocs to call dump_relr_relocations if relocation
type is reltype_relr.

binutils/

	PR binutils/33328
	* readelf.c (dump_relr_relocations): Replace a pointer to
	Elf_Internal_Shdr argument with relr_size, relr_entsize and
	relr_offset.
	(display_relocations): Update the dump_relr_relocations call.
	(process_relocs): Call dump_relr_relocations if relocation type
	is reltype_relr.

ld/

	PR binutils/33328
	* testsuite/ld-i386/dt-relr-1c.d: New file.
	* testsuite/ld-i386/dt-relr-1d.d: Likewise.
	* testsuite/ld-x86-64/dt-relr-1c-x32.d: Likewise.
	* testsuite/ld-x86-64/dt-relr-1c.d: Likewise.
	* testsuite/ld-x86-64/dt-relr-1d-x32.d: Likewise.
	* testsuite/ld-x86-64/dt-relr-1d.d: Likewise.
	* testsuite/ld-i386/i386.exp: Run PR binutils/33328 tests.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-27 18:07:50 -07:00
Alan Modra
93dfa8e923 objcopy "strip without global symbol" test
This binutils test fails with -fsanitize.  NOSANITIZE_CFLAGS isn't
available in the binutils testsuite, and importing it over from ld
requires a huge amount of tcl code to be moved.  So I chose to simply
add -fno-sanitize=all if -fsanitize= is seem in CFLAGS.

	* testsuite/binutils-all/objcopy.exp
	(objcopy_test_without_global_symbol): Add -fno-sanitize=all to
	flags if -fsanitize= is found in CFLAGS_FOR_TARGET.  Tidy use
	of objfile.
2025-08-27 21:45:12 +09:30
Alan Modra
d8867f5d1b tekhex test for commit bf0f85df12
* testsuite/binutils-all/tek2.obj: Change to a 3 byte data file
	that triggers tekhex error fixed by commit bf0f85df12.
	* testsuite/binutils-all/ar.exp: Adjust to suit.
	* testsuite/binutils-all/objcopy.exp (objcopy_tek2bin): New proc.
2025-08-27 21:45:12 +09:30
Alan Modra
3fa891a80c objcopy "Unable to recognise the format of the input file"
This bogus error comes up when trying something like
objcopy -O binary .../binutils/testsuite/binutils-all/tek2.obj xxx

This is an annoying message, as HJ said in
https://sourceware.org/pipermail/binutils/2002-August/021354.html
and removed it for some cases, eg. I can make it go away by specifying
-I tekhex.  The message is also untrue, as objcopy does in fact know
the format of the input file.

I think the message should be limited to ELF input files that are
being handled by the elf64-little, elf64-big, elf32-little or
elf32-big targets, due to libbfd being compiled with limited target
support.  I'm also changing the message a litle.

	* objcopy.c (copy_object): Change "Unable to recognise format"
	message to "Unable to recognise architecture" and only report
	this error for ELF objects lacking their proper target support.
	* testsuite/binutils-all/x86-64/x86-64.exp: Update to suit.
2025-08-27 21:45:12 +09:30
Alan Modra
ab0e81e536 Revert part of commit 8e885fece1
After commit 5e83077d55 we no longer choose a "plugin" target in
objcopy so ibfd->target_defaults can again be used to test whether the
user supplied a target.

	PR 33230
	* objcopy.c (copy_file): Revert change adding a target_defaulted
	variable and passing down to..
	(copy_archive, copy_object): ..here.  Remove target_defaulted
	parameter.  Use ibfd->target_defaulted.
2025-08-27 21:45:12 +09:30
Vladimir Mezentsev
5319c8dec6 MAINTAINERS: Remove my email address
My position was eliminated and I don't have access to my oracle email
account.
You need a new gprofng maintainer.
2025-08-26 02:48:13 +01:00
Jan Beulich
1bfc186f71 MAINTAINERS: move Jim Wilson to Past Maintainers
..., effectively yielding IA-64 maintainer-less, as per his request:
https://sourceware.org/pipermail/binutils/2025-August/143393.html
https://sourceware.org/pipermail/binutils/2025-August/143491.html
Jim - thanks much for your past work.
2025-08-22 07:56:59 +02:00
Alan Modra
fed7c3654c Remove cloudabi support
Apparently the cloudabi project is dead.  The cloudabi support branded
object files with ELFOSABI_CLOUDABI but other than that didn't do much.
2025-08-20 13:26:19 +09:30
Indu Bhagat
09292f4ae2 binutils: dwarf: fix display of large cfa_offset
eh_frame textual dump was not correct when the cfa_offset is a large
value.  The reason is that the dumping code generally assumes the
cfa_offset is an 'int'.

cfa_offset values can be updated by various DWARF opcodes, like:
  - DW_CFA_def_cfa, DW_CFA_def_cfa_offset which bring unsigned leb128
    cfa_offset
  - DW_CFA_def_cfa_sf, DW_CFA_def_cfa_offset_sf which bring signed
    leb128 cfa_offset

Internally, the routines in dwarf.c keep the value as 'uint64_t
cfa_offset'.  That size of the datatype is expected to work for most of
the real-world cases.  Care, however, needs to be taken when it comes
to the signedness of the value.  Fix the buggy behavior by adding an
additional field to track whether the value of cfa_offset is signed or
unsigned and display accordingly for "frames-interp" output.

The display of cfa_offset had issues in both "frames-interp" output
(objdump -WF or do_debug_frames_interp) and the "frames" output.

Add two new tests: cfi-common-10.s uses a large positive cfa_offset
(with "frames output), and cfi-x86_64-2.s uses a negative cfa_offset
(with "frames-interp" output).

ChangeLog:
	* binutils/dwarf.c (frame_display_row): Update format string
	based on signedness.
	(display_debug_frames): Track signedness.  Also fix display of
	cfa_offset using PRIu64 or PRId64 as applicable.
	* gas/testsuite/gas/cfi/cfi.exp: Add two new tests.
	* gas/testsuite/gas/cfi/cfi-common-10.d: New test.
	* gas/testsuite/gas/cfi/cfi-common-10.s: New test.
	* gas/testsuite/gas/cfi/cfi-x86_64-2.d: New test.
	* gas/testsuite/gas/cfi/cfi-x86_64-2.s: New test.
2025-08-19 01:08:06 -07:00
H.J. Lu
7e432e93f8 Limit BFD_SUPPORTS_PLUGINS check to plugin.h and targets.c
Minimize the BFD_SUPPORTS_PLUGINS check to make code more readable and
maintainable by:

1. Update bfd/plugin.h to define plugin functions as static inline if
BFD_SUPPORTS_PLUGINS is 0.
2. Remove BFD_SUPPORTS_PLUGINS check from all bfd and binutils files
except plugin.h and targets.c.
3. Replace the remaining BFD_SUPPORTS_PLUGINS checks with a function so
that plugin availability is checked at run time.

bfd/

	* archive.c: Include plugin.h unconditionally.
	(_bfd_compute_and_write_armap): Remove the BFD_SUPPORTS_PLUGINS
	check.
	* bfd-in.h (bfd_plugin_enabled): New.
	* bfd-in2.h: Regenerated.
	* elflink.c: Include plugin.h unconditionally.
	(elf_link_is_defined_archive_symbol): Remove the
	BFD_SUPPORTS_PLUGINS check.
	* format.c: Include plugin.h unconditionally.
	(bfd_set_lto_type): Remove the BFD_SUPPORTS_PLUGINS check.
	(bfd_check_format_matches): Replace the BFD_SUPPORTS_PLUGINS
	check with the bfd_plugin_enabled call.  Replace plugin_vec
	with bfd_plugin_vec.  Remove the BFD_SUPPORTS_PLUGINS check.
	* plugin.c (bfd_plugin_target_p): Removed.
	* plugin.h (bfd_plugin_vec): New.
	(bfd_plugin_target_p): Likewise.
	(bfd_plugin_set_program_name): New.  Static inline
	function if BFD_SUPPORTS_PLUGINS is 0.
	(bfd_plugin_open_input): Likewise.
	(bfd_plugin_set_plugin): Likewise.
	(bfd_link_plugin_object_p): Likewise.
	(register_ld_plugin_object_p): Likewise.
	(bfd_plugin_close_file_descriptor): Likewise.
	(bfd_plugin_vec): Likewise.
	(bfd_plugin_target_p): Likewise.
	* xtensa-dynconfig.c (xtensa_load_config): Replace the
	BFD_SUPPORTS_PLUGINS check with the bfd_plugin_enabled call.

ar/

	* ar.c: Include plugin.h unconditionally.
	(plugin_target): Removed.
	(usage): Replace the BFD_SUPPORTS_PLUGINS check with the
	bfd_plugin_enabled call.
	(ranlib_usage): Likewise.
	(decode_options): Likewise.
	(ranlib_main): Likewise.
	(main): Call bfd_plugin_set_program_name unconditionally.
	* nm.c: Include plugin.h unconditionally.
	(plugin_target): Removed.
	(usage): Replace the BFD_SUPPORTS_PLUGINS check with the
	bfd_plugin_enabled call.
	(filter_symbols): Remove the BFD_SUPPORTS_PLUGINS check.
	(display_rel_file): Likewise.
	(main): Call bfd_plugin_set_program_name unconditionally.  Replace
	the BFD_SUPPORTS_PLUGINS check with the bfd_plugin_enabled call.
	* objcopy.c: Include plugin.h unconditionally.
	(strip_usage): Replace the BFD_SUPPORTS_PLUGINS check with the
	bfd_plugin_enabled call.
	(copy_archive): Remove the BFD_SUPPORTS_PLUGINS check.  Replace
	BFD_SUPPORTS_PLUGINS with the bfd_plugin_enabled call.
	(copy_file): Likewise.
	(strip_main): Likewise.

ld/

	* ldfile.c: Include plugin.h unconditionally.
	(ldfile_try_open_bfd): Remove the BFD_SUPPORTS_PLUGINS check.
	* ldlang.c: Include plugin.h unconditionally.
	(plugin_insert): Remove the BFD_SUPPORTS_PLUGINS check.
	(plugin_undefs): Likewise.
	(open_input_bfds): Likewise.
	(lang_check): Likewise.
	(lang_gc_sections): Likewise.
	(find_next_input_statement): Likewise.
	(lang_process): Likewise.
	* ldlang.h (lang_input_statement_flags): Likewise.
	* ldlex.h (option_values): Likewise.
	* ldmain.c: Include plugin.h unconditionally.
	(ld_cleanup): Remove the BFD_SUPPORTS_PLUGINS check.
	(main): Likewise.
	(add_archive_element): Likewise.
	* lexsup.c: Include plugin.h unconditionally.
	(ld_options): Remove the BFD_SUPPORTS_PLUGINS check.
	(parse_args): Replace the BFD_SUPPORTS_PLUGINS check with the
	bfd_plugin_enabled call.  Remove the BFD_SUPPORTS_PLUGINS check.
	(help): Append " (ignored)" to plugin options if bfd_plugin_enabled
	return false.
	* libdep_plugin.c: Remove the BFD_SUPPORTS_PLUGINS check.
	* plugin.c: Likewise.
	* testplug.c: Likewise.
	* testplug2.c: Likewise.
	* testplug3.c: Likewise.
	* testplug4.c: Likewise.

Co-Authored-By: Alan Modra <amodra@gmail.com>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-18 17:05:43 -07:00
Alan Modra
74201a3208 Re: windres: don't exit so much on errors in read_coff_rsrc
oss-fuzz found that I missed some error paths in commit 9e68cae4fd.
This fix prevents reads of a NULL pointer in sort_resources.

	* rescoff.c (read_coff_res_dir): Check return of recursive calls
	and read_coff_data_entry calls.  Pass failures up the call chain.
2025-08-19 09:31:06 +09:30
Alan Modra
5e83077d55 Don't choose plugin target in binutils/
Instead make bfd_check_format try the plugin target first when the
user hasn't supplied a target.

bfd/
	* format.c (bfd_check_format_matches): Try for a plugin target
	match first.
	* targets.c (bfd_find_target): Don't specially treat "plugin".
binutils/
	* ar.c (plugin_target): Delete.
	(open_inarch): Don't set target of archive elements.
	(replace_members): Use target rather than plugin_target when
	opening replacement or additional files.
	* arsup.c (plugin_target): Delete.  Replace all uses with NULL.
	(ar_open): Don't set element target.
	* bucomm.h (set_plugin_target): Delete.
	* nm.c (plugin_target): Delete.
	(display_archive): Don't set element target.
	(display_file): Alway use target when opening file.
	* objcopy.c (copy_archive): Don't use plugin target for output
	elements.
	* NEWS: Mention stricter target checking.
2025-08-18 23:05:43 +09:30
Alan Modra
a5858e8136 Sanity check windows resource version len
oss-fuzz generated a total length field of 32, when the header was 40
bytes.  Subtracting gave -8ul for the remaining length..

I think we should be sanity checking the total length given in the
header against the remaining buffer length and the size of the header
each time get_version_header is called.

Possibly vallen should be sanity checked inside get_version_header
too, but I'll leave that to someone else.

	PR 27686
	* resbin.c (bin_to_res_version): Correct error message arg.
	Move len vs. buffer length sanity check..
	(get_version_header): ..to here.  Also sanity check len
	against off.
2025-08-17 22:32:43 +09:30
Alan Modra
28daddd33a Make bfd_check_format better respect given target
bfd_check_format currently does not take much notice of the target
set in its abfd arg, merely checking that target first if
target_defaulted is false.  As the comment says this was due to
complications with archive handling which I think was fixed in
commit f832531609.  It should now be possible to just check the
given target, except for linker input files.  This will speed checking
the target of the first file in archives, which is done in the process
of matching archive targets.

This will no doubt expose some misuse of target options, as found in
the binutils "efi app" tests.

The stricter checking also exposed some errors.  Cris targets gave
"FAIL: objcopy decompress debug sections in archive (reason: unexpected output)"
"FAIL: objcopy decompress debug sections in archive with zlib-gabi (reason: unexpected output)"
without the bfd_generic_archive_p fix.  cris has a default target of
cris-aout which doesn't match objects for any of the cris-elf or
cris-linux targets.  The problem here was that checking the first
object file in archives didn't match but a logic error there meant
bfd_error_wrong_object_format wasn't returned as it should be.  There
was also a possibility of bfd_error_wrong_object_format persisting
from one target check to the next.

bfd/
	* archive.c (bfd_generic_archive_p): Correct object in archive
	target test.
	* format.c (bfd_check_format_matches_lto): Try to match given
	target first even when target_defaulted is set.  Don't try
	other targets if !target_defaulted except for linker input.
	Clear bfd_error before attempted target matches.
	* targets.c (bfd_find_target): Set target_defaulted for
	plugin target.
binutils/
	* bucomm.h (set_plugin_target): Set target_defaulted.
	* testsuite/binutils-all/aarch64/pei-aarch64-little.d: Don't
	wrongly specify both input and output target, just specify
	output.
	* testsuite/binutils-all/loongarch64/pei-loongarch64.d: Likewise.
	* testsuite/binutils-all/riscv/pei-riscv64.d: Likewise.
2025-08-16 10:28:58 +09:30
Alan Modra
46cd7e0dc8 archives and plugin target
Automatically choosing "plugin" for the archive target when plugins
are enabled can result in making archives as specified by the plugin
target vec, ie. COFF style archives (also used by most ELF
binutils targets).  This is wrong for aix, hpux, vms, aout, macho
and possibly other targets, if compatibility with target system
archives matters.

This patch removes archive support entirely from the plugin target.
That means an archive will never get past bfd_check_format with a
target of plugin_vec, even if it is opened using "plugin".  Instead,
archives will have their elements opened using the plugin target
selected is such a way that the plugin target will be tried first in
bfd_check_format and then continue to try other targets if that fails.

The patch tries to avoid opening archives using "plugin" because that
is guaranteed to fail the first target check in bfd_check_format, but
mm.c still does so, and nested archives will also be opened using
"plugin".

The patch also fixes poor arsup.c plugin support.

bfd/
	* plugin.c (plugin_vec): Remove archive support.
	* configure.ac: Remove plugin archive warning, and don't disable
	plugins by default on anything but aout targets.
	* configure: Regenerate.
binutils/
	* bucomm.h (set_plugin_target): New inline function.
	* ar.c: Remove unneeded forward declarations.
	(open_inarch): Don't use "plugin" if defaulting target when
	opening an archive, use "plugin" when opening elements.
	(replace_members): Use "plugin" when opening replacement or
	additional elements.
	* arsup.c: Remove unneeded forward declarations.
	(plugin_target): New.
	(ar_open): Don't open archives using "plugin", use it when
	opening elements.
	(ar_addmod): Use plugin_target.
	(ar_replace): Use plugin_target when opening replacement or
	additional elements.
	(ar_extract): Don't bfd_openr.
	* nm.c (display_archive): Open archive elements using the
	"plugin" target.
2025-08-16 07:37:08 +09:30
H.J. Lu
b71d1202f0 objcopy.c: Re-indent slim LTO IR comment
Re-indent slim LTO IR comment in

commit 9b383903e7
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 12 12:02:08 2025 -0700

    strip: Treat slim GCC/LLVM IR objects the same

	PR binutils/33271
	* objcopy.c (copy_file): Re-indent slim LTO IR comment.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-15 11:05:41 -07:00
Jan Beulich
b3743a2c05 bfd: have objcopy retain unknown ELF section flags
Silently zapping them is certainly wrong. When they're not replaced due
to user request, simply keeping them may not always be correct (we don't
know what such a flag means, after all), but is certainly at least
closer to having the output object still represent what the input object
had.

This introduces new binutils/ testsuite failures, but only for two
targets where most of the tests there fail anyway (amdgcn-elf and
nfp-elf), due to there not being an assembler available.
2025-08-15 12:16:22 +02:00
H.J. Lu
9b383903e7 strip: Treat slim GCC/LLVM IR objects the same
Slim LLVM IR object is a standalone file whose first 4 bytes are 'B',
'C', 0xc0, 0xde.  GCC IR object is regular ELF object with sections
whose names start with .gnu.lto_.* or .gnu.debuglto_.*.  GCC IR object
uses a .gnu.lto_.lto.<some_hash> section to encode the LTO bytecode
information:

struct lto_section
{
  int16_t major_version;
  int16_t minor_version;
  unsigned char slim_object;

  /* Flags is a private field that is not defined publicly.  */
  uint16_t flags;
};

In slim GCC IR object, the slim_object field is non-zero.  Strip should
treat slim GCC/LLVM IR objects the same.  Since strip won't change slim
LLVM IR objects, it should leave slim GCC IR object unchanged even when
asked to remove all IR objects:

1. Set the lto_type field to lto_slim_ir_object for slim LLVM IR object.
2. Always copy slim IR object as unknown object.

bfd/

	PR binutils/33271
	* format.c (bfd_set_lto_type): Set the lto_type field to
	lto_slim_ir_object for slim LLVM IR object.

binutils/

	PR binutils/33271
	* objcopy.c (lto_sections_removed): Removed.
	(copy_archive): Always copy slim IR object as unknown object.
	(copy_file): Likewise.
	(strip_main): Updated.

ld/

	PR binutils/33271
	* testsuite/ld-plugin/lto-binutils.exp: Don't check if fat IR is
	available when running slim IR tests.
	* testsuite/ld-plugin/strip-1a-s-all.nd: Expect full symbol list.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-14 18:12:36 -07:00
Alan Modra
9adb8ba865 objcopy/strip of IR files and is_strip_input
This tidies objcopy/strip handling of IR objects, in the process of
removing the unnecessary is_strip_input flag.

The first thing I noticed when looking at is_strip_input code was that
the abfd->my_archive test in bfd_check_format_matches meant that
plugins were disabled when reading archive elements.  We can instead
disable plugins by setting bfd_no_plugin, so there doesn't seem to be
a need for is_strip_input in objcopy.c:copy_archive.  This isn't
exactly the same, because bfd_no_plugin prevents the plugin target
recognising archive elements in the bfd_check_format_matches loop over
all targets as well as just the first !target_defaulted test.  But
that turns out to be fine.  IR code is handled in copy_archive as for
other unknown format files.  In fact, the only need for the plugin
target when copying archives is when reading symbols for the archive
map.  I've made that plain by moving the plugin target override and
commenting on why it is really needed.

So on to plain object files.  Here, IR code is also copied unchanged,
so there doesn't seem a need for the plugin target there either.  It
isn't quite so simple though, because the objcopy/strip code handling
object files wants to verify the format of the object file.  Allowing
objcopy/strip to copy unknown format files would be a change in
behaviour (and results in mmix testsuite fails, ld-mmix/b-badfil1 and
others).  However, always excluding the plugin target results in a
fail of tests added in commit c2729c37f1.  So I've enabled a plugin
format check only for files that are otherwise unrecognised, and
commented why this is done.  I question the need to objcopy LLVM
bytecode files.

bfd/
	* bfd.c (struct bfd<is_strip_input>): Delete.
	* format.c (bfd_check_format_matches): Delete is_strip_input
	special case code.
	* bfd-in2.h: Regenerate.
binutils/
	* objcopy.c (copy_archive): Don't set is_strip_input.  Always
	set bfd_plugin_no when reading elements.  Enable plugins when
	opening copied elements.
	(check_format_object): Delete.
	(copy_file): Don't enable plugin target here.  Don't set
	is_strip_input.  Set bfd_plugin_no.  Move bfd_core handling
	code earlier to remove goto.  Enable plugin for llvm bytecode.
	Copy slim IR files as unknown objects.
2025-08-14 22:53:46 +09:30
Alan Modra
58abb43bc5 Correct readelf thin archive test
If we have an existing archive, the test may fail due to it being the
wrong format.  Also, downloading bintest.thin.a from a remote host
(before creating it!) is wrong.

	* testsuite/binutils-all/readelf.exp (readelf_thin_archive_test):
	Don't remote_download bintest.thin.a.  Delete lib before
	creating.
2025-08-14 22:53:46 +09:30
Sam James
fb04a67e6f binutils: add ia64 marker in name of testranges-ia64
Otherwise, the same test appears twice, once with PASS, once with UNSUPPORTED
on non-ia64. Just add '(ia64)' to the name so binutils.log is clearer.

	* testsuite/binutils-all/testranges-ia64.d (#name): Add suffix.
2025-08-08 23:17:32 +01:00
Alan Modra
97b6ffe44b Move struct plugin_data_struct to plugin.c
It isn't needed anywhere except plugin.c.  The typedef can disappear.
Also make a forward declaraion for ld_plugin_input_file in plugin.h
so that this header can be used without first including plugin-api.h.

bfd/
	* plugin.h (struct ld_plugin_input_file): Forward declare.
	(struct plugin_data_struct): Move to..
	* plugin.c: ..here.
	(add_symbols): Size plugin_data without using type.
	* archive.c: Don't include plugin-api.h.
	* elflink.c: Likewise.
	* format.c: Likewise.
binutils/
	* ar.c: Don't include plugin-api.h or ansidecl.h.  Only
	include plugin.h when BFD_SUPPORTS_PLUGINS.
	* nm.c: Don't include plugin-api.h.  Only include plugin.h
	when BFD_SUPPORTS_PLUGINS.
	* objcopy.c: Likewise.
ld/
	* ldfile.c: Don't include plugin-api.h.
	* ldmain.c: Likewise.
2025-08-07 22:14:49 +09:30
Pietro Monteiro
bdee554202 Update obsolete autoconf macros
bfd/
	* bfd.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
binutils/
	* configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
gas/
	* acinclude.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
	Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
gprof/
	* configure.ac: Replace AC_OUTPUT(file list) with
	AC_CONFIG_FILES([file list])\nAC_OUTPUT.
libctf/
	* configure.ac: Replace AC_TRY_LINK with AC_LINK_IFELSE.
opcodes/
	* configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
2025-08-07 22:14:49 +09:30
H.J. Lu
c2729c37f1 strip: Don't treat fat IR objects as plugin object
Fat IR objects contains both regular sections and IR sections.  After

commit 717a38e9a0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun May 4 05:12:46 2025 +0800

    strip: Add GCC LTO IR support

"strip --strip-debug" no longer strips debug sections in fat IR objects
since fat IR objects are recognized as plugin object and copied as unknown
objects.  Add a is_strip_input field to bfd to indicate called from strip.
Update bfd_check_format_matches not to treat archive member nor standalone
fat IR object as IR object so that strip can remove debug and IR sections
in fat IR object.  For archive member, it is copied as an unknown object
if the plugin target is in use or it is a slim IR object.  For standalone
fat IR object, it is copied as non-IR object.

bfd/

	PR binutils/33246
	* archive.c: Include "plugin-api.h" and "plugin.h" if plugin is
	enabled.
	(_bfd_compute_and_write_armap): Don't complain plugin is needed
	when the plugin target is in use.
	* bfd-in2.h: Regenerated.
	* bfd.c (bfd): Add is_strip_input.
	* format.c (bfd_set_lto_type): If there is .llvm.lto section,
	set LTO type to lto_fat_ir_object.
	(bfd_check_format_matches): Don't set LTO type when setting
	format.  When called from strip, don't treat archive member nor
	standalone fat IR object as an IR object.
	* plugin.c (bfd_plugin_get_symbols_in_object_only): Copy LTO
	type derived from input sections.

nm/

	PR binutils/33246
	* nm.c (filter_symbols): Don't complain plugin is needed when
	the plugin target is in use.
	(display_rel_file): Likewise.
	* objcopy.c (copy_archive): Set the BFD is_strip_input field of
	archive member to 1 to indicate called from strip.  Also copy
	slim IR archive member as unknown object.
	(copy_file): Set the BFD is_strip_input field of input bfd to
	1 to indicate called from strip.
	(strip_main): Keep .gnu.debuglto_* sections unless all GCC LTO
	sections will be removed.

ld/

	PR binutils/33246
	* testsuite/ld-plugin/lto-binutils.exp (run_pr33246_test): New.
	Run binutils/33246 tests with GCC and Clang.
	* testsuite/ld-plugin/pr33246.c: New file.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-06 04:51:20 -07:00
Alan Modra
b64e0a2816 Remove bfd_check_format_lto
Tidy changes to bfd_check_format_matches made by commit 9b854f169d
which added a bfd_plugin_specified_p test and commit f752be8f91
which added an lto_sections_removed arg.  Both of these changes are
unnecessary if plugin_format is set to bfd_plugin_no before calling
bfd_check_format.  bfd_plugin_no will prevent the plugin object_p
function from returning a match (and in the first case from a segfault
when loading plugins while a plugin is running).  The plugin object_p
function already protected itself from recursive calls by setting
bfd_plugin_no before loading a plugin, but commit 9b854f169d opened
new bfds so they were unprotected.

It isn't strictly necessary to test for bfd_plugin_no in
bfd_check_format_matches but I kept the check to minimise functional
changes.  Close inspection of the patch will notice I've added an
is_linker_input test too.  That also isn't strictly necessary, I
think, but the match_count test was for the linker.  See commit
999d6dff80.

	PR 12291
	PR 12430
	PR 13298
	PR 33198
bfd/
	* format.c (bfd_check_format_lto): Revert to bfd_check_format.
	(bfd_check_format_matches_lto): Revert to bfd_check_format_matches.
	Correct comments.  Manage both the lto_sections_removed and
	bfd_plugin_specified_p cases by testing for bfd_plugin_no.
	* plugin.c (bfd_plugin_get_symbols_in_object_only): Set
	plugin_format to bfd_plugin_no before checking new bfds.
	(try_load_plugin): Comment setting bfd_plugin_no.
	(bfd_plugin_specified_p): Delete.
	* plugin.h (bfd_plugin_specified_p): Delete.
	* bfd-in2.h: Regenerate.
binutils/
	* objcopy.c (copy_archive): Replace bfd_check_format_lto calls
	with bfd_check_format using plugin_format set to bfd_plugin_no.
	(check_format_object): New function.
	(copy_file): Use it.
2025-08-06 08:53:19 +09:30
Alan Modra
059477e4ba windres PR 33244 testcase
Make the windres testing both parse .rc files to binary and back
again.  It's not possible to compare against the original .rc file
unfortunately, but at least this checks for the segfault fixed by
commit 891d1654d7.

	PR 33244
	* testsuite/binutils-all/windres/psql.rc: New file.
	* testsuite/binutils-all/windres/windres.exp: Do a -J res
	-O rc conversion too.  Correct verbose message.
2025-08-04 22:22:39 +09:30
Alan Modra
891d1654d7 Re: resbin: don't pass NULL as printf %s arg
Commit c6c8d0b821 went completely the wrong way.  "key" needs to be
NULL as that reads a different type of data.

	PR 33244
	* resbin.c (get_version_header): Don't pass a NULL key on to
	toosmall.
	(bin_to_res_version): Restore NULL key cases.
2025-08-02 10:20:15 +09:30
Alan Modra
e443ffcf79 ia64 assembler warning breaks ld tests
The "Warning: Explicit stops are ignored in auto mode" results in
failures of a number of run_ld_link_tests because the compiler is run
using -S and then the resulting .s file assembled without suppplying
-x to gas.  Fix that problem by adding -x to ASFLAGS for ia64, and
tweak the binutils link-order test since the source is used in a ld
test too.

ld/
	* testsuite/config/default.exp: Set ASFLAGS to "-x" for ia64.
	Remove unnecessary "global".
binutils/
	* testsuite/binutils-all/link-order.s: Provide explicit stop.
	* testsuite/binutils-all/objcopy.exp: Pass "-x" when building
	link-order test for ia64.
2025-08-01 10:46:27 +09:30
H.J. Lu
3ac83564eb strip: Treat "default" output_target as unspecified
Treat output target as unspecified if it is set to "default".

binutils/

	PR binutils/33230
	* objcopy.c (copy_file): Treat "default" output_target as
	unspecified.

binutils/testsuite/

	PR binutils/33230
	* binutils-all/x86-64/x86-64.exp (run_pr33230_test): New.
	Run binutils/33230 tests with readelf if supported.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-31 06:16:04 -07:00
H.J. Lu
8e885fece1 strip: Don't check target_defaulted in input BFD
The target_defaulted field in BFD is set to true if the target isn't
specified.  After

commit 717a38e9a0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun May 4 05:12:46 2025 +0800

    strip: Add GCC LTO IR support

the target is set to "plugin" if BFD supports plugin when the target
isn't specified nor default.  Update strip to check the input target,
instead of the target_defaulted field in input BFD.

	PR binutils/33230
	* objcopy.c (copy_object): Add a bool argument, target_defaulted,
	to indicate if the input target isn't specified nor default.
	Check it instead of ibfd->target_defaulted.
	(copy_archive): Add a bool argument, target_defaulted, and pass
	it to copy_object.
	(copy_file): Set target_defaulted to true if the input target
	isn't specified and pass it to copy_archive and copy_object.
	* testsuite/binutils-all/x86-64/pr33230.obj.bz2: New file.
	* testsuite/binutils-all/x86-64/x86-64.exp: Run PR binutils/33230
	tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-30 17:45:38 -07:00
Nick Clifton
c6b78229b3 Update release documentation following 2.45 release 2025-07-27 10:55:33 +01:00
Indu Bhagat
a9bab7ab6e readelf: objdump: sframe: fix dumping with section name
Fix PR binutils/33186 - No SFrame dump if section name is not .sframe

When the section name is not ".sframe", ensure that readelf and objdump
are able to dump a section of type SHT_GNU_SFRAME and not fail if the
user specifies the new section name.

For objdump, in dump_dwarf_section (), use the match string of ".sframe"
to find the corresponding debug_displays[] item for SFrame section.
Doing this ensures that any call to dump_dwarf_section () with the
section pointing to the SFrame section (with name possibly different
from ".sframe") will successfully dump the SFrame section.

If the SFrame section is named anything but ".sframe", and user does not
specify the name of the SFrame section either, the documented behaviour
is that the default section name is assumed to be ".sframe".  So the
following (albeit counter intuitive) is expected at this time:

$ readelf -S sort | grep sframe
  [NN] .sframe2          GNU_SFRAME       0000000000NNNNNN  0000NNNN

(Note section name .sframe2).

$ objdump --sframe sort

sort:     file format elf64-x86-64

No .sframe section present

(Similarly for readelf as well).

For objdump, set dump_sframe_section_name to ".sframe" if user specifies
no section name.  In the error checking done in dump_sframe_section, add
the case when user specifies a valid section name but one that does not
contain SFrame section data.  For sections generated with Binutils >=
2.45, this can be checked with section type of SHT_GNU_SFRAME.
Previously these sections were SHT_PROGBITS with name ".sframe".

Similar changes in readelf.

Add a test each for objdump and readelf to dump a renamed section.  Use
gas_sframe_check to limit the execution of these tests only when a gas
supporting SFrame format is present.

binutils/
	PR binutils/33186
	* objdump.c (dump_dwarf_section): Set match to ".sframe" which
	corresponds to the name in the debug_displays[] entry for
	SFrame section.
	(dump_sframe_section): Check if the user specified section name
	contains SFrame data.
	(main): Set default section name to ".sframe".
	* readelf.c (display_debug_section): Adjust checks to find the
	debug_diplays[] item for the input arg SFrame section.
	Use id instead of i, as it is more readable.

binutils/testsuite/
	PR binutils/33186
	* binutils-all/x86-64/objdump-sframe-01.d: New test.
	* binutils-all/x86-64/readelf-sframe-01.d: New test.
	* binutils-all/x86-64/sframe-func.s: New test.
2025-07-25 01:21:29 -07:00
H.J. Lu
f752be8f91 strip: Properly handle LLVM IR bitcode
commit 717a38e9a0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun May 4 05:12:46 2025 +0800

    strip: Add GCC LTO IR support

added "-R .gnu.lto_.*" to strip to remove all GCC LTO sections.  When
"-R .gnu.lto_.*" is used, the plugin target is ignored so that all LTO
sections are stripped as the regular sections.  It works for the slim
GCC LTO IR since the GCC LTO IR is stored in the regular sections.  When
the plugin target is ignored, the GCC LTO IR can be recognized as the
normal object files.  But it doesn't work for the slim LLVM IR which
is stored in a standalone file.

1. Add bfd_check_format_matches_lto and bfd_check_format_lto to take an
argument, lto_sections_removed, to indicate if all LTO sections should
be removed.
2. Update strip to always enable the plugin target so that the plugin
target is enabled when checking for bfd_archive.
3. Update strip to ignore the plugin target for bfd_object when all LTO
sections should be removed.  If the object is unknown, copy it as an
unknown file without any messages.
4. Treat the "-R .llvm.lto" strip option as removing all LTO sections.

bfd/

	PR binutils/33198
	* format.c (bfd_check_format_lto): New function.
	(bfd_check_format): Call bfd_check_format_matches_lto.
	(bfd_check_format_matches): Renamed to ...
	(bfd_check_format_matches_lto): This.  Add an argument,
	lto_sections_removed, to indicate if all LTO sections should be
	removed and don't match the plugin target if lto_sections_removed
	is true.
	(bfd_check_format_matches): Call bfd_check_format_matches_lto.
	* bfd-in2.h: Regenerated.

binutils/

	PR binutils/33198
	* objcopy.c (copy_archive): Call bfd_check_format_lto, instead
	of bfd_check_format, and pass lto_sections_removed.  Remove the
	non-fatal message on unknown element since it will be copied as
	an unknown file.
	(copy_file): Don't check lto_sections_removed when enabling LTO
	plugin in strip.
	(copy_file): Ignore the plugin target first if all LTO sections
	should be removed.  Try with the plugin target next if ignoring
	the plugin target failed to match the format.
	(strip_main): Also set lto_sections_removed for -R .llvm.lto.
	* testsuite/binutils-all/x86-64/pr33198.c: New file.
	* testsuite/binutils-all/x86-64/x86-64.exp (run_pr33198_test):
	New.
	Run binutils/33198 tests.
	* testsuite/lib/binutils-common.exp (llvm_plug_opt): New.
	(CLANG_FOR_TARGET): New.  Set to "clang" for native build if
	"clang -v" reports "clang version".

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-24 06:52:02 -07:00
Nick Clifton
ca8c70d033 Remove steps for adding .dirstamp when creating pre-release tarball 2025-07-22 15:41:11 +01:00
H.J. Lu
014ae6af49 Remove NaCl/arm target support
NaCl has been deprecated:

https://developer.chrome.com/docs/native-client/migration/

It is now in the process of being removed from llvm:

https://github.com/llvm/llvm-project/pull/133661

Remove NaCl/arm target support from bfd, binutils, gas and ld.

bfd/

	* Makefile.am (BFD32_BACKENDS): Remove elf-nacl.lo.
	(BFD32_BACKENDS_CFILES): Remove elf-nacl.c.
	(SOURCE_HFILES): Remove elf-nacl.h.
	* Makefile.in: Regenerated.
	* config.bfd: Add *-*-nacl* to obsolete targets.
	Remove *-*-nacl* targets.
	* configure.ac: Remove nacl target vectors.
	* elf-bfd.h (elf_target_os): Remove is_nacl.
	* elf-nacl.c: Removed.
	* elf-nacl.h: Likewise.
	* elf32-arm.c: Don't include "elf-nacl.h".
	(elf32_arm_nacl_plt0_entry): Removed.
	(elf32_arm_nacl_plt_entry): Likewise.
	(elf32_arm_stub_long_branch_arm_nacl): Likewise.
	(elf32_arm_stub_long_branch_arm_nacl_pic): Likewise.
	(arm_movw_immediate): Likewise.
	(arm_movt_immediate): Likewise.
	(arm_nacl_put_plt0): Likewise.
	(elf32_arm_nacl_link_hash_table_create): Likewise.
	(elf32_arm_nacl_modify_segment_map): Likewise.
	(elf32_arm_nacl_final_write_processing): Likewise.
	(elf32_arm_nacl_plt_sym_val): Likewise.
	(elf32_arm_stub_cmse_branch_thumb_only): Remove
	long_branch_arm_nacl and long_branch_arm_nacl_pic entries.
	(arm_type_of_stub): Updated.
	(elf32_arm_create_or_find_stub_sec): Likewise.
	(arm_stub_required_alignment): Likewise.
	(elf32_arm_allocate_plt_entry): Likewise.
	(elf32_arm_populate_plt_entry): Likewise.
	(elf32_arm_finish_dynamic_sections): Likewise.
	(elf32_arm_output_plt_map_1): Likewise.
	(elf32_arm_output_arch_local_syms): Likewise.
	Remove elf32_arm_nacl_bed.
	* targets.c: Remove NaCl target vectors.
	* bfd-in2.h: Regenerated.
	* configure: Likewise.
	* po/SRC-POTFILES.in: Likewise.

binutils/

	* NEWS: Mention NaCl target support removal.
	* testsuite/lib/binutils-common.exp: Remove NaCl target support.

gas/

	* NEWS: Mention NaCl target support removal.
	* configure.tgt: Likewise.
	* config/tc-arm.c: Remove NaCl target support.
	* testsuite/gas/arm/any-armv8m.d: Likewise.
	* testsuite/gas/arm/any-cmse-main.d: Likewise.
	* testsuite/gas/arm/any-cmse.d: Likewise.
	* testsuite/gas/arm/any-idiv.d: Likewise.
	* testsuite/gas/arm/arch4t-eabi.d: Likewise.
	* testsuite/gas/arm/arch4t.d: Likewise.
	* testsuite/gas/arm/armv8m.base-idiv.d: Likewise.
	* testsuite/gas/arm/armv9-a_arch.d: Likewise.
	* testsuite/gas/arm/attr-abi-hardfp-use-0.d: Likewise.
	* testsuite/gas/arm/attr-abi-hardfp-use-1.d: Likewise.
	* testsuite/gas/arm/attr-abi-hardfp-use-2.d: Likewise.
	* testsuite/gas/arm/attr-abi-hardfp-use-3.d: Likewise.
	* testsuite/gas/arm/attr-any-armv4t.d: Likewise.
	* testsuite/gas/arm/attr-any-thumbv6.d: Likewise.
	* testsuite/gas/arm/attr-arch-assumption.d: Likewise.
	* testsuite/gas/arm/attr-cpu-directive.d: Likewise.
	* testsuite/gas/arm/attr-default.d: Likewise.
	* testsuite/gas/arm/attr-empty-string.d: Likewise.
	* testsuite/gas/arm/attr-ext-fpv5-d16.d: Likewise.
	* testsuite/gas/arm/attr-ext-fpv5.d: Likewise.
	* testsuite/gas/arm/attr-ext-idiv.d: Likewise.
	* testsuite/gas/arm/attr-ext-mp.d: Likewise.
	* testsuite/gas/arm/attr-ext-neon-fp16.d: Likewise.
	* testsuite/gas/arm/attr-ext-neon-vfpv3.d: Likewise.
	* testsuite/gas/arm/attr-ext-neon-vfpv4.d: Likewise.
	* testsuite/gas/arm/attr-ext-sec.d: Likewise.
	* testsuite/gas/arm/attr-ext-vfpv3-d16-fp16.d: Likewise.
	* testsuite/gas/arm/attr-ext-vfpv3-d16.d: Likewise.
	* testsuite/gas/arm/attr-ext-vfpv3-fp16.d: Likewise.
	* testsuite/gas/arm/attr-ext-vfpv3.d: Likewise.
	* testsuite/gas/arm/attr-ext-vfpv3xd-fp.d: Likewise.
	* testsuite/gas/arm/attr-ext-vfpv3xd.d: Likewise.
	* testsuite/gas/arm/attr-ext-vfpv4-d16.d: Likewise.
	* testsuite/gas/arm/attr-ext-vfpv4-sp-d16.d: Likewise.
	* testsuite/gas/arm/attr-ext-vfpv4.d: Likewise.
	* testsuite/gas/arm/attr-march-all.d: Likewise.
	* testsuite/gas/arm/attr-march-armv1.d: Likewise.
	* testsuite/gas/arm/attr-march-armv2.d: Likewise.
	* testsuite/gas/arm/attr-march-armv2a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv2s.d: Likewise.
	* testsuite/gas/arm/attr-march-armv3.d: Likewise.
	* testsuite/gas/arm/attr-march-armv3m.d: Likewise.
	* testsuite/gas/arm/attr-march-armv4.d: Likewise.
	* testsuite/gas/arm/attr-march-armv4t.d: Likewise.
	* testsuite/gas/arm/attr-march-armv4txm.d: Likewise.
	* testsuite/gas/arm/attr-march-armv4xm.d: Likewise.
	* testsuite/gas/arm/attr-march-armv5.d: Likewise.
	* testsuite/gas/arm/attr-march-armv5t.d: Likewise.
	* testsuite/gas/arm/attr-march-armv5te.d: Likewise.
	* testsuite/gas/arm/attr-march-armv5tej.d: Likewise.
	* testsuite/gas/arm/attr-march-armv5texp.d: Likewise.
	* testsuite/gas/arm/attr-march-armv5txm.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6-m+os.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6-m.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6j.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6k+sec.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6k.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6kt2.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6kz.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6kzt2.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6s-m.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6t2.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6z.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6zk.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6zkt2.d: Likewise.
	* testsuite/gas/arm/attr-march-armv6zt2.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7-a+idiv.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7-a+mp.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7-a+sec+virt.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7-a+sec.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7-a+virt.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7-m.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7-r+mp.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7-r.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7em.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7m.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7r.d: Likewise.
	* testsuite/gas/arm/attr-march-armv7ve.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8-a+crypto.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8-a+fp.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8-a+rdma.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8-a+simd.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8-r+crypto.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8-r+fp.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8-r+simd.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8-r.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8_1-a+simd.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8_1-m.main.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8_4-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8_5-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8_6-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8_7-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8_8-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8_9-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv9_1-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv9_2-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv9_3-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv9_4-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv9_5-a.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8m.base.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8m.main.d: Likewise.
	* testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.
	* testsuite/gas/arm/attr-march-iwmmxt.d: Likewise.
	* testsuite/gas/arm/attr-march-iwmmxt2.d: Likewise.
	* testsuite/gas/arm/attr-march-xscale.d: Likewise.
	* testsuite/gas/arm/attr-mcpu.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-arm1020e.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-arm1020t.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-arm1136jf-s.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-arm1136jfs.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-neon-fp16.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-neon.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-softvfp+vfp.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-softvfp.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfp.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfp10-r0.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfp10.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfp3.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfp9.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfpv2.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfpv3-d16.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfpv3.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfpv4-d16.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfpv4.d: Likewise.
	* testsuite/gas/arm/attr-mfpu-vfpxd.d: Likewise.
	* testsuite/gas/arm/attr-names.d: Likewise.
	* testsuite/gas/arm/attr-non-null-terminated-string.d: Likewise.
	* testsuite/gas/arm/attr-order.d: Likewise.
	* testsuite/gas/arm/attr-override-cpu-directive.d: Likewise.
	* testsuite/gas/arm/attr-override-mcpu.d: Likewise.
	* testsuite/gas/arm/bl-local-2.d: Likewise.
	* testsuite/gas/arm/bl-local-v4t.d: Likewise.
	* testsuite/gas/arm/blx-local.d: Likewise.
	* testsuite/gas/arm/branch-reloc.d: Likewise.
	* testsuite/gas/arm/directives.d: Likewise.
	* testsuite/gas/arm/got_prel.d: Likewise.
	* testsuite/gas/arm/mapdir.d: Likewise.
	* testsuite/gas/arm/mapmisc.d: Likewise.
	* testsuite/gas/arm/mapsecs.d: Likewise.
	* testsuite/gas/arm/mapshort-eabi.d: Likewise.
	* testsuite/gas/arm/mov-highregs-any.d: Likewise.
	* testsuite/gas/arm/mov-lowregs-any.d: Likewise.
	* testsuite/gas/arm/note-march-armv2.d: Likewise.
	* testsuite/gas/arm/note-march-armv2a.d: Likewise.
	* testsuite/gas/arm/note-march-armv3.d: Likewise.
	* testsuite/gas/arm/note-march-armv3m.d: Likewise.
	* testsuite/gas/arm/note-march-armv4.d: Likewise.
	* testsuite/gas/arm/note-march-armv4t.d: Likewise.
	* testsuite/gas/arm/note-march-armv5.d: Likewise.
	* testsuite/gas/arm/note-march-armv5t.d: Likewise.
	* testsuite/gas/arm/note-march-armv5te.d: Likewise.
	* testsuite/gas/arm/note-march-iwmmxt.d: Likewise.
	* testsuite/gas/arm/note-march-iwmmxt2.d: Likewise.
	* testsuite/gas/arm/note-march-xscale.d: Likewise.
	* testsuite/gas/arm/pr12198-1.d: Likewise.
	* testsuite/gas/arm/pr12198-2.d: Likewise.
	* testsuite/gas/arm/thumb-eabi.d: Likewise.
	* testsuite/gas/arm/thumb.d: Likewise.
	* testsuite/gas/arm/thumbrel.d: Likewise.
	* config/te-nacl.h: Removed.

ld/

	* Makefile.am (ALL_EMULATION_SOURCES): Remove earmelf_nacl.c and
	and earmelfb_nacl.c.
	Remove NaCl dep files.
	* NEWS: Mention NaCl target support removal.
	* configure.tgt: Remove NaCl target support.
	* Makefile.in: Regenerated.
	* configure: Likewise.
	* po/BLD-POTFILES.in: Likewise.
	* emulparams/armelf_nacl.sh: Removed.
	* emulparams/armelfb_nacl.sh: Likewise.
	* emulparams/elf_nacl.sh: Likewise.
	* testsuite/ld-arm/farcall-arm-nacl-pic.d: Likewise.
	* testsuite/ld-arm/farcall-arm-nacl.d: Likewise.
	* testsuite/ld-arm/farcall-data-nacl.d: Likewise.
	* testsuite/ld-arm/farcall-thumb2-purecode-consecutive-veneer.d:
	Adjusted.
	* testsuite/ld-arm/arm-elf.exp: Remove NaCl target support.
	* testsuite/ld-arm/cortex-a8-far.d: Likewise.
	* testsuite/ld-arm/non-contiguous-arm3.d: Likewise.
	* testsuite/ld-arm/non-contiguous-arm6.d: Likewise.
	* testsuite/ld-elf/binutils.exp: Likewise.
	* testsuite/ld-elf/build-id.exp: Likewise.
	* testsuite/ld-elf/ehdr_start-missing.d: Likewise.
	* testsuite/ld-elf/ehdr_start-shared.d: Likewise.
	* testsuite/ld-elf/ehdr_start-userdef.d: Likewise.
	* testsuite/ld-elf/ehdr_start-weak.d: Likewise.
	* testsuite/ld-elf/ehdr_start.d: Likewise.
	* testsuite/ld-elf/elf.exp: Likewise.
	* testsuite/ld-elf/export-class.exp: Likewise.
	* testsuite/ld-elf/fatal-warnings-1a.d: Likewise.
	* testsuite/ld-elf/fatal-warnings-1b.d: Likewise.
	* testsuite/ld-elf/orphan-region.d: Likewise.
	* testsuite/ld-elf/package-note.exp: Likewise.
	* testsuite/ld-elf/pr16322.d: Likewise.
	* testsuite/ld-elf/pr16498a.d: Likewise.
	* testsuite/ld-elf/pr16498b.d: Likewise.
	* testsuite/ld-elf/pr19162.d: Likewise.
	* testsuite/ld-elf/pr22269a.d: Likewise.
	* testsuite/ld-elf/pr22269b.d: Likewise.
	* testsuite/ld-elf/pr22393-1a.d: Likewise.
	* testsuite/ld-elf/pr22393-1b.d: Likewise.
	* testsuite/ld-elf/pr22393-1c.d: Likewise.
	* testsuite/ld-elf/pr22393-1d.d: Likewise.
	* testsuite/ld-elf/pr22393-1e.d: Likewise.
	* testsuite/ld-elf/pr22393-1f.d: Likewise.
	* testsuite/ld-elf/pr22393-2a.rd: Likewise.
	* testsuite/ld-elf/pr22393-2b.rd: Likewise.
	* testsuite/ld-elf/pr23900-1-32.rd: Likewise.
	* testsuite/ld-elf/pr23900-1-64.rd: Likewise.
	* testsuite/ld-elf/pr23900-1.d: Likewise.
	* testsuite/ld-elf/pr23900-2a.d: Likewise.
	* testsuite/ld-elf/pr23900-2b.d: Likewise.
	* testsuite/ld-elf/pr30508.d: Likewise.
	* testsuite/ld-elf/pr30907-1.d: Likewise.
	* testsuite/ld-elf/pr30907-2.d: Likewise.
	* testsuite/ld-elf/pr32341.d: Likewise.
	* testsuite/ld-elf/shared.exp: Likewise.
	* testsuite/ld-elf/tls.exp: Likewise.
	* testsuite/ld-elf/tls_common.exp: Likewise.
	* testsuite/ld-elfvers/vers.exp: Likewise.
	* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
	* testsuite/ld-elfweak/elfweak.exp: Likewise.
	* testsuite/ld-gc/gc.exp: Likewise.
	* testsuite/ld-ifunc/binutils.exp: Likewise.
	* testsuite/ld-pie/pie.exp: Likewise.
	* testsuite/ld-plugin/lto-binutils.exp: Likewise.
	* testsuite/ld-plugin/lto.exp: Likewise.
	* testsuite/ld-scripts/rgn-at3.d: Likewise.
	* testsuite/ld-shared/shared.exp: Likewise.
	* testsuite/ld-size/size.exp: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-21 06:18:54 -07:00
Sam James
d3d1718602 binutils: drop unused note_size, contents, old variables
GCC trunk recently had improvements to its -Wunused-but-set-variable which
picked up that contents and hence note_size & old aren't used at all in the
end.

	* objcopy.c (merge_gnu_build_notes): Drop unused 'note_size', 'contents',
	and 'old' variables.
2025-07-17 13:18:55 +01:00
Alan Modra
118dc72152 readelf v850 notes
This patch was prompted by a clang warning:
readelf.c:23317:37: warning: pointer comparison always evaluates to false [-Wtautological-compare]
 23317 |           || inote.namedata + inote.namesz < inote.namedata)
       |                                            ^

Use the same sanity checks as used by process_notes_at.  (See commit
5396a86e43).  While we are at it, print all the v850 note info in
one place to properly handle error conditions.
2025-07-17 10:34:11 +09:30
Nick Clifton
83be472a61 Updated translations for various sub-directories 2025-07-15 13:37:09 +01:00
Nick Clifton
9ab6d84937 More updates to the 'how to make a release' documentation 2025-07-14 16:43:24 +01:00
Nick Clifton
78437d947e Updated Ukranian translation for the binutils sub-directory 2025-07-14 16:42:04 +01:00
Alan Modra
33aa1470c7 Delete AM_PO_SUBDIRS invocation
These aren't needed since commit 862776f26a.
2025-07-14 19:31:41 +09:30
Alan Modra
a57a3a169e Re: gas: Move gas_sframe_check to binutils-common.exp
PR ld/33146

Correct TCL errors trying to access error output file in commit
ef7a634dc0.  In fact, get rid of the output file test entirely since
gas exit status is sufficient.

Also there is no need to firstly check for ELF support.

Set check_as_sframe_result, and remove ld-lib.exp check_as_sframe.
2025-07-14 10:04:05 +09:30