Fix compile on some linux distros (#15225)
Fixes: 1. After #15096, we pass -flto to jemalloc. On Azure Linux, the resulting jemalloc library cannot be handled at link time and the build fails. Adding -ffat-lto-objects so the compiler also emits regular object code that the linker can fall back to when it cannot handle the LTO-compiled library. 2. Fixed a warning about `path` being NULL in `moduleLoadInternalModules()`. 3. Fixed compile warnings on older GCC versions introduced by #15162 (reported on Ubuntu 20.04) Co-authored-by: debing.sun <debing.sun@redis.com>
This commit is contained in:
co-authored by
debing.sun
parent
b1a53ea21f
commit
0d06e515af
Vendored
+3
-3
@@ -126,7 +126,7 @@ hash_table_add(hashTable *tbl, void *ptr, size_t bytes,
|
||||
}
|
||||
|
||||
static void
|
||||
#if defined(__GNUC__) && __GNUC__ >= 10
|
||||
#if defined(__GNUC__) && __GNUC__ >= 11
|
||||
__attribute__((access(none, 2)))
|
||||
#endif
|
||||
hash_table_del(hashTable *tbl, void *ptr)
|
||||
@@ -344,12 +344,12 @@ xrealloc_impl(void *ptr, size_t new_size, const char *file, int line,
|
||||
new_ptr = realloc(ptr, new_size);
|
||||
if (new_ptr != NULL && new_ptr != ptr)
|
||||
{
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 12
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuse-after-free"
|
||||
#endif
|
||||
hash_table_del(xmalloc_table, ptr);
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 12
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
hash_table_add(xmalloc_table, new_ptr, (int)new_size, file, line, func);
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ ifeq ($(OPTIMIZATION),-O3)
|
||||
ifeq (clang,$(CLANG))
|
||||
ENABLE_LTO=-flto
|
||||
else
|
||||
ENABLE_LTO=-flto=auto
|
||||
ENABLE_LTO=-flto=auto -ffat-lto-objects
|
||||
endif
|
||||
OPTIMIZATION+=$(ENABLE_LTO)
|
||||
endif
|
||||
|
||||
+1
-1
@@ -13373,7 +13373,7 @@ int moduleOnLoad(int (*onload)(void *, void **, int), const char *path, void *ha
|
||||
moduleCreateContext(&ctx, NULL, REDISMODULE_CTX_TEMP_CLIENT); /* We pass NULL since we don't have a module yet. */
|
||||
if (onload((void*)&ctx,module_argv,module_argc) == REDISMODULE_ERR) {
|
||||
serverLog(LL_WARNING,
|
||||
"Module %s initialization failed. Module not loaded",path);
|
||||
"Module %s initialization failed. Module not loaded", path ? path : "(null)");
|
||||
if (ctx.module) {
|
||||
moduleUnregisterCleanup(ctx.module);
|
||||
moduleRemoveCateogires(ctx.module);
|
||||
|
||||
Reference in New Issue
Block a user