aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-10-01 00:34:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2020-10-01 00:34:44 +0200
commitb1c7a66ca6ff913afba17cfe6f16a78a66915c07 (patch)
tree7e99b0a9372dfce961ae44b094987f00a6e4601b /libbb
parent6561e07460acc5b38af99aa5e80283dc04953eca (diff)
downloadbusybox-w32-b1c7a66ca6ff913afba17cfe6f16a78a66915c07.tar.gz
busybox-w32-b1c7a66ca6ff913afba17cfe6f16a78a66915c07.tar.bz2
busybox-w32-b1c7a66ca6ff913afba17cfe6f16a78a66915c07.zip
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 'libbb')
-rw-r--r--libbb/appletlib.c2
-rw-r--r--libbb/ptr_to_globals.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index a515c3fe3..717c63649 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -303,7 +303,7 @@ void lbb_prepare(const char *applet
303void lbb_prepare(const char *applet 303void lbb_prepare(const char *applet
304 IF_FEATURE_INDIVIDUAL(, char **argv)) 304 IF_FEATURE_INDIVIDUAL(, char **argv))
305{ 305{
306#ifdef __GLIBC__ 306#ifdef bb_cached_errno_ptr
307 (*(int **)not_const_pp(&bb_errno)) = __errno_location(); 307 (*(int **)not_const_pp(&bb_errno)) = __errno_location();
308 barrier(); 308 barrier();
309#endif 309#endif
diff --git a/libbb/ptr_to_globals.c b/libbb/ptr_to_globals.c
index 8ba9cd154..2232c6864 100644
--- a/libbb/ptr_to_globals.c
+++ b/libbb/ptr_to_globals.c
@@ -14,7 +14,7 @@ struct globals;
14 * but here we make it live in R/W memory */ 14 * but here we make it live in R/W memory */
15struct globals *ptr_to_globals; 15struct globals *ptr_to_globals;
16 16
17#ifdef __GLIBC__ 17#ifdef errno
18int *bb_errno; 18int *bb_errno;
19#endif 19#endif
20 20
@@ -27,7 +27,7 @@ int *bb_errno;
27 * on weird architectures, compilers, linkers and so on */ 27 * on weird architectures, compilers, linkers and so on */
28struct globals *const ptr_to_globals __attribute__ ((section (".data"))); 28struct globals *const ptr_to_globals __attribute__ ((section (".data")));
29 29
30#ifdef __GLIBC__ 30#ifdef errno
31int *const bb_errno __attribute__ ((section (".data"))); 31int *const bb_errno __attribute__ ((section (".data")));
32#endif 32#endif
33 33