Re: the risk of dependencies on the C++ runtime.

(apologies Konstantin, your email got trapped in a spam filter; "It is in
violation of Google's recommended email sender guidelines", according to

Avoiding C++ runtime dependencies is fairly straightforward in practice
(e.g. a program that doesn't use *use* thread-local objects with
destructors won't link against cxa_thread_atexit; similarly,
-fno-exceptions and -fno-rtti and their equivalents are widely available).
It's impossible of course to guarantee that FreeBSD won't ever want to
switch to a (not-yet-written, afaik) compiler + ABI combo that doesn't
admit a runtime-less C++, but that seems unlikely (and, if it were to
happen, it would take enough years of notice and effort that porting the
allocator back to C would be a small relative cost).

We also test bootstrapping behavior against the libcs that we care about,
so that we get some relatively good signal that everything will integrate
correctly on a per-jemalloc-commit basis (we don't try to test against
FreeBSD head, but I don't think that's necessarily a feasible strategy).

I'm sympathetic to the costs of the added compiler required for those
building libc, but weighing it against the ongoing maintenance drag on our
end, it seems like a no-brainer (especially when we already come with
dependencies outside of just the compiler and base build system).

- David

On Thu, Oct 5, 2017 at 11:59 AM, David Goldblatt <>

> Hi all,
> The jemalloc developers have wanted to start using C++ for a while, to
> enable some targeted refactorings of code we have trouble maintaining due
> to brittleness or complexity (e.g. moving thousand line macro definitions
> to templates, changing the build->extract symbols->rebuild mangling scheme
> for internal symbols to one using C++ namespaces). We'd been holding off
> because we thought that FreeBSD base all had to compile on GCC 4.2, in
> order to support some esoteric architectures[1].
> The other day though, I noticed that there is some C++ shipping with
> FreeBSD; /usr/bin/dtc and /sbin/devd (the former claiming in the HACKING
> document that C++11 is a minimum for FreeBSD 11). This, combined with the
> fact that ports now points to a modern gcc, makes me think we were
> incorrect, and can turn on C++ without breaking FreeBSD builds.
> Am I right? Will anything break if jemalloc needs a C++ compiler to build?
> We will of course not use exceptions, RTTI, global constructors, the C++
> stdlib, or anything else that might affect C source or link compatibility.
> Thanks,
> David (on behalf of the jemalloc developers
> [1] That being said, we don't compile or test on those architectures, and
> so probably don't work there in the first place if I'm being honest. But
> we'd also like to avoid making that a permanent state of affairs that can't
> be changed.
_______________________________________________ mailing list
To unsubscribe, send any mail to ""

Reply via email to