From cf686ae3b401c68b64ff997b68b7972881dbf80e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 16 Aug 2017 15:05:36 +0200 Subject: syslogd,logger: code shrink for musl function old new delta syslogd_main 1252 1910 +658 logger_main 277 393 +116 timestamp_and_log 434 542 +108 static.__compound_literal - 104 +104 parse_fac_prio_20 137 - -137 pencode 167 - -167 parse_syslogdcfg 715 - -715 ------------------------------------------------------------------------------ (add/remove: 1/3 grow/shrink: 3/0 up/down: 986/-1019) Total: -33 bytes text data bss dec hex filename 912506 563 6132 919201 e06a1 busybox_old 912364 563 6132 919059 e0613 busybox_unstripped Signed-off-by: Denys Vlasenko --- sysklogd/syslogd_and_logger.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sysklogd/syslogd_and_logger.c') diff --git a/sysklogd/syslogd_and_logger.c b/sysklogd/syslogd_and_logger.c index 6458a93..6d06a71 100644 --- a/sysklogd/syslogd_and_logger.c +++ b/sysklogd/syslogd_and_logger.c @@ -43,6 +43,17 @@ typedef struct _code { */ #endif +/* musl decided to be funny and it implements these as giant defines + * of the form: ((CODE *)(const CODE []){ ... }) + * Which works, but causes _every_ function using them + * to have a copy on stack (at least with gcc-6.3.0). + * If we reference them just once, this saves 150 bytes. + * The pointers themselves are optimized out + * (no size change on uclibc). + */ +static const CODE *const bb_prioritynames = prioritynames; +static const CODE *const bb_facilitynames = facilitynames; + #if ENABLE_SYSLOGD #include "syslogd.c" #endif -- cgit v1.1