[PATCH] D97736: [Driver] Add a experimental option to link to LLVM libc.

Siva Chandra via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 13 19:44:07 PST 2021


On Sat, Mar 13, 2021 at 9:36 AM Eric Christopher <echristo at gmail.com> wrote:

>
>
> On Fri, Mar 5, 2021 at 1:15 AM Siva Chandra via Phabricator <
> reviews at reviews.llvm.org> wrote:
>
>> sivachandra added a comment.
>>
>> In D97736#2605535 <https://reviews.llvm.org/D97736#2605535>, @phosek
>> wrote:
>>
>> > Have you considered using an input linker script? We could generate
>> `libc.so` that could look something like:
>> >
>> >   INPUT(libllvmlibc.a /lib/libc.so)
>> >
>> > We would need to pass `--sysroot` to the linker for this to work. The
>> driver could remain completely agnostic of whether you're using LLVM libc
>> or not.
>>
>> Yes, that was also considered. Those downstream users who have the
>> flexibility to do it that way should be able to do it that way. However,
>> not all downstream users or normal clang users will have that liberty [1].
>> Another point to note is that we will have to do this with all libc
>> components like `libc.so`, `libm.so` etc.
>>
>> [1] I think all of this can be done. For example, we can set all this up
>> when building a distribution. However, I am not sure this is worth it when
>> we know this is a transient phase. Soon, when LLVM libc is complete enough,
>> a more appropriate option would be the one which allows choosing a libc as
>> Eric pointed out.
>>
>
> To be clear I'm not a fan of a "pick your libc" option as opposed to just
> naming the compiled llvm libc as perhaps libc.[a,so,etc] similar to other
> platforms. I think we'd need a good reason to diverge here.
>

The reason is that LLVM libc is not a libc until it can be one. This option
is being added so that one can use LLVM libc as a source of alternate
implementations. Once LLVM libc can actually be a full libc, this option is
not required. Also, from that point in time, the LLVM libc binary should be
given the conventional libc.<something> name as you suggest.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210313/be493350/attachment.html>


More information about the cfe-commits mailing list