Commit Graph

845 Commits

Author SHA1 Message Date
Richard Earnshaw
c2e7c05ad4 binutils: testsuite: fix duplicate testnames in readelf.exp
There are two places in readelf.exp where we generate duplicate
testnames.

The first is due to calling readelf_find_size twice with the same
iteration index (2).  This is fixed by using 4 for the second
instance.

The other is at the end of readelf_thin_archive_test.  This test calls
readelf_test before unconditionally passing.  It happens to construct
exactly the same test name as readelf test (might not be a
coincidence), so we end up with a duplicate test.  But it seems wrong
anyway to 'pass' a test that readelf_test might have failed, so simply
delete this duplicate pass entry.
2025-09-16 17:15:57 +01:00
Richard Earnshaw
f52a9a2b06 binutils: testsuite: avoid dup names when using multiple as: directives
binutils tests support running a test with distinct options to the
assembler by allowing

	#as: <optset-1>
	#as: <optset-2>

But results in both test runs using the same test name in the summary
file.  This causes confusion if one test fails but the other doesn't
(and GCC's compare_tests script will diagnose this as an error).  To
fix the ambiguity append the appropriate optset to the test name.

We only do this if a test has multiple runs in this way to avoid
causing every test result name to change.
2025-09-16 10:31:11 +01:00
H.J. Lu
45f3ea0bbb Revert "binutils: Require GNU tail for 'objdump -Wi' test"
This reverts commit 897d8d7bba.
2025-09-10 05:15:55 -07:00
Dmitry Klochkov
7be4186c22 nm: fix treating an ifunc symbol as a stab if '--ifunc-chars=--' is given
If an ifunc symbol is processed in print_symbol(), a 'type' field of a
'syminfo' structure is set to any character specified by a user with an
'--ifunc-chars' option.  But afterwards the 'type' field is used to
check whether a symbol is a stab in print_symbol_info_{bsd,sysv}()
functions in order to print additional stab related data.  If the 'type'
field equals '-', a symbol is treated as a stab.  If '--ifunc-chars=--'
is given, all ifunc symbols will be treated as stab symbols and
uninitialized stab related fields of the 'syminfo' structure will be
printed which can lead to segmentation fault.

To fix this, check if a symbol is a stab before override the 'type'
field.  Also, add a test case for this fix.

	PR binutils/32556
	* nm.c (extended_symbol_info): Add is_stab.
	(print_symbol): Check if a symbol is a stab.
	(print_symbol_info_bsd): Use info->is_stab.
	(print_symbol_info_sysv): Use info->is_stab.
	* testsuite/binutils-all/nm.exp: Test nm --ifunc-chars=--.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32556
Fixes: e6f6aa8d18 ("Add option to nm to change the characters displayed for ifunc symbols")
Signed-off-by: Dmitry Klochkov <dmitry.klochkov@bell-sw.com>
2025-09-09 12:06:25 +02:00
H.J. Lu
897d8d7bba binutils: Require GNU tail for 'objdump -Wi' test
testsuite/binutils-all/objdump.exp has

set got [remote_exec host "tail -n +4 tmpdir/objdump.out" "" "/dev/null" "tmpdir/objdump.tail"]

But the default Solaris tail doesn't support "tail -n +4".  Add
ACX_PROG_GNU_TAIL to use GNU tail for 'objdump -Wi' test.

Tested on Linux and Solaris.

binutils/

	PR binutils/33396
	* Makefile.am (check-DEJAGNU): Also export TAIL.
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* configure.ac: Add ACX_PROG_GNU_TAIL.
	* testsuite/binutils-all/objdump.exp: Require GNU tail for
	'objdump -Wi' test and replace tail with $env(TAIL).

config/

	PR binutils/33396
	* acx.m4 (ACX_PROG_GNU_TAIL): New.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-09-08 05:44:09 -07:00
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
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
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
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
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
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
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
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
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
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
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
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
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
H.J. Lu
ef7a634dc0 gas: Move gas_sframe_check to binutils-common.exp
Move gas_sframe_check to binutils-common.exp so that it can be used in
linker tests to check if a target assembler supports --gsframe.

binutils/

	PR ld/33146
	* testsuite/lib/binutils-common.exp (gas_sframe_check): Moved
	from cfi-sframe.exp.  Replace gas_host_run with remote_exec.

gas/

	PR ld/33146
	* testsuite/gas/cfi-sframe/cfi-sframe.exp (gas_sframe_check):
	Moved to binutils-common.exp.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-14 06:10:52 +08:00
H.J. Lu
803e6cfb43 x86-64.exp: Correct pr26808.dump to pr27708.dump
Change

verbose "cmp tmpdir/pr27708.out $srcdir/$subdir/pr26808.dump" 1

to

verbose "cmp tmpdir/pr27708.out $srcdir/$subdir/pr27708.dump" 1

	* testsuite/binutils-all/x86-64/x86-64.exp: Correct pr26808.dump
	to pr27708.dump.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-06-29 06:41:05 +08:00
Kito Cheng
4ad5217caf RISC-V: Add GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS and GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED
This patch adds two new GNU properties for RISC-V:
GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS and GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED.

We only add readelf and define the properties in this patch.

Ref: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/417
2025-06-24 18:14:39 +08:00
H.J. Lu
eee822a660 objcopy: Correctly check archive element for LTO IR
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:

@@ -3744,6 +3768,12 @@ copy_archive (bfd *ibfd, bfd *obfd, const char
*output_target,
     goto cleanup_and_exit;
   }

+#if BFD_SUPPORTS_PLUGINS
+      /* Copy LTO IR file as unknown object.  */
+      if (bfd_plugin_target_p (ibfd->xvec))
                                ^^^^ A typo, should be this_element.
+  ok_object = false;
+      else
+#endif
       if (ok_object)
   {
     ok = copy_object (this_element, output_element, input_arch);

to check if the archive element is a LTO IR file.  "ibfd" is the archive
BFD.  "this_element" should be used to check for LTO IR in the archive
element.  Fix it by replacing "ibfd" with "this_element".

	PR binutils/33078
	* objcopy.c (copy_archive): Correctly check archive element for
	LTO IR.
	* testsuite/binutils-all/objcopy.exp (strip_test_archive): New.
	Run strip_test_archive.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-06-15 05:49:40 +08:00
Matthieu Longo
c5a0d25737 Remove annoying spaces from objcopy.exp 2025-05-14 10:38:13 +01:00
Jan Beulich
36e66b193b Arm/COFF: accept .def outside of CCS mode
There's no reason to reject this common COFF directive when it doesn't
have any other meaning.
2025-05-02 10:05:12 +02:00
H.J. Lu
f72c4fa3d5 dwarf: Properly check holes in .debug_ranges/debug_rnglists
Don't warn if the offset of the first entry in .debug_rnglists starts
right after the header.  Warn holes in .debug_ranges and debug_rnglists
sections only if the last end pointer isn't the same as the current
start pointer.

	PR binutils/32927
	* dwarf.c (display_debug_ranges_list): Return the pointer to the
	end.
	(display_debug_ranges): Don't warn if the offset of the first
	entry in .debug_rnglists starts right after the header.  Warn a
	hole only if the last end pointer is the same as the next pointer.
	* testsuite/binutils-all/x86-64/dwarf4.s: New file.
	* testsuite/binutils-all/x86-64/dwarf5.s: Likewise.
	* testsuite/binutils-all/x86-64/pr32927-1.d: Likewise.
	* testsuite/binutils-all/x86-64/pr32927-2.d: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-Authored-By: Alan Modra <amodra@gmail.com>
2025-05-01 13:52:15 +09:30
Jan Beulich
6fe5e01b13 nm: also retrieve size for COFF function symbols
Like ELF for all symbols, COFF can record size for at least function
ones. Use that - if available - in preference to the distance-to-next-
symbol heuristic.

To be able to use the new test there, make TI C54x follow TI C4x in
providing .sdef to cover for .def already having different meaning.
2025-04-07 12:45:11 +02:00
Jan Beulich
379535a2e6 binutils: run objcopy set-section-alignment also for COFF
There's no reason to limit this to just ELF. TI C30 and Z8k don't encode
section alignment in the section entries though (which can't be quite
right, or there would need to be another means by which to express
alignment needs), so --set-section-alignment simply has no effect there.
2025-04-04 10:25:16 +02:00
Jan Beulich
43ea7d00a7 objcopy: constrain --section-alignment to PE binaries again
PR binutils/32732

The --set-section-alignment option is what ought to be used on object
files; --section-alignment should be affecting PE binaries only, and
only the value stored in the header. Sections don't individually have
alignment recorded there; see 6f8f6017a0 ("PR27567, Linking PE files
adds alignment section flags to executables").

Undo the core part of 121a3f4b4f ("Update objcopy's
--section-alignment option so that it sets the alignment flag on..."),
which includes removing the testcase again, while leaving all secondary
changes in place. (Note that the testcase did fail anyway for
i?86-interix, with objdump saying "option -P/--private not supported by
this file".)
2025-04-04 10:24:56 +02:00
Clément Chigot
71320db650 binutils/testsuite: don't tail the same input and output file
The output file could be created before the input is gathered by tail,
erasing the later before it's being proceeded.

This happened on rare cases when performing remote tests on
Ubuntu 24.04.
2025-04-01 10:14:54 +02:00
Clément Chigot
c27e4f5273 binutils/testsuite: move objdump test output into tmpdir
"objdump.out" is a testsuite trace and thus should be created within the
tmpdir.
2025-04-01 10:14:54 +02:00
WANG Xuerui
6d1823dc89 LoongArch: Fix disassembly option parsing stopping at the first option
Turns out the return value of parse_loongarch_dis_option acts as an
error code, and previously the function always signified failure with
a non-zero return value, making only the first disassembly option get
to take effect.

Fix by adding the missing `return 0`'s to the two success code paths.

Signed-off-by: WANG Xuerui <git@xen0n.name>
2025-03-26 15:49:58 +08:00
Jan Beulich
cdd8492b05 objdump: permit disassembling multiple individual functions
Compilers may split functions, e.g. into a "hot" and "cold" part, or
they may emit special case instantiations (e.g. as a result of IPA). It
can be helpful to be able to disassemble all of the parts or clones in
one go. Permit using "--disassemble=" multiple times.
2025-03-07 11:24:19 +01:00
Jan Beulich
60e254b701 objdump: properly disassemble successive functions of the same name
... when only their symbol was requested for disassembly. Addressing the
respective FIXME is as easy as coverting the "else" there to an if()
with the opposite condition, thus accounting for the disabling the
original if() may have effected.
2025-03-07 11:23:13 +01:00
Jonas 'Sortie' Termansen
a3177d19fb Remove unnecessary non-standard & unportable inclusions.
<memory.h> is not needed and not standardized and is just an alias for
<string.h>.

<sys/param.h> is not needed and not standardized and contains a kitchen
sink of various unportable definitions not agreed upon and best done
manually or through other headers.

These fixes are needed to compile binutils on Sortix and other operating
systems with a strict POSIX.1-2024 libc without obsolete features.

Signed-off-by: Jonas 'Sortie' Termansen <sortie@maxsi.org>
2025-02-28 13:24:50 +00:00
Alan Modra
592819f718 run_dump_test warning/error regexp
This allows you to specify a run_dump_test warning that may or may not
be present using
warning: (warning_text_goes_here)?
ie. the regexp matches an empty string.
2025-01-21 08:42:44 +10:30
Adhemerval Zanella
80dc29527f ld: Add --enable-memory-seal configure option
Add --enable-memory-seal linker configure option to enable memory
sealing (GNU_PROPERTY_MEMORY_SEAL) by default.

Change-Id: I4ce4ff33657f0f09b1ceb06210b6fcaa501f1799
2025-01-14 13:18:52 -03:00
Alan Modra
f832531609 ar and foreign object files
ar is supposed to make archives containing any sort of file, and it
generally does that.  It also tries to make archives suited to target
object files stored.  Some targets have peculiar archives.

In one particular case we get into trouble trying to suit archives to
object files: where the target object file is recognised but that
target doesn't happen to support archives, and the default target has
a special archive format.  For example, we'll get failures on
rs6000-aix if trying to add tekhex objects to a new archive.  What
happens in that the tekhex object is recognised and its target vector
used to create an empty archive, ie. with _bfd_generic_mkarchive and
_bfd_write_archive_contents.  An attempt is then made to open the
newly created archive.  The tekhex target vector does not have a
check_format function to recognise generic archives, nor as it happens
do any of the xcoff or other targets built for rs6000-aix.

It seems to me the simplest fix is to not use any target vector to
create archives where that vector can't also recognise them.  That's
what this patch does, and to reinforce that I've removed target vector
support for creating empty archives from such targets.

bfd/
	* i386msdos.c (i386_msdos_vec): Remove support for creating
	empty archives.
	* ihex.c (ihex_vec): Likewise.
	* srec.c (srec_vec, symbolsrec_vec): Likewise.
	* tekhex.c (tekhex_vec): Likewise.
	* wasm-module.c (wasm_vec): Likewise.
	* ptrace-core.c (core_ptrace_vec): Tidy.
	* targets.c (bfd_target_supports_archives): New inline function.
	* bfd-in2.h: Regenerate.
binutils/
	* ar.c (open_inarch): Don't select a target from the first
	object file that can't read archives.  Set output_filename
	earlier.
	* testsuite/binutils-all/ar.exp (thin_archive_with_nested):
	Don't repeat --thin test using T.
	(foreign_object): New test.
	* testsuite/binutils-all/tek1.obj,
	* testsuite/binutils-all/tek2.obj: New files.
2025-01-06 14:09:32 +10:30
Alan Modra
e8e7cf2abe Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
Jan Beulich
d5cbf916be gas/ELF: also reject merge entity size being zero
This won't have any useful effect, so is at best marginally less bogus
than a negative value.

The change actually points out a flawed (for Arm) testcase: @ is a
comment character there.
2024-11-18 11:35:57 +01:00
Alan Modra
bc85bc665a Add noxfail option to run_dump_test
The noxfail option is useful in situations like pr23658-1e which
fails on all microblaze ELF targets except microblaze-linux.  This was
possible to handle by writing a small proc and use that as an xfail
predicate, or painstakingly listing all microblaze ELF targets, but
this is simpler.  The patch also fixes some other FAILs and XPASSes of
the pr23658 tests.

binutils/
	* testsuite/lib/binutils-common.exp (run_dump_test): Support
	noxfail.
ld/
	* testsuite/ld-elf/pr23658-1a.d: Don't xfail m68hc12.
	* testsuite/ld-elf/pr23658-1e.d: Likewise.  xfail xstormy16
	and correct microblaze xfails.
2024-10-16 14:54:00 +10:30
Jan Beulich
1f1b5e506b bfd/ELF: restrict file alignment for object files
While for executables properly aligning sections within the file can be
quite relevant, the same is of pretty little importance for relocatable
object files. Avoid passing "true" into
_bfd_elf_assign_file_position_for_section() when dealing with object
files, but compensate minimally by applying log_file_align in such
cases as a cap to the alignment put in place.
2024-10-11 08:19:34 +02:00
Alan Modra
c6bf8c475a Enable dlltool --leading-underscore for targets other than x86
This also makes the dlltool tests run more PE targets, finding that
sh-pe dlltool reports "Machine 'sh' not supported".  I guess no one
cares about that.

	PR19459
	* dlltool.c (asm_prefix): Remove "mach" parameter.  Return
	leading_underscore independent of machine.
	(ASM_PREFIX): Adjust.
	* testsuite/binutils-all/dlltool.exp: Run on any target
	satisfying is_pecoff_format for which dlltool is built.
	Revert commit 0398b8d6c8.  Remove target_xfail.
2024-10-03 12:31:46 +09:30
Alan Modra
f6abafcd91 Move uses_elf_em to ld-lib.exp
and add a missing entry from uses_genelf.

binutils/
	* testsuite/lib/binutils-common.exp (uses_elf_em): Delete.
ld/
	* testsuite/lib/ld-lib.exp (uses_genelf): Add moxie-*-moxiebox.
	(uses_elf_em): New.
2024-09-28 15:45:50 +09:30
Frank Ch. Eigler
3babc2e220 binutils testsuite: canonicalize subtest names in debuginfod.exp
Previous code included the full $srcdir pathnames in the individual
subtest PASS/FAIL names, which makes it difficult to compute
comparisons or regressions between test runs on different machines.
This version switches to the basename only, which are common.

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
2024-09-24 21:50:41 -04:00