You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Skip stackoverflow handler for panic=immediate-abort
std installs guard pages and a signal handler to ensure that
stackoverflows 1) terminate abruptly and 2) print an nice message.
Even for panic=immediate-abort, 1) is desirable, we don't want silent
data corruption there. But 2) is completely unnecessary, as users
deliberately *don't* want nice messages, they want minimum binary size.
Therefore, skip the entire guard signal handler setup, which saves a lot
of bytes.
I tested this with a hello world binary using fat LTO, build-std,
panic=immediate-abort, opt-level=s, strip=debuginfo.
`size` reports significant savings:
```
text data bss dec hex filename
15252 1032 104 16388 4004 tiny-before
10869 968 88 11925 2e95 tiny-after
```
`nm -U` goes from 71 to 65, getting rid of a bunch of stack overflow
related symbols. The disk size goes from `31k` to `29k`.
The impact on the error message is minimal, as the message was already
missing.
before:
```
fish: Job 1, './tiny-so-before' terminated by signal SIGABRT (Abort)
```
after:
```
fish: Job 1, './tiny-so-after' terminated by signal SIGSEGV (Address boundary error)
```
0 commit comments