-
-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce libstdc++/libc++ bloat in statically-linked executables #689
Comments
Audit of a Linux build (libstdc++):
I used this script to correlate imported (undefined) symbols with their callers: # Usage: objdump -xd build-size/quick-lint-js | python slurp.py | c++filt
import collections
import re
import sys
callers = collections.defaultdict(set)
current_symbol = "???"
for line in sys.stdin:
line = line.rstrip("\n")
match = re.match(r"^[0-9a-f]{16} <(?P<symbol>.*)>:$", line)
if match is not None:
current_symbol = match.group("symbol")
match = re.match(r".*(call|jmp).*<(?P<symbol>(_Z|__cxa).*@plt)>$", line)
if match is not None:
called_symbol = match.group("symbol")
callers[called_symbol].add(current_symbol)
for callee in sorted(callers.keys()):
print(callee)
for caller in sorted(callers[callee]):
print(f"\t{caller}")
print() |
A plan:
|
For |
@AbleBacon I recall some range checks too (e.g. for |
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::string/String8 to reduce binary bloat: #689
Reduce our use of std::string/String8 to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::string/String8 to reduce binary bloat: #689
Reduce our use of std::string/String8 to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::string/String8 to reduce binary bloat: #689
Reduce our use of std::string/String8 to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector in non-test code to reduce binary bloat: #689
Reduce our use of std::vector in non-test code to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector in non-test code to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector in non-test code to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689 Because Debug_Server now uses Vector internally, make the vector instrumentation tests for Debug_Server tolerant of extra vector profile data.
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689 Because Debug_Server now uses Vector internally, make the vector instrumentation tests for Debug_Server tolerant of extra vector profile data.
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
Reduce our use of std::vector to reduce binary bloat: #689
I think the biggest binary size win would be avoiding statically linking with the C++ runtimes.
On Linux, for example, I noticed that statically linking the C++ runtime is a problem because exception support gets pulled in, even if we don't use exceptions. Exception support in libstdc++ includes a C++ symbol demangler which is bloated.
We've gotten good binary size reductions in the past by avoiding some parts of the C++ standard libraries. See commits 909fae2 and dfbb182 for example.
The text was updated successfully, but these errors were encountered: