LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 45822 - Support COMDATs in ORC Core
Summary: Support COMDATs in ORC Core
Status: NEW
Alias: None
Product: libraries
Classification: Unclassified
Component: OrcJIT (show other bugs)
Version: trunk
Hardware: PC All
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-06 20:58 PDT by Lang Hames
Modified: 2021-03-31 05:56 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lang Hames 2020-05-06 20:58:28 PDT
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