Commit Graph

122837 Commits

Author SHA1 Message Date
Nick Clifton
2bc7af1ff7 This is the 2.45 release binutils-2_45 2025-07-27 09:56:42 +01:00
Nick Clifton
57ab0c3f82 Oops - test files accidentally omitted from previous deltas 2025-07-27 09:21:48 +01:00
Indu Bhagat
4b28a4c542 [PATCH] doc: sframe: mention errata 1 of SFrame version 2
With the changes of an added flag SFRAME_F_FDE_FUNC_START_PCREL, s390x
support and new section type SHT_GNU_SFRAME, indicate that this document
specifies the errata 1 of SFrame version 2.  This will help distinguish
the document / specification better from previous releases.

libsframe/doc/
	* sframe-spec.texi: Mention errata 1 of SFrame version 2.
2025-07-27 09:15:37 +01:00
Indu Bhagat
bb6b63d7b1 [PATCH] 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-27 09:14:05 +01:00
Indu Bhagat
3fd0711530 [PATCH] gas: sframe: command line option takes precedence over gas directive to emit .sframe section.
Fix PR gas/33175 sframe: --gsframe=no does not disable when .cfi_sections directive with .sframe

--gsframe=no should also disable generation of SFrame section when explicit CFI directive: .cfi_sections .sframe is specified in the input.
This means we need to track whether SFrame generation was explicitly disabled by the user.
Introduce a new enum to facilitate disambiguation between GEN_SFRAME_DEFAULT_NONE and GEN_SFRAME_DISABLED.
While fixing the bug by adding the enum, keep the upcoming requirement in mind: we will also need to disambiguate between --enable-default-sframe and user-specified --gsframe/--gsframe=yes.
The intent is to not display SFrame related warnings or errors like:   as_bad (_(".sframe not supported for target")); for unsupported targets if --enable-default-sframe is in effect.
This implies we need to have a four state enum ( GEN_SFRAME_DEFAULT_NONE, GEN_SFRAME_CONFIG_ENABLED, GEN_SFRAME_DISABLED, GEN_SFRAME_ENABLED) gas
2025-07-27 09:11:44 +01:00
GDB Administrator
e4c5cc3729 Automatic date update in version.in 2025-07-27 00:04:22 +00:00
GDB Administrator
d6faa5099a Automatic date update in version.in 2025-07-26 00:03:17 +00:00
Alice Carlotti
28514771f8 gas/NEWS: Add AArch64 updates 2025-07-25 10:46:06 +01:00
Alice Carlotti
979c81a1da gas/doc: Update AArch64 Architecture Extensions
Add faminmax, move a couple of misplaced entries, and improve a few
other entries.

The documentation now lists every recognised extension name, with the
exception of a couple of aliases that are deliberately undocumented.
2025-07-25 10:46:06 +01:00
Alice Carlotti
7991fcf273 aarch64: Fix sve2p2/sme2p2 dependencies
Change dependency on sve2/sme2 to sve2p1/sme2p1.
2025-07-25 10:46:06 +01:00
Rainer Orth
21b517c1d5 ld: Force SHELL=/bin/bash in ld for Solaris [PR32580]
As described in PR ld/32580, when using SHELL=/bin/sh or /bin/ksh on
Solaris, the generated linker scripts get corrupted.  So far, the only
workaround is to enforce /bin/bash instead.

This is a major nuisance for developers and users alike, so this patch
automates this by overriding SHELL in ld/configure.ac.

Tested on amd64-pc-solaris2.11 in three configurations:

* CONFIG_SHELL unset

* CONFIG_SHELL=/bin/ksh

* CONFIG_SHELL='/bin/bash --norc'

In the first two cases, SHELL was set to /bin/bash as desired, while in
the third it was left unchanged.

2025-07-24  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	ld:
	PR ld/32580
	* configure.ac <*-*-solaris2*>: Enforce SHELL=/bin/bash.
	* configure: Regenerate.

(cherry picked from commit 96ad2fd3c0)
2025-07-25 09:50:37 +02:00
GDB Administrator
e11f6d2134 Automatic date update in version.in 2025-07-25 00:04:34 +00:00
Indu Bhagat
9105eee3bc gas: sframe: fix PR gas/33170
SFrame generation code assumes that since DW_CFA_restore means
restoration of the state of the register to the one at the beginning of
the function, there must be a state to restore to (hence the gas_assert
(cie_fre)).

This assumption needs adjustment.  DW_CFA_restore may be present in the
very beginning of a (e.g., cold) function, with no initialized state for
SFrame functions to restore to.

