Indu Bhagat 6442427b49 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
...                 ...                 ...

TBD:
1. Error/Warn if user says -z memtag-stack but does not select a
   mode ?
2. Should ld check that all input ELF components were compiled with
   -fsanitize=memtag-stack ? If yes, we likely need something like
   GNU_PROPERTY_AARCH64_FEATURE_1_MEMTAG_STACK specified in the ABI.
   Should we then allow the user to select the desirable action like we
   do in other cases, via say memtag-report[=none|warning|error] ?

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-04-10 20:54:24 -07:00
2025-01-19 12:09:01 +00:00
2025-04-10 18:42:06 +02:00
2025-03-29 07:03:46 -07:00
2025-04-06 18:23:56 -07:00
2023-08-12 10:27:57 +09:30
2025-03-10 16:15:42 -04:00
2025-04-09 10:03:27 -04:00
2025-02-28 16:06:25 +00:00

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.
Description
No description provided
Readme 552 MiB
Languages
C 51.2%
Makefile 22.7%
Assembly 12.5%
C++ 5.9%
Roff 1.4%
Other 5.7%