Skip to content

MLIR linking warnings concerning weak symbols #166

Closed
@dpotop

Description

@dpotop

Hello,

I'm building a dialect for MLIR, and one main difficulty was to isolate my
sources from those of the official LLVM/MLIR project (which I try to maintain
full compatibility with).

Now I manage to compile and execute my code, but I have some nasty linking
warnings I don't know how to make disappear properly.

Here is the link command and the first warning (subsequent ones are quite similar).
I insist on the fact that the code is (currently) working. But then again, It does not do
much - just check the correctness of the input. Sorry for the huge command - I found no simple way of determining which of the .a library files I really need.

clang++ -std=c++14 -L /Users/llvm-test/llvm-dpotop/lib -o main main.o -lExampleIRTransforms -lLLVMAggressiveInstCombine -lLLVMAnalysis -lLLVMAsmParser -lLLVMAsmPrinter -lLLVMBinaryFormat -lLLVMBitReader -lLLVMBitWriter -lLLVMBitstreamReader -lLLVMCFGuard -lLLVMCodeGen -lLLVMCore -lLLVMCoroutines -lLLVMCoverage -lLLVMDWARFLinker -lLLVMDebugInfoCodeView -lLLVMDebugInfoDWARF -lLLVMDebugInfoGSYM -lLLVMDebugInfoMSF -lLLVMDebugInfoPDB -lLLVMDemangle -lLLVMDlltoolDriver -lLLVMExecutionEngine -lLLVMFrontendOpenMP -lLLVMFuzzMutate -lLLVMGlobalISel -lLLVMIRReader -lLLVMInstCombine -lLLVMInstrumentation -lLLVMInterpreter -lLLVMJITLink -lLLVMLTO -lLLVMLibDriver -lLLVMLineEditor -lLLVMLinker -lLLVMMC -lLLVMMCA -lLLVMMCDisassembler -lLLVMMCJIT -lLLVMMCParser -lLLVMMIRParser -lLLVMMLIRTableGen -lLLVMObjCARCOpts -lLLVMObject -lLLVMObjectYAML -lLLVMOption -lLLVMOrcError -lLLVMOrcJIT -lLLVMPasses -lLLVMProfileData -lLLVMRemarks -lLLVMRuntimeDyld -lLLVMScalarOpts -lLLVMSelectionDAG -lLLVMSupport -lLLVMSymbolize -lLLVMTableGen -lLLVMTarget -lLLVMTextAPI -lLLVMTransformUtils -lLLVMVectorize -lLLVMWindowsManifest -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Disassembler -lLLVMX86Info -lLLVMX86Utils -lLLVMXRay -lLLVMipo -lMLIRAffineOps -lMLIRAffineToStandard -lMLIRAnalysis -lMLIRDialect -lMLIREDSC -lMLIREDSCInterface -lMLIRExecutionEngine -lMLIRFxpMathOps -lMLIRGPU -lMLIRGPUtoCUDATransforms -lMLIRGPUtoNVVMTransforms -lMLIRGPUtoROCDLTransforms -lMLIRGPUtoSPIRVTransforms -lMLIRGPUtoVulkanTransforms -lMLIRIR -lMLIRJitRunner -lMLIRLLVMIR -lMLIRLinalgAnalysis -lMLIRLinalgEDSC -lMLIRLinalgOps -lMLIRLinalgToLLVM -lMLIRLinalgToSPIRVTransforms -lMLIRLinalgTransforms -lMLIRLinalgUtils -lMLIRLoopAnalysis -lMLIRLoopOps -lMLIRLoopOpsTransforms -lMLIRLoopToStandard -lMLIRLoopsToGPU -lMLIRMlirOptMain -lMLIRNVVMIR -lMLIROpenMP -lMLIROptLib -lMLIRParser -lMLIRPass -lMLIRPlay -lMLIRQuantOps -lMLIRQuantizerFxpMathConfig -lMLIRQuantizerSupport -lMLIRQuantizerTransforms -lMLIRROCDLIR -lMLIRSDBM -lMLIRSPIRV -lMLIRSPIRVSerialization -lMLIRSPIRVTestPasses -lMLIRSPIRVTransforms -lMLIRShape -lMLIRStandardOps -lMLIRStandardToLLVM -lMLIRStandardToSPIRVTransforms -lMLIRSupport -lMLIRTargetLLVMIR -lMLIRTargetLLVMIRModuleTranslation -lMLIRTargetNVVMIR -lMLIRTargetROCDLIR -lMLIRTestDialect -lMLIRTestIR -lMLIRTestPass -lMLIRTestTransforms -lMLIRTransformUtils -lMLIRTransforms -lMLIRTranslateClParser -lMLIRTranslation -lMLIRVectorOps -lMLIRVectorToLLVM -lMLIRVectorToLoops -lz -lncurses
ld: warning: direct access in function 'mlir::Dialect::VariadicOperationAdder<mlir::AffineApplyOp, mlir::AffineDmaStartOp, mlir::AffineDmaWaitOp, mlir::AffineLoadOp, mlir::AffineStoreOp, mlir::AffineForOp, mlir::AffineIfOp, mlir::AffineMaxOp, mlir::AffineMinOp, mlir::AffineParallelOp, mlir::AffinePrefetchOp, mlir::AffineTerminatorOp>::addToSet(mlir::Dialect&)' from file '/Users/llvm-test/llvm-dpotop/lib/libMLIRAffineOps.a(AffineOps.cpp.o)' to global weak symbol 'mlir::OpState::getCanonicalizationPatterns(mlir::OwningRewritePatternList&, mlir::MLIRContext*)' from file 'main.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'mlir::Dialect::VariadicOperationAdder<mlir::AffineIfOp, mlir::AffineMaxOp, mlir::AffineMinOp, mlir::AffineParallelOp, mlir::AffinePrefetchOp, mlir::AffineTerminatorOp>::addToSet(mlir::Dialect&)' from file '/Users/llvm-test/llvm-dpotop/lib/libMLIRAffineOps.a(AffineOps.cpp.o)' to global weak symbol 'mlir::OpState::getCanonicalizationPatterns(mlir::OwningRewritePatternList&, mlir::MLIRContext*)' from file 'main.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions