From: "Scholz Maik (CM-CR/EES3) *" <Maik.Scholz@de.bosch.com>
To: "'Manfred Hollstein'" <manfredh@redhat.com>
Cc: "'gcc@gcc.gnu.org'" <gcc@gcc.gnu.org>
Subject: AW: howto use -fstack-check
Date: Wed, 24 Apr 2002 05:34:00 -0000 [thread overview]
Message-ID: <D7C2090CD687D311AB160008C7E62F9204EE0738@himail5.hi.de.bosch.com> (raw)
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
Is there any description how to use the
"extra generated code".
Regards
Maik
-----Ursprüngliche Nachricht-----
Von: Manfred Hollstein [mailto:manfredh@redhat.com]
Gesendet: Mittwoch, 24. April 2002 13:49
An: Scholz Maik (CM-CR/EES3) *
Cc: 'gcc@gcc.gnu.org'
Betreff: Re: howto use -fstack-check
Scholz Maik (CM-CR/EES3) * wrote:
> We have an embedded system with a
> RTOS without any stack check.
>
> How can I use the gcc build in stack check
> "-fstack-check"
From gcc's info page:
`-fstack-check'
Generate code to verify that you do not go beyond the boundary of
the stack. You should specify this flag if you are running in an
environment with multiple threads, but only rarely need to specify
it in a single-threaded environment since stack overflow is
automatically detected on nearly all systems if there is only one
stack.
Note that this switch does not actually cause checking to be done;
the operating system must do that. The switch causes generation
of code to ensure that the operating system sees the stack being
extended.
This means to me, you try with "-S -fstack-check" when compiling
your code and see how the generated code looks like.
>
> Regards
>
> Maik Scholz
>
HTH.
Cheers.
l8er
manfred
--
Manfred Hollstein <mailto:manfredh@redhat.com>
Red Hat GmbH
GPG fingerprint: 1D1F 0F5A 32C1 9E2A B8BA 561A E372 AF4C 0581 D831
next reply other threads:[~2002-04-24 12:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-24 5:34 Scholz Maik (CM-CR/EES3) * [this message]
2002-04-24 5:45 ` Manfred Hollstein
2002-04-24 5:51 AW: " Scholz Maik (CM-CR/EES3) *
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D7C2090CD687D311AB160008C7E62F9204EE0738@himail5.hi.de.bosch.com \
--to=maik.scholz@de.bosch.com \
--cc=gcc@gcc.gnu.org \
--cc=manfredh@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).