<div dir="ltr">Duncan,<div><br></div><div>Why can't we always build the profile library with -fPIC, so that it would work for both PIC and non-PIC code?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 15, 2014 at 9:07 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">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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Alexey Samsonov, Mountain View, CA</div></div></div>
</div>