[cfe-dev] Linking ProfileRT when using -nodefaultlibs

Eric Fiselier eric at efcs.ca
Mon Nov 10 14:40:46 PST 2014


> Hm? On the contrary, in the attached file  "libclang_rt.profile.x86_64.a"
is listed *after* its dependencies, in particular, after "-lc".
> I think this is wrong, and we should just fix it in the driver.
"-nodefautlibs" shouldn't be a problem here, as you seem to add "-lc",
"-lpthread"
> etc. manually to your linker invocation.

Yep. Sorry if I was unclear. I believe we are in agreement.
The linked libraries that come before "libclang_rt.profile.x86_64.a" are
the ones libc++ manually specifies.
They actually need to appear after "libclang_rt.profile.x86_64.a" but there
is no way to make that happen.
When -nodefaultlibs is not passed the linker driver automatically puts the
required libraries after "libclang_rt.profile.x86_64.a" so the issues
doesn't arise.

/Eric


On Mon, Nov 10, 2014 at 3:33 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:

>
> On Sun, Nov 9, 2014 at 10:39 PM, Eric Fiselier <eric at efcs.ca> wrote:
>
>> Hello,
>>
>> I'm working on making libc++ generate code coverage data. This means that
>> libclang_rt.profile.x86_64.a is put into the link command before '-lc' and
>> other dependencies.
>> I suspect this change in library order causes the linker errors I see
>> while running the tests.
>>
>> I have a couple of questions:
>>   - Should -ftest-coverage be passed when linking libc++?
>>   - Is there a way to link libclang_rt.profile.x86_64.a after the given
>> linker flags
>>
>>
>> This file shows the ld invocation with and without -nodefaultlibs as well
>> as the error produced when
>> linking tests w/ -nodefaultlibs
>> http://pastebin.com/QWagJpsW
>>
>
> Hm? On the contrary, in the attached file  "libclang_rt.profile.x86_64.a"
> is listed *after* its dependencies, in particular, after "-lc".
> I think this is wrong, and we should just fix it in the driver.
> "-nodefautlibs" shouldn't be a problem here, as you seem to add "-lc",
> "-lpthread"
> etc. manually to your linker invocation.
>
>
>>
>>
>> Any help is appreciated
>>
>> /Eric
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141110/40b65752/attachment.html>


More information about the cfe-dev mailing list