<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 12, 2015 at 10:52 AM, Xinliang David Li <span dir="ltr"><<a href="mailto:davidxl@google.com" target="_blank">davidxl@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Oct 12, 2015 at 10:51 AM, Justin Bogner <<a href="mailto:mail@justinbogner.com">mail@justinbogner.com</a>> wrote:<br>
> David Li <<a href="mailto:davidxl@google.com">davidxl@google.com</a>> writes:<br>
>> davidxl updated this revision to Diff 36641.<br>
>> davidxl added a comment.<br>
>><br>
>> Make new change strictly limited to linux platform.<br>
><br>
> LGTM, please clang-format InstrProfilingPlatformLinux.c though.<br>
<br>
</span>ok. I assume the one liner change in LLVM is also ok (skipping<br>
register function call when target is linux).<br>
<span class=""><br>
><br>
> Would you mind reaching out to some BSD folks so they're aware of this<br>
> change? Ian Taylor's explanation made it sound like this might work for<br>
> them too, so they might be interested.<br>
<br>
</span>yes -- will do this as a follow up.<br></blockquote><div><br></div><div>The change is now enabled for FreeBSD after verifying __start/__stop section symbol works on the platform. Note that InstrProfilePlatformLinux.c file is not yet changed as there is no good name for it yet (it covers more platforms than Linux but not yet for all ELF platforms).</div><div><br></div><div>David</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
thanks,<br>
<br>
David<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
>><br>
>> <a href="http://reviews.llvm.org/D13329" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13329</a><br>
>><br>
>> Files:<br>
>>   lib/profile/CMakeLists.txt<br>
>>   lib/profile/InstrProfilingPlatformLinux.c<br>
>>   lib/profile/InstrProfilingPlatformOther.c<br>
>><br>
>> Index: lib/profile/InstrProfilingPlatformOther.c<br>
>> ===================================================================<br>
>> --- lib/profile/InstrProfilingPlatformOther.c<br>
>> +++ lib/profile/InstrProfilingPlatformOther.c<br>
>> @@ -9,7 +9,7 @@<br>
>><br>
>>  #include "InstrProfiling.h"<br>
>><br>
>> -#if !defined(__APPLE__)<br>
>> +#if !defined(__APPLE__) && !defined(__linux__)<br>
>>  #include <stdlib.h><br>
>><br>
>>  static const __llvm_profile_data *DataFirst = NULL;<br>
>> Index: lib/profile/InstrProfilingPlatformLinux.c<br>
>> ===================================================================<br>
>> --- /dev/null<br>
>> +++ lib/profile/InstrProfilingPlatformLinux.c<br>
>> @@ -0,0 +1,48 @@<br>
>> +/*===- InstrProfilingPlatformLinux.c - Profile data Linux platform ------===*\<br>
>> +|*<br>
>> +|*                     The LLVM Compiler Infrastructure<br>
>> +|*<br>
>> +|* This file is distributed under the University of Illinois Open Source<br>
>> +|* License. See LICENSE.TXT for details.<br>
>> +|*<br>
>> +\*===----------------------------------------------------------------------===*/<br>
>> +<br>
>> +#include "InstrProfiling.h"<br>
>> +<br>
>> +#if defined(__linux__)<br>
>> +#include <stdlib.h><br>
>> +<br>
>> +extern __llvm_profile_data __start___llvm_prf_data<br>
>> +    __attribute__((visibility("hidden")));<br>
>> +extern __llvm_profile_data __stop___llvm_prf_data<br>
>> +    __attribute__((visibility("hidden")));<br>
>> +extern uint64_t __start___llvm_prf_cnts __attribute__((visibility("hidden")));<br>
>> +extern uint64_t __stop___llvm_prf_cnts __attribute__((visibility("hidden")));<br>
>> +extern char __start___llvm_prf_names __attribute__((visibility("hidden")));<br>
>> +extern char __stop___llvm_prf_names __attribute__((visibility("hidden")));<br>
>> +<br>
>> +__attribute__((visibility("hidden"))) const __llvm_profile_data *<br>
>> +__llvm_profile_begin_data(void) {<br>
>> +  return &__start___llvm_prf_data;<br>
>> +}<br>
>> +__attribute__((visibility("hidden"))) const __llvm_profile_data *<br>
>> +__llvm_profile_end_data(void) {<br>
>> +  return &__stop___llvm_prf_data;<br>
>> +}<br>
>> +__attribute__((visibility("hidden"))) const char *__llvm_profile_begin_names(<br>
>> +    void) {<br>
>> +  return &__start___llvm_prf_names;<br>
>> +}<br>
>> +__attribute__((visibility("hidden"))) const char *__llvm_profile_end_names(<br>
>> +    void) {<br>
>> +  return &__stop___llvm_prf_names;<br>
>> +}<br>
>> +__attribute__((visibility("hidden"))) uint64_t *__llvm_profile_begin_counters(<br>
>> +    void) {<br>
>> +  return &__start___llvm_prf_cnts;<br>
>> +}<br>
>> +__attribute__((visibility("hidden"))) uint64_t *__llvm_profile_end_counters(<br>
>> +    void) {<br>
>> +  return &__stop___llvm_prf_cnts;<br>
>> +}<br>
>> +#endif<br>
>> Index: lib/profile/CMakeLists.txt<br>
>> ===================================================================<br>
>> --- lib/profile/CMakeLists.txt<br>
>> +++ lib/profile/CMakeLists.txt<br>
>> @@ -6,6 +6,7 @@<br>
>>    InstrProfilingBuffer.c<br>
>>    InstrProfilingFile.c<br>
>>    InstrProfilingPlatformDarwin.c<br>
>> +  InstrProfilingPlatformLinux.c<br>
>>    InstrProfilingPlatformOther.c<br>
>>    InstrProfilingRuntime.cc<br>
>>    InstrProfilingUtil.c)<br>
</div></div></blockquote></div><br></div></div>