Date: Thu, 23 May 2019 14:17:15 -0700 From: Mark Millard <marklmi@yahoo.com> To: FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, ports-list freebsd <freebsd-ports@freebsd.org> Cc: Jan Beich <jbeich@FreeBSD.org> Subject: Re: powerpc64 context: x11-toolkits/qt5-declarative fails to build in poudriere: /usr/local/lib/qt5/bin/qlalr segmentation faults in std::type_info::~type_info() () from /usr/local/lib/gcc8/libstdc++.so.6 Message-ID: <22D9DF10-E58A-49E5-8372-CC9D263A7C76@yahoo.com> In-Reply-To: <590AAD80-8D2F-4F7A-8910-001D72A5E666@yahoo.com> References: <8B8355C5-731B-4F03-AA98-11324C618D3C@yahoo.com> <590AAD80-8D2F-4F7A-8910-001D72A5E666@yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[It looks like code generation missed a level of indirection to me.] > On 2019-May-23, at 13:46, Mark Millard <marklmi at yahoo.com> wrote: >=20 > [I should have listed uname -apKU output and such.] >=20 > On 2019-May-23, at 13:21, Mark Millard <marklmi@yahoo.com> wrote: >=20 >> The poudriere bulk run that tried to build = x11-toolkits/qt5-declarative >> got: >>=20 >> --- qqmljsgrammar.cpp --- >> /usr/local/lib/qt5/bin/qlalr --no-debug --qt parser/qqmljs.g >> Segmentation fault (core dumped) >> *** [qqmljsgrammar.cpp] Error code 139 >>=20 >> make[3]: stopped in = /wrkdirs/usr/ports/x11-toolkits/qt5-declarative/work/qtdeclarative-everywh= ere-src-5.12.2/src/qml >> 1 error >>=20 >> Installing qt5-core and manually running under gdb from >> an expansion of the bulk's tar of the failure, I was able >> to get a backtrace: >>=20 >> (gdb) run --no-debug --qt parser/qqmljs.g >> Starting program: /usr/local/bin/qlalr --no-debug --qt = parser/qqmljs.g >> process 26823 is executing new program: /usr/local/lib/qt5/bin/qlalr >> . . . (text about auto-loading has been declined and such) . . . >> Program received signal SIGSEGV, Segmentation fault. >> 0x0000000810a96be0 in std::type_info::~type_info() () from = /usr/local/lib/gcc8/libstdc++.so.6 >> (gdb) bt >> #0 0x0000000810a96be0 in std::type_info::~type_info() () from = /usr/local/lib/gcc8/libstdc++.so.6 >> #1 0x000000081092152c in __cxxabiv1::__dynamic_cast = (src_ptr=3D0x810ab57d0 <(anonymous namespace)::ctype_c>, = src_type=3D0x810a8eaa0 <typeinfo for std::locale::facet>,=20 >> dst_type=3D0x810a8fb18 <typeinfo for std::ctype<char>>, src2dst=3D0) = at = /wrkdirs/usr/ports/lang/gcc8/work/gcc-8.3.0/libstdc++-v3/libsupc++/dyncast= .cc:71 >> #2 0x00000008109df908 in std::has_facet<std::ctype<char> > = (__loc=3D...) at = /wrkdirs/usr/ports/lang/gcc8/work/.build/powerpc64-portbld-freebsd13.0/lib= stdc++-v3/include/bits/locale_classes.tcc:104 >> #3 0x00000008109cb474 in std::basic_ios<char, std::char_traits<char> = >::_M_cache_locale (this=3D0x810ab48c8 <std::cout+8>, __loc=3D...) >> at = /wrkdirs/usr/ports/lang/gcc8/work/.build/powerpc64-portbld-freebsd13.0/lib= stdc++-v3/include/bits/basic_ios.tcc:157 >> #4 0x00000008109cbad0 in std::basic_ios<char, std::char_traits<char> = >::init (this=3D0x810ab48c8 <std::cout+8>, __sb=3D0x810ab36f8 = <__gnu_internal::buf_cout_sync>) >> at = /wrkdirs/usr/ports/lang/gcc8/work/.build/powerpc64-portbld-freebsd13.0/lib= stdc++-v3/include/bits/basic_ios.tcc:126 >> #5 0x000000081093e644 in std::basic_ostream<char, = std::char_traits<char> >::basic_ostream (__sb=3D<optimized out>, = this=3D<optimized out>, __in_chrg=3D<optimized out>, = __vtt_parm=3D<optimized out>) >> at = /wrkdirs/usr/ports/lang/gcc8/work/.build/powerpc64-portbld-freebsd13.0/lib= stdc++-v3/include/bits/basic_ios.h:460 >> #6 std::ios_base::Init::Init (this=3D<optimized out>) at = /wrkdirs/usr/ports/lang/gcc8/work/gcc-8.3.0/libstdc++-v3/src/c++98/ios_ini= t.cc:91 >> #7 std::ios_base::Init::Init (this=3D<optimized out>) at = /wrkdirs/usr/ports/lang/gcc8/work/gcc-8.3.0/libstdc++-v3/src/c++98/ios_ini= t.cc:78 >> #8 0x000000001000334c in __static_initialization_and_destruction_0 = (__initialize_p=3D__initialize_p@entry=3D1, __priority=3D<optimized = out>, __priority@entry=3D65535) at compress.cpp:273 >> #9 0x0000000010004c2c in _GLOBAL__sub_I_compress.cpp(void) () at = compress.cpp:273 >> #10 0x000000081005dfa0 in objlist_call_init (list=3D<optimized out>, = lockstate=3D<optimized out>) at /usr/src/libexec/rtld-elf/rtld.c:2728 >> #11 0x000000081005c830 in _rtld (sp=3D<optimized out>, = exit_proc=3D<optimized out>, objp=3D<optimized out>) at = /usr/src/libexec/rtld-elf/rtld.c:765 >> #12 0x000000081005a240 in ._rtld_start () at = /usr/src/libexec/rtld-elf/powerpc64/rtld_start.S:83 >> Backtrace stopped: frame did not save the PC >>=20 >>=20 >>=20 >> NOTE: In order to have built devel/qt5-core I used a patch >> to make sure that all the %%LOCALBASE%% strings were replaced >> (otherwise in the powerpc64 system clang 8 based world the >> devel/qt5-core build failed from -I%%LOCALBASE%%... use): >>=20 >> Index: /usr/ports/Mk/Uses/qt-dist.mk >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- /usr/ports/Mk/Uses/qt-dist.mk (revision 501994) >> +++ /usr/ports/Mk/Uses/qt-dist.mk (working copy) >> @@ -251,7 +251,7 @@ >> .if ${_QT_VER:M5} >> post-patch: gcc-post-patch >> gcc-post-patch: >> - ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|' \ >> + ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' \ >> ${WRKSRC}/mkspecs/common/gcc-base.conf \ >> ${WRKSRC}/mkspecs/freebsd-g++/qmake.conf >> ${REINPLACE_CMD} 's|%%GCC_DEFAULT%%|${GCC_DEFAULT}|g' \ >> @@ -298,7 +298,7 @@ >> # ports/194088. >> post-patch: qtbase-post-patch >> qtbase-post-patch: >> - ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ >> + ${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' \ >> ${WRKSRC}/mkspecs/common/bsd/bsd.conf \ >> ${WRKSRC}/mkspecs/freebsd-clang/qmake.conf >>=20 >>=20 >> (So having the missing g added but not having the optional -e >> usage in the other %%LOCALBASE%% related command. The -e >> status is optional here: only one command to sed sed command >> in each sed command. The additional g is the important part.) >=20 > I should have listed: >=20 > # uname -apKU > FreeBSD FBSDG5L 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r347549M: Wed May = 22 15:14:43 PDT 2019 = markmi@FBSDG5L:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/= usr/src/powerpc.powerpc64/sys/GENERIC64vtsc-NODBG powerpc powerpc64 = 1300025 1300025 >=20 > # svnlite info /usr/ports/ | grep 'Re[plv]' | more > Relative URL: ^/head > Repository Root: svn://svn0.us-west.freebsd.org/ports > Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5 > Revision: 501994 > Last Changed Rev: 501994 >=20 >=20 > As part of experimenting with a system clang 8 based world > context: >=20 > # svnlite diff /usr/ports/devel/binutils/Makefile > Index: /usr/ports/devel/binutils/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/ports/devel/binutils/Makefile (revision 501994) > +++ /usr/ports/devel/binutils/Makefile (working copy) > @@ -3,6 +3,7 @@ >=20 > PORTNAME=3D binutils > PORTVERSION=3D 2.32 > +PORTREVISION=3D 1 > PORTEPOCH?=3D 1 > CATEGORIES?=3D devel > MASTER_SITES=3D SOURCEWARE/binutils/releases > @@ -13,7 +14,6 @@ > LICENSE=3D GPLv3 LGPL3 > LICENSE_COMB=3D multi >=20 > -EXTRA_PATCHES=3D = ${FILESDIR}/binutils-do-not-provide-shared-section-symbols.patch:-p1 > .if defined(PREFIX) && ${PREFIX} !=3D "/usr" > BUILD_DEPENDS=3D ${LOCALBASE}/lib/libgmp.so:math/gmp \ > ${LOCALBASE}/lib/libmpfr.so:math/mpfr >=20 >=20 > # svnlite diff /usr/ports/lang/gcc8/Makefile > Index: /usr/ports/lang/gcc8/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/ports/lang/gcc8/Makefile (revision 501994) > +++ /usr/ports/lang/gcc8/Makefile (working copy) > @@ -62,7 +62,7 @@ >=20 > .elif ${ARCH} =3D=3D powerpc64 > CONFIGURE_ENV+=3D UNAME_m=3D"powerpc64" > -MAKE_ARGS+=3D CFLAGS_FOR_TARGET=3D"-O1" = CXXFLAGS_FOR_TARGET=3D"-O1" BOOT_CFLAGS=3D"-O1" # PR235975 > +#MAKE_ARGS+=3D CFLAGS_FOR_TARGET=3D"-O1" = CXXFLAGS_FOR_TARGET=3D"-O1" BOOT_CFLAGS=3D"-O1" # PR235975 >=20 > .elif ${ARCH} =3D=3D powerpcspe > CONFIGURE_ARGS+=3D --with-cpu=3D8548 --enable-e500_double = --without-fp > @@ -80,7 +80,7 @@ > CONFIGURE_ARGS+=3D--with-build-config=3Dbootstrap-debug > ALL_TARGET=3D bootstrap-lean > .endif > -INSTALL_TARGET=3D install-strip > +#INSTALL_TARGET=3D install-strip > .if ${UID} !=3D 0 > BINMODE=3D 755 > .endif >=20 > I had to work around clang reserving "vec_step" as a name > in contexts where the gcc8 source code used that name: > (vec_step is associated with support of the the vector > instructions on powerpc64.) >=20 > # more /usr/ports/lang/gcc8/files/patch-gcc_tree-vect-loop.c > --- gcc/tree-vect-loop.c.orig 2018-10-10 22:41:40.295753000 -0700 > +++ gcc/tree-vect-loop.c 2018-10-10 22:57:44.698855000 -0700 > @@ -4970,13 +4970,13 @@ >=20 > /* Create a vector of the step value. */ > tree step =3D build_int_cst (cr_index_scalar_type, nunits_out); > - tree vec_step =3D build_vector_from_val (cr_index_vector_type, = step); > + tree vec_step_renamed =3D build_vector_from_val = (cr_index_vector_type, step); >=20 > /* Create an induction variable. */ > gimple_stmt_iterator incr_gsi; > bool insert_after; > standard_iv_increment_position (loop, &incr_gsi, &insert_after); > - create_iv (series_vect, vec_step, NULL_TREE, loop, &incr_gsi, > + create_iv (series_vect, vec_step_renamed, NULL_TREE, loop, = &incr_gsi, > insert_after, &indx_before_incr, &indx_after_incr); >=20 > /* Next create a new phi node vector (NEW_PHI_TREE) which starts > @@ -7641,7 +7641,7 @@ > tree vec_def; > edge pe =3D loop_preheader_edge (loop); > basic_block new_bb; > - tree new_vec, vec_init, vec_step, t; > + tree new_vec, vec_init, vec_step_renamed, t; > tree new_name; > gimple *new_stmt; > gphi *induction_phi; > @@ -7834,7 +7834,7 @@ > new_name =3D vect_init_vector (phi, new_name, > TREE_TYPE (step_expr), NULL); > new_vec =3D build_vector_from_val (vectype, new_name); > - vec_step =3D vect_init_vector (phi, new_vec, vectype, NULL); > + vec_step_renamed =3D vect_init_vector (phi, new_vec, vectype, = NULL); >=20 > /* Now generate the IVs. */ > unsigned group_size =3D SLP_TREE_SCALAR_STMTS (slp_node).length = (); > @@ -7873,7 +7873,7 @@ >=20 > /* Create the iv update inside the loop */ > vec_def =3D make_ssa_name (vec_dest); > - new_stmt =3D gimple_build_assign (vec_def, PLUS_EXPR, = induc_def, vec_step); > + new_stmt =3D gimple_build_assign (vec_def, PLUS_EXPR, = induc_def, vec_step_renamed); > gsi_insert_before (&si, new_stmt, GSI_SAME_STMT); > set_vinfo_for_stmt (new_stmt, new_stmt_vec_info (new_stmt, = loop_vinfo)); >=20 > @@ -7904,7 +7904,7 @@ > new_name =3D vect_init_vector (phi, new_name, > TREE_TYPE (step_expr), NULL); > new_vec =3D build_vector_from_val (vectype, new_name); > - vec_step =3D vect_init_vector (phi, new_vec, vectype, NULL); > + vec_step_renamed =3D vect_init_vector (phi, new_vec, = vectype, NULL); > for (; ivn < nvects; ++ivn) > { > gimple *iv =3D SLP_TREE_VEC_STMTS (slp_node)[ivn - nivs]; > @@ -7915,7 +7915,7 @@ > def =3D gimple_assign_lhs (iv); > new_stmt =3D gimple_build_assign (make_ssa_name = (vectype), > PLUS_EXPR, > - def, vec_step); > + def, vec_step_renamed); > if (gimple_code (iv) =3D=3D GIMPLE_PHI) > gsi_insert_before (&si, new_stmt, GSI_SAME_STMT); > else > @@ -8041,7 +8041,7 @@ > gcc_assert (CONSTANT_CLASS_P (new_name) > || TREE_CODE (new_name) =3D=3D SSA_NAME); > new_vec =3D build_vector_from_val (vectype, t); > - vec_step =3D vect_init_vector (phi, new_vec, vectype, NULL); > + vec_step_renamed =3D vect_init_vector (phi, new_vec, vectype, = NULL); >=20 >=20 > /* Create the following def-use cycle: > @@ -8064,7 +8064,7 @@ >=20 > /* Create the iv update inside the loop */ > vec_def =3D make_ssa_name (vec_dest); > - new_stmt =3D gimple_build_assign (vec_def, PLUS_EXPR, induc_def, = vec_step); > + new_stmt =3D gimple_build_assign (vec_def, PLUS_EXPR, induc_def, = vec_step_renamed); > gsi_insert_before (&si, new_stmt, GSI_SAME_STMT); > set_vinfo_for_stmt (new_stmt, new_stmt_vec_info (new_stmt, = loop_vinfo)); >=20 > @@ -8108,7 +8108,7 @@ > gcc_assert (CONSTANT_CLASS_P (new_name) > || TREE_CODE (new_name) =3D=3D SSA_NAME); > new_vec =3D build_vector_from_val (vectype, t); > - vec_step =3D vect_init_vector (phi, new_vec, vectype, NULL); > + vec_step_renamed =3D vect_init_vector (phi, new_vec, vectype, = NULL); >=20 > vec_def =3D induc_def; > prev_stmt_vinfo =3D vinfo_for_stmt (induction_phi); > @@ -8116,7 +8116,7 @@ > { > /* vec_i =3D vec_prev + vec_step */ > new_stmt =3D gimple_build_assign (vec_dest, PLUS_EXPR, > - vec_def, vec_step); > + vec_def, vec_step_renamed); > vec_def =3D make_ssa_name (vec_dest, new_stmt); > gimple_assign_set_lhs (new_stmt, vec_def); >=20 >=20 > # svnlite diff /usr/ports/devel/libunwind/Makefile > Index: /usr/ports/devel/libunwind/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/ports/devel/libunwind/Makefile (revision 501994) > +++ /usr/ports/devel/libunwind/Makefile (working copy) > @@ -22,6 +22,8 @@ >=20 > USES=3D libtool pathfix pkgconfig > USE_LDCONFIG=3D yes > +CFLAGS+=3D -fPIC > + > GNU_CONFIGURE=3D yes > INSTALL_TARGET=3D install-strip > LLD_UNSAFE=3D yes >=20 >=20 >=20 > I do use an ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG change to > bsd.port.mk (ignore the OPSYS and _OSRELEASE inline > substitutions): >=20 > # svnlite diff /usr/ports/Mk/bsd.port.mk > Index: /usr/ports/Mk/bsd.port.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/ports/Mk/bsd.port.mk (revision 501994) > +++ /usr/ports/Mk/bsd.port.mk (working copy) > @@ -1151,12 +1151,12 @@ >=20 > # Get the operating system type > .if !defined(OPSYS) > -OPSYS!=3D ${UNAME} -s > +OPSYS!=3D echo FreeBSD > .endif > _EXPORTED_VARS+=3D OPSYS >=20 > .if !defined(_OSRELEASE) > -_OSRELEASE!=3D ${UNAME} -r > +_OSRELEASE!=3D echo 13.0-CURRENT > .endif > _EXPORTED_VARS+=3D _OSRELEASE >=20 > @@ -1762,7 +1762,11 @@ > STRIP_CMD=3D ${TRUE} > .endif > DEBUG_FLAGS?=3D -g > +.if defined(ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG) > +CFLAGS:=3D ${CFLAGS} ${DEBUG_FLAGS} > +.else > CFLAGS:=3D ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS} > +.endif > .if defined(INSTALL_TARGET) > INSTALL_TARGET:=3D ${INSTALL_TARGET:S/^install-strip$/install/g} > .endif >=20 >=20 > (I once had a context where the ${UNAME} -s and ${UNAME} -r > lines each ended up with empty strings assigned. The echo's > just worked around the problem. I've no clue if I'd still > have the problem.) Program received signal SIGSEGV, Segmentation fault. 0x0000000810a96be0 in std::type_info::~type_info() () from = /usr/local/lib/gcc8/libstdc++.so.6 (gdb) disass Dump of assembler code for function _ZNSt9type_infoD2Ev: =3D> 0x0000000810a96be0 <+0>: .long 0x8 0x0000000810a96be4 <+4>: .long 0x109273d0 0x0000000810a96be8 <+8>: .long 0x8 0x0000000810a96bec <+12>: vsubuqm v5,v11,v7 End of assembler dump. Note that for the 0x8'1092'73d0 from the +0 and +4: (gdb) disass 0x8109273d0 Dump of assembler code for function std::type_info::~type_info(): 0x00000008109273d0 <+0>: blr 0x00000008109273d4 <+4>: .long 0x0 0x00000008109273d8 <+8>: .long 0x90000 0x00000008109273dc <+12>: .long 0x0 End of assembler dump. And the code that got to 0x810a96be0 was: (gdb) disass Dump of assembler code for function __cxxabiv1::__dynamic_cast(void = const*, __cxxabiv1::__class_type_info const*, = __cxxabiv1::__class_type_info const*, ptrdiff_t): . . . 0x0000000810921518 <+136>: ld r0,0(r12) 0x000000081092151c <+140>: ld r11,16(r12) 0x0000000810921520 <+144>: mtctr r0 0x0000000810921524 <+148>: ld r2,8(r12) 0x0000000810921528 <+152>: bctrl =3D> 0x000000081092152c <+156>: ld r2,40(r1) . . . with ctr holding: 0x810a96be0 (gdb) info reg . . . pc 0x81092152c 0x81092152c = <__cxxabiv1::__dynamic_cast(void const*, __cxxabiv1::__class_type_info = const*, __cxxabiv1::__class_type_info const*, ptrdiff_t)+156> . . . lr 0x81092152c 0x81092152c = <__cxxabiv1::__dynamic_cast(void const*, __cxxabiv1::__class_type_info = const*, __cxxabiv1::__class_type_info const*, ptrdiff_t)+156> ctr 0x810a96be0 34639277024 . . . It looks to me like: 0x0000000810921518 <+136>: ld r0,0(r12) 0x000000081092151c <+140>: ld r11,16(r12) 0x0000000810921520 <+144>: mtctr r0 0x0000000810921524 <+148>: ld r2,8(r12) 0x0000000810921528 <+152>: bctrl needed something like another instruction to get the correct address into ctr for the later bctrl use:=20 ld r0,0(r12) ld r11,16(r12) ld r0,0(r0) # <<=3D=3D=3D Needed? mtctr r0 ld r2,8(r12) bctrl =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?22D9DF10-E58A-49E5-8372-CC9D263A7C76>