mold: mold error when building gcc with lto 'Assertion `!is_v2' failed.'
Hello @rui314,
First thanks for the great linker! actually wanted to build gcc with lto and bootstrap and faced into a error, i dont know if its configuring, gcc or mold related but here the error:
make[3]: Leaving directory '/tmp/makepkg/gcc/src/gcc-build/gcc'
/tmp/makepkg/gcc/src/gcc-build/./prev-gcc/xg++ -B/tmp/makepkg/gcc/src/gcc-build/./prev-gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -nostdinc++ -B/tmp/makepkg/gcc/src/gcc-build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -B/tmp/makepkg/gcc/src/gcc-build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -I/tmp/makepkg/gcc/src/gcc-build/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu -I/tmp/makepkg/gcc/src/gcc-build/prev-x86_64-pc-linux-gnu/libstdc++-v3/include -I/tmp/makepkg/gcc/src/gcc/libstdc++-v3/libsupc++ -L/tmp/makepkg/gcc/src/gcc-build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/tmp/makepkg/gcc/src/gcc-build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -no-pie -march=native -O3 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -fno-plt -fopenmp -pthread -Wno-error -w -fno-checking -flto=jobserver -frandom-seed=1 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o cc1plus \
cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/coroutines.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o cp/mapper-client.o cp/mapper-resolver.o cp/method.o cp/module.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o cp/vtable-class-hierarchy.o attribs.o incpath.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o i386-c.o glibc-c.o cc1plus-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcody/libcody.a \
libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lisl -lmpc -lmpfr -lgmp -rdynamic -lz -lzstd
mold: elf/lto.cc:273: mold::PluginStatus mold::elf::get_symbols(const void*, int, mold::PluginSymbol*, bool) [with E = X86_64]: Assertion `!is_v2' failed.
collect2: fatal error: ld terminated with signal 6 [Aborted], core dumped
compilation terminated.
make[3]: *** [/tmp/makepkg/gcc/src/gcc/gcc/cp/Make-lang.in:136: cc1plus] Error 1
rm gfdl.pod gcc.pod gfortran.pod gcov-dump.pod gcov-tool.pod fsf-funding.pod gpl.pod cpp.pod gcov.pod lto-dump.pod gccgo.pod gdc.pod
make[2]: *** [Makefile:5005: all-stage2-gcc] Error 2
make[1]: *** [Makefile:30918: stage2-bubble] Error 2
make: *** [Makefile:31130: bootstrap] Error 2
==> ERROR: A failure occurred in build().
Aborting...
used latest mold commit 494b28cfb38c3291adeb7ea4ed1fc64f37846651 and gcc-12 `gcc version 12.0.1 20220421 (experimental) GCC’, built on archlinux.
did built with following configuring flags:
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--with-bugurl=https://bugs.archlinux.org/ \
--with-linker-hash-style=gnu \
--with-system-zlib \
--enable-__cxa_atexit \
--enable-cet=auto \
--enable-checking=release \
--enable-clocale=gnu \
--enable-default-pie \
--enable-default-ssp \
--enable-gnu-indirect-function \
--enable-gnu-unique-object \
--enable-linker-build-id
--enable-lto \
--enable-multilib \
--enable-plugin \
--enable-shared \
--enable-threads=posix \
--disable-libssp \
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d \
--enable-bootstrap \
--with-ld=/usr/bin/mold \
--with-build-config=bootstrap-lto \
--enable-link-serialization=1 \
--disable-libstdcxx-pch \
--disable-werror \
gdc_include_dir=/usr/include/dlang/gdc"
Maybe @marxin could help.
Thanks and Regards.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 34 (29 by maintainers)
All right, I’ve suggested that: https://gcc.gnu.org/pipermail/gcc-patches/2022-May/594012.html
@marxin Sorry I was working on mold/macOS. I’ll try that this week.
Just a quick note, 2 of 3 patches are upstreamed and I’m right now waiting for your feedback about the
LDPT_GET_API_VERSION. Any estimation when can you get to that?I will check the current status, but reverting a patch shouldn’t harm any existing GCC users. It’s that mold now always assumes that gcc supports only the v2 API.
Yes! That seems more robust than the workaround that I implemented in https://github.com/rui314/mold/commit/38f2b965dbd7ea40f4c155f82e5a0f27cad07e16.
The original issue should also be fixed in the above commit.
That problem should be fixed now, so please try again.
It’s new issue #475.