commit d8026c50d32aef1b346ee75be0e65e7b82f3aa85 Author: Ryota Ozaki Date: Tue Apr 4 17:23:07 2017 +0900 Don't strip symbols of rump libraries diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index b657c7b9eea..fcf26784f64 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -577,6 +577,9 @@ _LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \ _LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \ -L=${SHLIBINSTALLDIR} .endif +.if ${LIBSYMSTRIP:Uyes} == yes +_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 +638,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}} diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 35c11f569ca..45f42aad561 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -308,6 +308,11 @@ OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][dx]' -K '[$$][dx]\.*' # ARM big endian needs to preserve $a/$d/$t symbols for the linker. OBJCOPYLIBFLAGS_EXTRA=-w -K '[$$][adt]' -K '[$$][adt]\.*' .endif + +.if ${LIBSYMSTRIP:Uyes} == yes OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} ${OBJCOPYLIBFLAGS_EXTRA} +.else +OBJCOPYLIBFLAGS?=${OBJCOPYLIBFLAGS_EXTRA} +.endif .endif # !defined(_BSD_SYS_MK_) diff --git a/sys/rump/Makefile.rump b/sys/rump/Makefile.rump index e65cfee1d1b..f2c9a101c3e 100644 --- a/sys/rump/Makefile.rump +++ b/sys/rump/Makefile.rump @@ -112,6 +112,11 @@ RUMP_KTRACE?=yes CPPFLAGS+= -DKTRACE .endif +RUMP_KEEPSYMBOLS?=no +.if ${RUMP_KEEPSYMBOLS} == "yes" +LIBSYMSTRIP= no +.endif + # kernel libs should not get linked against libc # XXX: actually, we would like to enable this but cannot, since it # also leaves out libgcc, it causes problems on some platforms. diff --git a/sys/rump/README.compileopts b/sys/rump/README.compileopts index 26a356ef8a6..da2d3529bb6 100644 --- a/sys/rump/README.compileopts +++ b/sys/rump/README.compileopts @@ -80,6 +80,16 @@ effect: Builds NetBSD COMPAT_nn code for each of the elements in the list. NetBSD userspace, and an empty value may be supplied elsewhere. + RUMP_KEEPSYMBOLS + +values: yes|no +defval: no +effect: Iff "yes", build shared libraries without stripping local symbols, + which is equivalent to not passing -x option to the linker. Keeping + local symbols is useful on debugging, for example, symbols of static + functions in a backtrace can be seen as well as public functions. + + ================================================================================ Per-component options: