NetBSD-Bugs archive

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

misc/47700: MKSTATICLIB, MKPICLIB, and `-g' interact badly in bsd.lib.mk



>Number:         47700
>Category:       misc
>Synopsis:       MKSTATICLIB, MKPICLIB, and `-g' interact badly in bsd.lib.mk
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 28 03:30:00 +0000 2013
>Originator:     Taylor R Campbell <campbell+netbsd%mumble.net@localhost>
>Release:        NetBSD 6.99.17
>Organization:
>Environment:
System: NetBSD vox.local 6.99.17 NetBSD 6.99.17 (GENERIC) #0: Thu Mar 28 
03:12:05 UTC 2013 
root@vox.local:/home/riastradh/netbsd/current/obj.vax/sys/arch/vax/compile/GENERIC
 vax
Architecture: vax
Machine: vax
>Description:

        MKDEBUG=yes is broken on VAX, because...

        The logic surrounding CSHLIBFLAGS affects which variants of a
        library (.a, _pic.a), and the initialization of CSHLIBFLAGS
        depends on whether `-g' has turned up.  This breaks the case of
        MKDEBUG=yes/MKSTATICLIB=no/MKPICLIB=no, which happens in
        librumphijack (which sets NOSTATICLIB) on VAX (which sets
        MKPICLIB=no) if you set MKDEBUG=yes in your mk.conf -- the
        symlink at librumphijack_pic.a is omitted from the destdir in
        spite of its presence in the set lists.

        A separate problem is that librumphijack_pic.a has no business
        being installed, really, any more than librumphijack.a does.
        But fixing this sounds even more convoluted and I think I've
        had enough of a foray into architecture necrophilia and the
        tortu(r)ous convolutions of logic in bsd.lib.mk for now.

>How-To-Repeat:

        build.sh -m vax -V MKDEBUG=yes distribution

        See that librumphijack_pic.a is not installed.

>Fix:

        Apply the following patch to set CSHLIBFLAGS a little later,
        after it could change the decision of what libraries get built:

Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.lib.mk,v
retrieving revision 1.332
diff -p -u -r1.332 bsd.lib.mk
--- share/mk/bsd.lib.mk 5 Mar 2013 21:16:24 -0000       1.332
+++ share/mk/bsd.lib.mk 28 Mar 2013 03:22:12 -0000
@@ -47,13 +47,6 @@ CFLAGS+=        ${PIE_CFLAGS}
 AFLAGS+=        ${PIE_AFLAGS}
 .endif
 
-.if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \
-    (defined(CFLAGS) && !empty(CFLAGS:M*-g*))
-# We only add -g to the shared library objects
-# because we don't currently split .a archives.
-CSHLIBFLAGS+=  -g
-.endif
-
 ##### Libraries that this may depend upon.
 .if defined(LIBDPLIBS) && ${MKPIC} != "no"                             # {
 .for _lib _dir in ${LIBDPLIBS}
@@ -200,6 +193,13 @@ MKSHLIBOBJS= yes
 MKSHLIBOBJS= no
 .endif
 
+.if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \
+    (defined(CFLAGS) && !empty(CFLAGS:M*-g*))
+# We only add -g to the shared library objects
+# because we don't currently split .a archives.
+CSHLIBFLAGS+=  -g
+.endif
+
 # Platform-independent linker flags for ELF shared libraries
 SHLIB_SOVERSION=       ${SHLIB_MAJOR}
 SHLIB_SHFLAGS=         -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION}



Home | Main Index | Thread Index | Old Index