Small fixes for snmalloc used in FreeBSD libc. (#454)

- Mark the hook that we're exporting for the threading library to call
   to clean up per-thread malloc state as 'used'.  It was changed to
   `inline` to allow duplicate copies of it to be merged but this also
   means that it isn't emitted at all in compilation units that don't
   use it (and it isn't used internally at all).
 - Fix the `__je_bootstrap_*` functions, which are used to bootstrap TLS
   allocation, for the changes to `ScopedAllocator`.

The `__je_bootstrap*` functions weren't being built in CI.  They now are
for non-PIE targets with a smoke test.
This commit is contained in:
David Chisnall
2022-01-21 14:19:26 +00:00
committed by GitHub
parent ef64f6c31b
commit f1be609cdb
4 changed files with 15 additions and 3 deletions

View File

@@ -25,6 +25,7 @@
# define SNMALLOC_COLD
# define SNMALLOC_REQUIRE_CONSTINIT
# define SNMALLOC_UNUSED_FUNCTION
# define SNMALLOC_USED_FUNCTION
#else
# define SNMALLOC_FAST_FAIL() __builtin_trap()
# define SNMALLOC_LIKELY(x) __builtin_expect(!!(x), 1)
@@ -47,6 +48,7 @@
# define SNMALLOC_PURE __attribute__((const))
# define SNMALLOC_COLD __attribute__((cold))
# define SNMALLOC_UNUSED_FUNCTION __attribute((unused))
# define SNMALLOC_USED_FUNCTION __attribute((used))
# ifdef __clang__
# define SNMALLOC_REQUIRE_CONSTINIT \
[[clang::require_constant_initialization]]