Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 35145: /trunk/ /trunk/epan/: Makefil
From: Balint Reczey <balint.reczey@xxxxxxxxxxxx>
Date: Thu, 9 Dec 2010 01:10:26 +0100
On 12/09/2010 12:59 AM, Balint Reczey wrote:
On 12/08/2010 04:21 AM, Jeff Morriss wrote:
On 12/07/2010 01:42 PM, Jeff Morriss wrote:
Balint Reczey wrote:
On 12/07/2010 04:06 PM, Jeff Morriss wrote:
rbalint@xxxxxxxxxxxxx wrote:
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=35145

User: rbalint
Date: 2010/12/07 05:38 AM

Log:
Make libtool export only symbols listed in *.def files
[...]
Directory: /trunk/wsutil/
Changes Path Action
+6 -2 Makefile.am Modified
Hmmm, libwsutil holds the optional targets (e.g., inet_aton() for
systems that don't have it).

At least on the MacOS 10.5 buildbots, nmedit complains if libtool asks
it to export a symbol that isn't present in the library. I'm not sure
of an easy way to fix that (hacking the .def or the .sym file depending
on which optional targets are being built doesn't sound fun). Any
ideas? Or should we export all symbols from libwsutil?
I revert the change for /trunk/wsutil/ to make us able to build for
all platforms.

I will look into other possibilities of hiding some functions:
http://www.gnu.org/software/hello/manual/gnulib/Exported-Symbols-of-Shared-

Libraries.html

Oops, looks like I just beat you to it.

As mentioned in the commit message, it may not be worth it for
libwsutil: on my system there are only 21 global symbols (including
things like _init, _end, etc.). Since this library's purpose is to
provide utility functions, I suppose we may be able to control what it
exports fairly easily (there hopefully won't be any cases of module A's
symbols being needed by module B where that symbol isn't also needed
outside of the library).

There are also optional functions in libwireshark.  The Solaris buildbot
doesn't have Lua installed so it's failing to link because it can't find
wslua_plugin_list...  Ideas?  Maybe this behavior can only be enabled if
the "right" versions of various tools are installed (which ones?)?
I committed a hack which will filter out wslua_plugin_list from the sym file to
keep the build successful.
I think this is not the right approach. I think the list of exported symbols
should not depend on configure parameters, because that way we could make two
libraries with the same so version but with different symbol lists.
In the wslua_plugin_list case we could export it and leave it as NULL.
I will send my patch after running a few tests.

Cheers,
Balint
Tests ran faster than expected.
Will commit this tomorrow and revert my last commit if there are no objections.
The commit implementing filtering could be adapted to wsutil's several optional symbols, if needed.

Cheers,
Balint
Index: gtk/plugins_dlg.c
===================================================================
--- gtk/plugins_dlg.c	(revision 35158)
+++ gtk/plugins_dlg.c	(working copy)
@@ -29,9 +29,6 @@
 #include <gtk/gtk.h>
 
 #include "epan/plugins.h"
-#ifdef HAVE_LUA_5_1
-#include "epan/wslua/init_wslua.h"
-#endif
 
 #include "gtk/dlg_utils.h"
 #include "gtk/gui_utils.h"
Index: epan/wslua/init_wslua.c
===================================================================
--- epan/wslua/init_wslua.c	(revision 35158)
+++ epan/wslua/init_wslua.c	(working copy)
@@ -32,9 +32,9 @@
 #include <math.h>
 #include <epan/expert.h>
 #include <epan/ex-opt.h>
+#include <epan/plugins.h>
 #include <wsutil/privileges.h>
 #include <wsutil/file_util.h>
-#include "init_wslua.h"
 
 static lua_State* L = NULL;
 
Index: epan/wslua/init_wslua.h
===================================================================
--- epan/wslua/init_wslua.h	(revision 35158)
+++ epan/wslua/init_wslua.h	(working copy)
@@ -1,43 +0,0 @@
-/* init_wslua.h
- * definitions for wslua plugins structures
- *
- * $Id$
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@xxxxxxxxxxxxx>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef __INIT_WSLUA_H__
-#define __INIT_WSLUA_H__
-
-#include <glib.h>
-/** @defgroup wslua_group Wireshark LUA
- *
- */
-/** @file
- * @ingroup wslua_group
- */
-typedef struct _wslua_plugin {
-    gchar       *name;            /**< plugin name */
-    gchar       *version;         /**< plugin version */
-    struct _wslua_plugin *next;
-} wslua_plugin;
-
-WS_VAR_IMPORT wslua_plugin *wslua_plugin_list;
-
-#endif /* __INIT_WSLUA_H__ */
Index: epan/plugins.h
===================================================================
--- epan/plugins.h	(revision 35158)
+++ epan/plugins.h	(working copy)
@@ -55,6 +55,14 @@
 extern void register_all_wiretap_modules(void);
 extern void register_all_codecs(void);
 
+typedef struct _wslua_plugin {
+    gchar       *name;            /**< plugin name */
+    gchar       *version;         /**< plugin version */
+    struct _wslua_plugin *next;
+} wslua_plugin;
+
+WS_VAR_IMPORT wslua_plugin *wslua_plugin_list;
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */