From owner-svn-src-head@freebsd.org Fri Nov 10 01:17:28 2017 Return-Path: Delivered-To: svn-src-head@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 181C3E6184F; Fri, 10 Nov 2017 01:17:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 D6D228053A; Fri, 10 Nov 2017 01:17:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAA1HQ1Q094113; Fri, 10 Nov 2017 01:17:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAA1HQqT094112; Fri, 10 Nov 2017 01:17:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201711100117.vAA1HQqT094112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 10 Nov 2017 01:17:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325624 - head/libexec/rtld-elf/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/libexec/rtld-elf/mips X-SVN-Commit-Revision: 325624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 01:17:28 -0000 Author: jhb Date: Fri Nov 10 01:17:26 2017 New Revision: 325624 URL: https://svnweb.freebsd.org/changeset/base/325624 Log: Some fixups to the CFI directives for PLT stub entry points. The directives I added in r323466 and r323501 did not define a valid CFA until several instructions into the associated functions. This triggers an assertion in GDB when generating a stack trace while stopped at the first instruction of PLT stub entry point since there is no valid CFA rule for the first instruction. This is probably just wrong on my part as the non-simple .cfi_startproc would have defined a valid CFA. Instead, define a valid CFA as sp + 0 at the start of the functions and then use .cfa_def_offset to change the offset when sp is adjusted later in the function. Sponsored by: DARPA / AFRL Modified: head/libexec/rtld-elf/mips/rtld_start.S Modified: head/libexec/rtld-elf/mips/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/mips/rtld_start.S Fri Nov 10 01:13:45 2017 (r325623) +++ head/libexec/rtld-elf/mips/rtld_start.S Fri Nov 10 01:17:26 2017 (r325624) @@ -32,6 +32,8 @@ #include + .cfi_sections .debug_frame + .globl _C_LABEL(_rtld_relocate_nonplt_self) .globl _C_LABEL(_rtld) @@ -107,6 +109,7 @@ END(rtld_start) _rtld_bind_start: .frame sp, XCALLFRAME_SIZ, $15 .cfi_startproc simple + .cfi_def_cfa sp, 0 .cfi_register ra, $15 move v1, gp /* save old GP */ #if defined(__mips_o32) || defined(__mips_o64) @@ -114,7 +117,7 @@ _rtld_bind_start: #endif SETUP_GP PTR_SUBU sp, XCALLFRAME_SIZ /* save arguments and sp value in stack */ - .cfi_def_cfa sp, XCALLFRAME_SIZ + .cfi_def_cfa_offset XCALLFRAME_SIZ SETUP_GP64(XCALLFRAME_GP, _rtld_bind_start) SAVE_GP(XCALLFRAME_GP) #if defined(__mips_n32) || defined(__mips_n64) @@ -200,6 +203,7 @@ END(_rtld_bind_start) _rtld_pltbind_start: .frame sp, XCALLFRAME_SIZ, $15 .cfi_startproc simple + .cfi_def_cfa sp, 0 .cfi_register ra, $15 #if defined(__mips_o32) move v1, gp /* save pointer to .got.plt */ @@ -211,7 +215,7 @@ _rtld_pltbind_start: #endif SETUP_GP PTR_SUBU sp, XCALLFRAME_SIZ /* save arguments and sp value in stack */ - .cfi_def_cfa sp, XCALLFRAME_SIZ + .cfi_def_cfa_offset XCALLFRAME_SIZ SETUP_GP64(XCALLFRAME_GP, _rtld_pltbind_start) SAVE_GP(XCALLFRAME_GP) #if defined(__mips_n32) || defined(__mips_n64)