[libc-commits] [PATCH] D112104: [libc] add malloc funcs as external entrypoints

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Oct 21 08:48:05 PDT 2021

sivachandra added a comment.

In D112104#3077996 <https://reviews.llvm.org/D112104#3077996>, @abrachet wrote:

> I think I remember the original plan in this case was to use redirectors <https://github.com/llvm/llvm-project/blob/main/libc/docs/redirectors.rst>. We have add_redirector_object <https://github.com/llvm/llvm-project/blob/main/libc/cmake/modules/LLVMLibCObjectRules.cmake#L262>, but I don't think it has ever been used.

Redirectors were for a different use case: When LLVM libc does not provide a function, a redirector still makes it appear as if it provides it by using a "redirector" to the system libc function [1]. The use case relevant for this patch is different. With allocators, it is further more nuanced [2]. LLVM libc provides an allocator, which is the SCUDO standalone allocator. So, there is no need of a redirector. But, we can't use the normal `add_entrypoint_object` rule for them because LLVM libc doesn't "own" those sources.

[1] For all practical purposes, we have given up on the idea of redirectors. We might use them still, but not sure for what exactly.
[2] Allocators are a little nuanced because when calling the allocator functions from libc code, we want to call them using the public name and not an internal name. This is because we want the users to be able to override the libc allocators.

  rG LLVM Github Monorepo



More information about the libc-commits mailing list