Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTO crash "Alias must point to a definition" #122242

Open
BrettRD opened this issue Jan 9, 2025 · 0 comments
Open

LTO crash "Alias must point to a definition" #122242

BrettRD opened this issue Jan 9, 2025 · 0 comments
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] LTO Link time optimization (regular/full LTO or ThinLTO)

Comments

@BrettRD
Copy link

BrettRD commented Jan 9, 2025

I can't tell if this is a duplicate

I Built LLVM from source at main (737d6ca)
and used clang to build https://github.com/Open-Cascade-SAS/OCCT at main (f7dea47c33b579b344c548d39549dca09f98bc3a)

Link-time optimisation fails building TKMath.so:

cmake .. \
-D BUILD_LIBRARY_TYPE="Shared" \
-D CMAKE_BUILD_TYPE="RelWithDebInfo" \
-D CMAKE_C_COMPILER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/clang" \
-D CMAKE_CXX_COMPILER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/clang" \
-D CMAKE_LINKER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld" \
-D CMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld -flto" \
-D CMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld -flto" \
-D CMAKE_C_FLAGS="-flto" \
-D CMAKE_CXX_FLAGS="-flto"

crashes with:

[  3%] Linking CXX shared library ../../lin64/clang/libi/libTKMath.so
Alias must point to a definition
ptr @_ZN17BVH_LinearBuilderIdLi3EED1Ev
LLVM ERROR: Broken module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -shared -o ../../lin64/clang/libi/libTKMath.so.7.8.2 /lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/12 -L/usr/lib/gcc/x86_64-linux-gnu/12/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib -plugin-opt=mcpu=x86-64 -plugin-opt=O2 -lm -Bsymbolic -soname libTKMath.so.7.8 CMakeFiles/TKMath.dir/__/math/math.cxx.o CMakeFiles/TKMath.dir/__/math/math_BFGS.cxx.o CMakeFiles/TKMath.dir/__/math/math_BissecNewton.cxx.o CMakeFiles/TKMath.dir/__/math/math_BracketedRoot.cxx.o CMakeFiles/TKMath.dir/__/math/math_BracketMinimum.cxx.o CMakeFiles/TKMath.dir/__/math/math_BrentMinimum.cxx.o CMakeFiles/TKMath.dir/__/math/math_ComputeGaussPointsAndWeights.cxx.o CMakeFiles/TKMath.dir/__/math/math_ComputeKronrodPointsAndWeights.cxx.o CMakeFiles/TKMath.dir/__/math/math_Crout.cxx.o CMakeFiles/TKMath.dir/__/math/math_DirectPolynomialRoots.cxx.o CMakeFiles/TKMath.dir/__/math/math_DoubleTab.cxx.o CMakeFiles/TKMath.dir/__/math/math_EigenValuesSearcher.cxx.o CMakeFiles/TKMath.dir/__/math/math_FRPR.cxx.o CMakeFiles/TKMath.dir/__/math/math_Function.cxx.o CMakeFiles/TKMath.dir/__/math/math_FunctionAllRoots.cxx.o CMakeFiles/TKMath.dir/__/math/math_FunctionRoot.cxx.o CMakeFiles/TKMath.dir/__/math/math_FunctionRoots.cxx.o CMakeFiles/TKMath.dir/__/math/math_FunctionSample.cxx.o CMakeFiles/TKMath.dir/__/math/math_FunctionSet.cxx.o CMakeFiles/TKMath.dir/__/math/math_FunctionSetRoot.cxx.o CMakeFiles/TKMath.dir/__/math/math_FunctionWithDerivative.cxx.o CMakeFiles/TKMath.dir/__/math/math_Gauss.cxx.o CMakeFiles/TKMath.dir/__/math/math_GaussLeastSquare.cxx.o CMakeFiles/TKMath.dir/__/math/math_GaussMultipleIntegration.cxx.o CMakeFiles/TKMath.dir/__/math/math_GaussSetIntegration.cxx.o CMakeFiles/TKMath.dir/__/math/math_GaussSingleIntegration.cxx.o CMakeFiles/TKMath.dir/__/math/math_GlobOptMin.cxx.o CMakeFiles/TKMath.dir/__/math/math_Householder.cxx.o CMakeFiles/TKMath.dir/__/math/math_Jacobi.cxx.o CMakeFiles/TKMath.dir/__/math/math_Kronrod.cxx.o CMakeFiles/TKMath.dir/__/math/math_KronrodSingleIntegration.cxx.o CMakeFiles/TKMath.dir/__/math/math_Matrix.cxx.o CMakeFiles/TKMath.dir/__/math/math_MultipleVarFunction.cxx.o CMakeFiles/TKMath.dir/__/math/math_NewtonFunctionRoot.cxx.o CMakeFiles/TKMath.dir/__/math/math_NewtonFunctionSetRoot.cxx.o CMakeFiles/TKMath.dir/__/math/math_NewtonMinimum.cxx.o CMakeFiles/TKMath.dir/__/math/math_Powell.cxx.o CMakeFiles/TKMath.dir/__/math/math_PSO.cxx.o CMakeFiles/TKMath.dir/__/math/math_PSOParticlesPool.cxx.o CMakeFiles/TKMath.dir/__/math/math_Recipes.cxx.o CMakeFiles/TKMath.dir/__/math/math_SVD.cxx.o CMakeFiles/TKMath.dir/__/math/math_TrigonometricFunctionRoots.cxx.o CMakeFiles/TKMath.dir/__/math/math_Uzawa.cxx.o CMakeFiles/TKMath.dir/__/ElCLib/ElCLib.cxx.o CMakeFiles/TKMath.dir/__/ElSLib/ElSLib.cxx.o CMakeFiles/TKMath.dir/__/BSplCLib/BSplCLib.cxx.o CMakeFiles/TKMath.dir/__/BSplCLib/BSplCLib_1.cxx.o CMakeFiles/TKMath.dir/__/BSplCLib/BSplCLib_2.cxx.o CMakeFiles/TKMath.dir/__/BSplCLib/BSplCLib_3.cxx.o CMakeFiles/TKMath.dir/__/BSplCLib/BSplCLib_BzSyntaxes.cxx.o CMakeFiles/TKMath.dir/__/BSplCLib/BSplCLib_Cache.cxx.o CMakeFiles/TKMath.dir/__/BSplSLib/BSplSLib.cxx.o CMakeFiles/TKMath.dir/__/BSplSLib/BSplSLib_BzSyntaxes.cxx.o CMakeFiles/TKMath.dir/__/BSplSLib/BSplSLib_Cache.cxx.o CMakeFiles/TKMath.dir/__/PLib/PLib.cxx.o CMakeFiles/TKMath.dir/__/PLib/PLib_Base.cxx.o CMakeFiles/TKMath.dir/__/PLib/PLib_DoubleJacobiPolynomial.cxx.o CMakeFiles/TKMath.dir/__/PLib/PLib_HermitJacobi.cxx.o CMakeFiles/TKMath.dir/__/PLib/PLib_JacobiPolynomial.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_ArrayOfNodes.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_ArrayOfUVNodes.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_CoherentLink.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_CoherentNode.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_CoherentTriangle.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_CoherentTriangulation.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_CoherentTriPtr.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_Connect.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_MakeLoops.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_MergeNodesTool.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_Polygon2D.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_Polygon3D.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_PolygonOnTriangulation.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_TriangulationParameters.cxx.o CMakeFiles/TKMath.dir/__/Poly/Poly_Triangulation.cxx.o CMakeFiles/TKMath.dir/__/CSLib/CSLib.cxx.o CMakeFiles/TKMath.dir/__/CSLib/CSLib_Class2d.cxx.o CMakeFiles/TKMath.dir/__/CSLib/CSLib_NormalPolyDef.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_CircleToBSplineCurve.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_CompBezierCurves2dToBSplineCurve2d.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_CompBezierCurvesToBSplineCurve.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_CompPolynomialToPoles.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_ConeToBSplineSurface.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_ConicToBSplineCurve.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_CylinderToBSplineSurface.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_ElementarySurfaceToBSplineSurface.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_EllipseToBSplineCurve.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_GridPolynomialToPoles.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_HyperbolaToBSplineCurve.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_ParabolaToBSplineCurve.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_PolynomialCosAndSin.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_SphereToBSplineSurface.cxx.o CMakeFiles/TKMath.dir/__/Convert/Convert_TorusToBSplineSurface.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_B2d_0.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_B2f_0.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_B3d_0.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_B3f_0.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_BoundSortBox.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_Box.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_Box2d.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_OBB.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_Range.cxx.o CMakeFiles/TKMath.dir/__/Bnd/Bnd_Sphere.cxx.o CMakeFiles/TKMath.dir/__/BVH/BVH.cxx.o CMakeFiles/TKMath.dir/__/BVH/BVH_BuildQueue.cxx.o CMakeFiles/TKMath.dir/__/BVH/BVH_BuildThread.cxx.o CMakeFiles/TKMath.dir/__/BVH/BVH_Properties.cxx.o CMakeFiles/TKMath.dir/__/gp/gp.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Ax1.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Ax2.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Ax2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Ax3.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Ax22d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Circ.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Circ2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Cone.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Cylinder.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Dir.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Dir2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Elips.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Elips2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_GTrsf.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_GTrsf2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Hypr.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Hypr2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Lin.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Lin2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Mat.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Mat2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Parab.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Parab2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Pln.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Pnt.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Pnt2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Quaternion.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Sphere.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Torus.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Trsf.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Trsf2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Vec.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_Vec2d.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_XY.cxx.o CMakeFiles/TKMath.dir/__/gp/gp_XYZ.cxx.o CMakeFiles/TKMath.dir/__/TopLoc/TopLoc_Datum3D.cxx.o CMakeFiles/TKMath.dir/__/TopLoc/TopLoc_ItemLocation.cxx.o CMakeFiles/TKMath.dir/__/TopLoc/TopLoc_Location.cxx.o CMakeFiles/TKMath.dir/__/TopLoc/TopLoc_SListNodeOfItemLocation.cxx.o CMakeFiles/TKMath.dir/__/TopLoc/TopLoc_SListOfItemLocation.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Absolute.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_ArcCosine.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_ArcSine.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_ArcTangent.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_ArgCosh.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_ArgSinh.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_ArgTanh.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_BinaryExpression.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_BinaryFunction.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Cosh.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Cosine.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Difference.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Different.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Division.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Equal.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Exponential.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Exponentiate.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_FunctionDerivative.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_GeneralExpression.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_GeneralFunction.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_GeneralRelation.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_GreaterThan.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_GreaterThanOrEqual.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_LessThan.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_LessThanOrEqual.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_LogOf10.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_LogOfe.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_NamedConstant.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_NamedExpression.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_NamedFunction.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_NamedUnknown.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_NumericValue.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Operators.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_PolyExpression.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_PolyFunction.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Product.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_RelationIterator.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_RUIterator.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Sign.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Sine.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_SingleRelation.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Sinh.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Square.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_SquareRoot.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Sum.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_SystemRelation.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Tangent.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_Tanh.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_UnaryExpression.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_UnaryFunction.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_UnaryMinus.cxx.o CMakeFiles/TKMath.dir/__/Expr/Expr_UnknownIterator.cxx.o CMakeFiles/TKMath.dir/__/ExprIntrp/ExprIntrp.cxx.o CMakeFiles/TKMath.dir/__/ExprIntrp/ExprIntrp.tab.c.o CMakeFiles/TKMath.dir/__/ExprIntrp/ExprIntrp_Analysis.cxx.o CMakeFiles/TKMath.dir/__/ExprIntrp/ExprIntrp_Generator.cxx.o CMakeFiles/TKMath.dir/__/ExprIntrp/ExprIntrp_GenExp.cxx.o CMakeFiles/TKMath.dir/__/ExprIntrp/ExprIntrp_GenFct.cxx.o CMakeFiles/TKMath.dir/__/ExprIntrp/ExprIntrp_GenRel.cxx.o CMakeFiles/TKMath.dir/__/ExprIntrp/ExprIntrp_yaccintrf.cxx.o CMakeFiles/TKMath.dir/__/ExprIntrp/ExprIntrp_yacclex.cxx.o CMakeFiles/TKMath.dir/__/ExprIntrp/lex.ExprIntrp.c.o -rpath /home/brettrd/Documents/projects/adv_optim/enzyme_targets/OCCT/build/lin64/clang/libi: ../../lin64/clang/libi/libTKernel.so.7.8.2 -lpthread -lrt -lstdc++ -ldl -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o /lib/x86_64-linux-gnu/crtn.o
1.	Running pass "verify" on module "ld-temp.o"
 #0 0x000055567e8f5edb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x722edb)
 #1 0x000055567e8f332b llvm::sys::RunSignalHandlers() (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x72032b)
 #2 0x000055567e8f3455 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fb782b7c050 (/lib/x86_64-linux-gnu/libc.so.6+0x3c050)
 #4 0x00007fb782bcaebc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007fb782b7bfb2 raise ./signal/../sysdeps/posix/raise.c:27:6
 #6 0x00007fb782b66472 abort ./stdlib/abort.c:81:7
 #7 0x000055567e7a0203 (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x5cd203)
 #8 0x000055567e8926ea (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x6bf6ea)
 #9 0x0000555681a20d58 (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x384dd58)
