Source-Changes-HG archive

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

[src/trunk]: src/share/mk Add rules for building relocatable objects to avoid...



details:   https://anonhg.NetBSD.org/src/rev/05d129663b37
branches:  trunk
changeset: 323236:05d129663b37
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jun 05 00:56:51 2018 +0000

description:
Add rules for building relocatable objects to avoid having random Makefiles
use ${LD} ${LDFLAGS} -r which does not work if we specify MKRELRO since
LDFLAGS is supposed to be passed to LINK.c not LD directly (although some
of the flags work).

diffstat:

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

diffs (40 lines):

diff -r e05e7fe56a65 -r 05d129663b37 share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk       Mon Jun 04 21:36:03 2018 +0000
+++ b/share/mk/bsd.lib.mk       Tue Jun 05 00:56:51 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.lib.mk,v 1.372 2017/05/29 03:52:43 christos Exp $
+#      $NetBSD: bsd.lib.mk,v 1.373 2018/06/05 00:56:51 christos Exp $
 #      @(#)bsd.lib.mk  8.3 (Berkeley) 4/22/94
 
 .include <bsd.init.mk>
@@ -541,7 +541,7 @@
 .if !target(__archivebuild)
 __archivebuild: .USE
        ${_MKTARGET_BUILD}
-       rm -f ${.TARGET}
+       @rm -f ${.TARGET}
        ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
 .endif
 
@@ -556,6 +556,21 @@
        ${_MKTARGET_INSTALL}
        ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
 
+.if !target(__buildstdlib)
+__buildstdlib: .USE
+       @echo building standard ${.TARGET:T:S/.o//:S/lib//} library
+       @rm -f ${.TARGET}
+       @${LINK.c} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
+.endif
+
+.if !target(__buildproflib)
+__buildproflib: .USE
+       @echo building profiled ${.TARGET:T:S/.o//:S/lib//} library
+       ${_MKTARGET_BUILD}
+       @rm -f ${.TARGET}
+       @${LINK.c} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*po} | ${TSORT}`
+.endif
+
 DPSRCS+=       ${_YLSRCS}
 CLEANFILES+=   ${_YLSRCS}
 



Home | Main Index | Thread Index | Old Index