lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1256650350.5499.117.camel@falcon>
Date:	Tue, 27 Oct 2009 21:32:30 +0800
From:	Wu Zhangjin <wuzhangjin@...il.com>
To:	Steven Rostedt <rostedt@...dmis.org>, rdsandiford@...glemail.com
Cc:	David Daney <ddaney@...iumnetworks.com>,
	Ralf Baechle <ralf@...ux-mips.org>, linux-mips@...ux-mips.org,
	linux-kernel@...r.kernel.org
Subject: mipsel-linux-gnu-gcc: -pg and -fomit-frame-pointer are incompatible

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