Commit graph

5030 commits

Author SHA1 Message Date
Jan Beulich
201d1fb60d prune BeOS leftovers
The target was marked removed by bd3828b0de ("Remove support for the
beos file format") in early 2024. Drop leftover entries.
2026-07-17 15:37:56 +02:00
Alan Modra
4643afba91 readelf.c gcc-4.9 compile error
gcc-4.9 doesn't like an empty initialiser.

binutils/readelf.c: In function ‘process_relocs’:
binutils/readelf.c:10229:5: error: missing initializer for field ‘sh_name’ of ‘Elf_Internal_Shdr’ [-Werror=missing-field-initializers]
     Elf_Internal_Shdr section = {};

	* readelf.c (process_relocs): Avoid gcc-4.9 compile error.
2026-07-16 07:34:30 +09:30
Nick Clifton
35c64456cd Change version number to 2.47.50 and regenerate files 2026-07-12 10:50:36 +01:00
Alan Modra
e7c25d560b Re: readelf: Save and dump the original section header values
This started as removing the imperative "Ignore the.." from
validate_section_info warnings, and making them a little less work for
translators.  I also decided it wasn't worth reporting specifics about
a malloc failure when allocating a relatively small fixed size buffer.
It would be different if some large chunk of file data caused a malloc
fail.

The patch also fixes a potential orig_section_headers buffer overflow,
caused by allocating a single element array when probing, hitting some
early error in process_file_header, then attempting to access it as an
array of e_shnum entries in free_filedata.

	* readelf.c (save_original_section_header_values): Use xmalloc
	rather than reporting a more specific error.  Drop now unused
	function parameters.
	(validate_section_info): Delete "dynamic" and "probe" params.
	Redo warning messages.  Don't save orig header for fake
	section header passing relr dynamic tags.  Avoid possible
	arithmetic overflow when checking sh_size.
	(get_32bit_section_headers): Don't allocate orig_section_headers
	or call validate_section_info when probing.
	(get_64bit_section_headers): Likewise.
	(process_relocs): Update validate_section_info call when
	handling relr.
2026-07-12 19:03:27 +09:30
Nick Clifton
94967025f8 Add markers to NEWS files for 2.47 release 2026-07-12 10:12:19 +01:00
Nick Alcock
f15c755572 MAINTAINERS: update my email address 2026-07-09 14:33:38 +01:00
H.J. Lu
c447183ab0 readelf: Save and dump the original section header values
validate_section_info clears the garbage values in the section header
to avoid crash later.  Save and dump the original section header values
to make the garbage values in the section header visible when dumping
section headers.

Note: orig_section_headers, instead of sane_section_headers, is added to
filedata since filedata->section_headers is used in many places.  Replace
filedata->section_headers with filedata->sane_section_headers requires
a much bigger change.

	* readelf.c (filedata): Add orig_section_headers.
	(save_original_section_header_values): New.
	(validate_section_info): Add a pointer to the original section
	header and call save_original_section_header_values to save the
	original section header values before clearing the section header
	fields.
	(get_32bit_section_headers): Allocate the original section header
	buffer.  Pass the original section header pointer to
	validate_section_info.
	(get_64bit_section_headers): Likewise.
	(process_section_headers): Dump the original section header
	values if they exist.
	(process_relocs): Pass a dummy original section pointer to
	validate_section_info.
	(free_filedata): Free filedata->orig_section_headers.
	* testsuite/binutils-all/corrupt-1.elf.bz2: New file.
	* testsuite/binutils-all/corrupt-1.r: Likewise.
	* testsuite/binutils-all/readelf.exp: Run corrupt-1.elf test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-07-09 18:26:15 +08:00
Alan Modra
64ca9aa242 PR 34353 objcopy: null-pointer dereference bfd/section.c:1433
objcopy --update-section specifying a SHT_GROUP section hits a case
where output_section is NULL.

	* objcopy.c (copy_object): Don't segfault when update_sections
	output_section is NULL.  Remove the "not found" part of
	existing error so this message can be used.
	* testsuite/binutils-all/update-section.exp: Update to suit.
2026-07-07 10:19:31 +09:30
Jens Remus
748bc6a7fe s390: Deprecate s390 32-bit target "s390-*"
The s390 32-bit target (s390-*) is deprecated and planned for removal
in a future release, along with the elf32-s390 target format.  Emit an
error for this target during configure, which can be overridden using
option --enable-obsolete.

Linux Kernel 6.19 removed s390 32-bit compatibility support. [1]
Glibc 2.43 [2] and GCC 16.1 (compiler option -m31) [3] deprecated
s390 32-bit with the intent to remove it in a future release.

The s390 64-bit target (s390x-*) remains supported.

[1]: Linux kernel 6.19 commit 8e0b986c59c6 ("s390: Remove compat support"),
     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e0b986c59c6
[2]: Glibc 2.43 commit 638d437dbf9c ("Deprecate s390-linux-gnu (31bit)"),
     https://sourceware.org/git/glibc.git?a=commitdiff;h=638d437dbf9c
[3]: GCC 16 commit 5886bb453a6a ("s390: Deprecate -m31"),
     https://gcc.gnu.org/git/gcc.git?h=5886bb453a6a

bfd/
	* config.bfd: Require --enable-obsolete to build s390 32-bit
	target "s390-*".

binutils/
	* NEWS: Deprecate s390 32-bit target "s390-*".

gdb/
	* NEWS: Deprecate s390 32-bit target "s390-*".

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2026-07-06 16:34:26 +02:00
Alan Modra
58b8db1ca4 pr34322: assertion failure in get_or_create_member_type
I thought about warning "DW_TAG_member without struct/union parent"
here but decided that doesn't help much as the warning is disconnected
from output.  As it is the --map-global-vars code silently ignores
unexpected attributes that might be found in fuzzed files.  I'm fine
with that too.

	PR 34322
	* dwarf.c (get_or_create_member_type): Return NULL on NULL parent.
	(insert_element_in_list): Ignore DW_TAG_member without struct
	or union parent.
2026-07-04 20:11:54 +09:30
H.J. Lu
1dcfefd8dd readelf: Update dynamic tag processing and validate section info
Count DT_RELR relocations using dynamic tags when section header isn't
used.  Ignore section sh_offset and sh_size if they are larger than file
size.

One side effect is that we now display

readelf: Warning: Ignore the out of range sh_offset value of 2199023261148 for section 17
readelf: Warning: Ignore the out of range sh_size value of 13 for section 17 with sh_offset value of 2199023261148
...
  [17] .fini             PROGBITS        00000000000015dc 000000 000000 00  AX  0   0  4
...

instead of

...
  [17] .fini             PROGBITS        00000000000015dc 200000015dc 00000d 00  AX  0   0  4
...

and segfault.

binutils/

	PR binutils/34326
	PR binutils/34339
	* readelf.c (update_all_relocations): Skip if nentries == 0.
	(validate_section_info): New.
	(get_32bit_section_headers): Call validate_section_info.
	(get_64bit_section_headers): Likewise.
	(process_relocs): Call count_relr_relocations for relocations
	from dynamic tags.  Skip if values in DT_RELENT/DT_RELAENT
	are larger than values in DT_RELSZ/DT_RELASZ.
	(process_got_section_contents): Skip if all_relocations_count
	== 0.

ld/
	PR binutils/34339
	* testsuite/ld-x86-64/binutils.exp: Run PR binutils/34339 tests.
	* testsuite/ld-x86-64/got-2.s: New file.
	* testsuite/ld-x86-64/libgot-2.rd: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-07-03 21:50:49 +08:00
Srinath Parvathaneni
d154905284 bfd/readelf: Add core file support for FEAT_S1POE
Add support for `NT_ARM_POE` dumps/reads for core files.
2026-07-02 13:57:25 +00:00
H.J. Lu
c1c4795df8 readelf: Avoid may be used uninitialized warning from GCC 14
GCC 14 fails to recognize that rel_entsz and entsz_name are unused when
process_relocs returns early for error:

.../binutils/readelf.c:10127:18: error: ‘rel_entsz’ may be used uninitialized [-Werror=maybe-uninitialized]
10127 |               if (rel_entsz == 0)
      |                  ^
...
.../binutils/readelf.c:10129:19: error: ‘entsz_name’ may be used uninitialized [-Werror=maybe-uninitialized]
10129 |                   printf (_("<missing or corrupt dynamic tag: %s>\n"),
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10130 |                           entsz_name);

Clear them before returning error.  Also replace reltype_unknown with
default since GCC 14 fails to see that reltype_unknown is the only
unhandled value for relocation_type enum.

	PR binutils/34324
	* readelf.c (process_relocs): Clear rel_entsz and entsz_name
	before returning error on missing DT_REL and DT_RELA dynamic
	tags.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-07-02 07:11:59 +08:00
H.J. Lu
1913e1cb7b readelf: Check missing DT_REL and DT_RELA dynamic tags
PR binutils/34324
	* readelf.c (process_relocs): Return error on missing DT_REL and
	DT_RELA dynamic tags.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-07-02 06:21:35 +08:00
H.J. Lu
4f54c79267 readelf: Also set do_got_section_contents to false
Also set do_got_section_contents to false if section headers are failed
to load.

	PR binutils/34323
	* readelf.c (process_object): Also set do_got_section_contents.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-06-30 15:28:19 +08:00
Alan Modra
74388a1732 ld testsuite alpha_ld_flags
This is how alpha can use -Ttext-segment on just those tests that need
it.  And since the way run_dump_test uses $opts(ld) allows tcl procs to
be embedded, there is no need to specially expand [big_or_little_endian].

binutils/
	* testsuite/lib/binutils-common.exp (run_dump_test <opts(ld)>): No
	need to handle big_or_little_endian specially.
ld/
	* testsuite/ld-elf/elf.exp (alpha_ld_flags): New proc.
	(LDFLAGS): Don't set -Ttext-segment for alpha globally.
	* testsuite/ld-elf/compress1a.d: Add alpha_ld_flags.
	* testsuite/ld-elf/compressed1a.d: Likewise.
	* testsuite/ld-elf/eh5.d: Likewise.
2026-06-30 12:38:25 +09:30
Nelson Chu
05d87700db MAINTAINERS: Update my email address 2026-06-26 12:56:33 +08:00
H.J. Lu
f85ff0c4bc gas/ELF: Allow local symbol with non-protected visibility
In the source code extracted from glibc:

extern void _dl_sysinfo_int80 (void)
  __attribute__ ((visibility ("hidden")));

asm (".text\n\t"
     ".type _dl_sysinfo_int80,@function\n"
     "_dl_sysinfo_int80:\n\t"
     "int $0x80;\n\t"
     "ret");

uintptr_t
foo ()
{
  return (uintptr_t) _dl_sysinfo_int80;
}

_dl_sysinfo_int80 is a local function, but it is defined in an asm
statement.  Since it is referenced in C, it is declared as hidden,
which leads to an assembler warning:

Warning: local symbol `_dl_sysinfo_int80' has non-default visibility

Symbol binding and visiblity are orthogonal.  One is for link-editing,
the other for runtime linking.  In principle, all combinations are "okay"
(if questionable), and have obvious implementations.  But it's only that
specific combination STB_LOCAL+STV_PROTECTED that is explicitely made
ill-formed in the spec (despite it being also obviously implementable).
Warning on that combination can be done on the grounds of following the
spec.  But no other combination is so spelled out, so there's no basis
for trying to disallow them.

Partially revert:

commit c4150acbda
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri May 8 11:45:04 2026 +0200

    gas/ELF: warn upon non-default visibility of local symbols

and update elf_adjust_symtab to only warn local symbol with protected
visibility.

binutils/

	PR gas/34312
	* testsuite/binutils-all/localize-hidden-1.l: Adjusted.
	* testsuite/binutils-all/nm-ver.s: Revert commit c4150acbda.

gas/

	PR gas/34312
	* config/obj-elf.c (elf_adjust_symtab): Allow local symbol with
	non-protected visibility.
	* testsuite/gas/elf/visibility.l: Adjusted.
	* testsuite/gas/i386/tlsnopic.s: Revert commit c4150acbda.

ld/

	PR gas/34312
	* testsuite/ld-aarch64/ifunc-21.s: Revert commit c4150acbda.
	* testsuite/ld-aarch64/ifunc-21.s: Likewise.
	* testsuite/ld-tic6x/shlib-1.rd: Likewise.
	* testsuite/ld-tic6x/shlib-1.s: Likewise.
	* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
	* testsuite/ld-tic6x/shlib-1r.dd: Likewise.
	* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
	* testsuite/ld-tic6x/shlib-1rb.dd: Likewise.
	* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
	* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
	* testsuite/ld-tic6x/static-app-1.rd: Likewise.
	* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
	* testsuite/ld-tic6x/static-app-1r.dd: Likewise.
	* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
	* testsuite/ld-tic6x/static-app-1rb.dd: Likewise.
	* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-06-25 10:12:35 +08:00
Alan Modra
69a6db768a buffer overflow in fetch_indexed_addr
oss-fuzz found another case where sanity checks weren't good enough.

	* dwarf.c (fetch_indexed_addr): Avoid integer overflow when
	sanity checking field offset
	(fetch_indexed_offset): Similarly.  Don't bother with "too small"
	warning, which will be covered by field offset check.  Warn
	about base and index rather than possibly overflowed calculation.
2026-06-18 15:27:26 +09:30
Alan Modra
5003907202 PR 34204 dlltool SEGVs with --exclude-symbols
This fixes a segfault introduced by commit 45a7f5a29d which didn't
take into account that there was a use of leading_underscore in option
processing.

	PR 34204
	* dlltool.c (struct string_list): Make string a flexible array
	member.
	(add_excludes): Adjust to suit.  Extract code adding underscore
	and informing..
	(underscore_excludes): ..to here.  New function.
	(main): Call underscore_excludes.
2026-06-10 15:27:37 +09:30
Jan Beulich
0bd641bceb restore KVX maintainer
... now that a new email address for Paul is known. This partly reverts
1669d187cb ('MAINTAINERS: move three people to "Past Maintainers"').
2026-06-05 11:08:14 +02:00
Alan Modra
054fe087c7 spu: .note.spu_name
This fixes a bug with the .note.spu_name section flags, which were
made SEC_LOAD without SEC_ALLOC.  That combination doesn't really make
sense and led to odd layout behaviour.  In addition .note.spu_name
now uses the normal note alignment, with some tweaks to keep its file
offset 16 byte aligned.  This tends to work better in the testsuite
when the standard scripts are not used and the note is merged with
other notes.

bfd/
	* elf32-spu.c (spu_elf_create_sections): Remove SEC_LOAD from
	.note.spu_name, and align to 4 bytes.
	(spu_elf_fake_sections): Tweak .note.spu_name output section
	alignment for layout.
	(spu_elf_final_write_processing): New function.
	(elf_backend_final_write_processing): Define.
binutils/
	* testsuite/binutils-all/objcopy.exp (pr25662): Don't xfail spu.
ld/
	* testsuite/ld-elf/orphan-region.d: Don't xfail spu.
	* testsuite/ld-elf/pr23658-1e.d: Likewise.
	* testsuite/ld-scripts/provide-8.d: Likewise.
	* testsuite/ld-spu/ovl.d: Remove commented out old matches.
	Adjust expected overlay file offset.
	* testsuite/ld-spu/ovl2.d: Likewise.
2026-06-03 21:34:16 +09:30
Alan Modra
6c2f639186 buffer overflow in parse_stab_array_type
Fix oss-fuzz induced damage.

	stabs.c (parse_stab_type): Don't access beyond end of stab
	with bad type.
	(parse_stab_array_type): Don't duplicate "bad stab" message.
2026-06-01 10:39:16 +09:30
John David Anglin
9492ceba60 hppa*64*-*-hpux*: Create dummy milli.a archive for binutils and ld tests
On cross builds, this fixes numerous test fails due to the milli.a
archive not being found.  On hppa*64*-*-hpux*, this fixes four fails
due to undefined symbols in the HP milli.a archive.

The change to objcopy.exp causes the "objcopy executable (pr25662)"
test to fail.  Previously, it didn't run because milli.a wasn't
found.

2026-05-24  John David Anglin  <danglin@gcc.gnu.org>

binutils/ChangeLog:

	* testsuite/binutils-all/objcopy.exp: Append LDFLAGS to
	ldflags for milli.a archive.
	* testsuite/config/default.exp: Create dummy milli.a archive
	in tmpdir/hppa.  Append " -Ltmpdir/hppa" to LDFLAGS.

ld/ChangeLog:

	* testsuite/config/default.exp: Likewise.
2026-05-24 16:05:38 -04:00
Alan Modra
2766bde902 binutils test_build_id_debuglink
I saw build-id-debuglink test failures on a number of targets due to
deleting the glibc source I'd used when building the cross toolchains.
The tests failed with timeouts.

$ objdump -Sl tmpdir/testprog.strip

tmpdir/testprog.strip:     file format elf64-ia64-little

Disassembly of section .init:

40000000000003b0 <_init>:
_init():
/home/alan/src/glibc-2.38/csu/../sysdeps/ia64/crti.S:137
^C

I don't know where debuginfod was looking to try to find that crti.S
source, but wherever it was took too long, and we aren't trying to
test debuginfod here.  So remove the extraneous source dependencies
by building with -shared -nostdlib.  When making this change I also
removed the code passing extra options to target_compile via
CFLAGS_FOR_TARGET.  Instead, pass extra options with additional_flags.

	* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
	Don't use CFLAGS_FOR_TARGET to pass extra options to
	target_compile.  Instead use additional_flags.  Build test
	with -fPIC -shared -nostdlib.
2026-05-24 14:23:03 +09:30
Tom de Vries
1678d7d3d2 [binutils] Handle implicit const in .debug_names
I tried to use readelf to read the debug info for gdb test-case
gdb.dwarf2/debug-names-tu-dwarf5.exp, and ran into some trouble reading the
.debug_names section:
...
$ readelf -w debug-names-tu-dwarf5
  ...
Symbol table:
[  1] #eddb6232 _start: <0><1> DW_TAG_subprogram DW_IDX_compile_unit=0
[  2] #53a2ae86 struct_with_int_member:readelf: Warning: Unrecognized form: 0
readelf: Error: end of data encountered whilst reading LEB
 <0x3><2> DW_TAG_structure_type DW_IDX_type_unit=0 DW_IDX_GNU_language=0 DW_IDX_type_unitreadelf: Warning: Unrecognized form: 0
readelf: Error: end of data encountered whilst reading LEB
...

The .debug_names abbreviation table contains a DW_FORM_implicit_const entry:
...
.uleb128        0x2003          /* DW_IDX_GNU_language */
.uleb128        0x21            /* DW_FORM_implicit_const */
.sleb128        0x0002          /* DW_FORM_implicit_const value: DW_LANG_C */
...
and readelf doesn't support this.

Add support for DW_FORM_implicit_const in display_debug_names, such that we
get the expected:
...
Symbol table:
[  1] #eddb6232 _start: <0><1> DW_TAG_subprogram DW_IDX_compile_unit=0
[  2] #53a2ae86 struct_with_int_member: <0x3><2> DW_TAG_structure_type \
      DW_IDX_type_unit=0 DW_IDX_GNU_language=2
...
2026-05-22 15:11:56 +02:00
Jan Beulich
aeced13ee0 x86/disasm: rework comment handling
Model this after operand handling, such that comments can be emitted in
the same order as operands. %rip-relative address comments remain
separate for now. While there correct style for the symbols associated
with immediates: These aren't "comment starts", but symbol names.
2026-05-22 08:49:12 +02:00
Jan Beulich
618291699e binutils: make x86-64/x86-64.exp work again by itself
The "exe" global is introduced only by some *.exp in the parent dir, which
may not be run.
2026-05-22 08:46:29 +02:00
Alan Modra
469dcb143c Re: binutils/configure: look for msgpack-c.pc (in addition to msgpack.pc)
Commit 520c7eefed results in the following if both msgpack-c and
msgpack are missing.

checking for msgpack-c... no
checking for msgpack... no
configure: error: Package requirements (msgpack) were not met:

Package 'msgpack', required by 'virtual:world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables MSGPACK_CFLAGS
and MSGPACK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
make[2]: *** [Makefile:920: config.status] Error 1
make[2]: Leaving directory '/build/gas/all/binutils'
make[1]: *** [Makefile:4123: all-binutils] Error 2

binutils/
	* configure.ac <msgpack>: Tell PKG_CHECK_MODULES that errors
	will be handled by its caller.
	* configure: Regenerate.
bfd/
	* bfd-in2.h: Regenerate.
2026-05-16 10:36:30 +09:30
Simon Marchi
520c7eefed binutils/configure: look for msgpack-c.pc (in addition to msgpack.pc)
msgpack.pc was renamed to msgpack-c.pc in this commit [1].  This means
that we now find both in the wild.  For example Debian Bookworm has
msgpack.pc [2] while Debian Trixie has msgpack-c.pc [3].

Update the check in configure.ac to check for both.  Nothing in the code
needs to change.

[1] 01f3d24fee
[2] https://packages.debian.org/bookworm/amd64/libmsgpack-dev/filelist
[3] https://packages.debian.org/trixie/amd64/libmsgpack-c-dev/filelist
2026-05-15 10:13:58 -04:00
Jan Beulich
4506341f45 RISC-V: make EFI app testcase consistent
Along the lines of what 43720b0cdd ("RISC-V: avoid ld crashes due to
bogus use by testcases") did, options passed to the assembler want to fit
those passed to the linker.
2026-05-15 09:48:19 +02:00
Evgeny Karpov
f6f94d6af6 Fix IAT (Import Address Table) alignment on PE32+
The IAT should be aligned to 8 bytes in aarch64-w64-mingw32, otherwise, it might
result in relocation issues.

When a function is imported from DLL, it generates the following code:

adrp    x19, __imp_fn
ldr     x19, [x19, #:lo12:__imp_fn]

8 byte alignment is required for ldr relocation. Addresses are placed in IAT.
The size of the chunk on AArch64 is 8 bytes.
If IAT is not aligned to 8 bytes, the relocation issue appears.
This patch fixes this issue by aligning IAT to 8 bytes for PE32+.

binutils/ChangeLog:

	* dlltool.c (make_head): Apply alignment to IAT.
	(make_delay_head): Apply alignment to Delay IAT.
	(main): Adjust 8 byte alignment for PE32+.
2026-05-15 09:47:56 +02:00
Maciej W. Rozycki
325bb9405e Haiku/testsuite: Mark target as ELF
All the Haiku targets are ELF:

$ sed -n '/haiku/{n;p}' < bfd/config.bfd
    targ_defvec=aarch64_elf64_le_vec
    targ_defvec=arm_elf32_le_vec
    targ_defvec=x86_64_elf64_vec
    targ_defvec=i386_elf32_vec
    targ_defvec=m68k_elf32_vec
    targ_defvec=mips_elf32_le_vec
    targ_defvec=powerpc_elf32_vec
    targ_defvec=sparc_elf64_vec
$

so update `is_elf_format' accordingly, complementing commit d85e70a35b
("Add support for the haiku operating system.") and fixing regressions:

aarch64-haiku  -FAIL: GNU attributes v1/v2: no support for directive .gnu_attribute
aarch64-haiku  -FAIL: GNU attributes v2: no support for directive .gnu_subsection
arm-haiku  -FAIL: GNU attributes v1/v2: no support for directive .gnu_attribute
m68k-haiku  -FAIL: GNU attributes v1/v2: no support for directive .gnu_attribute
mipsel-haiku  -FAIL: GNU attributes v1/v2: no support for directive .gnu_attribute
powerpc-haiku  -FAIL: GNU attributes v1/v2: no support for directive .gnu_attribute
sparc64-haiku  -FAIL: GNU attributes v1/v2: no support for directive .gnu_attribute
sparc64-haiku  -FAIL: sparc relax CALL (a.out)

while widely broadening coverage, e.g. with `i486-haiku' we now get:

		=== binutils Summary ===

# of expected passes		230
# of untested testcases		18
# of unsupported tests		21

		=== gas Summary ===

# of expected passes		1066
# of unsupported tests		16

		=== ld Summary ===

# of expected passes		595
# of expected failures		2
# of untested testcases		26
# of unsupported tests		215

vs:

		=== binutils Summary ===

# of expected passes		77
# of untested testcases		13
# of unsupported tests		11

		=== gas Summary ===

# of expected passes		806
# of unsupported tests		4

		=== ld Summary ===

# of expected passes		188
# of expected failures		2
# of untested testcases		16
# of unsupported tests		62

The following regressions yet need to be addressed:

arm-haiku  +FAIL: bad .bss / .struct data allocation directives
arm-haiku  +FAIL: VFP11 denorm erratum fix, scalar operation
arm-haiku  +FAIL: VFP11 denorm erratum fix, vector operation
arm-haiku  +FAIL: script-type
arm-haiku  +FAIL: Branch future relocations for armv8.1-m.main target
arm-haiku  +FAIL: Mixed ARM/Thumb arch5 dynamic application
arm-haiku  +FAIL: Thumb-2-as-Thumb-1 BL
arm-haiku  +FAIL: Thumb-2 BL bad noeabi
arm-haiku  +FAIL: .noinit sections
arm-haiku  +FAIL: .persistent sections
m68k-haiku  +FAIL: DT_TEXTREL map file warning
m68k-haiku  +FAIL: pr20995
m68k-haiku  +FAIL: pr20995-2
powerpc-haiku  +FAIL: Build pr20995-2.so
powerpc-haiku  +FAIL: pr20995-2

There are the usual regressions with `mipsel-haiku' as well coming from
the use of the IRIX variant of the ELF format, to be handled separately.
2026-05-09 15:40:11 +01:00
Maciej W. Rozycki
754c98f7bc Aarch64/Haiku/binutils/testsuite: Suppress PEI test
There is no PEI BFD target included by default with the Haiku target
configuration, so exclude the EFI test, preventing a regression caused
by enabling ELF tests with Haiku targets:

aarch64-haiku  +FAIL: Check if efi app format is recognized
2026-05-09 15:40:11 +01:00
Lancelot Six
d49acf37a3 readelf: Add support for AMDGPU code object V6
AMDGPU code object V6 adds the EF_AMDGPU_GENERIC_VERSION_V field.
Decode it when decoding the e_flags value for amdgpu.

The output for such generic GFX targets will look like:

$ readelf -h gpu.elf
  ELF Header:
    ...
    Flags:     0x1000151, gfx9-generic, xnack any, generic v1
                                                   ----------
    ...

... indicating that this ELF has the "generic code object v1" flag.

Change-Id: I0cb8014fc23150e16f43ab98adb3832ede253c88
Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
2026-05-08 08:24:14 -04:00
Simon Marchi
7a3178707f Add AMDGPU generic targets
Add the following generic AMDGPU architectures:

  - gfx9-generic
  - gfx9-4-generic
  - gfx10-1-generic
  - gfx10-3-generic
  - gfx11-generic
  - gfx12-generic
  - gfx12-5-generic

Change-Id: Ibf600d7c70ba8499f8ef75d8d57a71929f1cd4d4
Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
2026-05-08 08:24:14 -04:00
Lancelot Six
f48d94eab1 Update list of supported AMDGPU architectures
This patch updates the list of supported AMDGPU architectures in bfd/
binutils/ and include/elf/.

The following architectures have been added:

- gfx942
- gfx950
- gfx1150
- gfx1151
- gfx1152
- gfx1153
- gfx1200
- gfx1201
- gfx1250

The canonical source for these numbers is:

https://llvm.org/docs/AMDGPUUsage.html#amdgpu-ef-amdgpu-mach-table

Co-Authored-By: Laurent Morichetti <laurent.morichetti@amd.com>
Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
Co-Authored-By: Olu Ogunbowale <oogunbow@amd.com>
Co-Authored-By: Shahab Vahedi <shahab.vahedi@amd.com>
Co-Authored-By: Anurag Kumar <AnuragKumar.Vulisha@amd.com>
Change-Id: I80e76c8ec98b725937fe445883fae707097ec2b7
2026-05-08 08:23:53 -04:00
Nick Clifton
0166d3cede Objdump: Add "-M annotate" option to the AArch64 disassembler. 2026-05-08 11:10:52 +01:00
Jan Beulich
e7e4f9d640 objcopy: zap ELF visibility when localizing symbols
The spec explicitly precludes STB_LOCAL together with STV_PROTECTED (and,
implicitly, STV_HIDDEN or STV_INTERNAL), so we better wouldn't (entirely
silently) write out symbols violating this.
2026-05-08 11:45:26 +02:00
Jan Beulich
c4150acbda gas/ELF: warn upon non-default visibility of local symbols
The spec explicitly precludes STB_LOCAL together with STV_PROTECTED (and,
implicity, STV_HIDDEN or STV_INTERNAL), so we better wouldn't entirely
silently write out symbols violating this.

