[LLVMdev] undefined reference to 'llvm_gcda_start_file', 'llvm_gcda_emit_arcs', etc

Qun Fa testforqunfa at gmail.com
Mon Mar 25 20:43:05 PDT 2013


This works great! Thanks Alexey for your help.

Qun

On Mon, Mar 25, 2013 at 9:22 AM, Alexey Samsonov <samsonov at google.com>wrote:

>
> On Mon, Mar 25, 2013 at 5:04 PM, Qun Fa <testforqunfa at gmail.com> wrote:
>
>> Thank you Alexey. I will try this out this week. Any idea on supporting
>> this for Mac?
>>
>> My raw idea is to add this to compiler-rt/lib/profile/CMakeLists.txt
>>
>> if(APPLE)
>>
>>   foreach(arch ${PROFILE_SUPPORTED_ARCH})
>>
>>     add_compiler_rt_static_runtime(clang_rt.profile-${arch} ${arch}
>>
>>       SOURCES ${PROFILE_SOURCES}
>>
>>       CFLAGS --sysroot=${COMPILER_RT_DARWIN_SDK_SYSROOT})
>>
>>   endforeach()
>> endif()
>>
>>
>> Do you think it will then support Mac?
>>
>
> Generally we build universal libraries on Mac OS X, so that one static
> library has sources compiled for
> multiple arches. I've added basic Mac support in r177870, hope this will
> work for you.
>
>
>>
>> Longyi
>>
>>
>> On Tue, Mar 19, 2013 at 4:20 AM, Alexey Samsonov <samsonov at google.com>wrote:
>>
>>> Hi!
>>>
>>> On Fri, Mar 15, 2013 at 10:51 PM, Qun Fa <testforqunfa at gmail.com> wrote:
>>>
>>>> Thank you Alexey.
>>>>
>>>> I have tried to use Makefile. This will generate the correct symbols
>>>> that I need.
>>>>
>>>> Any idea on the schedule of adding CMake support to compiler-rt?
>>>>
>>>
>>> Starting from r177382 CMake on Linux should build the same profile
>>> compiler-rt library
>>> as Makefiles.
>>>
>>>
>>>>
>>>> Sincerely,
>>>> Qun
>>>>
>>>>
>>>> On Fri, Mar 15, 2013 at 1:51 AM, Alexey Samsonov <samsonov at google.com>wrote:
>>>>
>>>>>
>>>>> On Fri, Mar 15, 2013 at 1:36 AM, Qun Fa <testforqunfa at gmail.com>wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I think Nick's suggestion is correct, my code was linked against
>>>>>> libprofile_rt.a, which had gcda profiling code before, but was removed
>>>>>> https://github.com/llvm-mirror/llvm/commit/218042a02305a3cc38d968a97ff9ecf4b4abe6ff
>>>>>>
>>>>>> So, I couldn't find the correct symbols from libprofile_rt.a any more.
>>>>>>
>>>>>> Now my assumption is I need to use the correct library that is
>>>>>> provided by compiler-rt. May I know which one?
>>>>>>
>>>>>> I am building the entire llvm/clang including compiler-rt based on
>>>>>> the instructions given on the clang get started page (
>>>>>> http://clang.llvm.org/get_started.html), but with CMake instead of
>>>>>> Makefile. But I also noticed in the compiler-rt/lib/CMakeLists.txt file, we
>>>>>> have the following FIXME.
>>>>>>
>>>>>> # FIXME: Add support for the profile library.
>>>>>>
>>>>>> So, if I want to use the correct library, do I have to switch to
>>>>>> Makefile? Any ideas?
>>>>>>
>>>>>
>>>>> Yeah, can you try Makefile (I think it should build libprofile_rt from
>>>>> GCDAProfiling.c that you need). I'll see if I can add CMake support for
>>>>> profile in compiler-rt any time soon.
>>>>> However, looks like Clang driver won't be smart enough to link two
>>>>> archives (lib/libprofile_rt.a and the one under lib/clang/3.3/linux/...),
>>>>> so we may need to patch the driver as well.
>>>>>
>>>>>
>>>>>>
>>>>>> Thanks very much,
>>>>>> Qun
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thu, Mar 14, 2013 at 8:46 AM, Qun Fa <testforqunfa at gmail.com>wrote:
>>>>>>
>>>>>>> Thanks for your reply.
>>>>>>>
>>>>>>> May I know which is the recommended library that should be linked
>>>>>>> against?
>>>>>>>
>>>>>>> I am currently linking libprofile_rt.a.
>>>>>>>
>>>>>>> And I have noticed the differences that, if we do
>>>>>>>
>>>>>>> `nm libprofile_rt.a | grep llvm`
>>>>>>>
>>>>>>> with my old copy of the llvm/clang installation, I can see
>>>>>>>
>>>>>>> 00000000000005e0 T _llvm_gcda_emit_arcs
>>>>>>> 0000000000000b48 S _llvm_gcda_emit_arcs.eh
>>>>>>> 0000000000000430 T _llvm_gcda_emit_function
>>>>>>> 0000000000000aa8 S _llvm_gcda_emit_function.eh
>>>>>>> 00000000000006c0 T _llvm_gcda_end_file
>>>>>>> 0000000000000b98 S _llvm_gcda_end_file.eh
>>>>>>> 00000000000003d0 T _llvm_gcda_increment_indirect_counter
>>>>>>> 0000000000000a80 S _llvm_gcda_increment_indirect_counter.eh
>>>>>>> 0000000000000000 T _llvm_gcda_start_file
>>>>>>> 0000000000000a08 S _llvm_gcda_start_file.eh
>>>>>>>
>>>>>>> They are the symbols that my test build is looking for.
>>>>>>>
>>>>>>> But with the latest codebase, here is what I saw
>>>>>>>
>>>>>>> 00000000000000a8 T llvm_start_basic_block_tracing
>>>>>>> 0000000000000067 T llvm_trace_basic_block
>>>>>>> 0000000000000467 T llvm_decrement_path_count
>>>>>>> 000000000000042a T llvm_increment_path_count
>>>>>>> 0000000000000662 T llvm_start_path_profiling
>>>>>>> 0000000000000020 T llvm_start_edge_profiling
>>>>>>> 0000000000000020 T llvm_start_opt_edge_profiling
>>>>>>>
>>>>>>> Thanks again,
>>>>>>> Qun
>>>>>>>
>>>>>>> On Thu, Mar 14, 2013 at 1:11 AM, Nick Lewycky <nicholas at mxc.ca>wrote:
>>>>>>>
>>>>>>>> Qun Fa wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>> I am trying to test my project and get the code coverage with a
>>>>>>>>> version
>>>>>>>>> of clang compiler that was built from the latest llvm/clang
>>>>>>>>> codebase.
>>>>>>>>>
>>>>>>>>> It worked for a while. But today, after I updated my local
>>>>>>>>> checkout, and
>>>>>>>>> re-build llvm, clang and compiler-rt, when I test my project
>>>>>>>>> again, I
>>>>>>>>> got the errors with undefined reference to 'llvm_gcda_start_file',
>>>>>>>>> 'llvm_gcda_emit_arcs', 'llvm_gcda_emit_function', and
>>>>>>>>> 'llvm_gcda_end_file'.
>>>>>>>>>
>>>>>>>>> I have searched the codebase, and have found the functions are
>>>>>>>>> defined
>>>>>>>>> in GCDAProfiling.c file, but not sure why this suddenly doesn't
>>>>>>>>> work for me.
>>>>>>>>>
>>>>>>>>> Anyone can give any suggestions?
>>>>>>>>>
>>>>>>>>
>>>>>>>> Those symbols should be provided by compiler-rt/lib/profile/**GCDAProfiling.c.
>>>>>>>> There used to be a copy in llvm's tree, but I deleted that one recently.
>>>>>>>> It's possible you used to be using the one from llvm, but now need to
>>>>>>>> switch to using the one from compiler-rt?
>>>>>>>>
>>>>>>>> Nick
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> LLVM Developers mailing list
>>>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Alexey Samsonov, MSK
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Alexey Samsonov, MSK
>>>
>>
>>
>
>
> --
> Alexey Samsonov, MSK
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130325/e48596f8/attachment.html>


More information about the llvm-dev mailing list