[libc-commits] [libc] [libc] Lazily initialize freelist malloc using symbols (PR #99254)
Daniel Thornburgh via libc-commits
libc-commits at lists.llvm.org
Fri Jul 19 16:19:20 PDT 2024
================
@@ -22,6 +22,9 @@
namespace LIBC_NAMESPACE_DECL {
+extern "C" cpp::byte _end;
----------------
mysterymath wrote:
I'd really like `extern "C" void _end;` to be legal for cases like this, but it isn't. There's no correct C type, since there is no C object that this symbol refers to. It's instead a GCC-blessed abuse of notation to obtain the symbol value via `&_end`. (I'm not sure whether or not this technically violates the standard; hadn't occurred to me before this reply.)
I made it a `cpp::byte` only because `cpp::byte*` seems to have become the preferred type for pointers to undifferentiated memory. The more conventional way to do this is `extern "C" char _end;`, but that might only be because this pattern appears far more commonly in C than in C++.
https://github.com/llvm/llvm-project/pull/99254
More information about the libc-commits
mailing list