LoongArch's tc_symbol_new_hook() simply needs dropping. If FAKE_LABEL_NAME
symbols can end up global, marking them hidden would need doing elsewhere.
There not being a need to make any testsuite adjustments suggests though
that this won't normally (ever?) happen.

A couple of testcases then also need adjustment.
2026-05-08 11:45:04 +02:00
Nick Clifton
e142806774 Update the SECURITY.txt document. Clarify what is meant by a "direct compromise of security", emphasise that the tools do not provide a sevrice of any kind, and show that bugs that rely upon untrusted input must be able to cross a trust boundary in order to be considered as a security issue. 2026-05-07 10:53:46 +01:00
Nick Clifton
9e6e0c3cd9 Remove Andreas Jaeger from the x86_64 maintainers. 2026-05-06 13:57:56 +01:00
H.J. Lu
365fc34606 Fix the strrchr error for DOS based filesystem
Fix the strrchr error like:

gprof/source.c:130:28: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  130 |             char *bslash = strrchr (sf->name, '\\');

binutils/

	* bucomm.c (template_in_dir): Make bslash const char *.

gprof/

	* source.c (annotate_source): Make bslash const char *.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-05-03 11:49:59 +08:00
Nick Clifton
a945087277 x86 disassembler: Add -Mannotate option to display symbolic names associated with immediates 2026-04-24 14:34:50 +01:00
Nick Clifton
bfd118583e Add --debug-dir option to readelf and objdumo. Load separate debug info files when disassemblng. 2026-04-17 12:17:27 +01:00
Bratislav Filipovic
a04e10c4b7 binutils/readelf: Remove unused static variables
Remove static variables do_ctf and do_sframe that are set but never
read, causing build failures with LLVM's extended
-Wunused-but-set-variable warning.

