]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
fix EXPORT_ALL_SYMBOLS.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 13 Oct 2011 14:09:50 +0000 (14:09 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 13 Oct 2011 14:09:50 +0000 (14:09 +0000)
git-svn-id: file:///svn/unbound/trunk@2509 be551aaa-1e26-0410-a405-d3ace91eadb9

config.h.in
configure
configure.ac
daemon/worker.c
util/fptr_wlist.c
util/fptr_wlist.h

index b4cf52571426a395cb57fe851ad6531e73f3c5ed..fe1d970a9b6e65f6f9e005adfeb6bb64a559b637 100644 (file)
 /* Define if you want to use debug lock checking (slow). */
 #undef ENABLE_LOCK_CHECKS
 
+/* Define this if you enabled-allsymbols from libunbound to link binaries to
+   it for smaller install size, but the libunbound export table is polluted by
+   internal symbols */
+#undef EXPORT_ALL_SYMBOLS
+
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #undef HAVE_ARPA_INET_H
 
index 84ad58e93be55d6d6d140a605abfbc9137e9d48d..20a63e44add71a07da0c61621be1474ed9e40ccd 100755 (executable)
--- a/configure
+++ b/configure
@@ -16665,6 +16665,9 @@ case "$enable_allsymbols" in
        ;;
        yes)
        EXPORT_ALL_SYMBOLS=yes
+
+$as_echo "#define EXPORT_ALL_SYMBOLS 1" >>confdefs.h
+
        ;;
 esac
 
index 8b3791c23351de5a1347df998d7a627b67e202e3..7868d3288eae5e2074b649ec77f9ecfbe04c0894 100644 (file)
@@ -707,6 +707,7 @@ case "$enable_allsymbols" in
        ;;
        yes)
        EXPORT_ALL_SYMBOLS=yes
+       AC_DEFINE(EXPORT_ALL_SYMBOLS, 1, [Define this if you enabled-allsymbols from libunbound to link binaries to it for smaller install size, but the libunbound export table is polluted by internal symbols])
        ;;
 esac
 AC_SUBST(EXPORT_ALL_SYMBOLS)
index 538d01a113b95435cb582877859c26930ab1c63b..6886db49b052f004841eed013c084938d881cf93 100644 (file)
@@ -1011,6 +1011,17 @@ worker_create(struct daemon* daemon, int id, int* ports, int n)
        unsigned int seed;
        struct worker* worker = (struct worker*)calloc(1, 
                sizeof(struct worker));
+#ifdef EXPORT_ALL_SYMBOLS
+       static void* symlist[] = {
+               &worker_handle_reply, &worker_alloc_cleanup,
+               &worker_probe_timer_cb, &worker_stat_timer_cb,
+               &remote_get_opt_ssl, &remote_control_callback,
+               &worker_handle_control_cmd, &remote_accept_callback,
+               &worker_handle_service_reply, &worker_send_query,
+               &worker_sighandler, &worker_handle_request, NULL
+       };
+       fptr_add_symbols(symlist);
+#endif
        if(!worker) 
                return NULL;
        worker->numports = n;
index dd54b3145b905a182d550135e1a403a8ecc3d56c..8069608a060a3cd33e7cdde8f42fcdd8eff4ba80 100644 (file)
 #include "pythonmod/pythonmod.h"
 #endif
 
+#ifdef EXPORT_ALL_SYMBOLS
+static void** extra_symlist = NULL;
+void fptr_add_symbols(void** list)
+{
+       extra_symlist = list;
+}
+int fptr_in_extralist(void* sym)
+{
+       void** p = extra_symlist;
+       if(!p) return 0;
+       while(*p) {
+               if(*p++ == sym)
+                       return 1;
+       }
+       return 0;
+}
+#endif /* EXPORT_ALL_SYMBOLS */
+
 int 
 fptr_whitelist_comm_point(comm_point_callback_t *fptr)
 {
@@ -86,6 +104,9 @@ fptr_whitelist_comm_point(comm_point_callback_t *fptr)
        else if(fptr == &outnet_udp_cb) return 1;
        else if(fptr == &outnet_tcp_cb) return 1;
        else if(fptr == &tube_handle_listen) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -96,6 +117,9 @@ fptr_whitelist_comm_point_raw(comm_point_callback_t *fptr)
        else if(fptr == &tube_handle_write) return 1;
        else if(fptr == &remote_accept_callback) return 1;
        else if(fptr == &remote_control_callback) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -108,6 +132,9 @@ fptr_whitelist_comm_timer(void (*fptr)(void*))
        else if(fptr == &worker_probe_timer_cb) return 1;
 #ifdef UB_ON_WINDOWS
        else if(fptr == &wsvc_cron_cb) return 1;
+#endif
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
 #endif
        return 0;
 }
