Add workaround for jemalloc linking order

Because we don't use jemalloc functions directly, but only via the
libisc library, the dynamic linker might pull the jemalloc library
too late when memory has been already allocated via standard libc
allocator.

Add a workaround round isc_mem_create() that makes the dynamic linker
to pull jemalloc earlier than libc.
This commit is contained in:
Ondřej Surý
2023-12-21 11:12:54 +01:00
parent 2ff908026d
commit 41a0ee1071
4 changed files with 33 additions and 7 deletions

View File

@@ -24,9 +24,6 @@
#include <time.h>
#include <unistd.h>
#define UNIT_TESTING
#include <cmocka.h>
#include <isc/buffer.h>
#include <isc/file.h>
#include <isc/hash.h>
@@ -264,7 +261,7 @@ dns_test_tohex(const unsigned char *data, size_t len, char *buf,
memset(buf, 0, buflen);
isc_buffer_init(&target, buf, buflen);
result = isc_hex_totext((isc_region_t *)&source, 1, " ", &target);
assert_int_equal(result, ISC_R_SUCCESS);
INSIST(result == ISC_R_SUCCESS);
return (buf);
}
@@ -428,7 +425,7 @@ dns_test_namefromstring(const char *namestr, dns_fixedname_t *fname) {
isc_buffer_putmem(b, (const unsigned char *)namestr, length);
result = dns_name_fromtext(name, b, NULL, 0, NULL);
assert_int_equal(result, ISC_R_SUCCESS);
INSIST(result == ISC_R_SUCCESS);
isc_buffer_free(&b);
}