[llvm-bugs] [Bug 40074] New: Duplicate definition of symbol error to do with mergable comdat constant symbols on Windows/COFF

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 18 03:45:26 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=40074

            Bug ID: 40074
           Summary: Duplicate definition of symbol error to do with
                    mergable comdat constant symbols on Windows/COFF
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: OrcJIT
          Assignee: unassignedbugs at nondot.org
          Reporter: contact at machiel.info
                CC: 1101.debian at gmail.com, llvm-bugs at lists.llvm.org

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 at 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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181218/ff1a4ade/attachment.html>


More information about the llvm-bugs mailing list