summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorpascal <pascal@openbsd.org>2012-08-22 22:54:44 +0000
committerpascal <pascal@openbsd.org>2012-08-22 22:54:44 +0000
commit97bd7d40d2ba21c3951468e63aecdf3afde055eb (patch)
tree978773378cb9939f0f9b30ee3a875b0cc65111fe /lib/libc
parentcorrect check. (diff)
downloadwireguard-openbsd-97bd7d40d2ba21c3951468e63aecdf3afde055eb.tar.xz
wireguard-openbsd-97bd7d40d2ba21c3951468e63aecdf3afde055eb.zip
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')
-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