ld error backward reference detected
What happened?
Got
Linking third_party/iree/tools/_iree-mlir-lsp-server_cc_binary failed
with
ld: error: backward reference detected: _ZN4mlir13iree_compiler35addIREEComprehensiveBufferizePassesERNS_13OpPassManagerEN4llvm8OptionalINSt3__u8functionIFNS_9FailureOrINS_5ValueEEERNS_9OpBuilderENS_8LocationENS_10MemRefTypeENS_10ValueRangeEjEEEEENS4_INS6_IFNS_13LogicalResultESB_SC_S8_EEEEENS4_INS6_IFSI_SB_SC_S8_S8_EEEEE in bazel-out/k8-opt/bin/third_party/iree/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/_objs/CommonExtensions/CommonExtensions.o refers to bazel-out/k8-opt/bin/third_party/iree/compiler/src/iree/compiler/Codegen/Common/_objs/Common/IREEComprehensiveBufferizePass.o
while building internally @ acc111bb3e7831afcfd4c4b4fa72cb28f9b0eb97 . I haven't repro'd in full OSS yet.
Steps to reproduce your issue
No response
What component(s) does this issue relate to?
Other
Version information
No response
Additional context
No response
Is this only happening with iree-mlir-lsp-server, or with other binaries also? That particular binary is for developer use via IDEs and is not depended on by any tests or anything user-facing. I'm not aware of anyone who builds that binary with Bazel, but the Bazel build targets were added for parity with CMake. (so feel free to disable in your downstream integrate, or hack at the upstream Bazel build target definition as needed)
Good question, I'll try disabling that one and see if only one
@jpienaar labeling as P1 assigned to you - please change if needed.
Only for that target so will disable downstream and lower priority here.
Well I'm hitting this on another internal build and searched for the problem and this is the second hit :facepalm: I'm hitting the issue linking iree-dialects-opt
ld: error: backward reference detected: _ZN4mlir13iree_compiler4IREE9LinalgExt33createLinalgStrategyDecomposePassERKNS_6linalg26LinalgTransformationFilterE in iree/llvm-external-projects/iree-dialects/_objs/IREELinalgExtPasses/Passes.o refers to llvm-external-projects/iree-dialects/_objs/IREELinalgExtTransforms/Transforms.o
I'm guessing this is something that isn't properly declaring its dependencies?
I suspect that if we added --warn-backrefs to our OSS build we would be able to repro this
:-( I reasoned this was due to transform dialect being in a partially moved state when I encountered the issue. We can check where the bazel and cmake differs for these, most likely in LLVM monorepo.
warn-backrefs didn't give me warning in OSS, don't know why, but I do see:
bin/third_party/iree/llvm-external-projects/iree-dialects/_objs/IREELinalgExtTransforms/Transforms.o: lazy definition of _ZN4mlir13iree_compiler4IREE9LinalgExt33createLinalgStrategyDecomposePassERKNS_6linalg26LinalgTransformationFilterE
bin/third_party/iree/llvm-external-projects/iree-dialects/_objs/IREELinalgExtPasses/Passes.o: reference to _ZN4mlir13iree_compiler4IREE9LinalgExt33createLinalgStrategyDecomposePassERKNS_6linalg26LinalgTransformationFilterE
bin/third_party/iree/llvm-external-projects/iree-dialects/_objs/IREELinalgExtTransforms/Transforms.o: definition of _ZN4mlir13iree_compiler4IREE9LinalgExt33createLinalgStrategyDecomposePassERKNS_6linalg26LinalgTransformationFilterE
An option is setting IREELinalgExtTransforms as alwayslink, the other is combining these two rules into one (and adding an alias).
Probably 2 tasks here 1) fix this for IREELinalgExt (I'm not sure what goes into llvm-external-projects related to LinalgExt and curating there), 2) get checking in main CI working to flag earlier
So the issue is a circular dependency then?
Sort of yes. I don't know why this hits here while we have others that follow similar pattern (I have a suspicion and it would probably be something small, wrong macro used level, but couldn't spot in the time yesterday). I'm more "upset" that I couldn't repro it still in OSS (even with extra linkopts), perhaps I'm synced to wrong git rev and has been fixed, but more likely there are additional settings needed.
We have this checking enabled now and missing case addressed . Issue is still open until the transforms & passes symbol issue is resolved / aliases removed.