gas/
	PR gas/33170
	* gas/gen-sframe.c (sframe_xlate_do_restore): Use current FRE if
	CIE FRE is not yet setup.
gas/testsuite/
	PR gas/33170
	* gas/cfi-sframe/cfi-sframe.exp: New test.
	* gas/cfi-sframe/cfi-sframe-x86_64-pr33170.d: New test.
	* gas/cfi-sframe/cfi-sframe-x86_64-pr33170.s: New test.

(cherry picked from commit 83eeaf9178)
2025-07-24 11:10:27 -07:00
H.J. Lu
a0d3507d10 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>
(cherry picked from commit f752be8f91)
2025-07-24 06:57:44 -07:00
Alan Modra
44cd1f92e5 PR 33197 [AVR] Incorrect syntax in generated ldscript
Rearrange scripttempl/avr.sc to avoid oddities of shells expanding
${RELOCATING+stuff} in here documents where "stuff" contains quoted
strings.  Also I think it is better to avoid multi-line "stuff" as it
can be tricky to spot the ending brace.

(cherry picked from commit ae114fb523)
2025-07-24 09:42:24 +02:00
GDB Administrator
9a3dda9240 Automatic date update in version.in 2025-07-24 00:08:18 +00:00
GDB Administrator
9a91823648 Automatic date update in version.in 2025-07-23 00:05:59 +00:00
Nick Clifton
612c12759a Updated translations for various sub-directories 2025-07-22 15:57:38 +01:00
Torbjörn SVENSSON
888f048f72 ld: Rename a file on Windows fails if target already exists
To rename a file on Windows, the target name cannot exist. Removing file
prior to renaming ensures this is handled.
To remove a file on Windows, the file cannot be open. Closing the bfd
handle ensures this is handled.
Moved call to free on isympp / osympp to after bfd is closed to align
with comment earlier in the cmdline_add_object_only_section function.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit 233cd59464)
2025-07-22 16:41:16 +02:00
Dmitrii Bordukov
c947a34079 gprofng: do not skip weak symbols
PR gprofng/33151

gprofng ignores functions that are compiled as weak symbols. This
heavily affects C++ class methods that are always compiled by g++
and clang++ as weak symbols. In this case 'gprofng display text'
just displays <static>@ADDRESS(<FILENAME>) instead of proper method
name.

The bug has been introduced in the commit 470a0288a8.
2025-07-21 09:22:09 -07:00
Alan Modra
78e9e506df Remove sframe relocs against discarded sections
Commit d7f343eaad testsuite change resulted in a regression for
s390x-linux.  This extends the x86_64 fix to other targets.

	PR ld/33156
	* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Remove .sframe
	relocs too.

(cherry picked from commit fcf7470408)
2025-07-18 17:38:24 +09:30
Indu Bhagat
9d3376031a libsframe: relax the assertion limit for fre_start_addr
Fix PR ld/33131 Failed assertion when linking gccgo

Make amendments in both sframe_decoder_get_fre and
sframe_encoder_add_fre.

Since GNU as and the dw2gencfi code generally accepts such CFI, its best
to allow in SFrame FREs too.

libsframe/
	PR ld/33131.
	* sframe.c (sframe_decoder_get_fre): Relax the assertion a bit.
	(sframe_encoder_add_fre): Likewise.

(cherry picked from commit 387efef5fe)
2025-07-16 22:50:32 -07:00
Sam James
d534793d98 gas: improve --gsframe documentation
I omitted documentation in 8aad677a12 in
error. Rectify that with:
1) changing ---help to mention bare `--gsframe` too, as we're not
   getting rid of that;

2) adding the new --gsframe=[no|yes] form to as.texi.

	PR gas/33125
	* gas/as.c (parse_args): Tweak --gsframe= help text.
	* gas/doc/as.texi: Document --gsframe=[no|yes].

(cherry picked from commit 50c1c57426)
2025-07-16 16:15:39 +01:00
H.J. Lu
9527498995 gas: Re-indent case OPTION_SFRAME:
PR gas/33125
	* gas/as.c (parse_args): Re-indent case OPTION_SFRAME:

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 1535d2a0ce)
2025-07-16 16:15:26 +01:00
Sam James
6c0b1a20b6 gas: support --gsframe=no
Being able to explicitly disable SFrames on the command line is useful,
especially when looking at a gas that enables SFrames by default. The
binutils testsuite will benefit from this as there's testcases that don't
expect their presence.

