[libc-commits] [PATCH] D69020: Illustrate a redirector using the example of round function from math.h.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Oct 25 14:59:45 PDT 2019


sivachandra added a comment.

In D69020#1721904 <https://reviews.llvm.org/D69020#1721904>, @jakehehrlich wrote:

> I've missed some emails and the round table at llvm. Could you describe more about why this mechanism for redirecting is used? It seems to me that there should be a way for `LLVM_LIBC_ENTRYPOINT(round)` to be an alias for `::round` rather than requiring two (likely tail) calls here. Could you motivate this mechanism?


Yes. Agreed that there is an added 2-call overhead, so I do not see this being used for all functions. Further, this is only an optional feature and not a necessary feature in the sense that one can choose to not include it in their libc build if they do not want to.

About what is it used for: we want to use LLVM-libc as a drop in replacement for the system libc as early as possible. So, having this redirector mechanism is one way to do it. One can argue that if static linking is all we care about, then such a mechanism is not required. However, having wrappers for system libc functions (when LLVM-libc does not provide the implementation) gives us a place to apply compiler based and other security mitigations.

[I now realize that the diagram is not viewable on phabricator, so I have put it on my github account: https://github.com/sivachandra/llvm-libc/blob/master/docs/redirectors.md ]


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69020/new/

https://reviews.llvm.org/D69020





More information about the libc-commits mailing list