dmd icon indicating copy to clipboard operation
dmd copied to clipboard

Enable linker optimizations when needed on windows

Open ryuukk opened this issue 3 years ago • 5 comments

This significantly reduce the executable file size

And this is what LDC is doing: https://github.com/ldc-developers/ldc/blob/3b9665bac69df0c27bc1888cca8a442df656d948/driver/linker-msvc.cpp#L130

Discussion: https://forum.dlang.org/post/[email protected]

ryuukk avatar Sep 05 '22 18:09 ryuukk

Thanks for your pull request and interest in making D better, @ryuukk! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#14418"

dlang-bot avatar Sep 05 '22 18:09 dlang-bot

I don't know if that PR is valid, if it is not, then please make appropriate changes, i'm not willing to dive deeper into DMD code base, i don't have the time

ryuukk avatar Sep 05 '22 18:09 ryuukk

As per review, i removed the dead code, even though i believe it was needed, but i lack skills so that's a story for an other PR

ryuukk avatar Sep 06 '22 17:09 ryuukk

I'll show you how in a few hours

maxhaton avatar Sep 06 '22 21:09 maxhaton

This seems to fail 2 tests on Windows. The failures are linker errors.

RazvanN7 avatar Sep 08 '22 07:09 RazvanN7

@ryuukk any progress on this?

RazvanN7 avatar Nov 01 '22 08:11 RazvanN7

I can't run the test myself since the instruction on the wiki doesn't work, it's outdated

https://wiki.dlang.org/Building_under_Windows#Using_DigitalMars_make_for_running_the_test_suite

If one could update the instructions, that would be nice (make related, wich one exactly to get, and from where)

I tried this: https://sourceforge.net/projects/gnuwin32/ but it doesn't work

make.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

ryuukk avatar Nov 02 '22 20:11 ryuukk

Indeed the instructions are outdated. However, both for building the compiler and running the tests we now have d scripts.

I don't have a windows machine, but I expect that if you run the run.d script from compiler/test directory that should run the tests. You can pass a specific directory to the program or a specific test:

run.exe fail_compilation              -> will run all fail compilation tests
run.exe fail_compilation/test123456.d -> will run that specific test

RazvanN7 avatar Nov 09 '22 08:11 RazvanN7