Thread overview
Strip Unused Symbols Ldc + Windows
Mar 21, 2020
SrMordred
Mar 21, 2020
kinke
Mar 21, 2020
SrMordred
Mar 21, 2020
kinke
Mar 21, 2020
SrMordred
March 21, 2020
Someone knows how to strip unused symbols on final binary using ldc on windows ?
i found this about this topic:

https://forum.dlang.org/post/yvmnkvzgoxhcfavjayky@forum.dlang.org

that uses --gc-sections and --version-script but this options are not avaliable in windows lld-link
March 21, 2020
On Saturday, 21 March 2020 at 01:54:00 UTC, SrMordred wrote:
> Someone knows how to strip unused symbols on final binary using ldc on windows ?
> i found this about this topic:
>
> https://forum.dlang.org/post/yvmnkvzgoxhcfavjayky@forum.dlang.org
>
> that uses --gc-sections and --version-script but this options are not avaliable in windows lld-link

That was about ELF symbol visibility and doesn't apply to Windows at all. - The symbols are stripped by default for Windows targets (/OPT:REF for MS linker/LLD). You can cross-check by disabling via `-disable-linker-strip-dead`.
March 21, 2020
On Saturday, 21 March 2020 at 15:53:53 UTC, kinke wrote:
> On Saturday, 21 March 2020 at 01:54:00 UTC, SrMordred wrote:
>> Someone knows how to strip unused symbols on final binary using ldc on windows ?
>> i found this about this topic:
>>
>> https://forum.dlang.org/post/yvmnkvzgoxhcfavjayky@forum.dlang.org
>>
>> that uses --gc-sections and --version-script but this options are not avaliable in windows lld-link
>
> That was about ELF symbol visibility and doesn't apply to Windows at all. - The symbols are stripped by default for Windows targets (/OPT:REF for MS linker/LLD). You can cross-check by disabling via `-disable-linker-strip-dead`.

Hmm, ok, my question is in fact relate to this kind of thing:
https://godbolt.org/z/NGjyyx

Why int example.add(int, int): its still on the binary when all u need is alredy optimized to
main:
 mov     eax, 30
 ret

?



March 21, 2020
On Saturday, 21 March 2020 at 17:33:21 UTC, SrMordred wrote:
> Hmm, ok, my question is in fact relate to this kind of thing:
> https://godbolt.org/z/NGjyyx
>
> Why int example.add(int, int): its still on the binary when all u need is alredy optimized to
> main:
>  mov     eax, 30
>  ret
>
> ?

You're inspecting an object file, before any linker and symbol stripping is involved.
March 21, 2020
On Saturday, 21 March 2020 at 18:01:55 UTC, kinke wrote:
> On Saturday, 21 March 2020 at 17:33:21 UTC, SrMordred wrote:
>> Hmm, ok, my question is in fact relate to this kind of thing:
>> https://godbolt.org/z/NGjyyx
>>
>> Why int example.add(int, int): its still on the binary when all u need is alredy optimized to
>> main:
>>  mov     eax, 30
>>  ret
>>
>> ?
>
> You're inspecting an object file, before any linker and symbol stripping is involved.

Oh, i thought that the symbol stripping was before linker!, my bad, thanks!