Skip to content
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

Pass options to linker detection #6065

Merged
merged 4 commits into from
Dec 17, 2019

Conversation

dcbaker
Copy link
Member

@dcbaker dcbaker commented Oct 17, 2019

Here's a new version, built on top of #6207, because I need so much of the machinery to make this work anyway. It will have the same bugs as 6207 does for the moment but I have tested using both -fuse-ld=gold and --target with clang and that works.

@jpakkane
Copy link
Member

Tests fail quite badly. CI should be fixed so getting these working should end up with a green checkmark.

@dcbaker dcbaker force-pushed the pass-options-to-linker-detection branch from a831d00 to 71f520b Compare November 13, 2019 22:47
@dcbaker
Copy link
Member Author

dcbaker commented Nov 25, 2019

Notes for me or whoever:

This is a whole mess of chicken and egg problems:

  1. we need to have the _args and _link_args before we detect the compiler
  2. we need to know if the compiler will invoke the linker before detecting the linker, but this must be done after the compiler is detected
  3. ATM, meson always invokes a given compiler as a linker or not, but the linker may be used both ways (ie, clang.exe on windows will invoke link.exe or lld-link.exe through the compiler)

@dcbaker dcbaker force-pushed the pass-options-to-linker-detection branch from 71f520b to fcee9c3 Compare November 25, 2019 22:31
@dcbaker dcbaker force-pushed the pass-options-to-linker-detection branch 3 times, most recently from e6a6400 to 5536c4b Compare November 27, 2019 00:02
We know that if a compiler class inherits CCompiler it's language will
be C, so doing this at the class level makes more sense.
Currently this is done at the instance level, but we need it at the
class level to allow compiler "lang" args to be gotten early enough.
This patch also removes a couple of instance of branch/leaf classes
providing their own implementation that is identical to the Compiler
version.
This is required to be able to pass compiler and linker arguments to the
methods that try to guess what linker to use.
If a user passes -fuse-ld=gold to gcc or clang, they expect that they'll
get ld.gold, not whatever the default is. Meson currently doesn't do
that, because it doesn't pass these arguments to the linker detection
logic. This patch fixes that. Another case that this is needed is with
clang's --target option

This is a bad solution, honestly, and it would be better to use $LD or a
cross/native file but this is needed for backwards compatability.

Fixes mesonbuild#6057
@dcbaker dcbaker force-pushed the pass-options-to-linker-detection branch from 5536c4b to 47dfe34 Compare December 12, 2019 19:06
@dcbaker dcbaker added this to the 0.53.0 milestone Dec 17, 2019
@dcbaker
Copy link
Member Author

dcbaker commented Dec 17, 2019

@jpakkane, I'm really hoping to get this merged for 0.53.

@jpakkane
Copy link
Member

Whoops, I forgot this since it was (I think) blocked by the dynamic linker change. Reviewing...

@jpakkane jpakkane merged commit a2a9611 into mesonbuild:master Dec 17, 2019
@dcbaker dcbaker deleted the pass-options-to-linker-detection branch December 17, 2019 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants