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

Support COMDATs in ORC Core #45167

Open
lhames opened this issue May 7, 2020 · 0 comments
Open

Support COMDATs in ORC Core #45167

lhames opened this issue May 7, 2020 · 0 comments
Labels
bugzilla Issues migrated from bugzilla orcjit

Comments

@lhames
Copy link
Contributor

lhames commented May 7, 2020

Bugzilla Link 45822
Version trunk
OS All
CC @AlexDenisov,@glevner

Extended Description

From the llvm-dev mailing list thread "[llvm-dev] C++ JIT Compiler with LLVM on Windows 10 - part 5":

"""
$"??_7exception@std@@6b@" = comdat largest

The JIT knows how to honor linkages, but it does not know about comdats yet except in limited circumstances, so it sees these as conflicting definitions.

Adding support for comdats will be non-trivial as their selection rules are more complex than the selection rules for linkage types.
"""

Actually it's worse than I thought: The IR model for COMDATs (see [1]) isn't quite the same as the COFF model for COMDATs (see [2]), but we would need something that can encapsulate both. I think COFF COMDATs are the most general and could cover IR COMDATs, but we should check this with a COFF expert.

Whatever model we settle on, I think we would need to implement it by generalizing SymbolFlagsMap as this is our current vehicle for describing MaterializationUnit interfaces to ORC Core. Once we can describe COMDAT symbols the JITDylib::defineImpl method can be updated to apply COMDAT selection criteria to choose which definitions are kept and which are discarded for any given MaterializationUnit.

[1] https://llvm.org/docs/LangRef.html#comdats
[2] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#comdat-sections-object-only

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla orcjit
Projects
None yet
Development

No branches or pull requests

1 participant