<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Duplicate definition of symbol error to do with mergable comdat constant symbols on Windows/COFF"
href="https://bugs.llvm.org/show_bug.cgi?id=40074">40074</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Duplicate definition of symbol error to do with mergable comdat constant symbols on Windows/COFF
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>OrcJIT
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>contact@machiel.info
</td>
</tr>
<tr>
<th>CC</th>
<td>1101.debian@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>It happens when the same literal is defined twice, each in a different module
and after the second module has been added to the RTDyldObjectLinkingLayer.
So for example in some module:
define float @someFunction() {
entry:
ret float 2.000000e+00
}
In some other module:
define float @someOtherFunction() {
entry:
ret float 2.000000e+00
}
When materializing the second function, you will get this error:
JIT session error: Duplicate definition of symbol '__real@40000000'
The symbol names come from comdat symbols that are created in
TargetLoweringObjectFileImpl.cpp
TargetLoweringObjectFileCOFF::getSectionForConstant
For COFF, I have the OverrideObjectFlagsWithResponsibilityFlags and
AutoClaimResponsibilityForObjectSymbols set to true on the
RTDyldObjectLinkingLayer or my function symbols are not found at all.
The same code compiles and runs just fine on Linux/Elf, even with the COFF
workarounds enabled there as well.
A workaround I found is to set HasCOFFComdatConstants to false in
MCAsmInfoCOFF.cpp</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>