New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix d compiler abstractions #6356
Fix d compiler abstractions #6356
Conversation
|
@michaelbadcrumble, @GoaLitiuM, Could one or both of you test this for me and see if it works in real use cases, not just our rather limited test case coverage (assuming the CI all comes back green)? |
|
Tested the fix on a dummy hello world program and does not fail to compiler the project, also compiled a shared and static library. So far it is doing good, but there are object files like |
|
That probably needs a fix similar to this one here. |
|
|
Looks like we need to set up link.exe to be invoked by ldc/dmd instead of invoke directly. I don't have my windows machine today, so I'll look at it it tomorrow and update the MR then. |
|
Any new development regarding the d compiler abstractions @dcbaker ? |
e445403
to
2585068
Compare
dd81686
to
972dfb0
Compare
This was never really true of the D compilers, it made them more complicated than necessary and was incorrect in many cases. Removing it causes no regressions on Linux, at least in our rather limited test cases).
DMD and LDC are a real pain to use as linkers. On Unices they invoke the C compiler as the linker, just like meson does. This means we have to figure out what C compiler they're using and try to pass valid arguments to that compiler if the D compiler doesn't understand the linker arguments we want to pass. In this case that means gcc or clang. We can use-the -Xcc to pass arguments directly to the C compiler without dmd/ldc getting involved, so we'll use that.
This allows fixing tests that produce .dylib's on macOS and .so's on elf Unices.
This breaks LDC and DMD, so just don't do it.
972dfb0
to
432135d
Compare
|
I've rebased this and fixed a large number of issues. There are still some I haven't fixed on windows. I've run out of time for this week though, so I'll come back and look at it more next week. Unless someone wants to point out the obvious reason it isn't working :) |
|
This pull request introduces 1 alert and fixes 1 when merging 5fb18d0 into 6ac4053 - view on LGTM.com new alerts:
fixed alerts:
|
This allows the harness to apply the version correctly, putting it in the right place, dropping the right amount of numbers, etc. pdb taking a version allows it to be more easily copied from the shared_lib type.
So we have some dlang testing on macos.
Like it wants
5fb18d0
to
94ab8b5
Compare
|
This pull request introduces 1 alert and fixes 1 when merging 94ab8b5 into 912d7b7 - view on LGTM.com new alerts:
fixed alerts:
|
DMD is awful in a lot of ways. To change the linker you set an environment variable, which is pretty much impossible for us.
This is the argument to name the implib when using the Visual Studio Linker. This is needed by LDC and DMD when using link.exe or lld-link.exe on windows, and is really a linker argument not a compiler argument.
It was impossible to figure out what was coming from where before.
This is needed when mixing D and C code, as it's possible to end up witha combination of linkers and compilres such that C produces pdb files but D does not.
94ab8b5
to
7470617
Compare
|
This pull request introduces 1 alert and fixes 1 when merging 7470617 into 912d7b7 - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 1 alert and fixes 1 when merging b55d0d3 into 1bd1f98 - view on LGTM.com new alerts:
fixed alerts:
|
62c2fe4
to
9f59d4a
Compare
|
This pull request introduces 1 alert and fixes 1 when merging 9f59d4a into 1bd1f98 - view on LGTM.com new alerts:
fixed alerts:
|
9f59d4a
to
fba6eeb
Compare
|
I don't have my macbook today, so I'm just kinda shooting blind at fixing the problems on macos. |
|
This pull request introduces 1 alert and fixes 1 when merging fba6eeb into 1bd1f98 - view on LGTM.com new alerts:
fixed alerts:
|
Some compilers that act as linker drivers (dmd and ldc) need to split arguments that GCC combines with , (ie, -Wl,-foo,bar -> -L=-foo -L=bar). As such we need to detect that the previous argument contained -soname, and not wrap that in a --start-group/--end-group This modifies the shared library test to demonstrate the problem, with a test case. Fixes mesonbuild#6359
fba6eeb
to
d017243
Compare
|
I now have my macbook and I think I finally have it all working (assuming I didn't break Linux or windows) |
|
This pull request introduces 1 alert and fixes 1 when merging d017243 into 69e9d32 - view on LGTM.com new alerts:
fixed alerts:
|
|
Finally, I think this is good to go! This should have ldc and dmd working on windows, Linux, and mac, plus gdc working on linux. |
|
Great work. This looks like it was all different kinds of terrible. |
|
It wasn't too bad, apart from dmd. That is an infuriating compiler to deal with. And the fact that I'd buggered it up pretty bad and we weren't testing on macos so it had all kinds of broken. We should probably add a test for dmd on macos and gdc on linux. Not sure if travis is the right place for that or if we should use github actions? |
This should fix the D compilers in a number of cases. It removes the code to treat D like it's own linker (in reality LDC and DMD do something much more annoying, they invoke gcc/clang behind our backs). I've also fixed a few other MacOS related bugs.
I've tested gdc, ldc, and dmd on Linux, and dmd and ldc on macos and windows, and there's no regressions in the test coverage from master. I've fixed all of the tests on macOS, and added ldc to the macOS image in travis so we can get some test coverage there. I've also added a couple of tests to help regressions.
Fixes: #6075
Fixes: #6359