9d6b00511e
Augment the arm_asm.h header file to simplify function prologues and epilogues whilst adding support for PACBTI enablement via macros for hand-written assembly functions. For PACBTI, both prologues/epilogues as well as cfi-related directives are automatically amended accordingly, depending on the compile-time mbranch-protection argument values. It defines the following preprocessor macros: * HAVE_PAC_LEAF: Indicates whether pac-signing has been requested for leaf functions. * PAC_LEAF_PUSH_IP: Whether leaf functions should push the pac code to the stack irrespective of whether the ip register is clobbered in the function or not. * STACK_ALIGN_ENFORCE: Whether a dummy register should be added to the push list as necessary in the prologue to ensure stack alignment preservation at the start of assembly function. The epilogue behavior is likewise affected by this flag, ensuring any pushed dummy registers also get popped on function return. It also defines the following assembler macros: * prologue: In addition to pushing any callee-saved registers onto the stack, it generates any requested pacbti instructions. Pushed registers are specified via the optional `first', `last', `push_ip' and `push_lr' macro argument parameters. when a single register number is provided, it pushes that register. When two register numbers are provided, they specify a rage to save. If push_ip and/or push_lr are non-zero, the respective registers are also saved. Stack alignment is requested via the `align` argument, which defaults to the value of STACK_ALIGN_ENFORCE, unless manually overridden. For example: prologue push_ip=1 -> push {ip} prologue push_ip=1, align8=1 -> push {r2, ip} prologue push_ip=1, push_lr=1 -> push {ip, lr} prologue 1 -> push {r1} prologue 1, align8=1 -> push {r0, r1} prologue 1 push_ip=1 -> push {r1, ip} prologue 1 4 -> push {r1-r4} prologue 1 4 push_ip=1 -> push {r1-r4, ip} * epilogue: pops registers off the stack and emits pac key signing instruction, if requested. The `first', `last', `push_ip', `push_lr' and `align' function as per the prologue macro, generating pop instead of push instructions. Stack alignment is enforced via the following helper macro call-chain: {prologue|epilogue} ->_align8 -> _preprocess_reglist -> _preprocess_reglist1 -> {_prologue|_epilogue} Finally, the necessary cfi directives for adding debug information to prologue and epilogue are generated via the following macros: * cfisavelist - prologue macro helper function, generating necessary .cfi_offset directives associated with push instruction. Therefore, the net effect of calling `prologue 1 2 push_ip=1' is to generate the following: push {r1-r2, ip} .cfi_adjust_cfa_offset 12 .cfi_offset 143, -4 .cfi_offset 2, -8 .cfi_offset 1, -12 * cfirestorelist - epilogue macro helper function, emitting .cfi_restore instructions prior to resetting the cfa offset. As such, calling `epilogue 1 2 push_ip=1' will produce: pop {r1-r2, ip} .cfi_register 143, 12 .cfi_restore 2 .cfi_restore 1 .cfi_def_cfa_offset 0 |
||
---|---|---|
.github/workflows | ||
config | ||
etc | ||
include | ||
libgloss | ||
newlib | ||
texinfo | ||
winsup | ||
.appveyor.yml | ||
.gitattributes | ||
.gitignore | ||
COPYING | ||
COPYING.LIB | ||
COPYING.LIBGLOSS | ||
COPYING.NEWLIB | ||
COPYING3 | ||
COPYING3.LIB | ||
ChangeLog | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
README | ||
README-maintainer-mode | ||
ar-lib | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
depcomp | ||
djunpack.bat | ||
install-sh | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
makefile.vms | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
setup.com | ||
src-release | ||
symlink-tree | ||
test-driver | ||
ylwrap |
README
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.