<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 10, 2014 at 3:36 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@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 2014-Nov-10, at 14:48, Alexey Samsonov <<a href="mailto:samsonov@google.com">samsonov@google.com</a>> wrote:<br>
><br>
> Duncan,<br>
><br>
> Why can't we always build the profile library with -fPIC, so that it would work for both PIC and non-PIC code?<br>
><br>
<br>
</span>Frankly I've paged this out. I vaguely recall flailing about trying<br>
to get tests passing on ELF, which I'm not set up to test without<br>
pinging the buildbots (and I know all-too-little about).<br>
<br>
If you think *always* setting -fPIC will work, go ahead and try it.<br>
Having two libraries is clearly inferior.<br></blockquote><div><br></div><div>Trying this in r221952.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
> On Thu, May 15, 2014 at 9:07 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
> Author: dexonsmith<br>
> Date: Thu May 15 23:07:09 2014<br>
> New Revision: 208947<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=208947&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=208947&view=rev</a><br>
> Log:<br>
> InstrProf: Create a PIC version of the profile runtime<br>
><br>
> These tests were XPASS-ing on Linux bots creating Mach-O, which makes<br>
> sense, since the real difference is the object format.<br>
><br>
> I'm hoping a short-term fix to get these tests passing on ELF is to<br>
> create two copies of the runtime -- one built with -fPIC, and one<br>
> without. A follow-up patch will change clang's driver to pick between<br>
> them depending on whether `-shared` is specified.<br>
><br>
> Modified:<br>
> compiler-rt/trunk/lib/profile/CMakeLists.txt<br>
> compiler-rt/trunk/test/profile/instrprof-dynamic-one-shared.test<br>
> compiler-rt/trunk/test/profile/instrprof-dynamic-two-shared.test<br>
><br>
> Modified: compiler-rt/trunk/lib/profile/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/CMakeLists.txt?rev=208947&r1=208946&r2=208947&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/CMakeLists.txt?rev=208947&r1=208946&r2=208947&view=diff</a><br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/profile/CMakeLists.txt (original)<br>
> +++ compiler-rt/trunk/lib/profile/CMakeLists.txt Thu May 15 23:07:09 2014<br>
> @@ -19,6 +19,11 @@ else()<br>
> add_compiler_rt_runtime(clang_rt.profile-${arch} ${arch} STATIC<br>
> SOURCES ${PROFILE_SOURCES})<br>
> add_dependencies(profile clang_rt.profile-${arch})<br>
> +<br>
> + add_compiler_rt_runtime(clang_rt.profile-pic-${arch} ${arch} STATIC<br>
> + CFLAGS -fPIC<br>
> + SOURCES ${PROFILE_SOURCES})<br>
> + add_dependencies(profile clang_rt.profile-pic-${arch})<br>
> endforeach()<br>
> endif()<br>
><br>
><br>
> Modified: compiler-rt/trunk/test/profile/instrprof-dynamic-one-shared.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-dynamic-one-shared.test?rev=208947&r1=208946&r2=208947&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-dynamic-one-shared.test?rev=208947&r1=208946&r2=208947&view=diff</a><br>
> ==============================================================================<br>
> --- compiler-rt/trunk/test/profile/instrprof-dynamic-one-shared.test (original)<br>
> +++ compiler-rt/trunk/test/profile/instrprof-dynamic-one-shared.test Thu May 15 23:07:09 2014<br>
> @@ -1,5 +1,3 @@<br>
> -XFAIL: linux, android<br>
> -<br>
> RUN: mkdir -p %t.d<br>
> RUN: %clang_profgen -o %t.d/a.shared -fPIC -shared %S/Inputs/instrprof-dynamic-a.cpp<br>
> RUN: %clang_profgen -o %t-shared -fPIC -rpath %t.d %t.d/a.shared %S/Inputs/instrprof-dynamic-b.cpp %S/Inputs/instrprof-dynamic-main.cpp<br>
><br>
> Modified: compiler-rt/trunk/test/profile/instrprof-dynamic-two-shared.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-dynamic-two-shared.test?rev=208947&r1=208946&r2=208947&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-dynamic-two-shared.test?rev=208947&r1=208946&r2=208947&view=diff</a><br>
> ==============================================================================<br>
> --- compiler-rt/trunk/test/profile/instrprof-dynamic-two-shared.test (original)<br>
> +++ compiler-rt/trunk/test/profile/instrprof-dynamic-two-shared.test Thu May 15 23:07:09 2014<br>
> @@ -1,5 +1,3 @@<br>
> -XFAIL: linux, android<br>
> -<br>
> RUN: mkdir -p %t.d<br>
> RUN: %clang_profgen -o %t.d/a.shared -fPIC -shared %S/Inputs/instrprof-dynamic-a.cpp<br>
> RUN: %clang_profgen -o %t.d/b.shared -fPIC -shared %S/Inputs/instrprof-dynamic-b.cpp<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
><br>
><br>
> --<br>
> Alexey Samsonov, Mountain View, CA<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div></div>