Module Name: src
Committed By: ozaki-r
Date: Thu Apr 20 09:29:11 UTC 2017
Modified Files:
src: BUILDING
src/doc: BUILDING.mdoc
src/share/man/man5: mk.conf.5
src/share/mk: bsd.README bsd.lib.mk bsd.lua.mk bsd.sys.mk
Log Message:
Introduce MKSTRIPSYM build option
If it's yes, all local symbols of shared libraries are stripped
(default). If it's no, only temporary local symbols are stripped;
for example, symbols of static functions are kept. Keeping such
symbols is useful on using DTrace for userland libraries and
getting a backtrace from a rump server loading modules (shared
libraries).
Proposed and discussed on tech-kern and tech-toolchain
To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/BUILDING
cvs rdiff -u -r1.116 -r1.117 src/doc/BUILDING.mdoc
cvs rdiff -u -r1.72 -r1.73 src/share/man/man5/mk.conf.5
cvs rdiff -u -r1.358 -r1.359 src/share/mk/bsd.README
cvs rdiff -u -r1.368 -r1.369 src/share/mk/bsd.lib.mk
cvs rdiff -u -r1.7 -r1.8 src/share/mk/bsd.lua.mk
cvs rdiff -u -r1.270 -r1.271 src/share/mk/bsd.sys.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/BUILDING
diff -u src/BUILDING:1.124 src/BUILDING:1.125
--- src/BUILDING:1.124 Mon Feb 20 21:28:48 2017
+++ src/BUILDING Thu Apr 20 09:29:10 2017
@@ -396,6 +396,18 @@ CONFIGURATION
Default: ``no''
+ MKSTRIPSYM Can be set to ``yes'' or ``no''. Indicates whether all local
+ symbols should be stripped from shared libraries. If ``yes'',
+ strip all local symbols from shared libraries; the affect is
+ equivalent to -x option of ld(1). If ``no'', strip only
+ temporary local symbols; the affect is equivalent to -X
+ option of ld(1). Keeping non-temporary local symbols such as
+ static function names is useful on using DTrace for userland
+ libraries and getting a backtrace from a rump kernel loading
+ shared libraries.
+
+ Default: ``yes''
+
MKUNPRIVED Can be set to ``yes'' or ``no''. Indicates whether an
unprivileged install will occur. The user, group,
permissions, and file flags, will not be set on the installed
Index: src/doc/BUILDING.mdoc
diff -u src/doc/BUILDING.mdoc:1.116 src/doc/BUILDING.mdoc:1.117
--- src/doc/BUILDING.mdoc:1.116 Mon Feb 20 20:56:30 2017
+++ src/doc/BUILDING.mdoc Thu Apr 20 09:29:10 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: BUILDING.mdoc,v 1.116 2017/02/20 20:56:30 christos Exp $
+.\" $NetBSD: BUILDING.mdoc,v 1.117 2017/04/20 09:29:10 ozaki-r Exp $
.\"
.\" Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -33,7 +33,7 @@
.\" Toolchain prefix for commands
.ds toolprefix nb
.
-.Dd February 20, 2017
+.Dd April 13, 2017
.Dt BUILDING 8
.Os NetBSD
.
@@ -697,6 +697,21 @@ Indicates whether RCS IDs, for use with
should be stripped from program binaries and shared libraries.
.DFLTn
.
+.It Sy MKSTRIPSYM
+.YorN
+Indicates whether all local symbols should be stripped from shared libraries.
+If
+.Dq yes ,
+strip all local symbols from shared libraries;
+the affect is equivalent to -x option of ld(1). If
+.Dq no ,
+strip only temporary local symbols; the affect is equivalent
+to -X option of ld(1). Keeping non-temporary local symbols
+such as static function names is useful on using DTrace for
+userland libraries and getting a backtrace from a rump kernel
+loading shared libraries.
+.DFLTy
+.
.It Sy MKUNPRIVED
.YorN
Indicates whether an unprivileged install will occur.
Index: src/share/man/man5/mk.conf.5
diff -u src/share/man/man5/mk.conf.5:1.72 src/share/man/man5/mk.conf.5:1.73
--- src/share/man/man5/mk.conf.5:1.72 Thu Feb 16 17:15:26 2017
+++ src/share/man/man5/mk.conf.5 Thu Apr 20 09:29:10 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: mk.conf.5,v 1.72 2017/02/16 17:15:26 rin Exp $
+.\" $NetBSD: mk.conf.5,v 1.73 2017/04/20 09:29:10 ozaki-r Exp $
.\"
.\" Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -783,6 +783,21 @@ Indicates whether RCS IDs, for use with
should be stripped from program binaries and shared libraries.
.DFLTn
.
+.It Sy MKSTRIPSYM
+.YorN
+Indicates whether all local symbols should be stripped from shared libraries.
+If
+.Dq yes ,
+strip all local symbols from shared libraries;
+the affect is equivalent to -x option of ld(1). If
+.Dq no ,
+strip only temporary local symbols; the affect is equivalent
+to -X option of ld(1). Keeping non-temporary local symbols
+such as static function names is useful on using DTrace for
+userland libraries and getting a backtrace from a rump kernel
+loading shared libraries.
+.DFLTy
+.
.It Sy MKUNPRIVED
.YorN
Indicates whether an unprivileged install will occur.
Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.358 src/share/mk/bsd.README:1.359
--- src/share/mk/bsd.README:1.358 Wed Feb 8 03:44:41 2017
+++ src/share/mk/bsd.README Thu Apr 20 09:29:10 2017
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.README,v 1.358 2017/02/08 03:44:41 kamil Exp $
+# $NetBSD: bsd.README,v 1.359 2017/04/20 09:29:10 ozaki-r Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the make "include" files for the NetBSD
@@ -409,6 +409,15 @@ MKSTATICLIB If "no", don't build or inst
libraries.
Default: yes
+MKSTRIPSYM If "yes", strip all local symbols from shared libraries;
+ the affect is equivalent to -x option of ld(1). If "no",
+ strip only temporary local symbols; the affect is equivalent
+ to -X option of ld(1). Keeping non-temporary local symbols
+ such as static function names is useful on using DTrace for
+ userland libraries and getting a backtrace from a rump kernel
+ loading shared libraries.
+ Default: yes
+
MKTOOLSDEBUG If "yes" build the tools with debugging symbols.
Default: no
Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.368 src/share/mk/bsd.lib.mk:1.369
--- src/share/mk/bsd.lib.mk:1.368 Sun Jan 8 17:40:44 2017
+++ src/share/mk/bsd.lib.mk Thu Apr 20 09:29:11 2017
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.lib.mk,v 1.368 2017/01/08 17:40:44 christos Exp $
+# $NetBSD: bsd.lib.mk,v 1.369 2017/04/20 09:29:11 ozaki-r Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.include <bsd.init.mk>
@@ -577,6 +577,11 @@ _LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \
_LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
-L=${SHLIBINSTALLDIR}
.endif
+.if ${MKSTRIPSYM:Uyes} == "yes"
+_LIBLDOPTS+= -Wl,-x
+.else
+_LIBLDOPTS+= -Wl,-X
+.endif
# gcc -shared now adds -lc automatically. For libraries other than libc and
# libgcc* we add as a dependency the installed shared libc. For libc and
@@ -635,7 +640,7 @@ ${_LIB.so.full}: ${_MAINLIBDEPS}
.endif
${_MKTARGET_BUILD}
rm -f ${.TARGET}
- ${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \
+ ${LIBCC} ${LDLIBC} -shared ${SHLIB_SHFLAGS} \
${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \
-Wl,--whole-archive ${SOLIB} \
-Wl,--no-whole-archive ${_LDADD.${_LIB}}
Index: src/share/mk/bsd.lua.mk
diff -u src/share/mk/bsd.lua.mk:1.7 src/share/mk/bsd.lua.mk:1.8
--- src/share/mk/bsd.lua.mk:1.7 Sat Jul 19 18:38:34 2014
+++ src/share/mk/bsd.lua.mk Thu Apr 20 09:29:11 2017
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.lua.mk,v 1.7 2014/07/19 18:38:34 lneto Exp $
+# $NetBSD: bsd.lua.mk,v 1.8 2017/04/20 09:29:11 ozaki-r Exp $
#
# Build rules and definitions for Lua modules
@@ -128,6 +128,13 @@ CLEANFILES+=${LUA_OBJS.${_M}} ${LUA_LOBJ
DPSRCS+=${LUA_SRCS.${_M}}
SRCS+=${LUA_SRCS.${_M}}
+LUA_LDOPTS= -Wl,--warn-shared-textrel
+.if ${MKSTRIPSYM:Uyes} == "yes"
+LUA_LDOPTS+= -Wl,-x
+.else
+LUA_LDOPTS+= -Wl,-X
+.endif
+
.NOPATH: ${LUA_OBJS.${_M}} ${LUA_LOBJ.${_M}} ${LUA_TARG.${_M}}
.if ${MKLINT} != "no"
${LUA_TARG.${_M}}: ${LUA_LOBJ.${_M}}
@@ -137,8 +144,7 @@ lua-all: ${LUA_TARG.${_M}}
${LUA_TARG.${_M}}: ${LUA_OBJS.${_M}} ${DPADD} ${DPADD.${_M}}
${_MKTARGET_BUILD}
rm -f ${.TARGET}
- ${CC} -Wl,--warn-shared-textrel \
- -Wl,-x -shared ${LUA_OBJS.${_M}} \
+ ${CC} ${LUA_LDOPTS} -shared ${LUA_OBJS.${_M}} \
-Wl,-soname,${LUA_NAME.${_M}} -o ${.TARGET} \
${LDADD} ${LDADD.${_M}} ${LDFLAGS} ${LDFLAGS.${_M}}
Index: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.270 src/share/mk/bsd.sys.mk:1.271
--- src/share/mk/bsd.sys.mk:1.270 Wed Mar 22 23:11:09 2017
+++ src/share/mk/bsd.sys.mk Thu Apr 20 09:29:11 2017
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.sys.mk,v 1.270 2017/03/22 23:11:09 chs Exp $
+# $NetBSD: bsd.sys.mk,v 1.271 2017/04/20 09:29:11 ozaki-r Exp $
#
# Build definitions used for NetBSD source tree builds.
@@ -308,6 +308,11 @@ OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][dx]' -
# ARM big endian needs to preserve $a/$d/$t symbols for the linker.
OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][adt]' -K '[$$][adt]\.*'
.endif
+
+.if ${MKSTRIPSYM:Uyes} == "yes"
OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} ${OBJCOPYLIBFLAGS_EXTRA}
+.else
+OBJCOPYLIBFLAGS?=-X ${OBJCOPYLIBFLAGS_EXTRA}
+.endif
.endif # !defined(_BSD_SYS_MK_)