diff --git a/include/modversion.h b/include/modversion.h index 0de6b7cd1..396be2e18 100644 --- a/include/modversion.h +++ b/include/modversion.h @@ -21,48 +21,16 @@ #include "version.h" -/* What all this is for? Well, it's simple... - * Example: When someone compiles a module with ssl support, but the - * core was not compiled with ssl support, then the module will read - * things incorrect in the struct because the module sees an extra - * field half-way the struct but in the core that field does not exist, - * hence all data is shifted 4 bytes causing all kinds of odd crashes, - * memory corruption, and weird problems. - * This is an attempt to prevent this a bit, but there are a lot more - * options that cause binary incompatability (eg: changing nicklen), - * we just take the most common ones... - * - * NOTE: On win32 we allow ssl inconsistencies because we - * explicitly use "padding" in the structs: we add a useless - * placeholder so everything is still aligned correctly. - * In the process of doing so, we waste several bytes per-user, - * but this prevents (most) binary incompatability problems - * making it easier for module coders to ship dll's. +/* At UnrealIRCd we don't have a stable module ABI. + * We check for version nowadays, but actually there are many more + * ways to cause binary interface screwups, like using the git + * version and then have a different include/struct.h on your + * running unrealircd compared to your modules, with members shifted + * or reordered and the like. Fun! */ - #ifndef _WIN32 - #define MYTOKEN_SSL "/SSL" - #else - #define MYTOKEN_SSL "" - #endif - #define MYTOKEN_NEWCHF "/NOCHF" - -#ifdef __GNUC__ - #if defined(__GNUC_PATCHLEVEL__) - #define GCCVER ((__GNUC__ << 16) + (__GNUC_MINOR__ << 8) + __GNUC_PATCHLEVEL__) - #else - #define GCCVER ((__GNUC__ << 16) + (__GNUC_MINOR__ << 8)) - #endif -#else - #define GCCVER 0 -#endif - #ifdef UNREALCORE - char our_mod_version[] = BASE_VERSION "-" PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9 \ - MYTOKEN_SSL MYTOKEN_NEWCHF; - unsigned int our_compiler_version = GCCVER; + char our_mod_version[] = BASE_VERSION "-" PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9; #else - DLLFUNC char Mod_Version[] = BASE_VERSION "-" PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9 \ - MYTOKEN_SSL MYTOKEN_NEWCHF; - DLLFUNC unsigned int compiler_version = GCCVER; + DLLFUNC char Mod_Version[] = BASE_VERSION "-" PATCH1 PATCH2 PATCH3 PATCH4 PATCH6 PATCH7 PATCH8 PATCH9; #endif diff --git a/src/modules.c b/src/modules.c index 20e6f4874..7269bd814 100644 --- a/src/modules.c +++ b/src/modules.c @@ -290,7 +290,6 @@ const char *Module_Create(const char *path_) int (*Mod_Load)(); int (*Mod_Unload)(); char *Mod_Version; - unsigned int *compiler_version; static char errorbuf[1024]; const char *path, *relpath, *tmppath; ModuleHeader *mod_header = NULL; @@ -298,7 +297,6 @@ const char *Module_Create(const char *path_) const char *reterr; Module *mod = NULL, **Mod_Handle = NULL; char *expectedmodversion = our_mod_version; - unsigned int expectedcompilerversion = our_compiler_version; long modsys_ver = 0; path = Module_TransformPath(path_); @@ -356,19 +354,6 @@ const char *Module_Create(const char *path_) deletetmp(tmppath); return errorbuf; } - irc_dlsym(Mod, "compiler_version", compiler_version); - if (compiler_version && ( ((*compiler_version) & 0xffff00) != (expectedcompilerversion & 0xffff00) ) ) - { - char theyhad[64], wehave[64]; - make_compiler_string(theyhad, sizeof(theyhad), *compiler_version); - make_compiler_string(wehave, sizeof(wehave), expectedcompilerversion); - snprintf(errorbuf, sizeof(errorbuf), - "Module was compiled with GCC %s, core was compiled with GCC %s. SOLUTION: Recompile your UnrealIRCd and all its modules by doing a 'make clean; ./Config -quick && make'.", - theyhad, wehave); - irc_dlclose(Mod); - deletetmp(tmppath); - return errorbuf; - } irc_dlsym(Mod, "Mod_Header", mod_header); if (!mod_header) { @@ -405,7 +390,6 @@ const char *Module_Create(const char *path_) mod = (Module *)Module_make(mod_header, Mod); safe_strdup(mod->tmp_file, tmppath); mod->mod_sys_version = modsys_ver; - mod->compiler_version = compiler_version ? *compiler_version : 0; safe_strdup(mod->relpath, relpath); irc_dlsym(Mod, "Mod_Init", Mod_Init);