+2005-09-25 Peter Ekberg <peda@lysator.liu.se>
+
+ * libltdl/libltdl/lt__private.h, libltdl/lt_error.c:
+ Don't export the lt__last_error and lt__error_strings
+ variables. Define lt__error_strings so that no relocations
+ are needed.
+ * libltdl/libltdl/lt__private.h (LT__STRERROR, LT__GETERROR)
+ (LT__SETERRORSTR): Adjust to not use the above variables,
+ instead use the following functions...
+ * libltdl/lt_error.c: (lt__error_string, lt__get_last_error)
+ (lt__set_last_error): Reimplement the functionality in
+ these functions instead.
+ * libltdl/libltdl/lt_error.h: Add LT_ERROR_LEN_MAX define for
+ max error string length.
+ (lt_dlerror_table): Append explicit nul terminators so that
+ compilers warn more reliably if the above define is too small.
+
2005-09-23 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* tests/link-order.at [ aix* ]: skip path syntax grep.
-2005-09-23 Peter Ekberg <peda@lysator.liu.se>,
+2005-09-23 Peter Ekberg <peda@lysator.liu.se>
* libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Fix awk
script to be a single line so that the cache variable isn't
symbols. Fixes segfault in stresstest.at on Cygwin and
makes the test pass.
-2005-09-22 Peter Ekberg <peda@lysator.liu.se>,
+2005-09-22 Peter Ekberg <peda@lysator.liu.se>
* tests/link-order.test: Clean up the uninstalled libraries
before linking the test executables so that they don't pick
(_LT_LINKER_SHLIBS): Require _LT_TAG_COMPILER to make sure that
$compiler is assigned. Fixes crippled configure output.
-2005-09-21 Peter Ekberg <peda@lysator.liu.se>,
+2005-09-21 Peter Ekberg <peda@lysator.liu.se>
* libltdl/m4/libtool.m4 (LT_PATH_NM): Fix autodetection of
dumpbin and also check for "link -dump -symbols" as a synonym
library. Fixes -mode=clean on Cygwin and MinGW to actually
remove the dll when cleaning up an uninstalled library.
-2005-09-20 Peter Ekberg <peda@lysator.liu.se>,
+2005-09-20 Peter Ekberg <peda@lysator.liu.se>
* libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS, _LT_LANG_CXX_CONFIG):
Split up --out-implib option for linker in separate args so that
libltdl/libltdl/lt__private.h, libltdl/libltdl/lt__strl.h:
Adjusted.
-2005-09-16 Peter Ekberg <peda@lysator.liu.se>,
+2005-09-16 Peter Ekberg <peda@lysator.liu.se>
* tests/testsuite.at (LT_AT_EXEC_CHECK): Make sure
that the exit status of the tested program is
/* Extract the diagnostic strings from the error table macro in the same
order as the enumerated indices in lt_error.h. */
-LT_SCOPE const char *lt__error_strings[];
+#define LT__STRERROR(name) lt__error_string(LT_CONC(LT_ERROR_,name))
-#define LT__STRERROR(name) lt__error_strings[LT_CONC(LT_ERROR_,name)]
-
-#define LT__GETERROR(lvalue) (lvalue) = lt__last_error;
-#define LT__SETERRORSTR(errormsg) lt__last_error = (errormsg)
+#define LT__GETERROR(lvalue) (lvalue) = lt__get_last_error()
+#define LT__SETERRORSTR(errormsg) lt__set_last_error(errormsg)
#define LT__SETERROR(errorcode) LT__SETERRORSTR(LT__STRERROR(errorcode))
-LT_SCOPE const char *lt__last_error;
+LT_SCOPE const char *lt__error_string (int errorcode);
+LT_SCOPE const char *lt__get_last_error (void);
+LT_SCOPE const char *lt__set_last_error (const char *errormsg);
LT_END_C_DECLS
/* Defining error strings alongside their symbolic names in a macro in
this way allows us to expand the macro in different contexts with
confidence that the enumeration of symbolic names will map correctly
- onto the table of error strings. */
+ onto the table of error strings. \0 is appended to the strings to
+ expilicitely initialize the string terminator. */
#define lt_dlerror_table \
- LT_ERROR(UNKNOWN, "unknown error") \
- LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available") \
- LT_ERROR(INVALID_LOADER, "invalid loader") \
- LT_ERROR(INIT_LOADER, "loader initialization failed") \
- LT_ERROR(REMOVE_LOADER, "loader removal failed") \
- LT_ERROR(FILE_NOT_FOUND, "file not found") \
- LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found") \
- LT_ERROR(NO_SYMBOLS, "no symbols defined") \
- LT_ERROR(CANNOT_OPEN, "can't open the module") \
- LT_ERROR(CANNOT_CLOSE, "can't close the module") \
- LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found") \
- LT_ERROR(NO_MEMORY, "not enough memory") \
- LT_ERROR(INVALID_HANDLE, "invalid module handle") \
- LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow") \
- LT_ERROR(INVALID_ERRORCODE, "invalid errorcode") \
- LT_ERROR(SHUTDOWN, "library already shutdown") \
- LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module") \
- LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)") \
- LT_ERROR(INVALID_POSITION, "invalid search path insert position")
+ LT_ERROR(UNKNOWN, "unknown error\0") \
+ LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available\0") \
+ LT_ERROR(INVALID_LOADER, "invalid loader\0") \
+ LT_ERROR(INIT_LOADER, "loader initialization failed\0") \
+ LT_ERROR(REMOVE_LOADER, "loader removal failed\0") \
+ LT_ERROR(FILE_NOT_FOUND, "file not found\0") \
+ LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found\0") \
+ LT_ERROR(NO_SYMBOLS, "no symbols defined\0") \
+ LT_ERROR(CANNOT_OPEN, "can't open the module\0") \
+ LT_ERROR(CANNOT_CLOSE, "can't close the module\0") \
+ LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found\0") \
+ LT_ERROR(NO_MEMORY, "not enough memory\0") \
+ LT_ERROR(INVALID_HANDLE, "invalid module handle\0") \
+ LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow\0") \
+ LT_ERROR(INVALID_ERRORCODE, "invalid errorcode\0") \
+ LT_ERROR(SHUTDOWN, "library already shutdown\0") \
+ LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module\0") \
+ LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)\0")\
+ LT_ERROR(INVALID_POSITION, "invalid search path insert position\0")
/* Enumerate the symbolic error names. */
enum {
LT_ERROR_MAX
};
+/* Should be max of the error string lengths above */
+#define LT_ERROR_LEN_MAX (35)
+
/* These functions are only useful from inside custom module loaders. */
LT_SCOPE int lt_dladderror (const char *diagnostic);
LT_SCOPE int lt_dlseterror (int errorcode);
#include "lt_error.h"
#include "lt__private.h"
-LT_GLOBAL_DATA const char *lt__last_error = 0;
-LT_GLOBAL_DATA const char *lt__error_strings[] =
+static const char *lt__last_error = 0;
+static const char lt__error_strings[LT_ERROR_MAX][LT_ERROR_LEN_MAX + 1] =
{
#define LT_ERROR(name, diagnostic) (diagnostic),
lt_dlerror_table
#undef LT_ERROR
-
- 0
};
static const char **user_error_strings = 0;
return errors;
}
+
+const char *
+lt__error_string (int errorcode)
+{
+ assert (errorcode >= 0);
+ assert (errorcode < LT_ERROR_MAX);
+
+ return lt__error_strings[errorcode];
+}
+
+const char *
+lt__get_last_error (void)
+{
+ return lt__last_error;
+}
+
+const char *
+lt__set_last_error (const char *errormsg)
+{
+ return lt__last_error = errormsg;
+}