From c4c23d9061b6eb2a3456620a48b84583b00fe0ce Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Sat, 30 Jul 2005 13:59:45 +0000 Subject: [PATCH] Stop installing profiling libraries as /usr/lib/lib${LIB}_p.a, because it makes it really hard to support shared profiling. Instead, install them into /usr/lib/profile and tweak GCC to look there first, when -pg is given. Also add support for /usr/lib/debug and -g respective. If both -pg and -g are given, profile has the precedence. Now that libc.a is always used for the static case, link all shared objects against libc, too. This makes it easier to detect libc mixing and can be used for stricter link-time checks in the future. --- etc/mtree/BSD.usr.dist | 14 ++++++++++- gnu/lib/gcc34/Makefile.inc | 8 ++++--- gnu/lib/gcc40/Makefile.inc | 8 ++++--- .../cc34/cc_prep/config/dragonfly-spec.h | 21 +++++++++-------- .../cc40/cc_prep/config/dragonfly-spec.h | 23 ++++++++++--------- lib/libncurses/libncurses/Makefile | 12 +++++----- share/mk/bsd.lib.mk | 6 +++-- share/mk/bsd.own.mk | 4 +++- usr.bin/lex/lib/Makefile | 6 ++--- 9 files changed, 62 insertions(+), 40 deletions(-) diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index c4872e1ab8..6c903b5b9e 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -1,5 +1,5 @@ # $FreeBSD: src/etc/mtree/BSD.usr.dist,v 1.188.2.40 2003/02/14 22:38:14 nectar Exp $ -# $DragonFly: src/etc/mtree/BSD.usr.dist,v 1.38 2005/07/08 15:38:54 joerg Exp $ +# $DragonFly: src/etc/mtree/BSD.usr.dist,v 1.39 2005/07/30 13:59:45 joerg Exp $ # # Please see the file src/etc/mtree/README before making changes to this file. # @@ -15,12 +15,24 @@ include .. lib + debug + .. gcc34 + debug + .. + profile + .. .. gcc40 + debug + .. + profile + .. .. i18n .. + profile + .. security .. aout diff --git a/gnu/lib/gcc34/Makefile.inc b/gnu/lib/gcc34/Makefile.inc index dea038b20e..0777552dcb 100644 --- a/gnu/lib/gcc34/Makefile.inc +++ b/gnu/lib/gcc34/Makefile.inc @@ -1,9 +1,11 @@ -# $DragonFly: src/gnu/lib/gcc34/Makefile.inc,v 1.2 2005/07/28 19:19:47 joerg Exp $ +# $DragonFly: src/gnu/lib/gcc34/Makefile.inc,v 1.3 2005/07/30 13:59:45 joerg Exp $ TOP_PREFIX= ../../../usr.bin/cc34/cc_tools CCVER=gcc34 -TARGET_LIBDIR?= ${LIBDIR}/gcc34 -TARGET_SHLIBDIR?= ${SHLIBDIR}/gcc34 +TARGET_LIBDIR= ${LIBDIR}/gcc34 +TARGET_DEBUGLIBDIR= ${LIBDIR}/gcc34/debug +TARGET_PROFLIBDIR= ${LIBDIR}/gcc34/profile +TARGET_SHLIBDIR= ${LIBDIR}/gcc34 .include "../../usr.bin/cc34/Makefile.inc" diff --git a/gnu/lib/gcc40/Makefile.inc b/gnu/lib/gcc40/Makefile.inc index 6bc7731a41..67f6b20a20 100644 --- a/gnu/lib/gcc40/Makefile.inc +++ b/gnu/lib/gcc40/Makefile.inc @@ -1,9 +1,11 @@ -# $DragonFly: src/gnu/lib/gcc40/Attic/Makefile.inc,v 1.2 2005/07/28 19:19:47 joerg Exp $ +# $DragonFly: src/gnu/lib/gcc40/Attic/Makefile.inc,v 1.3 2005/07/30 13:59:45 joerg Exp $ TOP_PREFIX= ../../../usr.bin/cc40/cc_tools CCVER=gcc40 -TARGET_LIBDIR?= ${LIBDIR}/gcc40 -TARGET_SHLIBDIR?= ${SHLIBDIR}/gcc40 +TARGET_LIBDIR= ${LIBDIR}/gcc40 +TARGET_DEBUGLIBDIR= ${LIBDIR}/gcc40/debug +TARGET_PROFLIBDIR= ${LIBDIR}/gcc40/profile +TARGET_SHLIBDIR= ${LIBDIR}/gcc40 .include "../../usr.bin/cc40/Makefile.inc" diff --git a/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h b/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h index 247ad67763..f42374a645 100644 --- a/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h +++ b/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h @@ -1,4 +1,4 @@ -/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h,v 1.7 2005/05/11 19:46:49 dillon Exp $ */ +/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h,v 1.8 2005/07/30 13:59:45 joerg Exp $ */ /* Base configuration file for all DragonFly targets. Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. @@ -122,18 +122,19 @@ Boston, MA 02111-1307, USA. */ #define DFBSD_LIB_SPEC " \ %{pthread: %eThe -pthread option is only supported on DragonFly when gcc \ is built with the --enable-threads configure-time option.} \ - %{!shared: \ - %{!pg: -lc} \ - %{pg: -lc_p} \ + %{pg: -L/usr/lib/profiling} \ + %{g: -L/usr/lib/debug} \ + -L/usr/lib \ + -lc \ }" #else #define DFBSD_LIB_SPEC " \ - %{!shared: \ - %{!pg: \ - %{pthread:-lc_r} -lc} \ - %{pg: \ - %{pthread:-lc_r_p} -lc_p} \ - }" + %{pg: -L/usr/lib/profiling} \ + %{g: -L/usr/lib/debug} \ + -L/usr/lib \ + %{!shared: %{pthread:-lc_r}} \ + -lc \ + " #endif #define DFBSD_LINK_COMMAND_SPEC "\ diff --git a/gnu/usr.bin/cc40/cc_prep/config/dragonfly-spec.h b/gnu/usr.bin/cc40/cc_prep/config/dragonfly-spec.h index 9189bebdeb..95d47cec6a 100644 --- a/gnu/usr.bin/cc40/cc_prep/config/dragonfly-spec.h +++ b/gnu/usr.bin/cc40/cc_prep/config/dragonfly-spec.h @@ -1,4 +1,4 @@ -/* $DragonFly: src/gnu/usr.bin/cc40/cc_prep/config/Attic/dragonfly-spec.h,v 1.1 2005/06/05 22:43:20 corecode Exp $ */ +/* $DragonFly: src/gnu/usr.bin/cc40/cc_prep/config/Attic/dragonfly-spec.h,v 1.2 2005/07/30 13:59:45 joerg Exp $ */ /* Base configuration file for all DragonFly targets. Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. @@ -121,18 +121,19 @@ Boston, MA 02111-1307, USA. */ #define DFBSD_LIB_SPEC " \ %{pthread: %eThe -pthread option is only supported on DragonFly when gcc \ is built with the --enable-threads configure-time option.} \ - %{!shared: \ - %{!pg: -lc} \ - %{pg: -lc_p} \ + %{pg: -L/usr/lib/profiling} \ + %{g: -L/usr/lib/debug} \ + -L/usr/lib \ + -lc \ }" #else -#define DFBSD_LIB_SPEC " \ - %{!shared: \ - %{!pg: \ - %{pthread:-lc_r} -lc} \ - %{pg: \ - %{pthread:-lc_r_p} -lc_p} \ - }" +#define DFBSD_LIB_SPEC " \ + %{pg: -L/usr/lib/profiling} \ + %{g: -L/usr/lib/debug} \ + -L/usr/lib \ + %{!shared: %{pthread:-lc_r}} \ + -lc \ + " #endif #define DFBSD_LINK_COMMAND_SPEC "\ diff --git a/lib/libncurses/libncurses/Makefile b/lib/libncurses/libncurses/Makefile index 68e8c7a250..15677a67d7 100644 --- a/lib/libncurses/libncurses/Makefile +++ b/lib/libncurses/libncurses/Makefile @@ -1,4 +1,4 @@ -# $DragonFly: src/lib/libncurses/libncurses/Makefile,v 1.5 2005/03/25 11:42:36 y0netan1 Exp $ +# $DragonFly: src/lib/libncurses/libncurses/Makefile,v 1.6 2005/07/30 13:59:45 joerg Exp $ LIB= ncurses @@ -254,11 +254,11 @@ SYMLINKS+=libncurses.so ${SHLIBDIR}/libmytinfo.so SYMLINKS+=libncurses.so ${SHLIBDIR}/libtinfo.so .endif .if !defined(NOPROFILE) -SYMLINKS+=libncurses_p.a ${LIBDIR}/libcurses_p.a -SYMLINKS+=libncurses_p.a ${LIBDIR}/libtermcap_p.a -SYMLINKS+=libncurses_p.a ${LIBDIR}/libtermlib_p.a -SYMLINKS+=libncurses_p.a ${LIBDIR}/libmytinfo_p.a -SYMLINKS+=libncurses_p.a ${LIBDIR}/libtinfo_p.a +SYMLINKS+=libncurses.a ${PROFLIBDIR}/libcurses.a +SYMLINKS+=libncurses.a ${PROFLIBDIR}/libtermcap.a +SYMLINKS+=libncurses.a ${PROFLIBDIR}/libtermlib.a +SYMLINKS+=libncurses.a ${PROFLIBDIR}/libmytinfo.a +SYMLINKS+=libncurses.a ${PROFLIBDIR}/libtinfo.aa .endif INCS= term.h ${.CURDIR}/../include/termcap.h \ diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 019b56df25..0846f00344 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -1,6 +1,6 @@ # from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 # $FreeBSD: src/share/mk/bsd.lib.mk,v 1.91.2.15 2002/08/07 16:31:50 ru Exp $ -# $DragonFly: src/share/mk/bsd.lib.mk,v 1.13 2005/07/28 19:19:46 joerg Exp $ +# $DragonFly: src/share/mk/bsd.lib.mk,v 1.14 2005/07/30 13:59:45 joerg Exp $ # .include @@ -33,6 +33,8 @@ STRIP?= -s .include TARGET_LIBDIR?= ${LIBDIR} +TARGET_DEBUGLIBDIR?= ${DEBUGLIBDIR} +TARGET_PROFLIBDIR?= ${PROFLIBDIR} TARGET_SHLIBDIR?= ${SHLIBDIR} # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries @@ -243,7 +245,7 @@ _libinstall: .endif .if !defined(NOPROFILE) && defined(LIB) && !empty(LIB) ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ - ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${TARGET_LIBDIR} + ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${TARGET_PROFLIBDIR}/lib${LIB}.a .endif .if defined(SHLIB_NAME) ${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 75072ed767..741ffc64fa 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -1,5 +1,5 @@ # $FreeBSD: src/share/mk/bsd.own.mk,v 1.27.2.4 2002/07/22 14:21:51 ru Exp $ -# $DragonFly: src/share/mk/bsd.own.mk,v 1.14 2005/04/12 23:35:37 okumoto Exp $ +# $DragonFly: src/share/mk/bsd.own.mk,v 1.15 2005/07/30 13:59:45 joerg Exp $ # # The include file set common variables for owner, # group, mode, and directories. Defaults are in brackets. @@ -161,6 +161,8 @@ GCCLIBDIR?= ${LIBDIR}/${CCVER} LIBCOMPATDIR?= /usr/lib/compat LIBDATADIR?= /usr/libdata LINTLIBDIR?= /usr/libdata/lint +DEBUGLIBDIR?= ${LIBDIR}/debug +PROFLIBDIR?= ${LIBDIR}/profile SHLIBDIR?= ${LIBDIR} GCCSHLIBDIR?= ${SHLIBDIR}/${CCVER} LIBOWN?= ${BINOWN} diff --git a/usr.bin/lex/lib/Makefile b/usr.bin/lex/lib/Makefile index d028162d5f..14fe88fde9 100644 --- a/usr.bin/lex/lib/Makefile +++ b/usr.bin/lex/lib/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/usr.bin/lex/lib/Makefile,v 1.7 1999/08/28 01:02:49 peter Exp $ -# $DragonFly: src/usr.bin/lex/lib/Makefile,v 1.2 2003/06/17 04:29:28 dillon Exp $ +# $DragonFly: src/usr.bin/lex/lib/Makefile,v 1.3 2005/07/30 13:59:45 joerg Exp $ LIB= ln SRCS= libmain.c libyywrap.c @@ -9,8 +9,8 @@ LINKS= ${LIBDIR}/libln.a ${LIBDIR}/libl.a LINKS+= ${LIBDIR}/libln.a ${LIBDIR}/libfl.a .if !defined(NOPROFILE) -LINKS+= ${LIBDIR}/libln_p.a ${LIBDIR}/libl_p.a -LINKS+= ${LIBDIR}/libln_p.a ${LIBDIR}/libfl_p.a +LINKS+= ${PROFLIBDIR}/libln.a ${PROFLIBDIR}/libl.a +LINKS+= ${PROFLIBDIR}/libln.a ${PROFLIBDIR}/libfl.a .endif .include -- 2.35.2