1
0
mirror of https://github.com/skeeto/w64devkit.git synced 2026-10-26 05:39:17 +03:00

4 Commits

Author SHA1 Message Date
Christopher Wellons
cbb4c3f0df Fix libmemory and libchkstk archival on x86
The build used the host ar instead of the cross ar. With -mbig-obj as
the default (c9c9c073), the host ar cannot understand the PE32 object
files and so doesn't produce a symbol index. Not the first time this
problem has come up.
2025-02-13 20:33:25 -05:00
Christopher Wellons
50b343dbfe libchkstk: Add frame low address overflow checks
If an especially large frame is requested, the low frame address might
overflow and land above the stack pointer, disabling the stack probe. In
practice it would only happen from alloca calls and VLAs using untrusted
sizes, but it would be nice to handle it anyway. This change introduces
an overflow check, nulling the low address and forcing the probe loop to
run until it overflows the stack.

In 64-bit (all) and 32-bit ___chkstk_ms, it costs a two-byte instruction
on the unhappy path, and on the fast path conversion of an unconditional
jump to a predictable conditional jump. On 32-bit __chkstk it costs two,
two-byte instructions, one on the fast path and one on the unhappy path.
Not too bad.

The stack low address "mov" did not need to move. I did it to keep the
stack frame operations together.

Thanks to Stefan Kanthak for pointing out this defect.
2024-02-18 20:19:47 -05:00
Christopher Wellons
c2b61e3322 libchkstk.S: Remove stray sub from x86 ___chkstk_ms
Thanks to Felipe Garcia for catching this. That sub was a leftover from
an earlier version which did not push eax/rax. I missed it when updating
to the current version.
2024-02-05 08:23:41 -05:00
Christopher Wellons
43bf1e56c9 New runtime library: libchkstk
Provides 32-bit and 64-bit ___chkstk_ms and __chkstk. The former can
replace the libgcc implementation. Better license, about half the size,
and substantially faster when used on a hot path. The purpose and role
is similar to libmemory.
2024-02-02 22:01:33 -05:00