@@ -116,6 +143,9 @@ int
 fptr_whitelist_comm_signal(void (*fptr)(int, void*))
 {
        if(fptr == &worker_sighandler) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -133,6 +163,9 @@ fptr_whitelist_event(void (*fptr)(int, short, void *))
        else if(fptr == &tube_handle_signal) return 1;
 #ifdef UB_ON_WINDOWS
        else if(fptr == &worker_win_stop_cb) return 1;
+#endif
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
 #endif
        return 0;
 }
@@ -143,6 +176,9 @@ fptr_whitelist_pending_udp(comm_point_callback_t *fptr)
        if(fptr == &serviced_udp_callback) return 1;
        else if(fptr == &worker_handle_reply) return 1;
        else if(fptr == &libworker_handle_reply) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -152,6 +188,9 @@ fptr_whitelist_pending_tcp(comm_point_callback_t *fptr)
        if(fptr == &serviced_tcp_callback) return 1;
        else if(fptr == &worker_handle_reply) return 1;
        else if(fptr == &libworker_handle_reply) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -160,6 +199,9 @@ fptr_whitelist_serviced_query(comm_point_callback_t *fptr)
 {
        if(fptr == &worker_handle_service_reply) return 1;
        else if(fptr == &libworker_handle_service_reply) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -186,6 +228,9 @@ fptr_whitelist_rbtree_cmp(int (*fptr) (const void *, const void *))
        else if(fptr == &val_neg_zone_compare) return 1;
        else if(fptr == &probetree_cmp) return 1;
        else if(fptr == &replay_var_compare) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -255,6 +300,9 @@ fptr_whitelist_modenv_send_query(struct outbound_entry* (*fptr)(
 {
        if(fptr == &worker_send_query) return 1;
        else if(fptr == &libworker_send_query) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -364,6 +412,9 @@ int
 fptr_whitelist_alloc_cleanup(void (*fptr)(void*))
 {
        if(fptr == &worker_alloc_cleanup) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -371,6 +422,9 @@ int fptr_whitelist_tube_listen(tube_callback_t* fptr)
 {
        if(fptr == &worker_handle_control_cmd) return 1;
        else if(fptr == &libworker_handle_control_cmd) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -379,6 +433,9 @@ int fptr_whitelist_mesh_cb(mesh_cb_func_t fptr)
        if(fptr == &libworker_fg_done_cb) return 1;
        else if(fptr == &libworker_bg_done_cb) return 1;
        else if(fptr == &probe_answer_cb) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
 
@@ -387,5 +444,8 @@ int fptr_whitelist_print_func(void (*fptr)(char*,void*))
        if(fptr == &config_print_func) return 1;
        else if(fptr == &config_collate_func) return 1;
        else if(fptr == &remote_get_opt_ssl) return 1;
+#ifdef EXPORT_ALL_SYMBOLS
+       else if(fptr_in_extralist(fptr)) return 1;
+#endif
        return 0;
 }
index 1b68627661e61535a3991f9ebdbe1ef9c108553d..84e2376a54f0d98fb99dda64335841cadc04a810 100644 (file)
@@ -335,4 +335,8 @@ int codeline_cmp(const void* a, const void* b);
 /** compare two replay_vars */
 int replay_var_compare(const void* a, const void* b);
 
+/** if export_all_symbols then you can register more symbols in an array,
+ * these are symbols from another module that is not loaded during compile */
+void fptr_add_symbols(void** list);
+
 #endif /* UTIL_FPTR_WLIST_H */