In summary:
* Nothing is passed       => no SFrames (no change from before)
* --gsframe is passed     => SFrames    (no change from before)
* --gsframe=yes is passed => SFrames    (previously rejected)
* --gsframe-no  is passed => no SFrames (previously rejected)

	PR gas/33125
	* gas/as.c (parse_args): Accept --gsframe=no, --gsframe=yes.

(cherry picked from commit 8aad677a12)
2025-07-16 16:15:16 +01:00
H.J. Lu
39363ad0a0 x86-64: Remove sframe relocs against discarded sections
Since unlike eh_frame editing code, sframe editing code keeps
R_X86_64_NONE reloc as is, its r_offset is wrong, we must not
generate R_X86_64_NONE reloc in sframe section against discarded
sections for "ld -r".

bfd/

	PR ld/33156
	* elf64-x86-64.c (elf_x86_64_relocate_section): Also remove
	sframe relocations against discarded sections for "ld -r".

ld/

	PR ld/33156
	* testsuite/ld-elf/eh-group.exp (as_gsframe): New.
	Assemble eh-group.o with $as_gsframe.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit d7f343eaad)
2025-07-16 07:53:45 -07:00
H.J. Lu
b4782f2504 sframe: Allow input R_*_NONE relocations
"ld -r" generates R_*_NONE relocations in sframe section if input
relocations in sframe section are against discarded section.  Allow
input R_*_NONE relocations if there are more relocation entries than
SFrame entries, instead of assuming number of SFrame entries == number
of relocation entries.

bfd/

	PR ld/33127
	* elf-sframe.c (sframe_decoder_init_func_bfdinfo): Allow input
	R_*_NONE relocations if there are more relocation entries than
	SFrame entries.

ld/

	PR ld/33127
	* testsuite/ld-x86-64/sframe-reloc-2a.s: New file.
	* testsuite/ld-x86-64/sframe-reloc-2b.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run PR ld/33127 tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 5f9bf0cf71)
2025-07-16 07:53:22 -07:00
H.J. Lu
64304170aa ld: Clear map_head_is_link_order for .gnu_object_only
Clear map_head_is_link_order when generating .gnu_object_only section so
that lang_add_section can add new sections and .sframe sections will be
properly merged by _bfd_elf_merge_section_sframe.

	PR ld/33146
	* ldlang.c (cmdline_emit_object_only_section): Clear
	map_head_is_link_order.
	* testsuite/ld-plugin/lto.exp (as_gsframe): New.
	(lto_link_tests): Add $as_gsframe to compile lto-4b.o and
	lto-4c.o.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
(cherry picked from commit 939eb467b2)
2025-07-16 07:53:02 -07:00
Alan Modra
78a230e080 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.

(cherry picked from commit a57a3a169e)
2025-07-16 07:52:40 -07:00
H.J. Lu
91b0c7e311 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>
(cherry picked from commit ef7a634dc0)
2025-07-16 07:51:55 -07:00
Alan Modra
9d44d46d99 s390x sframe regressions
Commit 6ab3f09a68 resulted in regressions.
s390x-linux-gnu  FAIL: SFrame simple link
s390x-linux-gnu  FAIL: SFrame for plt0 and pltN

Commit 939eb467b2 exposed the problem further.
s390x-linux-gnu  FAIL: LTO 4a
s390x-linux-gnu  FAIL: LTO 4c
s390x-linux-gnu  FAIL: LTO 4d

	* elf64-s390.c (elf_s390_create_dynamic_sections): Set plt_sframe
	ELF section type.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
(cherry picked from commit 168c017e20)
2025-07-16 07:20:32 +09:30
Nick Clifton
153c98d1d5 Updated translations for various sub-directories 2025-07-15 13:40:19 +01:00
Rainer Orth
45c3d20e7a Only parse attributes in ELF sections with the SHT_GNU_ATTRIBUTES type if the OS is not Solaris. Set the is_solaris flag for Sparc solaris architectures
PR 33153
2025-07-15 11:13:18 +01:00
Nick Clifton
e35b2e9572 Updated Ukranian translation for the opcodes sub-directory 2025-07-14 16:54:41 +01:00
Nick Clifton
d1cbd0de6f Updated Ukranian translation for the binutils sub-directory 2025-07-14 16:42:28 +01:00
Nick Clifton
fba0a3b95c Updated Spanish translation for the gas sub-directory 2025-07-14 16:39:10 +01:00
Nelson Chu
2113b2473c gas/NEWS: Corrected the information about mapping symbol $x for risc-v 2025-07-14 17:56:52 +08:00
Aaron Griffith
72300c917f gas: accept leading zeros on dollar local labels in z80 sdcc compat mode
SDCC assembly output uses 5-digit numeric dollar sign labels, padded
with zeros. Commit 226749d made these invalid, and broke the Z80 SDCC
compatibility mode in GAS.

https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=226749d5a6ff0d5c607d6428d6c81e1e7e7a994b

This restores SDCC compatibility by replacing the leading zeros with
spaces when inside dollar local labels and when SDCC compatibility is
enabled. It also restores the SDCC test case to represent actual
syntax emitted by SDCC, and adds a note explaining the purpose of
the test.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33030
2025-07-14 10:40:53 +02:00
Nick Clifton
cfa55064f4 Fix compile time warning message about optarg parameter shadowing global variable 2025-07-13 11:35:28 +01:00
Nick Clifton
0a86694dfa Update version number on 2.45 branch 2025-07-13 08:57:43 +01:00
Nick Clifton
5c778308bd Add markers for 2.45 branch 2025-07-13 08:35:45 +01:00
Tom de Vries
0e8dbf5c5d [gdb/build] Work around GCC ipa-modref bug
PR mi/32571 reports the following problem:
...
$ gdb -q -batch -ex "b bla.c:100"
<random output>
Make breakpoint pending on future shared library load? (y or [n]) \
  [answered N; input not from terminal]
...
while this is expected:
...
$ gdb -q -batch -ex "b bla.c:100"
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) \
  [answered N; input not from terminal]
...

A few factors in reproducing this are building gdb using gcc 14,
"-O2 -flto=auto" and --disable-nls.  For more details, see the PR.

This turns out to be caused by a GCC PR [1], more specifically a problem in
ipa-modref.

Work around this by disabling ipa-modref for GCC versions 12-15 and 16.0,
assuming the GCC 16.1 release will contain a fix.

Tested on aarch64-linux and x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32571

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120987
2025-07-13 07:25:43 +02:00
GDB Administrator
5ad9c520cb Automatic date update in version.in 2025-07-13 00:02:42 +00:00
Aaron Griffith
b6d770e18c gdb: add Aaron Griffith to gdb/MAINTAINERS 2025-07-12 08:43:37 -04:00
Indu Bhagat
b9b7bbb466 ld/aarch64elf: add support for DT_AARCH64_MEMTAG_STACK dynamic tag
Add new command line option -z memtag-stack for aarch64 elf.  This
option instructs the linker to generate the necessary dynamic tag
DT_AARCH64_MEMTAG_STACK, which the dynamic loader can then use to
protect the stack memory with PROT_MTE.  Linker issues an
'unrecognized option' error when -z memtag-stack is specified for
non-aarch64 based emulations.

readelf displays the dynamic tag when present:

$ readelf -d <exectutable>
Dynamic section at offset 0xfdd8 contains XX entries:
Tag        Type                         Name/Value
0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
0x000000000000000c (INIT)               0x400520
0x000000000000000d (FINI)               0x400b64
0x0000000000000019 (INIT_ARRAY)         0x41fdc8
...                 ...                 ...
0x000000007000000c (AARCH64_MEMTAG_STACK) 0x1
...                 ...                 ...

ChangeLog:

        * bfd/elfnn-aarch64.c (elfNN_aarch64_late_size_sections): Emit
	DT_AARCH64_MEMTAG_STACK dynamic tag.
        * bfd/elfxx-aarch64.h (struct aarch64_memtag_opts): Add new
	member for tracking whether stack access uses MTE insns.
        * binutils/readelf.c (get_aarch64_dynamic_type): Handle
	DT_AARCH64_MEMTAG_STACK.
        * ld/emultempl/aarch64elf.em: Add new command line option.
        * ld/ld.texi: Add documentation for -z memtag-stack.
        * ld/testsuite/ld-aarch64/aarch64-elf.exp: Add new test.
        * ld/testsuite/ld-aarch64/dt-memtag-stack.d: New test.

include/ChangeLog:

        * elf/aarch64.h (DT_AARCH64_MEMTAG_STACK): New definition.
2025-07-12 11:33:25 +02:00
Indu Bhagat
97d71f2366 ld/aarch64elf: add support for DT_AARCH64_MEMTAG_MODE dynamic tag
Add new command line option -z memtag-mode=<mode> to aarch64 elf,
where <mode> can be one of none, sync, or async.  For mode of sync or
async, a DT_AARCH64_MEMTAG_MODE dynamic tag with a value of 0 or 1
respectively is emitted.

readelf displays the dynamic tag when present:

