From owner-freebsd-toolchain@freebsd.org Sun Oct 8 13:34:49 2017 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3D07E35BDB for ; Sun, 8 Oct 2017 13:34:49 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-18.reflexion.net [208.70.210.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D2796977F for ; Sun, 8 Oct 2017 13:34:48 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 16511 invoked from network); 8 Oct 2017 13:34:47 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 8 Oct 2017 13:34:47 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v8.40.3) with SMTP; Sun, 08 Oct 2017 09:34:47 -0400 (EDT) Received: (qmail 19223 invoked from network); 8 Oct 2017 13:34:46 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 8 Oct 2017 13:34:46 -0000 Received: from [192.168.1.26] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 9E437EC8B8D; Sun, 8 Oct 2017 06:34:45 -0700 (PDT) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: head -r324071 clang++ 5 for TARGET_ARCH=powerpc64 (e.g.): DW_CFA_offset_extended for r97-r108? Handled by FreeBSD's libgcc_s.so.1 ? (more. . .) Date: Sun, 8 Oct 2017 06:34:44 -0700 References: <6FEAEDA2-6036-4FC0-B794-15BC264BD31D@dsl-only.net> To: Roman Divacky , FreeBSD Toolchain , FreeBSD PowerPC ML , freebsd-hackers In-Reply-To: <6FEAEDA2-6036-4FC0-B794-15BC264BD31D@dsl-only.net> Message-Id: <1098914B-6BA2-419D-B8FB-01AB71C3DC29@dsl-only.net> X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Oct 2017 13:34:49 -0000 [Looks like r97-r108 are for vr20-vr31 (AltiVec Registers).] On 2017-Oct-8, at 4:34 AM, Mark Millard wrote: > =46rom a dwarfdump's _Unwind_RaiseException information > from a clang/clang++ 5 based compile: >=20 > 91 DW_CFA_offset_extended r97 -496 (62 * -8) > 94 DW_CFA_offset_extended r98 -480 (60 * -8) > 97 DW_CFA_offset_extended r99 -464 (58 * -8) > 100 DW_CFA_offset_extended r100 -448 (56 * -8) > 103 DW_CFA_offset_extended r101 -432 (54 * -8) > 106 DW_CFA_offset_extended r102 -416 (52 * -8) > 109 DW_CFA_offset_extended r103 -400 (50 * -8) > 112 DW_CFA_offset_extended r104 -384 (48 * -8) > 115 DW_CFA_offset_extended r105 -368 (46 * -8) > 118 DW_CFA_offset_extended r106 -352 (44 * -8) > 121 DW_CFA_offset_extended r107 -336 (42 * -8) > 124 DW_CFA_offset_extended r108 -320 (40 * -8) >=20 > By contrast devel/powerpc64-gcc does not produce any > of those. Is this lack of support of some part of an > ABI? Is clang going outside the range of the intended > ABI? ABI64BitOpenPOWERv1.1_16July2015_pub.pdf indicates that r97-r108 are for vr20-vr31 (AltiVec Registers). [Is AltiVec optional --possibly missing?] So the questions translate into questions about AltiVec support/handling for C++ exceptions. [Note: R70 is supposed to be specific to CR2.] > Does FreeBSD's libgcc_s design and implementation handle > these additional logical registers? . . . So the libgcc_s question traces back to: does it handle AltiVec Registers vr20-vr31 if they are referenced (clang)? Is it well behaved if r97-r108 are not referenced (powerpc64-gcc)? > Supporting notes: >=20 > r46-r63 are for floating point registers (that > have been around for a long time: older > powerpc family members). r46-r63 are for f14-f31. > r70 is for having/using the value from "mfcr". Apparently r70 is supposed to be specific to CR2. > r2(?)-r6 are scratch for C++ exception handling. > (I originally identified r3-r6. r2 might have a > somewhat distinct status?) In normal functions r2-r6 do not get DW_CFA_offset_extended_sf or DW_CFA_offset entries. They are special to some internal exception handling routines. (See later.) > r14-r31 are for the normal r14 through r31 > registers. r97-r108 are for AltiVec Registers vr20-vr31. > r65 is standard and heavily used on all(?) > routines, not just some libgcc_s ones. (So > r65 is not listed below.) r65 for lr. > In libgcc_s.so.1.full (via powerpc64-gcc): >=20 > uw_update_context_1: r70 > _Unwind_RaiseException: r[2-6],r4[6-9],r5[0-9],r6[0-3],r70 > _Unwind_RaiseException_Phase2: (nothing special matched) > _Unwind_ForcedUnwind: r[2-6],r4[6-9],r5[0-9],r6[0-3],r70 > _Unwind_Resume: r[2-6],r4[6-9],r5[0-9],r6[0-3],r70 > _Unwind_Resume_or_Rethrow: r[2-6],r4[6-9],r5[0-9],r6[0-3],r70 > _Unwind_Backtrace: r4[6-9],r5[0-9],r6[0-3],r70 > __deregister_frame_info_bases: r70 > _Unwind_Find_FDE: r70 So no AltiVec Registers listed. > In libgcc_s.so.1.full (via clang): >=20 > uw_update_context_1: r70 (uw_update_context_1 was actually = later in the file) > _Unwind_RaiseException: = r4[6-9],r5[0-9],r6[0-3],r70,r9[7-9],r10[0-8] > _Unwind_RaiseException_Phase2: r70 > _Unwind_ForcedUnwind: = r4[6-9],r5[0-9],r6[0-3],r70,r9[7-9],r10[0-8] > _Unwind_Resume: = r4[6-9],r5[0-9],r6[0-3],r70,r9[7-9],r10[0-8] > _Unwind_Resume_or_Rethrow: = r4[6-9],r5[0-9],r6[0-3],r70,r9[7-9],r10[0-8] > _Unwind_Backtrace: = r4[6-9],r5[0-9],r6[0-3],r70,r9[7-9],r10[0-8] > __deregister_frame_info_bases: (nothing special matched) > _Unwind_Find_FDE: (nothing special matched) So no internal, special-for-excpetion-routines scratch register usage listed (r2-r6). > clang is missing all the r[2-6] references but > the code generated does have the registers in > use. Thrown C++ exceptions crash because of > the lack of the r2-r6's, dying on a r3 attempt. >=20 . . . >=20 > I have no clue why _Unwind_RaiseException_Phase2 > has a r70 for clang but not for powerpc64-gcc. > Or the other way around for __deregister_frame_info_bases > and _Unwind_Find_FDE. >=20 > Which file's implementations are used from > what I can tell : >=20 > uw_update_context_1: /usr/src/contrib/gcc/unwind-dw2.c > _Unwind_RaiseException: /usr/src/contrib/gcc/unwind.inc > _Unwind_RaiseException_Phase2: /usr/src/contrib/gcc/unwind.inc > _Unwind_ForcedUnwind: /usr/src/contrib/gcc/unwind.inc > _Unwind_Resume: /usr/src/contrib/gcc/unwind.inc > _Unwind_Resume_or_Rethrow: /usr/src/contrib/gcc/unwind.inc > _Unwind_Backtrace: /usr/src/contrib/gcc/unwind.inc > __deregister_frame_info_bases: /usr/src/contrib/gcc/unwind-dw2-fde.c > _Unwind_Find_FDE: /usr/src/contrib/gcc/unwind-dw2-fde*.c = (unsure) >=20 > An implication is that GPL Version 2 source code > is involved even when clang is the system compiler. > Is that what FreeBSD intends for the powerpc > families? >=20 > /* Exception handling and frame unwind runtime interface routines. -*- = C -*- > Copyright (C) 2001, 2003 Free Software Foundation, Inc. >=20 > This file is part of GCC. >=20 > GCC is free software; you can redistribute it and/or modify it > under the terms of the GNU General Public License as published by > the Free Software Foundation; either version 2, or (at your option) > any later version. >=20 > In addition to the permissions in the GNU General Public License, = the > Free Software Foundation gives you unlimited permission to link the > compiled version of this file into combinations with other programs, > and to distribute those combinations without any restriction coming > from the use of this file. (The General Public License restrictions > do apply in other respects; for example, they cover modification of > the file, and distribution when not linked into a combined > executable.) >=20 > . . . >=20 > Does libgcc_s.so.1 with its type of use form a "combined executable"? >=20 =3D=3D=3D Mark Millard markmi at dsl-only.net