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