summaryrefslogtreecommitdiff
path: root/lib/libc/gmon
diff options
context:
space:
mode:
authorPascal Stumpf <pascal@cvs.openbsd.org>2012-08-22 22:54:45 +0000
committerPascal Stumpf <pascal@cvs.openbsd.org>2012-08-22 22:54:45 +0000
commit55197ac21f217cfc7481f89abe3f2ff958a56d60 (patch)
treea3ec9c7898fb7e07a3cbd95eeeade760bff5463f /lib/libc/gmon
parent8514a201ec15acec40cd0ea37227745d30cfcc5f (diff)
We cannot just copy mcount.o to mcount.po, since the former may be PIE and
profiling does not work well along with PIE. ok deraadt@ guenther@
Diffstat (limited to 'lib/libc/gmon')
-rw-r--r--lib/libc/gmon/Makefile.inc11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libc/gmon/Makefile.inc b/lib/libc/gmon/Makefile.inc
index f7c3e1ff6db..7190de5d11c 100644
--- a/lib/libc/gmon/Makefile.inc
+++ b/lib/libc/gmon/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.4 1998/11/20 11:18:40 d Exp $
+# $OpenBSD: Makefile.inc,v 1.5 2012/08/22 22:54:44 pascal Exp $
# gmon sources
.PATH: ${LIBCSRCDIR}/gmon
@@ -8,6 +8,9 @@ MAN+= moncontrol.3
MLINKS+=moncontrol.3 monstartup.3
-# mcount cannot be compiled with profiling
-mcount.po: mcount.o
- cp mcount.o mcount.po
+# mcount cannot be compiled with profiling or pie
+mcount.po:
+ @echo "${COMPILE.c} ${NOPIE_FLAGS} ${.IMPSRC} -o ${.TARGET}"
+ @${COMPILE.c} ${NOPIE_FLAGS} ${.IMPSRC} -o ${.TARGET}.o
+ @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
+ @rm -f ${.TARGET}.o