These variables are dead code:
- Declared at lines 244-245 as static booleans
- Set to true when --ctf or --sframe options are parsed
- Never actually used or read anywhere in the code
- The actual dump functionality is triggered by request_dump() calls

Build error with -Werror enabled:

binutils/readelf.c:244:13: error: variable 'do_ctf' set but not used
  [-Werror,-Wunused-but-set-variable]
binutils/readelf.c:245:13: error: variable 'do_sframe' set but not used
  [-Werror,-Wunused-but-set-variable]
2026-04-09 09:13:44 +01:00
H.J. Lu
db4f00be62 ld: Pass --no-rosegment to ld in some linker tests
For elf/x86, --rosegment places code after read-only data, instead of
before read-only data.  Pass --no-rosegment to ld in some linker tests
to avoid extra linker test failures when binutils is configured with
--enable-rosegment for elf/x86.

binutils/

	PR ld/34003
	* testsuite/lib/binutils-common.exp (check_rosegment_support): New.
	(run_dump_test): Make NO_ROSEGMENT_LDFLAGS global.

ld/

	PR ld/34003
	* testsuite/config/default.exp (NO_ROSEGMENT_LDFLAGS): New.
	* testsuite/ld-elf/mbind1a.d: Pass $NO_ROSEGMENT_LDFLAGS to ld.
	* testsuite/ld-elf/pr26256-2b.d: Likewise.
	* testsuite/ld-srec/srec.exp (extra_flags): Add
	$NO_ROSEGMENT_LDFLAGS.
	* testsuite/ld-x86-64/no-plt.exp: Pass -Wl,--no-rosegment to
	compiler.
	* testsuite/ld-x86-64/pr27491-1c.d: Pass --no-rosegment to ld.
	* testsuite/ld-x86-64/pr27491-2.d: Likewise.
	* testsuite/ld-x86-64/pr27491-3.d: Likewise.
	* testsuite/ld-x86-64/pr27491-4.d: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-04-03 16:25:25 +08:00
Alan Modra
e16bdea671 remove arm-linux-gnu from supports_gnu_osabi
arm-linux-gnueabi allows OS/ABI to be set to ELFOSABI_GNU, but plain
arm-linux-gnu like arm-elf is ELFOSABI_ARM.
2026-04-02 22:53:48 +10:30
Indu Bhagat
50e79758b3 MAINTAINERS: update my email address
Signed-off-by: Indu Bhagat <ibhagatgnu@gmail.com>
2026-03-30 17:22:04 -07:00
Jan Beulich
6d79eef84f binutils/testsuite: don't leave temporary files in main dir
Leaving files in tmpdir/ is generally okay (often intended and helpful),
but the main directory really shouldn't be cluttered.
2026-03-13 10:32:42 +01:00