$ readelf -d <exectutable>
Dynamic section at offset 0xfdd8 contains XX entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x400520
 0x000000000000000d (FINI)               0x400b64
 0x0000000000000019 (INIT_ARRAY)         0x41fdc8
 ...                 ...                 ...
 0x0000000070000009 (AARCH64_MEMTAG_MODE) 0x1
 ...                 ...                 ...

Note that this patch doesn't add support for the "asymm" MTE mode,
which is an Armv8.7 extension.

ChangeLog:

        * bfd/elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Add
	new member for memtag properties.
        (bfd_elfNN_aarch64_set_options): New argument to pass memtag
	properties.
	(elfNN_aarch64_late_size_sections): Emit DT_AARCH64_MEMTAG_MODE
	dynamic tag.
        * bfd/elfxx-aarch64.h: New definition for the various memtag
	properties.
        * binutils/readelf.c (get_aarch64_dynamic_type): Handle
	DT_AARCH64_MEMTAG_MODE.
        * ld/emultempl/aarch64elf.em: Likewise.
        * ld/ld.texi: Add documentation for the new option
	-z memtag-mode.
        * ld/testsuite/ld-aarch64/aarch64-elf.exp: New test.
        * ld/testsuite/ld-aarch64/dt-memtag.d: New test.
        * ld/testsuite/ld-aarch64/dt-memtag-mode.s: New test.

include/ChangeLog:

        * elf/aarch64.h (DT_AARCH64_MEMTAG_MODE): New definition.
2025-07-12 11:33:25 +02:00
Indu Bhagat
427363b461 ld: aarch64: make EH Frame parsing aware of augmentation char 'G'
As per the DWARF for the Arm 64-bit Architecture (AArch64)
specification, the augmentation char 'G' indicates that associated
frames may modify MTE tags on the stack space they use.

Add knowledge of the 'G' augmentation char to the EH Frame parsing
code.

ChangeLog:

        * bfd/elf-eh-frame.c (_bfd_elf_parse_eh_frame): Accommodate
	augmentation char 'G'.
        * ld/testsuite/ld-aarch64/aarch64-elf.exp: New test.
        * ld/testsuite/ld-aarch64/mte-tagged-frame-bar.s: New test.
        * ld/testsuite/ld-aarch64/mte-tagged-frame-foo.s: New test.
        * ld/testsuite/ld-aarch64/mte-tagged-frame.d: New test.
2025-07-12 11:33:25 +02:00
Indu Bhagat
4c043ef6f3 gas: aarch64: suppport CFI directive .cfi_mte_tagged_frame
Process a new aarch64-specific CFI directive: .cfi_mte_tagged_frame
(LLVM uses this CFI directive already).  The CFI directive, when
present for a function, indicates that the stack frame for the
function may modify the MTE tags of the stack space it uses.  The
assembler emits char 'G' in the CIE augmentation string to indicate
the same.

ChangeLog:

        * gas/config/tc-aarch64.c (s_aarch64_mte_tagged_frame): New
	definition.
        * gas/config/tc-aarch64.h (tc_fde_entry_extras): Add
	memtag_frame_p.
        (tc_cie_entry_extras): Likewise.
        (tc_fde_entry_init_extra): Likewise.
        (tc_cie_fde_equivalent_extra): Likewise.
        (tc_cie_entry_init_extra): Likewise.
        * gas/doc/c-aarch64.texi: Add documentation for
	.cfi_mte_tagged_frame directive.
        * gas/testsuite/gas/aarch64/mte_tagged_stack.d: New test.
        * gas/testsuite/gas/aarch64/mte_tagged_stack.s: New test.
2025-07-12 11:33:25 +02:00
Indu Bhagat
83318af493 binutils: make read_cie aware of new augmentation char 'G'
This allows objdump/readelf to dump DWARF/EH Frame info when the stack
frame makes use of MTE tagging.

ChangeLog:

        * binutils/dwarf.c (is_aarch64_augmentation): Add handling for augmentation
	char 'G'.

---
[No change in V3]
2025-07-12 11:33:25 +02:00
Jose E. Marchesi
3bf7cb6860 bfd: fix recognition of arch-specific augmentations
This patch fixes _bfd_elf_parse_eh_frame so it will not recognize
machine/architecture specific augmentation characters in EH Frame
CFIs.

Regtested in x86_64-linux-gnu and aarch64-linux-gnu.

bfd/ChangeLog:

	* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Recognize augmentation
	'B' only if targetting aarch64.
2025-07-12 11:33:25 +02:00