[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:
> 
> [I should have listed uname -apKU output and such.]
> 
> On 2019-May-23, at 13:21, Mark Millard <mark...@yahoo.com> wrote:
> 
>> The poudriere bulk run that tried to build x11-toolkits/qt5-declarative
>> got:
>> 
>> --- qqmljsgrammar.cpp ---
>> /usr/local/lib/qt5/bin/qlalr --no-debug --qt parser/qqmljs.g
>> Segmentation fault (core dumped)
>> *** [qqmljsgrammar.cpp] Error code 139
>> 
>> make[3]: stopped in 
>> /wrkdirs/usr/ports/x11-toolkits/qt5-declarative/work/qtdeclarative-everywhere-src-5.12.2/src/qml
>> 1 error
>> 
>> 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:
>> 
>> (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=0x810ab57d0 
>> <(anonymous namespace)::ctype_c>, src_type=0x810a8eaa0 <typeinfo for 
>> std::locale::facet>, 
>>   dst_type=0x810a8fb18 <typeinfo for std::ctype<char>>, src2dst=0) 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=...) at 
>> /wrkdirs/usr/ports/lang/gcc8/work/.build/powerpc64-portbld-freebsd13.0/libstdc++-v3/include/bits/locale_classes.tcc:104
>> #3  0x00000008109cb474 in std::basic_ios<char, std::char_traits<char> 
>> >::_M_cache_locale (this=0x810ab48c8 <std::cout+8>, __loc=...)
>>   at 
>> /wrkdirs/usr/ports/lang/gcc8/work/.build/powerpc64-portbld-freebsd13.0/libstdc++-v3/include/bits/basic_ios.tcc:157
>> #4  0x00000008109cbad0 in std::basic_ios<char, std::char_traits<char> 
>> >::init (this=0x810ab48c8 <std::cout+8>, __sb=0x810ab36f8 
>> <__gnu_internal::buf_cout_sync>)
>>   at 
>> /wrkdirs/usr/ports/lang/gcc8/work/.build/powerpc64-portbld-freebsd13.0/libstdc++-v3/include/bits/basic_ios.tcc:126
>> #5  0x000000081093e644 in std::basic_ostream<char, std::char_traits<char> 
>> >::basic_ostream (__sb=<optimized out>, this=<optimized out>, 
>> __in_chrg=<optimized out>, __vtt_parm=<optimized out>)
>>   at 
>> /wrkdirs/usr/ports/lang/gcc8/work/.build/powerpc64-portbld-freebsd13.0/libstdc++-v3/include/bits/basic_ios.h:460
>> #6  std::ios_base::Init::Init (this=<optimized out>) at 
>> /wrkdirs/usr/ports/lang/gcc8/work/gcc-8.3.0/libstdc++-v3/src/c++98/ios_init.cc:91
>> #7  std::ios_base::Init::Init (this=<optimized out>) at 
>> /wrkdirs/usr/ports/lang/gcc8/work/gcc-8.3.0/libstdc++-v3/src/c++98/ios_init.cc:78
>> #8  0x000000001000334c in __static_initialization_and_destruction_0 
>> (__initialize_p=__initialize_p@entry=1, __priority=<optimized out>, 
>> __priority@entry=65535) at compress.cpp:273
>> #9  0x0000000010004c2c in _GLOBAL__sub_I_compress.cpp(void) () at 
>> compress.cpp:273
>> #10 0x000000081005dfa0 in objlist_call_init (list=<optimized out>, 
>> lockstate=<optimized out>) at /usr/src/libexec/rtld-elf/rtld.c:2728
>> #11 0x000000081005c830 in _rtld (sp=<optimized out>, exit_proc=<optimized 
>> out>, objp=<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
>> 
>> 
>> 
>> 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):
>> 
>> Index: /usr/ports/Mk/Uses/qt-dist.mk
>> ===================================================================
>> --- /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
>> 
>> 
>> (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.)
> 
> I should have listed:
> 
> # 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
> 
> # 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
> 
> 
> As part of experimenting with a system clang 8 based world
> context:
> 
> # svnlite diff /usr/ports/devel/binutils/Makefile
> Index: /usr/ports/devel/binutils/Makefile
> ===================================================================
> --- /usr/ports/devel/binutils/Makefile        (revision 501994)
> +++ /usr/ports/devel/binutils/Makefile        (working copy)
> @@ -3,6 +3,7 @@
> 
> PORTNAME=     binutils
> PORTVERSION=  2.32
> +PORTREVISION=        1
> PORTEPOCH?=   1
> CATEGORIES?=  devel
> MASTER_SITES= SOURCEWARE/binutils/releases
> @@ -13,7 +14,6 @@
> LICENSE=      GPLv3 LGPL3
> LICENSE_COMB= multi
> 
> -EXTRA_PATCHES=       
> ${FILESDIR}/binutils-do-not-provide-shared-section-symbols.patch:-p1
> .if defined(PREFIX) && ${PREFIX} != "/usr"
> BUILD_DEPENDS=        ${LOCALBASE}/lib/libgmp.so:math/gmp \
>               ${LOCALBASE}/lib/libmpfr.so:math/mpfr
> 
> 
> # svnlite diff  /usr/ports/lang/gcc8/Makefile
> Index: /usr/ports/lang/gcc8/Makefile
> ===================================================================
> --- /usr/ports/lang/gcc8/Makefile     (revision 501994)
> +++ /usr/ports/lang/gcc8/Makefile     (working copy)
> @@ -62,7 +62,7 @@
> 
> .elif ${ARCH} == powerpc64
> CONFIGURE_ENV+=       UNAME_m="powerpc64"
> -MAKE_ARGS+=  CFLAGS_FOR_TARGET="-O1" CXXFLAGS_FOR_TARGET="-O1" 
> BOOT_CFLAGS="-O1" # PR235975
> +#MAKE_ARGS+= CFLAGS_FOR_TARGET="-O1" CXXFLAGS_FOR_TARGET="-O1" 
> BOOT_CFLAGS="-O1" # PR235975
> 
> .elif ${ARCH} == powerpcspe
> CONFIGURE_ARGS+=      --with-cpu=8548 --enable-e500_double --without-fp
> @@ -80,7 +80,7 @@
> CONFIGURE_ARGS+=--with-build-config=bootstrap-debug
> ALL_TARGET=   bootstrap-lean
> .endif
> -INSTALL_TARGET=      install-strip
> +#INSTALL_TARGET=     install-strip
> .if ${UID} != 0
> BINMODE=      755
> .endif
> 
> 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.)
> 
> # 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 @@
> 
>       /* Create a vector of the step value.  */
>       tree step = build_int_cst (cr_index_scalar_type, nunits_out);
> -      tree vec_step = build_vector_from_val (cr_index_vector_type, step);
> +      tree vec_step_renamed = build_vector_from_val (cr_index_vector_type, 
> step);
> 
>       /* 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);
> 
>       /* Next create a new phi node vector (NEW_PHI_TREE) which starts
> @@ -7641,7 +7641,7 @@
>   tree vec_def;
>   edge pe = 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 = vect_init_vector (phi, new_name,
>                                     TREE_TYPE (step_expr), NULL);
>       new_vec = build_vector_from_val (vectype, new_name);
> -      vec_step = vect_init_vector (phi, new_vec, vectype, NULL);
> +      vec_step_renamed = vect_init_vector (phi, new_vec, vectype, NULL);
> 
>       /* Now generate the IVs.  */
>       unsigned group_size = SLP_TREE_SCALAR_STMTS (slp_node).length ();
> @@ -7873,7 +7873,7 @@
> 
>          /* Create the iv update inside the loop  */
>          vec_def = make_ssa_name (vec_dest);
> -         new_stmt = gimple_build_assign (vec_def, PLUS_EXPR, induc_def, 
> vec_step);
> +         new_stmt = 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));
> 
> @@ -7904,7 +7904,7 @@
>            new_name = vect_init_vector (phi, new_name,
>                                         TREE_TYPE (step_expr), NULL);
>          new_vec = build_vector_from_val (vectype, new_name);
> -         vec_step = vect_init_vector (phi, new_vec, vectype, NULL);
> +         vec_step_renamed = vect_init_vector (phi, new_vec, vectype, NULL);
>          for (; ivn < nvects; ++ivn)
>            {
>              gimple *iv = SLP_TREE_VEC_STMTS (slp_node)[ivn - nivs];
> @@ -7915,7 +7915,7 @@
>                def = gimple_assign_lhs (iv);
>              new_stmt = gimple_build_assign (make_ssa_name (vectype),
>                                              PLUS_EXPR,
> -                                             def, vec_step);
> +                                             def, vec_step_renamed);
>              if (gimple_code (iv) == 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) == SSA_NAME);
>   new_vec = build_vector_from_val (vectype, t);
> -  vec_step = vect_init_vector (phi, new_vec, vectype, NULL);
> +  vec_step_renamed = vect_init_vector (phi, new_vec, vectype, NULL);
> 
> 
>   /* Create the following def-use cycle:
> @@ -8064,7 +8064,7 @@
> 
>   /* Create the iv update inside the loop  */
>   vec_def = make_ssa_name (vec_dest);
> -  new_stmt = gimple_build_assign (vec_def, PLUS_EXPR, induc_def, vec_step);
> +  new_stmt = 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));
> 
> @@ -8108,7 +8108,7 @@
>       gcc_assert (CONSTANT_CLASS_P (new_name)
>                  || TREE_CODE (new_name) == SSA_NAME);
>       new_vec = build_vector_from_val (vectype, t);
> -      vec_step = vect_init_vector (phi, new_vec, vectype, NULL);
> +      vec_step_renamed = vect_init_vector (phi, new_vec, vectype, NULL);
> 
>       vec_def = induc_def;
>       prev_stmt_vinfo = vinfo_for_stmt (induction_phi);
> @@ -8116,7 +8116,7 @@
>        {
>          /* vec_i = vec_prev + vec_step  */
>          new_stmt = gimple_build_assign (vec_dest, PLUS_EXPR,
> -                                         vec_def, vec_step);
> +                                         vec_def, vec_step_renamed);
>          vec_def = make_ssa_name (vec_dest, new_stmt);
>          gimple_assign_set_lhs (new_stmt, vec_def);
> 
> 
> # svnlite diff /usr/ports/devel/libunwind/Makefile
> Index: /usr/ports/devel/libunwind/Makefile
> ===================================================================
> --- /usr/ports/devel/libunwind/Makefile       (revision 501994)
> +++ /usr/ports/devel/libunwind/Makefile       (working copy)
> @@ -22,6 +22,8 @@
> 
> USES=         libtool pathfix pkgconfig
> USE_LDCONFIG= yes
> +CFLAGS+= -fPIC
> +
> GNU_CONFIGURE=        yes
> INSTALL_TARGET=       install-strip
> LLD_UNSAFE=   yes
> 
> 
> 
> I do use an ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG change to
> bsd.port.mk (ignore the OPSYS and _OSRELEASE inline
> substitutions):
> 
> # svnlite diff /usr/ports/Mk/bsd.port.mk
> Index: /usr/ports/Mk/bsd.port.mk
> ===================================================================
> --- /usr/ports/Mk/bsd.port.mk (revision 501994)
> +++ /usr/ports/Mk/bsd.port.mk (working copy)
> @@ -1151,12 +1151,12 @@
> 
> # Get the operating system type
> .if !defined(OPSYS)
> -OPSYS!=      ${UNAME} -s
> +OPSYS!=      echo FreeBSD
> .endif
> _EXPORTED_VARS+=      OPSYS
> 
> .if !defined(_OSRELEASE)
> -_OSRELEASE!= ${UNAME} -r
> +_OSRELEASE!= echo 13.0-CURRENT
> .endif
> _EXPORTED_VARS+=      _OSRELEASE
> 
> @@ -1762,7 +1762,11 @@
> STRIP_CMD=    ${TRUE}
> .endif
> DEBUG_FLAGS?= -g
> +.if defined(ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG)
> +CFLAGS:=             ${CFLAGS} ${DEBUG_FLAGS}
> +.else
> CFLAGS:=              ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS}
> +.endif
> .if defined(INSTALL_TARGET)
> INSTALL_TARGET:=      ${INSTALL_TARGET:S/^install-strip$/install/g}
> .endif
> 
> 
> (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:
=> 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
=> 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: 

   ld      r0,0(r12)
   ld      r11,16(r12)
   ld r0,0(r0) # <<=== Needed?
   mtctr   r0
   ld      r2,8(r12)
   bctrl



===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

_______________________________________________
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Reply via email to