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

ld: Assertion failed: (0 && "lto symbol should not be in layout"), function symbolForAtom, file Layout.cpp, line 1381. #4653

Open
ibuclaw opened this issue May 9, 2024 · 3 comments

Comments

@ibuclaw
Copy link
Contributor

ibuclaw commented May 9, 2024

Building DMD on OSX with -O -inline -release -flto=full: https://github.com/dlang/installer/actions/runs/9023729802/job/24796283183

Judging from the error, only -flto=full seems to be important here.

Copy of logs.

Command: /private/var/folders/3m/p59k4qdj0f17st0gn2cmj3640000gn/T/tmp.mapdCK/ldc/ldc2-1.37.0-osx-x86_64/bin/ldmd2 -of/private/var/folders/3m/p59k4qdj0f17st0gn2cmj3640000gn/T/tmp.mapdCK/clones/dmd/generated/osx/release/64/dmd -vtls -J/private/var/folders/3m/p59k4qdj0f17st0gn2cmj3640000gn/T/tmp.mapdCK/clones/dmd/compiler/src/dmd/res -w -de -fPIC -m64 -J/private/var/folders/3m/p59k4qdj0f17st0gn2cmj3640000gn/T/tmp.mapdCK/clones/dmd/generated/osx/release/64 -I/private/var/folders/3m/p59k4qdj0f17st0gn2cmj3640000gn/T/tmp.mapdCK/clones/dmd/compiler/src -O -inline -release -flto=full -defaultlib=druntime-ldc-lto -color=on src/dmd/dinifile.d src/dmd/dmdparams.d src/dmd/gluelayer.d src/dmd/lib.d src/dmd/libelf.d src/dmd/libmach.d src/dmd/libmscoff.d src/dmd/libomf.d src/dmd/link.d src/dmd/mars.d src/dmd/main.d src/dmd/scanelf.d src/dmd/scanmach.d src/dmd/scanmscoff.d src/dmd/scanomf.d src/dmd/vsoptions.d src/dmd/access.d src/dmd/aggregate.d src/dmd/aliasthis.d src/dmd/argtypes_x86.d src/dmd/argtypes_sysv_x64.d src/dmd/argtypes_aarch64.d src/dmd/arrayop.d src/dmd/arraytypes.d src/dmd/astenums.d src/dmd/ast_node.d src/dmd/astcodegen.d src/dmd/asttypename.d src/dmd/attrib.d src/dmd/attribsem.d src/dmd/basicmangle.d src/dmd/blockexit.d src/dmd/builtin.d src/dmd/canthrow.d src/dmd/chkformat.d src/dmd/cli.d src/dmd/clone.d src/dmd/compiler.d src/dmd/cond.d src/dmd/constfold.d src/dmd/cppmangle.d src/dmd/cppmanglewin.d src/dmd/cpreprocess.d src/dmd/ctfeexpr.d src/dmd/ctorflow.d src/dmd/dcast.d src/dmd/dclass.d src/dmd/declaration.d src/dmd/delegatize.d src/dmd/denum.d src/dmd/dimport.d src/dmd/dinterpret.d src/dmd/dmacro.d src/dmd/dmangle.d src/dmd/dmodule.d src/dmd/doc.d src/dmd/dscope.d src/dmd/dstruct.d src/dmd/dsymbol.d src/dmd/dsymbolsem.d src/dmd/dtemplate.d src/dmd/dtoh.d src/dmd/dversion.d src/dmd/enumsem.d src/dmd/escape.d src/dmd/expression.d src/dmd/expressionsem.d src/dmd/func.d src/dmd/funcsem.d src/dmd/hdrgen.d src/dmd/iasm.d src/dmd/iasmgcc.d src/dmd/impcnvtab.d src/dmd/imphint.d src/dmd/importc.d src/dmd/init.d src/dmd/initsem.d src/dmd/inline.d src/dmd/inlinecost.d src/dmd/intrange.d src/dmd/json.d src/dmd/lambdacomp.d src/dmd/mtype.d src/dmd/mustuse.d src/dmd/nogc.d src/dmd/nspace.d src/dmd/ob.d src/dmd/objc.d src/dmd/opover.d src/dmd/optimize.d src/dmd/parse.d src/dmd/parsetimevisitor.d src/dmd/permissivevisitor.d src/dmd/postordervisitor.d src/dmd/pragmasem.d src/dmd/printast.d src/dmd/rootobject.d src/dmd/safe.d src/dmd/sapply.d src/dmd/semantic2.d src/dmd/semantic3.d src/dmd/sideeffect.d src/dmd/statement.d src/dmd/statement_rewrite_walker.d src/dmd/statementsem.d src/dmd/staticassert.d src/dmd/staticcond.d src/dmd/stmtstate.d src/dmd/target.d src/dmd/templatesem.d src/dmd/templateparamsem.d src/dmd/traits.d src/dmd/transitivevisitor.d src/dmd/typesem.d src/dmd/typinf.d src/dmd/utils.d src/dmd/visitor.d src/dmd/foreachvar.d src/dmd/cparse.d src/dmd/dmsc.d src/dmd/e2ir.d src/dmd/iasmdmd.d src/dmd/glue.d src/dmd/objc_glue.d src/dmd/s2ir.d src/dmd/tocsym.d src/dmd/toctype.d src/dmd/tocvdebug.d src/dmd/todt.d src/dmd/toir.d src/dmd/toobj.d src/dmd/backend/cc.d src/dmd/backend/cdef.d src/dmd/backend/cgcv.d src/dmd/backend/code.d src/dmd/backend/cv4.d src/dmd/backend/dt.d src/dmd/backend/el.d src/dmd/backend/global.d src/dmd/backend/obj.d src/dmd/backend/oper.d src/dmd/backend/rtlsym.d src/dmd/backend/code_x86.d src/dmd/backend/iasm.d src/dmd/backend/codebuilder.d src/dmd/backend/ty.d src/dmd/backend/type.d src/dmd/backend/mach.d src/dmd/backend/mscoff.d src/dmd/backend/dwarf.d src/dmd/backend/dwarf2.d src/dmd/backend/xmm.d src/dmd/backend/dlist.d src/dmd/backend/melf.d src/dmd/root/aav.d src/dmd/root/complex.d src/dmd/root/env.d src/dmd/root/longdouble.d src/dmd/root/man.d src/dmd/root/optional.d src/dmd/root/response.d src/dmd/root/speller.d src/dmd/root/string.d src/dmd/root/strtold.d ../generated/osx/release/64/lexer.o ../generated/osx/release/64/backend.o ../generated/osx/release/64/common.o