#10 0x000055567f82a72d llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x165772d)
#11 0x00005556819df7bc llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x380c7bc)
#12 0x000055567f8325c9 runNewPMPasses(llvm::lto::Config const&, llvm::Module&, llvm::TargetMachine*, unsigned int, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex const*) LTOBackend.cpp:0:0
#13 0x000055567f833ee4 llvm::lto::opt(llvm::lto::Config const&, llvm::TargetMachine*, unsigned int, llvm::Module&, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex const*, std::vector<unsigned char, std::allocator<unsigned char>> const&) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x1660ee4)
#14 0x000055567f836424 llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x1663424)
#15 0x000055567f825c80 llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x1652c80)
#16 0x000055567f829db4 llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, llvm::FileCache) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x1656db4)
#17 0x000055567eae5d22 lld::elf::BitcodeCompiler::compile() (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x912d22)
#18 0x000055567ea37337 void lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::endianness)1, true>>(bool) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x864337)
#19 0x000055567ea5ccc7 void lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::endianness)1, true>>(llvm::opt::InputArgList&) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x889cc7)
#20 0x000055567ea63d25 lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x890d25)
#21 0x000055567ea644bc lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x8914bc)
#22 0x000055567e92e59a lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x75b59a)
#23 0x000055567e86edcb lld_main(int, char**, llvm::ToolContext const&) (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x69bdcb)
#24 0x000055567e7a70c3 main (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x5d40c3)
#25 0x00007fb782b6724a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#26 0x00007fb782b67305 call_init ./csu/../csu/libc-start.c:128:20
#27 0x00007fb782b67305 __libc_start_main ./csu/../csu/libc-start.c:347:5
#28 0x000055567e86e671 _start (/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld+0x69b671)
clang: error: unable to execute command: Aborted
clang: error: linker command failed due to signal (use -v to see invocation)
make[2]: *** [src/TKMath/CMakeFiles/TKMath.dir/build.make:3459: lin64/clang/libi/libTKMath.so.7.8.2] Error 1
make[1]: *** [CMakeFiles/Makefile2:1348: src/TKMath/CMakeFiles/TKMath.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

OCCT compiles fine with similar config:

works without lto:

cmake .. \
-D BUILD_LIBRARY_TYPE="Shared" \
-D CMAKE_BUILD_TYPE="RelWithDebInfo" \
-D CMAKE_C_COMPILER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/clang" \
-D CMAKE_CXX_COMPILER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/clang" \
-D CMAKE_LINKER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld" \
-D CMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
-D CMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld"

works with lto set but no optimisation:

cmake .. \
-D BUILD_LIBRARY_TYPE="Shared" \
-D CMAKE_BUILD_TYPE="Debug" \
-D CMAKE_C_COMPILER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/clang" \
-D CMAKE_CXX_COMPILER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/clang" \
-D CMAKE_LINKER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld" \
-D CMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld -flto" \
-D CMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld -flto" \
-D CMAKE_C_FLAGS="-flto" \
-D CMAKE_CXX_FLAGS="-flto"

works with lto and static linkage:

cmake .. \
-D BUILD_LIBRARY_TYPE="Static" \
-D CMAKE_BUILD_TYPE="RelWithDebInfo" \
-D CMAKE_C_COMPILER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/clang" \
-D CMAKE_CXX_COMPILER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/clang" \
-D CMAKE_LINKER="/home/brettrd/Documents/projects/adv_optim/enzyme_targets/llvm-project/build/bin/ld.lld" \
-D CMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld -flto -lm" \
-D CMAKE_C_FLAGS="-flto" \
-D CMAKE_CXX_FLAGS="-flto"

Thanks for the great tools!

@EugeneZelenko EugeneZelenko added crash Prefer [crash-on-valid] or [crash-on-invalid] LTO Link time optimization (regular/full LTO or ThinLTO) and removed new issue labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] LTO Link time optimization (regular/full LTO or ThinLTO)
Projects
None yet
Development

No branches or pull requests

3 participants