Blame sysdeps/sh/____longjmp_chk.S

Packit 6c4009
/* Copyright (C) 2009-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
	.section .rodata.str1.1,"aMS",@progbits,1
Packit 6c4009
	.type	longjmp_msg,@object
Packit 6c4009
longjmp_msg:
Packit 6c4009
	.string "longjmp causes uninitialized stack frame"
Packit 6c4009
	.size	longjmp_msg, .-longjmp_msg
Packit 6c4009
	.text
Packit 6c4009
Packit 6c4009
#define __longjmp ____longjmp_chk
Packit 6c4009
Packit 6c4009
#ifdef PIC
Packit 6c4009
# define CALL_FAIL \
Packit 6c4009
	mov.l	.Lfail, r1;				\
Packit 6c4009
	mov.l	.Lstr, r4;				\
Packit 6c4009
	mov.l	r12, @-r15;				\
Packit 6c4009
	cfi_remember_state;				\
Packit 6c4009
	cfi_adjust_cfa_offset (4);			\
Packit 6c4009
	cfi_rel_offset (r12, 0);			\
Packit 6c4009
	mova	.Lgot, r0;				\
Packit 6c4009
	mov.l	.Lgot, r12;				\
Packit 6c4009
	add	r0, r12;				\
Packit 6c4009
	sts.l	pr, @-r15;				\
Packit 6c4009
	cfi_adjust_cfa_offset (4);			\
Packit 6c4009
	cfi_rel_offset (pr, 0);				\
Packit 6c4009
	bsrf	r1;					\
Packit 6c4009
	 add	r12, r4;				\
Packit 6c4009
	/* Unreachable.	 */				\
Packit 6c4009
.Lfail0:						\
Packit 6c4009
	.align	2;					\
Packit 6c4009
.Lgot:							\
Packit 6c4009
	.long	_GLOBAL_OFFSET_TABLE_;			\
Packit 6c4009
.Lstr:							\
Packit 6c4009
	.long	longjmp_msg@GOTOFF;			\
Packit 6c4009
.Lfail:							\
Packit 6c4009
	.long	__GI___fortify_fail@PLT-(.Lfail0-.);	\
Packit 6c4009
	cfi_restore_state;
Packit 6c4009
#else
Packit 6c4009
# define CALL_FAIL \
Packit 6c4009
	mov.l	.Lfail, r1;				\
Packit 6c4009
	mov.l	.Lstr, r4;				\
Packit 6c4009
	sts.l	pr, @-r15;				\
Packit 6c4009
	cfi_remember_state;				\
Packit 6c4009
	cfi_adjust_cfa_offset (4);			\
Packit 6c4009
	cfi_rel_offset (pr, 0);				\
Packit 6c4009
	jsr	@r1;					\
Packit 6c4009
	 nop;						\
Packit 6c4009
	/* Unreachable.	 */				\
Packit 6c4009
	.align	2;					\
Packit 6c4009
.Lstr:							\
Packit 6c4009
	.long	longjmp_msg;				\
Packit 6c4009
.Lfail:							\
Packit 6c4009
	.long	__fortify_fail;				\
Packit 6c4009
	cfi_restore_state;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#define CHECK_SP(reg) \
Packit 6c4009
	cmp/hs	r15, reg;				\
Packit 6c4009
	bt	.Lok;					\
Packit 6c4009
	CALL_FAIL					\
Packit 6c4009
.Lok:
Packit 6c4009
Packit 6c4009
#include <__longjmp.S>