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: unassignedb...@nondot.org
          Reporter: cont...@machiel.info
                CC: 1101.deb...@gmail.com, llvm-bugs@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@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to