``add_entrypoint_library`` target takes a list of ``add_entrypoint_object``
targets and produces a static library containing the object files corresponding
to the ``add_entrypoint_targets``.
-
-Targets for redirectors
------------------------
-
-Similar to how every entrypoint in LLVM-libc has its own build target, every
-redirector function also has its own build target. This target is listed using
-the ``add_redirector_object`` rule. This rule generates a single object file
-which can be packaged along with other redirector objects into shared library
-of redirectors (see below).
-
-Targets for library of redirectors
-----------------------------------
-
-Targets for shared libraries of redirectors are listed using the
-``add_redirector_library`` rule.
+++ /dev/null
-==========================
-Layering Over Another libc
-==========================
-
-When meaningful and practically possible on a platform, llvm-libc will be
-developed in a fashion that it will be possible to layer it over the system
-libc. This does not mean that one can mix llvm-libc with the system-libc. Also,
-it does not mean that layering is the only way to use llvm-libc. What it
-means is that, llvm-libc can optionally be packaged in a way that it can
-delegate parts of the functionality to the system-libc. The delegation happens
-internal to llvm-libc and is invisible to the users. From the user's point of
-view, they only call into llvm-libc.
-
-There are a few problems one needs to be mindful of when implementing such a
-delegation scheme in llvm-libc. Examples of such problems are:
-
-1. One cannot mix data structures from llvm-libc with those from the
-system-libc. A translation from one set of data structures to the other should
-happen internal to llvm-libc.
-2. The delegation mechanism has to be implemented over a related set of
-functions. For example, one cannot delegate just the `fopen` function to the
-system-libc. One will have to delegate all `FILE` related functions to the
-system-libc.
+++ /dev/null
-Redirectors
-===========
-
-When implementing a new C standard library (referred to as *libc* henceforth in
-this document) starting from scratch, it is unrealistic to expect that we will
-have the entire library available from day one. In such a scenario, a practical
-approach is to redirect calls to the unimplemented functions to the same
-functions from another fully functional libc implementation. Such a scheme can
-also serve users who would like to mix and match implementations from LLVM libc
-and another libc implementation. On most platforms, this other libc can be the
-system libc itself. In this document, we present a strategy one can employ to
-build redirectors to redirect from LLVM libc to the system libc. For now, the
-scheme presented is limited to ELF platforms.
-
-Highlevel Mechanism
--------------------
-
-The highlevel scheme is as below:
-
-<img src="./redirectors_schematic.svg">
-
-As shown in the diagram, the mechanism involves a redirector dynamic library
-which goes in between the llvm-libc static library and the system libc dynamic
-library. Essentially, LLVM libc provides implementations for all public
-functions. However, some of the implementations do not actually implement the
-expected functionality. Instead, they just call the corresponding function in
-the redirector library, which in turn calls the same function from the system
-libc.
-
-Implementation of redirecting entrypoints
------------------------------------------
-
-Let us take the ``round`` function from ``math.h`` as an example to see what
-it's implementation looks like when it just redirects to the ``round`` function
-from the system libc::
-
- namespace llvm_libc {
-
- double __redirected_round(double);
-
- double LLVM_LIBC_ENTRYPOINT(round)(double x) {
- return __redirected_round(x);
- }
-
- } // namespace llvm_libc
-
-As can be seen, the ``round`` function from LLVM libc does not call the
-``round`` function from the system libc directly. It calls a function
-``__redirected_round`` from the redirector library. The rest of the
-code follows the conventions described in the *implementation standard*
-document.
-
-Implementation of the redirector function
------------------------------------------
-
-The function ``__redirected_round`` calls the ``round`` function from the system
-libc. Its implementation is as follows::
-
- #include <math.h> // Header file from the system libc
-
- namespace llvm_libc {
-
- double __redirected_round(double x) {
- return ::round(x); // Call to round from the system libc
- }
-
- } // namespace llvm_libc
-