Add CFI directives for _rtld_bind_start.

This allows debuggers to unwind back into the caller when stopped in the
runtime linker.

Sponsored by:	DARPA / AFRL
This commit is contained in:
jhb 2017-09-11 22:18:01 +00:00
parent 38c30df2a9
commit 698de0bfc6

View File

@ -104,26 +104,39 @@ END(rtld_start)
.ent _rtld_bind_start
_rtld_bind_start:
.frame sp, XCALLFRAME_SIZ, $15
.cfi_startproc simple
.cfi_register ra, $15
move v1, gp /* save old GP */
#if defined(__mips_o32) || defined(__mips_o64)
PTR_ADDU t9, 8 /* modify T9 to point at .cpload */
#endif
SETUP_GP
PTR_SUBU sp, XCALLFRAME_SIZ /* save arguments and sp value in stack */
.cfi_def_cfa sp, XCALLFRAME_SIZ
SETUP_GP64(XCALLFRAME_GP, _rtld_bind_start)
SAVE_GP(XCALLFRAME_GP)
#if defined(__mips_n32) || defined(__mips_n64)
REG_S a4, XCALLFRAME_A4(sp)
.cfi_rel_offset a4, XCALLFRAME_A4
REG_S a5, XCALLFRAME_A5(sp)
.cfi_rel_offset a5, XCALLFRAME_A5
REG_S a6, XCALLFRAME_A6(sp)
.cfi_rel_offset a6, XCALLFRAME_A6
REG_S a7, XCALLFRAME_A7(sp)
.cfi_rel_offset a7, XCALLFRAME_A7
#endif
REG_S a0, XCALLFRAME_A0(sp)
.cfi_rel_offset a0, XCALLFRAME_A0
REG_S a1, XCALLFRAME_A1(sp)
.cfi_rel_offset a1, XCALLFRAME_A1
REG_S a2, XCALLFRAME_A2(sp)
.cfi_rel_offset a2, XCALLFRAME_A2
REG_S a3, XCALLFRAME_A3(sp)
.cfi_rel_offset a3, XCALLFRAME_A3
REG_S $15, XCALLFRAME_RA(sp) /* ra is in t7/t3 */
.cfi_rel_offset ra, XCALLFRAME_RA
REG_S s0, XCALLFRAME_S0(sp)
.cfi_rel_offset s0, XCALLFRAME_S0
move s0, sp
move a0, v1 /* old GP */
@ -147,20 +160,31 @@ _rtld_bind_start:
move sp, s0
REG_L ra, XCALLFRAME_RA(sp)
.cfi_restore ra
REG_L s0, XCALLFRAME_S0(sp)
.cfi_restore s0
REG_L a0, XCALLFRAME_A0(sp)
.cfi_restore a0
REG_L a1, XCALLFRAME_A1(sp)
.cfi_restore a1
REG_L a2, XCALLFRAME_A2(sp)
.cfi_restore a2
REG_L a3, XCALLFRAME_A3(sp)
.cfi_restore a3
#if defined(__mips_n32) || defined(__mips_n64)
REG_L a4, XCALLFRAME_A4(sp)
.cfi_restore a4
REG_L a5, XCALLFRAME_A5(sp)
.cfi_restore a5
REG_L a6, XCALLFRAME_A6(sp)
.cfi_restore a6
REG_L a7, XCALLFRAME_A7(sp)
.cfi_restore a7
#endif
RESTORE_GP64
PTR_ADDU sp, XCALLFRAME_SIZ
move t9, v0
jr t9
nop
.cfi_endproc
END(_rtld_bind_start)