newlib-cygwin/newlib/libc
Victor L. Do Nascimento 9d6b00511e newlib: libc: define M-profile PACBTI-enablement macros
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
2023-01-10 14:16:05 +00:00
..
argz newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
ctype Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
errno Add --enable-newlib-reent-thread-local option 2022-07-13 06:55:46 +02:00
iconv newlib: info: tweak iconv node to avoid collisions 2022-12-13 05:22:09 -05:00
include libc: arm: fix setjmp abi non-conformance 2022-12-13 15:50:35 +00:00
locale Cygwin: fix LC_CTYPE in global locale to be a real C.UTF-8 locale 2022-12-03 16:16:30 +01:00
machine newlib: libc: define M-profile PACBTI-enablement macros 2023-01-10 14:16:05 +00:00
misc Remove __sinit_locks / __sinit_recursive_mutex 2022-05-13 12:31:56 +02:00
posix Fix some Coverity Scan errors. 2022-08-31 15:18:08 -04:00
reent Add --enable-newlib-reent-thread-local option 2022-07-13 06:55:46 +02:00
search newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
signal Add --enable-newlib-reent-thread-local option 2022-07-13 06:55:46 +02:00
ssp newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
stdio Fix some Coverity Scan errors. 2022-08-31 15:18:08 -04:00
stdio64 Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
stdlib Implement sysconf for Arm 2022-09-19 15:35:55 -04:00
string Fix memccpy to handle end char >= x80 2023-01-03 14:52:47 -05:00
sys remove +x bit on source files 2022-12-21 22:38:57 -05:00
syscalls newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
time strftime/wcsftime: use STRLEN, not strlen 2022-10-29 20:15:58 +02:00
unix newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
xdr newlib: libc: merge build up a directory 2022-03-16 21:18:25 -04:00
Makefile.inc Silence xsltproc when writing manpages 2022-05-04 17:05:52 -04:00
Makefile.unidata cleanup Unicode data files after generating updated tables 2021-11-16 11:24:29 +01:00
acinclude.m4 newlib: drop phoenix support 2022-03-28 23:17:06 -04:00
libc.in.xml Generate manpages for functions in chapter sys.tex 2022-05-04 17:06:19 -04:00
libc.texi newlib: info: tweak iconv node to avoid collisions 2022-12-13 05:22:09 -05:00
sys.tex Don't include stdio64 functions in reentrant syscalls menu when not bulding stdio64. 2015-08-03 09:54:33 +01:00