Closed tos11 closed 4 years ago
It appears (at least on Ubuntu) without adding the -static flag, it will statically link everything, but still create a "dynamic program" which requires the dynamic linker. I'm not sure why, it doesn't make sense to me either. Adding static removes the dependency on /lib/ld-musl-x86_64.so.1
Without static: $ ldd templeos-loader-no-static statically linked $ readelf -a templeos-loader-no-static | grep ".so" [Requesting program interpreter: /lib/ld-musl-x86_64.so.1]
With static: $ ldd templeos-loader-static not a dynamic executable
Ah cool, I hadn't realized this distinction!
I'm wondering, what happens when you leave out the
-static
flag? Since the program only links libraries that we build ourselves as static, and musl-gcc should setup stuff likecrt0
, what else can end up dynamically linked?