tls: code shrink
[oweals/busybox.git] / sysklogd / syslogd_and_logger.c
index 0964f239cbec8d4c64853c0d8cc932a04d36e259..94d8273b61216fe7c5064f648c4237593d1ab8a4 100644 (file)
@@ -6,8 +6,8 @@
  *
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
-
 #include "libbb.h"
+#include "common_bufsiz.h"
 #define SYSLOG_NAMES
 #define SYSLOG_NAMES_CONST
 #include <syslog.h>
@@ -42,6 +42,18 @@ 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