summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/load.test4
-rw-r--r--tools/genStubs.tcl2
-rwxr-xr-xunix/configure50
-rw-r--r--unix/dltest/pkga.c17
-rw-r--r--unix/dltest/pkgua.c13
-rw-r--r--unix/tcl.m432
-rw-r--r--unix/tclAppInit.c8
7 files changed, 103 insertions, 23 deletions
diff --git a/tests/load.test b/tests/load.test
index b7c1a59..2ca6e96 100644
--- a/tests/load.test
+++ b/tests/load.test
@@ -82,6 +82,10 @@ test load-2.3 {loading with no _Init procedure} -constraints [list $dll $loaded]
test load-2.4 {loading with no _SafeInit procedure} [list $dll $loaded] {
list [catch {load [file join $testDir pkga$ext] {} child} msg] $msg
} {1 {can't use package in a safe interpreter: no Pkga_SafeInit procedure}}
+# This test fails due to --export-dynamic
+test load-2.5 {loading package with symbol conflict, this test fails when using --export-dynamic} [list $dll $loaded] {
+ pkga_quote
+} {I'm in pkga.c}
test load-3.1 {error in _Init procedure, same interpreter} \
[list $dll $loaded] {
diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl
index 163a354..a9a874a 100644
--- a/tools/genStubs.tcl
+++ b/tools/genStubs.tcl
@@ -190,6 +190,8 @@ proc genStubs::declare {args} {
puts stderr "Duplicate entry: declare $args"
}
}
+ regsub -all {\*[ \t]*} $decl { *} decl
+ regsub -all {\* \*} $decl {**} decl
regsub -all "\[ \t\n\]+" [string trim $decl] " " decl
set decl [parseDecl $decl]
diff --git a/unix/configure b/unix/configure
index 2483e4a..67785f3 100755
--- a/unix/configure
+++ b/unix/configure
@@ -7044,12 +7044,17 @@ fi
LD_SEARCH_FLAGS=""
;;
BSD/OS-4.*)
- SHLIB_CFLAGS="-export-dynamic -fPIC"
+ SHLIB_CFLAGS="-fPIC"
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -export-dynamic"
+ if test "$SHARED_BUILD" = 0; then
+
+ LDFLAGS="$LDFLAGS -export-dynamic"
+
+fi
+
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
@@ -7073,8 +7078,13 @@ fi
LD_SEARCH_FLAGS=""
;;
Haiku*)
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
SHLIB_CFLAGS="-fPIC"
+ if test "$SHARED_BUILD" = 0; then
+
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+
+fi
+
SHLIB_SUFFIX=".so"
SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
DL_OBJS="tclLoadDl.o"
@@ -7508,7 +7518,12 @@ fi
SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ if test "$SHARED_BUILD" = 0; then
+
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+
+fi
+
if test $doRpath = yes; then
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
@@ -7608,7 +7623,12 @@ fi
SHLIB_LD='${CC} -shared'
DL_OBJS=""
DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ if test "$SHARED_BUILD" = 0; then
+
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+
+fi
+
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
if test "`uname -m`" = "alpha"; then
@@ -7623,7 +7643,12 @@ fi
SHLIB_LD='${CC} -shared'
DL_OBJS="tclLoadDl.o"
DL_LIBS="-mshared -ldl"
- LD_FLAGS="-Wl,--export-dynamic"
+ if test "$SHARED_BUILD" = 0; then
+
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+
+fi
+
if test $doRpath = yes; then
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
@@ -7773,12 +7798,10 @@ rm -f conftest*
fi
echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5
echo "${ECHO_T}$tcl_cv_ld_elf" >&6
- if test $tcl_cv_ld_elf = yes; then
+ if test $tcl_cv_ld_elf = yes -a "$SHARED_BUILD" = 0; then
- LDFLAGS=-Wl,-export-dynamic
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
-else
- LDFLAGS=""
fi
if test "${TCL_THREADS}" = "1"; then
@@ -7802,7 +7825,12 @@ fi
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- LDFLAGS="$LDFLAGS -export-dynamic"
+ if test "$SHARED_BUILD" = 0; then
+
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+
+fi
+
if test $doRpath = yes; then
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
diff --git a/unix/dltest/pkga.c b/unix/dltest/pkga.c
index c4d3f32..a014458 100644
--- a/unix/dltest/pkga.c
+++ b/unix/dltest/pkga.c
@@ -29,6 +29,17 @@ static int Pkga_EqObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
static int Pkga_QuoteObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
+/*
+ * Function to be backlinked from the tcltest executable
+ */
+#if 0
+extern const char *Tcltest_Foo();
+#else
+EXTERN const char *Tcltest_Foo() {
+ return "I'm in pkga.c";
+}
+#endif
+
/*
*----------------------------------------------------------------------
@@ -99,11 +110,15 @@ Pkga_QuoteObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- if (objc != 2) {
+ if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "value");
return TCL_ERROR;
}
+ if (objc == 1) {
+ Tcl_SetResult(interp, (char *) Tcltest_Foo(), TCL_VOLATILE);
+ } else {
Tcl_SetObjResult(interp, objv[1]);
+ }
return TCL_OK;
}
diff --git a/unix/dltest/pkgua.c b/unix/dltest/pkgua.c
index 417bedb..b022c3c 100644
--- a/unix/dltest/pkgua.c
+++ b/unix/dltest/pkgua.c
@@ -13,6 +13,7 @@
#undef STATIC_BUILD
#include "tcl.h"
+#include <stdio.h>
/*
* TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
@@ -175,11 +176,21 @@ PkguaQuoteObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- if (objc != 2) {
+ if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "value");
return TCL_ERROR;
}
+ if (objc == 1) {
+ int major, minor, patch, type;
+ char result[128];
+
+#undef Tcl_GetVersion /* Link this symbol without stubs */
+ Tcl_GetVersion(&major, &minor, &patch, &type);
+ sprintf(result, "%d %d %d %d", major, minor, patch, type);
+ Tcl_SetResult(interp, result, TCL_VOLATILE);
+ } else {
Tcl_SetObjResult(interp, objv[1]);
+ }
return TCL_OK;
}
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 229e0b8..f11e019 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1211,12 +1211,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LD_SEARCH_FLAGS=""
;;
BSD/OS-4.*)
- SHLIB_CFLAGS="-export-dynamic -fPIC"
+ SHLIB_CFLAGS="-fPIC"
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -export-dynamic"
+ AS_IF([test "$SHARED_BUILD" = 0], [
+ LDFLAGS="$LDFLAGS -export-dynamic"
+ ])
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
@@ -1240,8 +1242,10 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LD_SEARCH_FLAGS=""
;;
Haiku*)
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
SHLIB_CFLAGS="-fPIC"
+ AS_IF([test "$SHARED_BUILD" = 0], [
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ ])
SHLIB_SUFFIX=".so"
SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
DL_OBJS="tclLoadDl.o"
@@ -1390,7 +1394,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ AS_IF([test "$SHARED_BUILD" = 0], [
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ ])
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
@@ -1422,7 +1428,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_LD='${CC} -shared'
DL_OBJS=""
DL_LIBS="-ldl"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ AS_IF([test "$SHARED_BUILD" = 0], [
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ ])
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
@@ -1434,7 +1442,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_LD='${CC} -shared'
DL_OBJS="tclLoadDl.o"
DL_LIBS="-mshared -ldl"
- LD_FLAGS="-Wl,--export-dynamic"
+ AS_IF([test "$SHARED_BUILD" = 0], [
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ ])
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
@@ -1524,9 +1534,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
yes
#endif
], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
- AS_IF([test $tcl_cv_ld_elf = yes], [
- LDFLAGS=-Wl,-export-dynamic
- ], [LDFLAGS=""])
+ AS_IF([test $tcl_cv_ld_elf = yes -a "$SHARED_BUILD" = 0], [
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ ])
AS_IF([test "${TCL_THREADS}" = "1"], [
# On OpenBSD: Compile with -pthread
# Don't link with -lpthread
@@ -1545,7 +1555,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
- LDFLAGS="$LDFLAGS -export-dynamic"
+ AS_IF([test "$SHARED_BUILD" = 0], [
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ ])
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c
index 0d2a6c4..910a233 100644
--- a/unix/tclAppInit.c
+++ b/unix/tclAppInit.c
@@ -154,6 +154,14 @@ Tcl_AppInit(
return TCL_OK;
}
+
+#ifdef TCL_TEST
+# undef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS DLLEXPORT
+EXTERN const char *Tcltest_Foo() {
+ return "I'm in tclAppInit.c";
+}
+#endif /* TCL_TEST */
/*
* Local Variables: