Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Nov 2017 01:17:26 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325624 - head/libexec/rtld-elf/mips
Message-ID:  <201711100117.vAA1HQqT094112@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <machine/asm.h>
 
+	.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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711100117.vAA1HQqT094112>