[libcxx-commits] [PATCH] D104328: [libc++] Always build libc++ and libc++abi with -fPIC
Mikhail Maltsev via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 28 05:52:02 PDT 2021
miyuki added a comment.
In D104328#2821342 <https://reviews.llvm.org/D104328#2821342>, @mstorsjo wrote:
>> Furthermore, there is apparently basically no downside to building the libraries with position independent code, since modern toolchains are sufficiently clever.
>
> FWIW it's not necessarily so much about modern toolchains, as it is about modern architectures. AFAIK position independent code is measurably less efficient on e.g. i386, while the overhead on e.g. x86_64 and arm64 is much much smaller (possibly also on 32 bit arm). Therefore I think the other patch (D104327 <https://reviews.llvm.org/D104327>) makes more sense out of these two, as the choice of PIC is more of a choice for how one configures and distributes it, than an intrinsic property of the project itself.
I agree. Using -fPIC does not make much sense for embedded targets where everything is linked statically: -fPIC will add overhead, with no particular benefits.
@ldionne, could you please make this feature configurable? Not necessarily using CMAKE_POSITION_INDEPENDENT_CODE like in D104327 <https://reviews.llvm.org/D104327>, but perhaps by a new CMake variable (e.g. LLVM_RUNTIMES_ENABLE_PIC).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104328/new/
https://reviews.llvm.org/D104328
More information about the libcxx-commits
mailing list