mirror of
https://git.FreeBSD.org/ports.git
synced 2024-10-20 20:09:11 +00:00
No more dlsym(3) hack. Thanks Sean C. Farley.
Submitted by: Sean C. Farley <sean-freebsd@farley.org>
This commit is contained in:
parent
ba07712221
commit
0be12316d4
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=183536
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= linuxpluginwrapper
|
||||
PORTVERSION= 20051113
|
||||
PORTREVISION= 6
|
||||
PORTREVISION= 7
|
||||
CATEGORIES= www linux emulators
|
||||
MASTER_SITES= http://people.FreeBSD.org/~nork/distfiles/ \
|
||||
${MASTER_SITE_LOCAL}
|
||||
|
@ -0,0 +1,96 @@
|
||||
--- compat_glibc/linux_dynamic.c.orig Sun Oct 17 12:45:23 2004
|
||||
+++ compat_glibc/linux_dynamic.c Sun Jan 28 22:09:17 2007
|
||||
@@ -1,5 +1,5 @@
|
||||
/*-
|
||||
- * Copyright (c) 2004 Norikatsu Shigemura
|
||||
+ * Copyright (c) 2006 Sean Farley
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -23,38 +23,68 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
- * $Id: linux_dynamic.c,v 1.1 2004/10/17 03:45:23 nork Exp $
|
||||
+ * $Id$
|
||||
*/
|
||||
|
||||
#include "pluginwrapper.h"
|
||||
#include "linux.h"
|
||||
-#include <stddef.h>
|
||||
#include <dlfcn.h>
|
||||
-#include <string.h>
|
||||
+#include <err.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+static const char LibGtk[] = "libgtk-x11-2.0.so.0";
|
||||
+
|
||||
+static void *libGtkHandle;
|
||||
+
|
||||
+/*
|
||||
+ * Initialize handle to libgtk-x11-2.0.
|
||||
+ */
|
||||
+static void __attribute__((constructor)) init_lib(void)
|
||||
+{
|
||||
+ libGtkHandle = dlopen(LibGtk, RTLD_LAZY | RTLD_LOCAL);
|
||||
+ if (libGtkHandle == NULL) {
|
||||
+ errx(EXIT_FAILURE, "dlopen(\"%s\"): %s", LibGtk, dlerror());
|
||||
+ }
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
|
||||
-extern unsigned int gtk_major_version;
|
||||
|
||||
/*
|
||||
- * dlsym(3)
|
||||
+ * Deinitialize handle to libgtk-x11-2.0.
|
||||
*/
|
||||
-void *_dlsym(void *, const char *);
|
||||
+static void __attribute__((constructor)) deinit_lib(void)
|
||||
+{
|
||||
+ if (libGtkHandle != NULL && dlclose(libGtkHandle) != 0) {
|
||||
+ errx(EXIT_FAILURE, "dlclose(%p): %s", libGtkHandle, dlerror());
|
||||
+ }
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
|
||||
+/*
|
||||
+ * dlsym(3) using dlfunc(3) to avoid difficulty of locating original dlsym().
|
||||
+ */
|
||||
void *
|
||||
dlsym(void *handle, const char *symbol)
|
||||
{
|
||||
- void *ret;
|
||||
-
|
||||
- if( handle == NULL && strcmp(symbol, "gtk_major_version") == 0 ) {
|
||||
- ret = >k_major_version;
|
||||
- dprintf("gtk_major_version = %d", gtk_major_version);
|
||||
- } else {
|
||||
- ret = _dlsym(handle, symbol);
|
||||
- }
|
||||
+ void *sym;
|
||||
|
||||
- dprintf("dlsym(handle='%s', symbol='%s') = %p", handle, symbol, ret);
|
||||
- if( ret == NULL ) {
|
||||
- dprintf("dlerror=%s", dlerror());
|
||||
+ /* Find desired symbol. */
|
||||
+ sym = dlfunc(handle, symbol);
|
||||
+ if (sym == NULL) {
|
||||
+ dprintf("dlfunc(%p, %s): %s", handle, symbol, dlerror());
|
||||
+
|
||||
+ /* Attempt another search using libgtk-x11-2.0. */
|
||||
+ if (handle == NULL) {
|
||||
+ sym = dlfunc(libGtkHandle, symbol);
|
||||
+ if (sym == NULL)
|
||||
+ dprintf("dlfunc(%p, %s): %s", handle, symbol,
|
||||
+ dlerror());
|
||||
+ }
|
||||
}
|
||||
+ dprintf("dlsym(%p, %s) = %p", handle, symbol, sym);
|
||||
|
||||
- return ret;
|
||||
+ return (sym);
|
||||
}
|
@ -1,12 +1,4 @@
|
||||
================================================================
|
||||
** PLEASE NOTICE TO USER USING FROM 5.0 TO 5.3-BETA6 **
|
||||
libm.so was version-bumped on 5.3-BETA7. Please change libm.so.2
|
||||
to libm.so.3.
|
||||
|
||||
** PLEASE NOTICE TO USER USING FROM 6.0-BETA3 and LATER **
|
||||
shared libraries were version-bumped on 6.0-BETA3. Please overhaul
|
||||
your libmap.conf.
|
||||
|
||||
** PLEASE NOTE Macromedia Flash7 SUPPORT IS ALPHA+ VERSION. **
|
||||
If you find any problem, please send me report(s) with debug
|
||||
information like 'make -DDEBUG install' or patch(es). :-)
|
||||
@ -15,10 +7,7 @@ Flash7 support is unstable. I know well that there are offten
|
||||
crash or freeze with flash7. So don't send me a such report.
|
||||
Of course, I always welcome to recieve fixed problems report.
|
||||
|
||||
Please get and apply a dlsym(3) hook patch.
|
||||
http://people.FreeBSD.org/~nork/rtld_dlsym_hack.diff
|
||||
This provides _dlsym(3) function to fix dynamic-link
|
||||
error "can't find gtk_major_version" ad-hoc-ly.
|
||||
Flash9 support is not yet. Please don't report about it.
|
||||
|
||||
I don't set default to use flash7. Please set-up your
|
||||
enviroment(ln -s, apply patch to rtld,...).
|
||||
@ -30,6 +19,14 @@ The configuration file was minor fixed. So please update your
|
||||
================================================================
|
||||
|
||||
|
||||
|
||||
No more applying a dlsym(3) hook patch.
|
||||
Thanks Sean C. Farley!
|
||||
|
||||
|
||||
|
||||
================================================================
|
||||
|
||||
Setup your /etc/libmap.conf. Please SEE ALSO following file.
|
||||
==> %%LIBMAPCONF%%
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user