Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk XXX: Remove -fPIE for profiled libraries because th...



details:   https://anonhg.NetBSD.org/src/rev/bbfeb1643bc7
branches:  trunk
changeset: 824085:bbfeb1643bc7
user:      christos <christos%NetBSD.org@localhost>
date:      Tue May 23 00:54:13 2017 +0000

description:
XXX: Remove -fPIE for profiled libraries because this breaks relocations for
the call to __mcount.

diffstat:

 share/mk/bsd.lib.mk |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 71854c61597a -r bbfeb1643bc7 share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk       Tue May 23 00:48:29 2017 +0000
+++ b/share/mk/bsd.lib.mk       Tue May 23 00:54:13 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.lib.mk,v 1.370 2017/04/24 17:09:37 chs Exp $
+#      $NetBSD: bsd.lib.mk,v 1.371 2017/05/23 00:54:13 christos Exp $
 #      @(#)bsd.lib.mk  8.3 (Berkeley) 4/22/94
 
 .include <bsd.init.mk>
@@ -43,6 +43,10 @@
 # Perhaps a more correct solution is to always generate _pic.a
 # files or always have a shared library.
 # XXX: This breaks profiling (__mcount relocation is wrong)
+# XXX: This is why we remove the PIE_CFLAGS from the profile
+# built-in rule below.
+# Another fix is to provide rcrt0.o like OpenBSD does and
+# do relocations for static PIE.
 .if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE)
 CFLAGS+=        ${PIE_CFLAGS}
 AFLAGS+=        ${PIE_AFLAGS}
@@ -220,7 +224,8 @@
 
 .c.po:
        ${_MKTARGET_COMPILE}
-       ${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
+       # XXX: See __mcount comment above
+       ${COMPILE.c:S/${PIE_CFLAGS}//} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
 .if defined(CTFCONVERT)
        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif



Home | Main Index | Thread Index | Old Index