Comments (5)
Description
- Plugin support in Clang was disabled to reduce binary size, but...
libclang.so
,libclang-cpp.so
andlibLLVM-17.so
are built, beacuseLLVM_BUILD_LLVM_DYLIB
isON
since the build scripts are refactored, and...
Thanks for flagging this. The libclang
and libLLVM
libraries are used by clang-based tools used in Android platform build. @DanAlbert They can be removed from the ndk.
- Currently the build scripts perform BOLT themselves, while upstream CMake has added BOLT support (llvm/llvm-project@3dab7fe and llvm/llvm-project@076240f).
This is by design. AOSP clang collects PGO and BOLT profiles when building Android so all backends get exercised and profiled. The CMake support only builds for the host architecture.
By the way, I find
LLVM_ENABLE_THREADS
is explicitly defined asON
, which is default on most platforms supported by LLVM.
As for "plugin support in Clang", it would be nice to compile and load out-of-tree passes independently rather than compile the whole modified LLVM toolchain.
For now, we plan to leave plugin support off considering the significant size reduction and build speedup, esp. for users on old hardware.
from ndk.
https://android-review.googlesource.com/c/platform/ndk/+/3038133. Will cherry-pick to r27 since that also shaves about half a GB off the install size. We had some code that stripped those (the toolchain you give me has those unstripped for whatever reason), but they either moved or whoever wrote that code in the first place didn't test it, because it was stripping the wrong location :(
from ndk.
I am not sure why the libraries are not stripped. Filed internal bug b/333762307 to track this down.
from ndk.
@pirama-arumuga-nainar @DanAlbert Thanks for your kindly response introducing more NDK design perspectives!
FYI, when LLVM_LINK_LLVM_DYLIB
is enabled, we have a dependency list:
components | dependencies |
---|---|
clang* |
libclang-cpp.so and libLLVM.so |
llvm* lld |
libLLVM.so |
lldb |
liblldb.so |
libclang.so liblldb.so |
libclang-cpp.so and libLLVM.so |
libclang-cpp.so |
libLLVM.so |
That means currently those bloated binaries and libraries, whose size are around 100MB and more, contain multiple copies of (at least part of) libclang-cpp.so
and libLLVM.so
.
With LLVM_LINK_LLVM_DYLIB
enabled, we have:
- Most binaries,
libLTO.so
andlibclang.so
below 1MB; liblldb.so
,clangd
andclang-tidy
around 20MB;libclang-cpp.so
around 70MB.
So I believe enabling LLVM_LINK_LLVM_DYLIB
is able to introduce more size reduction and build speedup (no more redundant static linking), which makes it negligible to enable plugin support in clang
.
The problem is whether optimizers, especially BOLT, work with dynamic libraries. I have noticed that both upstream CMake and our build scripts only perform BOLT over the clang
binary itself. Is it possible to perform BOLT over underlying libraries as well?
from ndk.
Related Issues (20)
- [Bug]: ld.lld: error: undefined symbol: __aeabi_l2d HOT 4
- [BUG] Unable to Handle Exceptions Properly HOT 2
- [BUG] With Buildozer for Python/Kivy project for Android NDK 26b HOT 6
- [Bug]: Cannot select while compiling llama.cpp on Windows HOT 4
- Simpleperf: Only one FEAT_FILE2 feature section can be read from the file HOT 2
- AES support (arm/arm64 vaeseq_u8) HOT 12
- [FR] clang driver should default to gnu hashes if the target api level is >= 23? HOT 7
- [Bug]: Segmentation Fault trying to run an LLVM pass HOT 2
- [Bug] clang frontend crashes on NDK 28.0.11617993 HOT 11
- [BUG] Building Library\Bee\artifacts\Android\a7sem\2b6k1szry106.o failed [RAM ISSUE?] HOT 9
- [BUG] clang frontend crashes on both r26d and canary version HOT 5
- [Bug] ndk clang building release raise error `declaration does not match` while llvm upstream compiles HOT 8
- [FR] improve bad diagnostic for `__REMOVED_IN` on `ALooper_pollAll` HOT 8
- [BUG] With Compose AndroidView on API 29, ANativeWindow_fromSurface with SurfaceView without an additional ViewGroup makes AndroidViewsHandle go black HOT 3
- [FR] Update Vulkan headers in sysroot of NDK r27 to enable FFmpeg's Vulkan integration HOT 18
- [Feature request] consider to provide libc.a for each API level HOT 6
- [BUG] using thread_local in x64 Android 12L/13 desktop simulator for release build generates invalid init function for thread_local variable that leads to SIGSEGV HOT 1
- [BUG] 23.1.77 Build errors on Unity 2022.3.21f1 HOT 7
- [BUG] Prebuilt clang and ld.lld fail to load compatible pass plugin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ndk.