Skip to content

[JITLink] [test] Extend preexisting MinGW XFAILs to new tests #142375

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

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

mstorsjo
Copy link
Member

@mstorsjo mstorsjo commented Jun 2, 2025

This extends the preexisting XFAILs from
4c642b6 to these new tests from 6fa8657.

This extends the preexisting XFAILs from
4c642b6 to these new tests from
6fa8657.
@mstorsjo mstorsjo requested a review from lhames June 2, 2025 12:29
@lhames
Copy link
Contributor

lhames commented Jun 3, 2025

@mstorsjo Do any of the JIT test cases work on MinGW?

If the JIT is close to working there then we could fix this by adding a definition of __main to be loaded by default for MinGW triples.

If the JIT isn't close to working then we could probably just disable the JITLink tests completely on MinGW.

@mstorsjo
Copy link
Member Author

mstorsjo commented Jun 3, 2025

@mstorsjo Do any of the JIT test cases work on MinGW?

If the JIT is close to working there then we could fix this by adding a definition of __main to be loaded by default for MinGW triples.

If the JIT isn't close to working then we could probably just disable the JITLink tests completely on MinGW.

I think the JIT is generally working (sorry I don't really know the nuance differences between the various JIT implementations); we tweaked things in the lli executable a couple years ago in cbc2a06 in order to make tests pass. I think the ORC runtime isn't set up to work in mingw mode though. But overall, up until last week all tests passed with ninja check (although some of them are marked as unsupported or XFAIL).

@mstorsjo
Copy link
Member Author

mstorsjo commented Jun 5, 2025

If the JIT is close to working there then we could fix this by adding a definition of __main to be loaded by default for MinGW triples.

Do you have any suggestion on where/how to do this?

Could we merge this first, to get the tests back to green first, and then look into providing __main and getting rid of these XFAILs?

@lhames
Copy link
Contributor

lhames commented Jun 6, 2025

I think it's fine to land these, but it'd be good to add a FIXME to reenable them once we add __main emulation to ORC?

The ORC runtime isn't relevant here, but the RuntimeDyld / JITLink distinction is: These are llvm-jitlink tests for the new JIT linker. The pure assembly cases are hand written, so have no reference to __main, but the new .ll ones are compiled by llc which will add a reference -- that's probably what's caused the difference.

@mstorsjo
Copy link
Member Author

mstorsjo commented Jun 6, 2025

I think it's fine to land these, but it'd be good to add a FIXME to reenable them once we add __main emulation to ORC?

Luckily, as they're XFAIL, it'll be a red failure again if it does start passing without updating the tests. :-) But if you prefer I can add a FIXME comment about it there as well - would you prefer that next to the XFAIL in the tests, or elsewhere?

The ORC runtime isn't relevant here, but the RuntimeDyld / JITLink distinction is: These are llvm-jitlink tests for the new JIT linker. The pure assembly cases are hand written, so have no reference to __main, but the new .ll ones are compiled by llc which will add a reference -- that's probably what's caused the difference.

Yep; fwiw I noted that lli does hook up a dummy __main similarly already:

// If this is a Mingw or Cygwin executor then we need to alias __main to
// orc_rt_int_void_return_0.
if (J->getTargetTriple().isOSCygMing())
ExitOnErr(J->getProcessSymbolsJITDylib()->define(
orc::absoluteSymbols({{J->mangleAndIntern("__main"),
{orc::ExecutorAddr::fromPtr(mingw_noop_main),
JITSymbolFlags::Exported}}})));

Copy link
Contributor

@lhames lhames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Luckily, as they're XFAIL, it'll be a red failure again if it does start passing without updating the tests. :-)
Good point. That will do. ;)

@lhames
Copy link
Contributor

lhames commented Jun 10, 2025

Yep; fwiw I noted that lli does hook up a dummy __main similarly already:

Yep. Having a no-op __main will probably be sufficient to get the tests passing (certainly it'll address the missing symbol error).

Ideally we'd figure out what __main's role in a regular program is and emulate it (a no-op might even be the right operation in a JIT context, but if so we should verify and document that).

@mstorsjo mstorsjo merged commit 9b282af into llvm:main Jun 10, 2025
12 checks passed
@mstorsjo mstorsjo deleted the jitlink-mingw-xfail branch June 10, 2025 09:05
rorth pushed a commit to rorth/llvm-project that referenced this pull request Jun 11, 2025
…42375)

This extends the preexisting XFAILs from
4c642b6 to these new tests from
6fa8657.
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
…42375)

This extends the preexisting XFAILs from
4c642b6 to these new tests from
6fa8657.
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.

2 participants