From owner-freebsd-bugs@freebsd.org Fri Feb 26 11:08:16 2016 Return-Path: Delivered-To: freebsd-bugs@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 44B82AB5E7C for ; Fri, 26 Feb 2016 11:08:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (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 2BF881986 for ; Fri, 26 Feb 2016 11:08:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u1QB8GUN023777 for ; Fri, 26 Feb 2016 11:08:16 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 207359] projects/clang380-import for TARGET_ARCH=powerpc64 via powerpc64-gcc : c++ exceptions unbounded loop in _Unwind_RaiseException (9 line program) Date: Fri, 26 Feb 2016 11:08:16 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: markmi@dsl-only.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2016 11:08:16 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207359 --- Comment #5 from Mark Millard --- (In reply to Mark Millard from comment #4) A new, corrected, even lower level detail interpretation. . . which may put= the burden on the system's .eh_frame handling in libgcc_s. I state the relationship from the point of view what the existing fde operations would need to do to be correct. The alternate is that the missing activity is missing operations instead of the activity being "inside" DW_CFA_remember_state and DW_CFA_restore_state. The problem is that the DW_CFA_remember_state and later DW_CFA_restore_stat= e do not in fact restore the cfa_offset (in this case 128 as it was at the time = of the DW_CFA_remember_state). dwarfdump shows in its notation that the DW_CFA_restore_state should restore the "off cfa=3D128(r1)" status. This makes sense for the code in question. = But DW_CFA_remember_state/DW_CFA_restore_state do not save and restore the cfa_offset (12 here). DW_CFA_remember_state only saves fs->regs. DW_CFA_restore_state only restores fs->regs. fs->cfa_offset is not part of regs but is used by uw_update_context_1 for: /* Compute this frame's CFA. */ switch (fs->cfa_how) { case CFA_REG_OFFSET: cfa =3D _Unwind_GetPtr (&orig_context, fs->cfa_reg); cfa +=3D fs->cfa_offset; break; In the example fs->cfa_offset ends up being 0 instead of 128 after the DW_CFA_restore_state, causing the wrong frame's return address to be used. For reference: The below is the dwarfdump -v -v -F for throw_exception (whe= re the "stuck" return address vale problem [0x000153a0] is observed): < 0><0x00015310:0x000153dc> 0x00015310: =20 0x00015318: =20 0x00015324: =20 0x00015368: =20 0x00015378: =20 0x00015380: =20 0x000153a8: =20 0x000153b8: =20 0x000153c0: =20 fde section offset 4312 0x000010d8 cie offset for fde: 4316 0x000010dc 0 DW_CFA_advance_loc 8 (2 * 4) 1 DW_CFA_register r65 =3D r0 4 DW_CFA_offset r31 -8 (1 * -8) 6 DW_CFA_advance_loc 12 (3 * 4) 7 DW_CFA_def_cfa_offset 128 10 DW_CFA_offset_extended_sf r65 16 (-2 * -8) 13 DW_CFA_advance_loc 68 (17 * 4) 14 DW_CFA_remember_state 15 DW_CFA_def_cfa_offset 0 17 DW_CFA_advance_loc 16 (4 * 4) 18 DW_CFA_restore_extended r65 20 DW_CFA_restore r31 21 DW_CFA_advance_loc 8 (2 * 4) 22 DW_CFA_restore_state 23 DW_CFA_advance_loc 40 (10 * 4) 24 DW_CFA_remember_state 25 DW_CFA_def_cfa_offset 0 27 DW_CFA_advance_loc 16 (4 * 4) 28 DW_CFA_restore_extended r65 30 DW_CFA_restore r31 31 DW_CFA_advance_loc 8 (2 * 4) 32 DW_CFA_restore_state 33 DW_CFA_nop 34 DW_CFA_nop 35 DW_CFA_nop 36 DW_CFA_nop 37 DW_CFA_nop 38 DW_CFA_nop Note that if fs->cfa_reg could be varying then DW_CFA_remember_state and DW_CFA_restore_state would need to do appropriate save/restore activity for that too. --=20 You are receiving this mail because: You are the assignee for the bug.=