enable --as-needed linking (#20619)

* only link as needed

* a few more

* need to fix order

* everywhre

* fix mac

* update spinner + text

* fix c2 build

* another fix

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 36d8c89ebf5fee583b89e48a5d2d5e1d178b5ee5
This commit is contained in:
Adeeb Shihadeh
2021-04-08 11:17:07 -07:00
committed by GitHub
parent cd4e847255
commit 7955ba0a5f
6 changed files with 16 additions and 10 deletions
+4
View File
@@ -141,6 +141,10 @@ else:
ccflags = []
ldflags = []
# no --as-needed on mac linker
if arch != "Darwin":
ldflags += ["-Wl,--as-needed"]
# change pythonpath to this
lenv["PYTHONPATH"] = Dir("#").path
+3 -2
View File
@@ -2,9 +2,10 @@ Import('env', 'arch', 'cereal', 'messaging', 'common', 'visionipc', 'gpucommon')
logger_lib = env.Library('logger', ["logger.cc"])
libs = [logger_lib, 'zmq', 'capnp', 'kj', 'z',
libs = [logger_lib, common, cereal, messaging, visionipc,
'zmq', 'capnp', 'kj', 'z',
'avformat', 'avcodec', 'swscale', 'avutil',
'yuv', 'bz2', 'OpenCL', common, cereal, messaging, visionipc]
'yuv', 'bz2', 'OpenCL']
src = ['loggerd.cc']
if arch in ["aarch64", "larch64"]:
+2 -1
View File
@@ -1,7 +1,8 @@
Import('env', 'arch', 'cereal', 'messaging', 'common', 'gpucommon', 'visionipc')
lenv = env.Clone()
libs = [cereal, messaging, common, 'OpenCL', 'SNPE', 'symphony-cpu', 'capnp', 'zmq', 'kj', 'yuv', gpucommon, visionipc]
libs = [cereal, messaging, common, visionipc, gpucommon,
'OpenCL', 'SNPE', 'symphony-cpu', 'capnp', 'zmq', 'kj', 'yuv']
def get_dlsym_offset():
"""Returns the offset between dlopen and dlsym in libdl.so"""
+3 -3
View File
@@ -2,8 +2,8 @@ import os
Import('qt_env', 'arch', 'common', 'messaging', 'gpucommon', 'visionipc',
'cereal', 'transformations')
base_libs = qt_env["LIBS"] + [gpucommon, common, 'zmq', 'capnp', 'kj', 'm', 'OpenCL', 'ssl', 'crypto', 'pthread',
cereal, messaging, visionipc, transformations]
base_libs = [gpucommon, common, cereal, messaging, visionipc, transformations, 'zmq',
'capnp', 'kj', 'm', 'OpenCL', 'ssl', 'crypto', 'pthread'] + qt_env["LIBS"]
if arch == 'aarch64':
base_libs += ['log', 'utils', 'gui', 'ui', 'CB', 'gsl', 'adreno_utils', 'cutils', 'uuid']
@@ -19,7 +19,7 @@ if arch != 'aarch64':
widgets_src += ["qt/offroad/networking.cc", "qt/offroad/wifiManager.cc"]
widgets = qt_env.Library("qt_widgets", widgets_src, LIBS=base_libs)
qt_libs = base_libs + [widgets]
qt_libs = [widgets] + base_libs
# spinner and text window
qt_env.Program("qt/text", ["qt/text.cc"], LIBS=qt_libs)
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c6edce17d54bf9762133e71fdddb5eb112eb182bef5d49c668e478c988aaf572
size 439744
oid sha256:dcf0ea9e0aad69be5f31e349297454433792daabbbc228e42873f37ce3e3a742
size 539856
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9ade107da94609e36256abf30fc45a6c8ad76804fb0f099f8d3d792e61bc118c
size 217160
oid sha256:2fc1c66d026b1beac5654ee18838454a609bc7f04b5ac1d9699be5c91b970e2e
size 616360