Download raw body.
sys/alpha: allign _STACKALIGNBYTES with GCC expectation
tech@,
martijn@ had tried to build gcc-16 on his alpha and shared with me that it
crashed as:
build/genpreds -h /usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/common.md /usr/ports/pobj/gcc-11.2.0/gcc-11.2.0/gcc/config/alpha/alpha.md > tmp-preds.h
Segmentation fault (core dumped)
he had shared with me the pobj's folder with .core where I saw:
(gdb) bt
Python Exception <class 'gdb.MemoryError'>: Cannot access memory at address 0x14
Cannot access memory at address 0x14
(gdb)
which smells like broken or truncated stack with almost NULL.
He confirmed that gcc-8 builds and gcc-16 doesn't which is far larger.
I recall that gcc has it's own stack size as part of system definition.
Here I just made an assumption that kernel truncate stack before gcc thinks
it will and run grep -r STACK by sys/arch/alpha it bring me hit with
_STACKALIGNBYTES which I had compared agains't gcc's alpha definition and
saw missmatch. Checked gcc in base, smae missmatch. Checked NetBSD the same
missmatch.
So, NetBSD, modern GCC and GCC in base defines it the same way with 128 bit mask:
https://github.com/NetBSD/src/blob/trunk/sys/arch/alpha/include/param.h#L60-L64
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/alpha/alpha.h#L253-L254
https://github.com/openbsd/src/blob/master/gnu/gcc/gcc/config/alpha/alpha.h#L352-L353
And we defines it with 64 bit mask:
https://github.com/openbsd/src/blob/master/sys/arch/alpha/include/_types.h#L54-L55
Here a diff whcih allign _STACKALIGNBYTES definition in base with what gcc
expects.
martijn@ had tested it and confirmed that it helped.
Ok?
diff --git sys/arch/alpha/include/_types.h sys/arch/alpha/include/_types.h
index 99f091ebe6b..56fefc5f6da 100644
--- sys/arch/alpha/include/_types.h
+++ sys/arch/alpha/include/_types.h
@@ -52,7 +52,7 @@ typedef struct label_t {
* (within reasonable limits).
*/
#define _ALIGNBYTES 7
-#define _STACKALIGNBYTES _ALIGNBYTES
+#define _STACKALIGNBYTES 15
#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
#define _MAX_PAGE_SHIFT 13 /* same as PAGE_SHIFT */
--
wbr, Kirill
sys/alpha: allign _STACKALIGNBYTES with GCC expectation