diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-10-01 00:34:44 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-10-01 00:34:44 +0200 |
commit | b1c7a66ca6ff913afba17cfe6f16a78a66915c07 (patch) | |
tree | 7e99b0a9372dfce961ae44b094987f00a6e4601b /include | |
parent | 6561e07460acc5b38af99aa5e80283dc04953eca (diff) | |
download | busybox-b1c7a66ca6ff913afba17cfe6f16a78a66915c07.tar.gz |
libbb: extend "errno pointer" trick to other than __GLIBC__
Savings on musl:
function old new delta
resume_main 582 614 +32
lbb_prepare - 20 +20
seq_main 432 449 +17
fgetsetversion 74 88 +14
...
script_main 1207 1180 -27
close_silently 28 - -28
shell_builtin_ulimit 655 626 -29
lineedit_read_key 280 247 -33
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 25/123 up/down: 182/-882) Total: -700 bytes
text data bss dec hex filename
1005858 551 5676 1012085 f7175 busybox_old
1005136 551 5680 1011367 f6ea7 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index 83ecca47f..df7e45404 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -339,12 +339,13 @@ struct BUG_off_t_size_is_misdetected { #endif #endif -#if defined(__GLIBC__) -/* glibc uses __errno_location() to get a ptr to errno */ -/* We can just memorize it once - no multithreading in busybox :) */ +#if defined(errno) +/* If errno is a define, assume it's "define errno (*__errno_location())" + * and we will cache it's result in this variable */ extern int *const bb_errno; #undef errno #define errno (*bb_errno) +#define bb_cached_errno_ptr 1 #endif #if !(ULONG_MAX > 0xffffffff) |