-----------------------------------------------------------
0  0x102830f43  __assert_rtn + 64
1  0x1027d8a20  mach_o::Symbol ld::Layout::symbolForAtom<ld::LinkedAtomPlacement const>(ld::Atom const*, CString, ld::LinkedAtomPlacement const&, ld::DylibMapping const*, unsigned long long) const + 2384
2  0x1027d244b  void dispatchForEach<ld::AtomAndName const, void ld::buildSymbolTable<ld::LinkedAtomPlacement>(ld::SymbolTableLayout&, ld::Layout const&, ld::Options const&, ld::AtomSymbolPartition const&, ld::LinkedAtomPlacement const&, ld::DylibMapping const*, unsigned long long, bool, bool)::'lambda1'(unsigned long, ld::AtomAndName const&)>(std::__1::span<ld::LinkedAtomPlacement, 18446744073709551615ul>, unsigned long, void ld::buildSymbolTable<ld::LinkedAtomPlacement>(ld::SymbolTableLayout&, ld::Layout const&, ld::Options const&, ld::AtomSymbolPartition const&, ld::LinkedAtomPlacement const&, ld::DylibMapping const*, unsigned long long, bool, bool)::'lambda1'(unsigned long, ld::AtomAndName const&))::'lambda'(unsigned long)::operator()(unsigned long) const + 187
3  0x1027dd95b  ld::LayoutExecutable::writeToFile(char const*) + 9099
4  0x10277ff9f  main + 12831
ld: Assertion failed: (0 && "lto symbol should not be in layout"), function symbolForAtom, file Layout.cpp, line 1381.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: /usr/bin/cc failed with status: 1

Entering dir: /private/var/folders/3m/p59k4qdj0f17st0gn2cmj3640000gn/T/tmp.mapdCK
object.Exception@build_all.d(79): Enforcement failed
----------------
/Users/runner/hostedtoolcache/dc/ldc2-1.37.0/arm64/ldc2-1.37.0-osx-universal/bin/../import/std/exception.d:522 pure @safe noreturn std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x104b09753]
/Users/runner/hostedtoolcache/dc/ldc2-1.37.0/arm64/ldc2-1.37.0-osx-universal/bin/../import/std/exception.d:442 pure @safe bool std.exception.enforce!().enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) [0x104af8457]
/Users/runner/work/installer/installer/create_dmd_release/build_all.d:79 void build_all.Shell.__dtor() [0x104afa083]
/Users/runner/work/installer/installer/create_dmd_release/build_all.d:75 void build_all.Shell.__aggrDtor() [0x104afa11f]
/Users/runner/work/installer/installer/create_dmd_release/build_all.d:271 void build_all.runBuild(ref build_all.Box, immutable(char)[], bool, bool, immutable(char)[]) [0x104afad43]
/Users/runner/work/installer/installer/create_dmd_release/build_all.d:200 void build_all.Box.build(immutable(char)[], bool, bool, immutable(char)[]) [0x104afa8e3]
/Users/runner/work/installer/installer/create_dmd_release/build_all.d:667 _Dmain [0x104b0749b]
@kinke
Copy link
Member

kinke commented May 9, 2024

Oh wait a second, that job uses macos-latest, which is now arm64 macOS 14. So default /usr/bin/cc might not really like x86_64 input. So I'd try reverting to a x86 macOS runner, either macos-13 or macos-12 as first thing.

Edit: dlang/installer#576

@kinke
Copy link
Member

kinke commented May 10, 2024

Findings from that PR: looks Xcode v15-related, as the same assertion happens on macos-13 x86_64, with the same Xcode v15.0.1, but macos-12 with Xcode v14.2 works. dlang/installer#576 (comment)

@ibuclaw
Copy link
Contributor Author

ibuclaw commented May 10, 2024

I almost forgot that I detest Xcode 15.0 - not only for asserting left and right, but also for being buggy as hell.

dlang/dmd#16240

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants