<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 7, 2016 at 6:50 PM, Vedant Kumar <span dir="ltr"><<a href="mailto:vsk@apple.com" target="_blank">vsk@apple.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=""><br>
> On Jun 7, 2016, at 6:29 PM, Xinliang David Li <<a href="mailto:xinliangli@gmail.com">xinliangli@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
</span><div><div class="h5">> On Tue, Jun 7, 2016 at 5:44 PM, Vedant Kumar via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: vedantk<br>
> Date: Tue Jun  7 19:44:38 2016<br>
> New Revision: 272081<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=272081&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=272081&view=rev</a><br>
> Log:<br>
> [profile] Hide a few external symbols (NFCI)<br>
><br>
> There are still a few external symbols visible from InstrProfData.inc.<br>
> The plan for dealing with those isn't as straightforward, so I'll try it<br>
> in a separate commit.<br>
><br>
> Modified:<br>
>     compiler-rt/trunk/lib/profile/InstrProfiling.c<br>
>     compiler-rt/trunk/lib/profile/InstrProfilingFile.c<br>
>     compiler-rt/trunk/lib/profile/InstrProfilingUtil.c<br>
><br>
> Modified: compiler-rt/trunk/lib/profile/InstrProfiling.c<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfiling.c?rev=272081&r1=272080&r2=272081&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfiling.c?rev=272081&r1=272080&r2=272081&view=diff</a><br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/profile/InstrProfiling.c (original)<br>
> +++ compiler-rt/trunk/lib/profile/InstrProfiling.c Tue Jun  7 19:44:38 2016<br>
> @@ -18,7 +18,8 @@<br>
><br>
>  COMPILER_RT_VISIBILITY char *(*GetEnvHook)(const char *) = 0;<br>
><br>
> -COMPILER_RT_WEAK uint64_t __llvm_profile_raw_version = INSTR_PROF_RAW_VERSION;<br>
> +COMPILER_RT_VISIBILITY COMPILER_RT_WEAK uint64_t __llvm_profile_raw_version =<br>
> +    INSTR_PROF_RAW_VERSION;<br>
><br>
> There is no need for this one to be hidden (see comments in  InstrProfiling.h).<br>
><br>
><br>
>  COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_magic(void) {<br>
>    return sizeof(void *) == sizeof(uint64_t) ? (INSTR_PROF_RAW_MAGIC_64)<br>
><br>
> Modified: compiler-rt/trunk/lib/profile/InstrProfilingFile.c<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=272081&r1=272080&r2=272081&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=272081&r1=272080&r2=272081&view=diff</a><br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/profile/InstrProfilingFile.c (original)<br>
> +++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c Tue Jun  7 19:44:38 2016<br>
> @@ -30,7 +30,7 @@ typedef struct lprofFilename {<br>
>    unsigned NumHosts;<br>
>  } lprofFilename;<br>
><br>
> -lprofFilename lprofCurFilename = {0, {0}, {0}, 0, 0};<br>
> +COMPILER_RT_VISIBILITY lprofFilename lprofCurFilename = {0, {0}, {0}, 0, 0};<br>
><br>
> This changes the behavior -- the original __llvm_profile_CurrentFilename was intended to be non-hidden -- so that share libraries and main program can share the same file name. It is debatable whether this is a good behavior, but it may require a separate discussion.<br>
<br>
</div></div>Rolled back in r272089.<br>
<br>
I'm surprised that this change didn't break check-profile on my machine. Could you explain how we're relying on lprofCurFilename having default visibility -- i.e how does the sharing happen exactly? I was under the impression that instrumented shared libraries received their own copies of lprofCurFilename.<br></blockquote><div><br></div><div>It is likely that no one actually depend on that behavior, but it does changes the instrumented binary behavior.   Example: build main program with -fprofile-instr-generate=t1.profraw  and linked with a a shared lib which is built with -fprofile-instr-generate=t2.profraw. Run the program. Before it will dump a combined profile into t1.profraw, now it will dump two separate profile data. Note that the old behavior might just be a bug.</div><div><br></div><div>David</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
vedant<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> David<br>
><br>
><br>
>  int getpid(void);<br>
>  static int getCurFilenameLength();<br>
><br>
> Modified: compiler-rt/trunk/lib/profile/InstrProfilingUtil.c<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingUtil.c?rev=272081&r1=272080&r2=272081&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingUtil.c?rev=272081&r1=272080&r2=272081&view=diff</a><br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/profile/InstrProfilingUtil.c (original)<br>
> +++ compiler-rt/trunk/lib/profile/InstrProfilingUtil.c Tue Jun  7 19:44:38 2016<br>
> @@ -67,7 +67,7 @@ void *lprofPtrFetchAdd(void **Mem, long<br>
>  #endif<br>
><br>
>  #ifdef COMPILER_RT_HAS_UNAME<br>
> -int lprofGetHostName(char *Name, int Len) {<br>
> +COMPILER_RT_VISIBILITY int lprofGetHostName(char *Name, int Len) {<br>
>    struct utsname N;<br>
>    int R;<br>
>    if (!(R = uname(&N)))<br>
> @@ -76,7 +76,7 @@ int lprofGetHostName(char *Name, int Len<br>
>  }<br>
>  #endif<br>
><br>
> -FILE *lprofOpenFileEx(const char *ProfileName) {<br>
> +COMPILER_RT_VISIBILITY FILE *lprofOpenFileEx(const char *ProfileName) {<br>
>    FILE *f;<br>
>    int fd;<br>
>  #ifdef COMPILER_RT_HAS_FCNTL_LCK<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
><br>
<br>
</div></div></blockquote></div><br></div></div>