This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: howto use -fstack-check


Scholz Maik (CM-CR/EES3) * wrote:
> small example:
> foo.c:
> 	void foo2()
> 	{
> 	}
> 
> 	void foo1()
> 	{
> 	  int i;
> 	  i = 1;
> 	  foo2();
> 	}
> 
> miplsisa32-elf -S -fstack-check
> foo.s:
> 	.file	1 "foo.c"
> 	.section	.text
> gcc2_compiled.:
> __gnu_compiled_c:
> 	.text
> 	.align	2
> 	.globl	foo2
> 	.ent	foo2
> foo2:
> 	.frame	$fp,16,$31		# vars= 0, regs= 1/0, args= 0,
> extra= 0
> 	.mask	0x40000000,-16
> 	.fmask	0x00000000,0
> 	subu	$sp,$sp,16
> 	sw	$fp,0($sp)
> 	move	$fp,$sp
> 	move	$sp,$fp
> 	lw	$fp,0($sp)
> 	addu	$sp,$sp,16
> 	j	$31
> 	.end	foo2
> 	.align	2
> 	.globl	foo1
> 	.ent	foo1
> foo1:
> 	.frame	$fp,32,$31		# vars= 16, regs= 2/0, args= 0,
> extra= 0
> 	.mask	0xc0000000,-12
> 	.fmask	0x00000000,0
> 	subu	$sp,$sp,32
> 	sw	$31,20($sp)
> 	sw	$fp,16($sp)
> 	move	$fp,$sp
> added code	|	addu	$2,$sp,-4392
> added code	|	#.set	volatile
> added code	|	sw	$0,0($2)
> added code	|	#.set	novolatile
> 	li	$2,1			# 0x1
> 	sw	$2,0($fp)
> 	jal	foo2
> 	move	$sp,$fp
> 	lw	$31,20($sp)
> 	lw	$fp,16($sp)
> 	addu	$sp,$sp,32
> 	j	$31
> 	.end	foo1

I'm not really MIPS aware, but assuming "addu" means "add unsigned"
and "sw" means "store word" I cannot imagine how those added insns
are of any use.

> 
> Is there any description how to use the 
> "extra generated code".

gccint.info describes three alternatives available to gcc hackers
who want to implement stack checking for their particular port, but
other than that, I'm afraid, no.

> 
> Regards
> 
> Maik
> 

Cheers.

l8er
manfred

-- 
Manfred Hollstein                         <mailto:manfredh@redhat.com>
Red Hat GmbH
GPG fingerprint:    1D1F 0F5A 32C1 9E2A B8BA  561A E372 AF4C 0581 D831


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]