Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/share/mk/bsd.lib.mk,v rcsdiff: /ftp/cvs/cvsroot/src/share/mk/bsd.lib.mk,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.345 retrieving revision 1.365 diff -u -p -r1.345 -r1.365 --- src/share/mk/bsd.lib.mk 2014/01/14 11:31:01 1.345 +++ src/share/mk/bsd.lib.mk 2016/02/27 20:36:17 1.365 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.lib.mk,v 1.345 2014/01/14 11:31:01 apb Exp $ +# $NetBSD: bsd.lib.mk,v 1.365 2016/02/27 20:36:17 christos Exp $ # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94 .include @@ -42,10 +42,11 @@ realinstall: checkver libinstall # XXX: This is needed for programs that link with .a libraries # Perhaps a more correct solution is to always generate _pic.a # files or always have a shared library. -.if defined(MKPIE) && (${MKPIE} != "no") -CFLAGS+= ${PIE_CFLAGS} -AFLAGS+= ${PIE_AFLAGS} -.endif +# Disabled since it breaks profiling. +#.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE) +#CFLAGS+= ${PIE_CFLAGS} +#AFLAGS+= ${PIE_AFLAGS} +#.endif ##### Libraries that this may depend upon. .if defined(LIBDPLIBS) && ${MKPIC} != "no" # { @@ -64,7 +65,7 @@ DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so .endif # } ##### Build and install rules -MKDEP_SUFFIXES?= .o .po .pico .go .ln +MKDEP_SUFFIXES?= .o .po .pico .go .ln .d .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # { SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major @@ -156,7 +157,7 @@ MKSHLIBOBJS= yes MKSHLIBOBJS= no .endif -.if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \ +.if (${MKDEBUG:Uno} != "no" && !defined(NODEBUG)) || \ (defined(CFLAGS) && !empty(CFLAGS:M*-g*)) # We only add -g to the shared library objects # because we don't currently split .a archives. @@ -169,7 +170,9 @@ CFLAGS+= -g # Platform-independent linker flags for ELF shared libraries SHLIB_SOVERSION= ${SHLIB_MAJOR} SHLIB_SHFLAGS= -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION} +.if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no" SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel +.endif .if !defined(SHLIB_MKMAP) || ${SHLIB_MKMAP} != "no" SHLIB_SHFLAGS+= -Wl,-Map=${_LIB}.so.${SHLIB_SOVERSION}.map .endif @@ -185,6 +188,9 @@ FFLAGS+= ${FOPTS} .if defined(CTFCONVERT) .if defined(CFLAGS) && !empty(CFLAGS:M*-g*) CTFFLAGS+= -g +.if defined(HAVE_GCC) && ${HAVE_GCC} >= 48 +#CFLAGS+= -gdwarf-2 +.endif .endif .endif @@ -401,7 +407,8 @@ _LIB.ln:=llib-l${LIB}.ln _LIB.so:=${_LIB}.so _LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR} _LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION} -.if ${MKDEBUG} != "no" +_LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link +.if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG) _LIB.so.debug:=${_LIB.so.full}.debug .endif .endif @@ -439,7 +446,7 @@ ${_LIB}_combine.o: ${COMBINESRCS} ${_MKTARGET_COMPILE} ${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET} .if defined(LIBSTRIPOBJS) - ${OBJCOPY} -x ${.TARGET} + ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET} .endif CLEANFILES+= ${_LIB}_combine.d @@ -599,10 +606,8 @@ LDADD+= -lgcc LIBCC:= ${CXX} . if ${MKLIBCXX} == "yes" LIBDPLIBS+= c++ ${.CURDIR}/../../../../../external/bsd/libc++/lib -. elif defined(HAVE_GCC) && ${HAVE_GCC} == 4 -LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../gnu/lib/libstdc++-v3_4 . else -LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/gcc/lib/libstdc++-v3 +LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3 . endif .else LIBCC:= ${CC} @@ -611,8 +616,25 @@ LIBCC:= ${CC} _LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}} _LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}} -${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPLIBC} \ - ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} +_MAINLIBDEPS= ${SOLIB} ${DPADD} ${DPLIBC} \ + ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE} + +.if defined(_LIB.so.debug) +${_LIB.so.debug}: ${_LIB.so.link} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --only-keep-debug \ + ${_LIB.so.link} ${_LIB.so.debug} \ + ) || (rm -f ${.TARGET}; false) +${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug} + ${_MKTARGET_CREATE} + ( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ + --add-gnu-debuglink=${_LIB.so.debug} \ + ${_LIB.so.link} ${_LIB.so.full} \ + ) || (rm -f ${.TARGET}; false) +${_LIB.so.link}: ${_MAINLIBDEPS} +.else # aka no MKDEBUG +${_LIB.so.full}: ${_MAINLIBDEPS} +.endif ${_MKTARGET_BUILD} rm -f ${.TARGET} ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \ @@ -622,6 +644,8 @@ ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPL # We don't use INSTALL_SYMLINK here because this is just # happening inside the build directory/objdir. XXX Why does # this spend so much effort on libraries that aren't live??? XXX +# XXX Also creates dead symlinks until the .full rule runs +# above and creates the main link .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \ "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp @@ -633,15 +657,6 @@ ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPL ${OBJCOPY} -R .ident ${.TARGET} .endif -.if defined(_LIB.so.debug) -${_LIB.so.debug}: ${_LIB.so.full} - ${_MKTARGET_CREATE} - ( ${OBJCOPY} --only-keep-debug ${_LIB.so.full} ${_LIB.so.debug} \ - && ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \ - --add-gnu-debuglink=${_LIB.so.debug} ${_LIB.so.full} \ - ) || (rm -f ${.TARGET}; false) -.endif - .if !empty(LOBJS) # { LLIBS?= -lc ${_LIB.ln}: ${LOBJS}