Question about LDC and --gc-sections
kinke
noone at nowhere.com
Fri Oct 26 13:03:58 UTC 2018
On Thursday, 25 October 2018 at 17:19:05 UTC, H. S. Teoh wrote:
> I suspect it may be because the target is an .so rather than an
> executable, so the linker may be leaving in all public symbols
> as a precaution.
Seems like it. The size of a std.stdio hello-world executable
with static druntime/Phobos on Linux x64 is about 900 KB, as
shared lib it's > 6 MB.
> How do I tell the linker (clang) to drop everything except the
> small handful of entry points required by the Android API?
What you could try is using an ld version script to override
symbol visibility - create a little text file like this:
---
CODEABI_1.0 {
global: *entry_point*;
local: *;
};
---
and then pass it to ld via `ldc2 ... -L--version-script=<path>`.
It got the size down to ~900 KB for my dummy .so. Found here:
http://anadoxin.org/blog/control-over-symbol-exports-in-gcc.html
More information about the Digitalmars-d
mailing list