Index: llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp =================================================================== --- llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp +++ llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp @@ -482,10 +482,16 @@ break; } case COFF::IMAGE_COMDAT_SELECT_LARGEST: { - // FIXME: Support IMAGE_COMDAT_SELECT_LARGEST when LinkGraph is able to - // handle this. - return make_error( - "IMAGE_COMDAT_SELECT_LARGEST is not supported."); + // FIXME: Support IMAGE_COMDAT_SELECT_LARGEST properly when LinkGraph is + // able to handle this. + LLVM_DEBUG({ + dbgs() << " " << SymIndex + << ": Partially supported IMAGE_COMDAT_SELECT_LARGEST was used" + " in section " + << Symbol.getSectionNumber() << "\n"; + }); + L = Linkage::Weak; + break; } case COFF::IMAGE_COMDAT_SELECT_NEWEST: { // Even link.exe doesn't support this selection properly. Index: llvm/test/ExecutionEngine/JITLink/X86/COFF_comdat_largest.test =================================================================== --- llvm/test/ExecutionEngine/JITLink/X86/COFF_comdat_largest.test +++ llvm/test/ExecutionEngine/JITLink/X86/COFF_comdat_largest.test @@ -1,10 +1,14 @@ # REQUIRES: asserts -# XFAIL: * # RUN: yaml2obj %s -o %t # RUN: llvm-jitlink -noexec --debug-only=jitlink -noexec %t 2>&1 # -# Check jitlink return an error when IMAGE_COMDAT_SELECT_LARGEST selection type is encountered. +# Check jitlink handles largest selection type as plain weak symbol. # +# CHECK: Creating graph symbols... +# CHECK: 2: Creating defined graph symbol for COFF symbol ".text" in .text (index: 2) +# CHECK-NEXT: 0x0 (block + 0x00000000): size: 0x00000001, linkage: strong, scope: local, dead - +# CHECK-NEXT: 4: Exporting COMDAT graph symbol for COFF symbol "func" in section 2 +# CHECK-NEXT: 0x0 (block + 0x00000000): size: 0x00000001, linkage: weak, scope: default, dead - func --- !COFF header: