From: Wouter Wijngaards Date: Thu, 13 Oct 2011 14:09:50 +0000 (+0000) Subject: fix EXPORT_ALL_SYMBOLS. X-Git-Tag: release-1.4.14rc1~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52f4247c48206f883991da0fb0ecc2fcb66c31d9;p=thirdparty%2Funbound.git fix EXPORT_ALL_SYMBOLS. git-svn-id: file:///svn/unbound/trunk@2509 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/config.h.in b/config.h.in index b4cf52571..fe1d970a9 100644 --- a/config.h.in +++ b/config.h.in @@ -25,6 +25,11 @@ /* 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 header file. */ #undef HAVE_ARPA_INET_H diff --git a/configure b/configure index 84ad58e93..20a63e44a 100755 --- 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 diff --git a/configure.ac b/configure.ac index 8b3791c23..7868d3288 100644 --- a/configure.ac +++ b/configure.ac @@ -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) diff --git a/daemon/worker.c b/daemon/worker.c index 538d01a11..6886db49b 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -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; diff --git a/util/fptr_wlist.c b/util/fptr_wlist.c index dd54b3145..8069608a0 100644 --- a/util/fptr_wlist.c +++ b/util/fptr_wlist.c @@ -79,6 +79,24 @@ #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; } diff --git a/util/fptr_wlist.h b/util/fptr_wlist.h index 1b6862766..84e2376a5 100644 --- a/util/fptr_wlist.h +++ b/util/fptr_wlist.h @@ -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 */