[cfe-dev] Linking ProfileRT when using -nodefaultlibs

Eric Fiselier eric at efcs.ca
Mon Nov 10 11:45:29 PST 2014


> Has anyone actually run the tests against GCC recently? IIRC it requires
some local modifications anyway.

I do it occasionally. Most parts work out of the box. I haven't tried
using sanitizers with GCC though.
Don't forget the CMake build also uses -nodefaultlibs so it's not just the
test suite that would require special handling of GCC.

/Eric

On Mon, Nov 10, 2014 at 12:43 PM, Dan Albert <danalbert at google.com> wrote:

> Yes, that is the downside.
>
> Has anyone actually run the tests against GCC recently? IIRC it requires
> some local modifications anyway.
>
> On Mon, Nov 10, 2014 at 11:40 AM, Eric Fiselier <eric at efcs.ca> wrote:
>
>> > The reason we use -nodefaultlibs is to avoid linking the system's
>> libc++. There's a -nostdinc++, maybe there should be a -nostdlib++? Or
>> perhaps -stdlib=none?
>> -nostdlib already exists but it acts like -nodefaultlibs and it drops the
>> startup files as well.
>> I would support -stdlib=none but I'm hesitant to start depending on Clang
>> only flags. It would be nice to not have to special case GCC.
>>
>> /Eric
>>
>> On Mon, Nov 10, 2014 at 12:37 PM, Dan Albert <danalbert at google.com>
>> wrote:
>>
>>> The reason we use -nodefaultlibs is to avoid linking the system's
>>> libc++. There's a -nostdinc++, maybe there should be a -nostdlib++? Or
>>> perhaps -stdlib=none?
>>>
>>> That would let us stop preventing the driver from doing its job...
>>>
>>> On Mon, Nov 10, 2014 at 11:26 AM, Eric Fiselier <eric at efcs.ca> wrote:
>>>
>>>> Thanks for the heads up about the dead link. I've attached the output
>>>> to this email.
>>>>
>>>> I spent some time last night trying to fix this problem in Clang but I
>>>> had no luck :(
>>>> Moving the compiler-rt library before the linker inputs only created
>>>> more issues.
>>>>
>>>> /Eric
>>>>
>>>> On Mon, Nov 10, 2014 at 11:40 AM, Justin Bogner <mail at justinbogner.com>
>>>> wrote:
>>>>
>>>>> Eric Fiselier <eric at efcs.ca> writes:
>>>>> > 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
>>>>>
>>>>> There's nothing there? Mailing this text directly seems simpler than a
>>>>> pastebin to me.
>>>>>
>>>>> This issue and a few other things I've seen recently make me think that
>>>>> compiler-rt and -nodefaultlibs don't interact very well in general. I
>>>>> guess there's work to be done in the area.
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> cfe-dev mailing list
>>>> cfe-dev at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141110/51eed740/attachment.html>


More information about the cfe-dev mailing list