<div dir="ltr">We build the objects for the shared library as an OBJECT library. Which is why I imagine CMake isn't passing -fPIC.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 8, 2019 at 7:02 PM Shoaib Meenai <<a href="mailto:smeenai@fb.com">smeenai@fb.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><a href="https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html</a> says POSITION_INDEPENDENT_CODE should be true for shared library targets by default. Were you running into issues with the static library targets?<br>
<br>
On 3/8/19, 3:26 PM, "libcxx-commits on behalf of Eric Fiselier via libcxx-commits" <<a href="mailto:libcxx-commits-bounces@lists.llvm.org" target="_blank">libcxx-commits-bounces@lists.llvm.org</a> on behalf of <a href="mailto:libcxx-commits@lists.llvm.org" target="_blank">libcxx-commits@lists.llvm.org</a>> wrote:<br>
<br>
Author: ericwf<br>
Date: Fri Mar 8 15:27:46 2019<br>
New Revision: 355756<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D355756-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=YW9OhXPyI41BvMX2Zq1kA4dRQT4_qoAaZewnn_i9-BQ&s=Y-7rBwXxL0GFGPtQGHRacJN6k5SX5zh27MyYs6RfQtw&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D355756-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=YW9OhXPyI41BvMX2Zq1kA4dRQT4_qoAaZewnn_i9-BQ&s=Y-7rBwXxL0GFGPtQGHRacJN6k5SX5zh27MyYs6RfQtw&e=</a><br>
Log:<br>
Revert "[libc++] Do not force building with -fPIC"<br>
<br>
This reverts commit r355764.<br>
<br>
CMake does not turn -fPIC on for us by default. so this patch breaks<br>
standalone builds. The only reason it hasn't broken any bots is because<br>
LLVM turns on and specifies '-fPIC' for us.<br>
<br>
Modified:<br>
libcxx/trunk/lib/CMakeLists.txt<br>
<br>
Modified: libcxx/trunk/lib/CMakeLists.txt<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_lib_CMakeLists.txt-3Frev-3D355756-26r1-3D355755-26r2-3D355756-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=YW9OhXPyI41BvMX2Zq1kA4dRQT4_qoAaZewnn_i9-BQ&s=Gmy_hBPr3_JmAW0-p4HRD_iNz9ZvRufPu6aBtYxVN0I&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_lib_CMakeLists.txt-3Frev-3D355756-26r1-3D355755-26r2-3D355756-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=YW9OhXPyI41BvMX2Zq1kA4dRQT4_qoAaZewnn_i9-BQ&s=Gmy_hBPr3_JmAW0-p4HRD_iNz9ZvRufPu6aBtYxVN0I&e=</a><br>
==============================================================================<br>
--- libcxx/trunk/lib/CMakeLists.txt (original)<br>
+++ libcxx/trunk/lib/CMakeLists.txt Fri Mar 8 15:27:46 2019<br>
@@ -105,6 +105,10 @@ if (LIBCXXABI_USE_LLVM_UNWINDER)<br>
endif()<br>
<br>
# Setup flags.<br>
+if (NOT WIN32)<br>
+ add_flags_if_supported(-fPIC)<br>
+endif()<br>
+<br>
add_link_flags_if_supported(-nodefaultlibs)<br>
<br>
if (LIBCXX_TARGETING_MSVC)<br>
<br>
<br>
_______________________________________________<br>
libcxx-commits mailing list<br>
<a href="mailto:libcxx-commits@lists.llvm.org" target="_blank">libcxx-commits@lists.llvm.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_libcxx-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=YW9OhXPyI41BvMX2Zq1kA4dRQT4_qoAaZewnn_i9-BQ&s=vIesftmbT9vy7WsaY43SyTTicNCVjdnT2KBcSiyaKtU&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_libcxx-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=YW9OhXPyI41BvMX2Zq1kA4dRQT4_qoAaZewnn_i9-BQ&s=vIesftmbT9vy7WsaY43SyTTicNCVjdnT2KBcSiyaKtU&e=</a><br>
<br>
<br>
</blockquote></div>