linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>, rdsandiford@googlemail.com
Cc: David Daney <ddaney@caviumnetworks.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
Subject: mipsel-linux-gnu-gcc: -pg and -fomit-frame-pointer are incompatible
Date: Tue, 27 Oct 2009 21:32:30 +0800	[thread overview]
Message-ID: <1256650350.5499.117.camel@falcon> (raw)

Hi, all

FUNCTION_TRACER have selected FRAME_POINTER by default to avoid the
following "weird" error when using -pg and -fomit-frame-pointer
together:

"-pg and -fomit-frame-pointer are incompatible"

kernel/trace/Kconfig:

config FUNCTION_TRACER
        bool "Kernel Function Tracer"
        depends on HAVE_FUNCTION_TRACER
        select FRAME_POINTER

and here is what FRAME_POINTER does in (linux)/Makefile:

ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS   += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
KBUILD_CFLAGS   += -fomit-frame-pointer
endif

but in reality, from the manual of gcc:

"Don’t keep the frame pointer in a register for functions that don’t
need one.  This avoids the instructions to save, set up and restore
frame pointers; it also makes an extra register available in many
functions.  It also makes debugging impossible on some machines.

On some machines, such as the VAX, this flag has no effect, because the
standard calling sequence automatically handles the frame pointer and
nothing is saved by pretending it doesn’t exist.  The
machine-description macro "FRAME_POINTER_REQUIRED" controls whether a
target machine supports this flag.

Enabled at levels -O, -O2, -O3, -Os."

-fomit-frame-pointer will be enabled by default for -O2, and If I
disable -fno-omit-frame-pointer, it will really not keep the frame
pointer in a register:

ffffffff80200400 <do_one_initcall>:
ffffffff80200400:       67bdffd0        daddiu  sp,sp,-48
ffffffff80200404:       ffbf0028        sd      ra,40(sp)
ffffffff80200408:       ffb40020        sd      s4,32(sp)
ffffffff8020040c:       ffb30018        sd      s3,24(sp)
ffffffff80200410:       ffb20010        sd      s2,16(sp)
ffffffff80200414:       ffb10008        sd      s1,8(sp)
ffffffff80200418:       ffb00000        sd      s0,0(sp)
ffffffff8020041c:       3c038021        lui     v1,0x8021
ffffffff80200420:       64630fb0        daddiu  v1,v1,4016  <> with -pg
ffffffff80200424:       03e0082d        move    at,ra
ffffffff80200428:       0060f809        jalr    v1
ffffffff8020042c:       00020021        nop
[...]
ffffffff80205b18 <au1k_wait>:
ffffffff80205b18:       3c038021        lui     v1,0x8021
ffffffff80205b1c:       64630fb0        daddiu  v1,v1,4016
ffffffff80205b20:       03e0082d        move    at,ra
ffffffff80205b24:       0060f809        jalr    v1
ffffffff80205b28:       00020021        nop

And without -fno-omit-frame-pointer option, ftrace for MIPS also works
normally and can save some overhead for us!

But perhaps some archs need the frame pointer, so, remove the
-fno-omit-frame-pointer from (linux)/Makefile, and add it into the arch
specific Makefile?

Besides, should we clear the "weird" error in gcc when using -pg and
-fomit-frame-pinter together?

Thanks & Regards,
	Wu Zhangjin

                 reply	other threads:[~2009-10-27 13:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1256650350.5499.117.camel@falcon \
    --to=wuzhangjin@gmail.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=rdsandiford@googlemail.com \
    --cc=rostedt@goodmis.org \
    /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 NNTP newsgroup(s).