[PATCH 0/8] s390: Support to generate .sframe in assembler and linker

Jens Remus jremus@linux.ibm.com
Mon Apr 7 12:55:50 GMT 2025


On 02.04.2025 18:11, Jens Remus wrote:

> Open issues and limitations that could be addressed in SFrame, GCC, and
> Glibc:

> - Issue: GCC use of non-SP/FP register as CFA base register.  GCC can
>    be observed to use the non-FP register r14 as temporary CFA base
>    register in the stack clash protector of variadic functions.  This
>    could be addressed either in GCC or with the planned SFrame V3
>    enhancement [2] to support non-SP/FP CFA base registers for topmost
>    frames.

Minor correction: This has nothing to do with variadic functions.  GCC
uses register 14 in the "stack clash protector" on s390x, which can be
enabled using GCC option -fstack-clash-protection, under the following
circumstances:
- Non-leaf function (in which the RA register r14 is saved)
- Function does not call builtin_return_address()
- Static stack allocation larger than ~2 pages (otherwise GCC does not
   use a loop to allocate and access the stack one page at a time)

Minimal sample:

// gcc -O2 -fstack-clash-protection -c -S sample.c
#define PAGE_SIZE       4096
#define SIZE            (3 * PAGE_SIZE)

extern void bar(char *buffer);

void foo() {
         char buffer[SIZE];
         bar(buffer);
}

Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list