clang: -mno-omit-leaf-frame-pointer

2013-03-30 Thread Andriy Gapon

It seems that, unlike gcc, for clang -fno-omit-frame-pointer does not imply
-mno-omit-leaf-frame-pointer.  This is probably a bug.

Meanwhile I would like to propose the following amd64-specific patch.  Perhaps
the same type of change would be useful for powerpc as well.

I would like this change primarily for DTrace (fbt), but other
debugging/profiling code may benefit from it as well.

I chose to make -mno-omit-leaf-frame-pointer not conditional on clang, because
with gcc it is just a nop (i.e. it doesn't hurt anything).

--- a/sys/conf/Makefile.amd64
+++ b/sys/conf/Makefile.amd64
@@ -32,7 +32,7 @@ S=../../..
 .include $S/conf/kern.pre.mk

 .if !empty(DDB_ENABLED) || !empty(DTR_ENABLED) || !empty(HWPMC_ENABLED)
-CFLAGS+=   -fno-omit-frame-pointer
+CFLAGS+=   -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 .endif

 MKMODULESENV+= MACHINE=amd64
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index f0d3d4d..7eaba85 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -122,7 +122,7 @@ LDFLAGS+=   -d -warn-common

 CFLAGS+=   ${DEBUG_FLAGS}
 .if ${MACHINE_CPUARCH} == amd64
-CFLAGS+=   -fno-omit-frame-pointer
+CFLAGS+=   -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 .endif

 .if ${MACHINE_CPUARCH} == powerpc

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org

Re: clang: -mno-omit-leaf-frame-pointer

2013-03-30 Thread Dimitry Andric
On Mar 30, 2013, at 09:10, Andriy Gapon a...@freebsd.org wrote:
 It seems that, unlike gcc, for clang -fno-omit-frame-pointer does not imply
 -mno-omit-leaf-frame-pointer.  This is probably a bug.

Yes, this is indeed the case.  There is even a rather old unresolved PR
for it in LLVM's Bugzilla:

http://llvm.org/bugs/show_bug.cgi?id=9825


 Meanwhile I would like to propose the following amd64-specific patch.  Perhaps
 the same type of change would be useful for powerpc as well.

Most likely yes.


 I would like this change primarily for DTrace (fbt), but other
 debugging/profiling code may benefit from it as well.
 
 I chose to make -mno-omit-leaf-frame-pointer not conditional on clang, because
 with gcc it is just a nop (i.e. it doesn't hurt anything).

The patch looks good to me, please commit.

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org