docs/80258: [PATCH] Comment why some Binaries are statically linked
Marius Nuennerich
marius.nuennerich at gmx.net
Fri Apr 22 18:00:40 UTC 2005
>Number: 80258
>Category: docs
>Synopsis: [PATCH] Comment why some Binaries are statically linked
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-doc
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Fri Apr 22 18:00:39 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Marius Nuennerich
>Release: FreeBSD 5.4-RC2 i386
>Organization:
>Environment:
System: FreeBSD 5.4-RC2 #1: Fri Apr 15 17:46:41 CEST 2005
marius at olaf.hackerzberg.local:/usr/obj/usr/src/sys/OLAF
>Description:
Some Binaries are statically linked, add comments to the Makefile why this is so.
I obtained the comments from cvs, the versions are:
devd: 1.5
ar: 1.6
as: 1.13
ld: 1.12
ranlib: 1.6
make: 1.19
nologin: was already commented
pccardc and pccardd: 1.7
cc: 1.22
cc1: 1.7
cc1plus. 1.7
gdb: ???
I don't know why gdb is still statically linked. 1.59 is not a real reason, I think. :)
Could someone please explain it in the Makefile?
>How-To-Repeat:
>Fix:
--- patch begins here ---
diff -ru src/gnu/usr.bin/binutils/ar/Makefile head/gnu/usr.bin/binutils/ar/Makefile
--- src/gnu/usr.bin/binutils/ar/Makefile Thu Apr 21 16:29:47 2005
+++ head/gnu/usr.bin/binutils/ar/Makefile Fri Apr 22 18:24:20 2005
@@ -10,7 +10,10 @@
CFLAGS+= -I${.CURDIR}/${RELTOP}/libbinutils
CFLAGS+= -I${SRCDIR}/binutils
CFLAGS+= -I${SRCDIR}/bfd
+
+# Critical toolchain binaries are staticly linked
NO_SHARED?= yes
+
DPADD= ${RELTOP}/libbinutils/libbinutils.a
DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
diff -ru src/gnu/usr.bin/binutils/as/Makefile head/gnu/usr.bin/binutils/as/Makefile
--- src/gnu/usr.bin/binutils/as/Makefile Thu Apr 21 16:29:47 2005
+++ head/gnu/usr.bin/binutils/as/Makefile Fri Apr 22 18:24:56 2005
@@ -43,6 +43,7 @@
CFLAGS+= -I${SRCDIR}/gas -I${SRCDIR}/gas/config -I${SRCDIR}
CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${TARGET_ARCH}-freebsd
+# Critical toolchain binaries are staticly linked
NO_SHARED?= yes
DPADD= ${RELTOP}/libbfd/libbfd.a
diff -ru src/gnu/usr.bin/binutils/gdb/Makefile head/gnu/usr.bin/binutils/gdb/Makefile
--- src/gnu/usr.bin/binutils/gdb/Makefile Thu Apr 21 16:29:55 2005
+++ head/gnu/usr.bin/binutils/gdb/Makefile Fri Apr 22 19:39:01 2005
@@ -16,7 +16,9 @@
GDB_CPU= ${TARGET_ARCH}
.endif
+# INSERT REASON HERE
NO_SHARED?=yes
+
PROG= gdb
XSRCS= annotate.c arch-utils.c ax-general.c ax-gdb.c bcache.c \
blockframe.c breakpoint.c buildsym.c complaints.c completer.c \
diff -ru src/gnu/usr.bin/binutils/ld/Makefile head/gnu/usr.bin/binutils/ld/Makefile
--- src/gnu/usr.bin/binutils/ld/Makefile Thu Apr 21 16:29:55 2005
+++ head/gnu/usr.bin/binutils/ld/Makefile Fri Apr 22 18:25:20 2005
@@ -19,7 +19,10 @@
CFLAGS+= -DTOOLBINDIR=\"${TOOLS_PREFIX}/${BINDIR}/libexec\"
CFLAGS+= -D_GNU_SOURCE
CFLAGS+= -I${SRCDIR}/ld -I${SRCDIR}/bfd
+
+# Critical toolchain binaries are staticly linked
NO_SHARED?= yes
+
DPADD= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
diff -ru src/gnu/usr.bin/binutils/ranlib/Makefile head/gnu/usr.bin/binutils/ranlib/Makefile
--- src/gnu/usr.bin/binutils/ranlib/Makefile Thu Apr 21 16:29:55 2005
+++ head/gnu/usr.bin/binutils/ranlib/Makefile Fri Apr 22 18:25:39 2005
@@ -10,7 +10,10 @@
CFLAGS+= -I${.CURDIR}/${RELTOP}/libbinutils
CFLAGS+= -I${SRCDIR}/binutils
CFLAGS+= -I${SRCDIR}/bfd
+
+# Critical toolchain binaries are staticly linked
NO_SHARED?= yes
+
DPADD= ${RELTOP}/libbinutils/libbinutils.a
DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
diff -ru src/gnu/usr.bin/cc/cc/Makefile head/gnu/usr.bin/cc/cc/Makefile
--- src/gnu/usr.bin/cc/cc/Makefile Thu Apr 21 16:29:55 2005
+++ head/gnu/usr.bin/cc/cc/Makefile Fri Apr 22 18:37:01 2005
@@ -8,6 +8,8 @@
PROG= cc
MAN= gcc.1
SRCS= gcc.c gccspec.c
+
+# Critical toolchain binaries are staticly linked
NO_SHARED?=yes
LINKS= ${BINDIR}/cc ${BINDIR}/gcc
diff -ru src/gnu/usr.bin/cc/cc1/Makefile head/gnu/usr.bin/cc/cc1/Makefile
--- src/gnu/usr.bin/cc/cc1/Makefile Thu Apr 21 16:29:55 2005
+++ head/gnu/usr.bin/cc/cc1/Makefile Fri Apr 22 19:24:54 2005
@@ -8,6 +8,9 @@
SRCS= main.c c-parse+%DIKED.c c-lang.c stub-objc.c
BINDIR= /usr/libexec
NO_MAN=
+
+# Build cc1 nonshared. This actually results in it consuming 40K *less* disk
+# space and improves compile times by a few percent.
NO_SHARED?=yes
CFLAGS+= -I.
diff -ru src/gnu/usr.bin/cc/cc1obj/Makefile head/gnu/usr.bin/cc/cc1obj/Makefile
--- src/gnu/usr.bin/cc/cc1obj/Makefile Thu Apr 21 16:29:55 2005
+++ head/gnu/usr.bin/cc/cc1obj/Makefile Fri Apr 22 18:36:14 2005
@@ -8,6 +8,8 @@
SRCS= main.c objc-parse+DIKED.c objc-act.c objc-lang.c c-decl.c
BINDIR= /usr/libexec
NO_MAN=
+
+# Critical toolchain binaries are staticly linked
NO_SHARED?=yes
CFLAGS+= -I${GCCDIR}/objc -I.
diff -ru src/gnu/usr.bin/cc/cc1plus/Makefile head/gnu/usr.bin/cc/cc1plus/Makefile
--- src/gnu/usr.bin/cc/cc1plus/Makefile Thu Apr 21 16:29:55 2005
+++ head/gnu/usr.bin/cc/cc1plus/Makefile Fri Apr 22 19:31:54 2005
@@ -13,6 +13,8 @@
BINDIR= /usr/libexec
NO_MAN=
+
+# Makes it smaller and faster
NO_SHARED?=yes
CFLAGS+= -I${GCCDIR}/cp -I.
diff -ru src/sbin/devd/Makefile head/sbin/devd/Makefile
--- src/sbin/devd/Makefile Thu Apr 21 16:35:48 2005
+++ head/sbin/devd/Makefile Fri Apr 22 18:22:22 2005
@@ -5,6 +5,11 @@
MAN= devd.8 devd.conf.5
WARNS?= 1
+# Force devd to be statically compiled. This avoids the
+# need for libstdc++ in /lib, and the generated binary is actually smaller
+# statically linked than dynamically + sizeof(libstdc++). Additionally,
+# devd doesn't use get*by*() which is one of the main motivations for
+# dynamically linking the root partition anyway.
NO_SHARED?=YES
DPADD= ${LIBL}
diff -ru src/sbin/init/Makefile head/sbin/init/Makefile
--- src/sbin/init/Makefile Thu Apr 21 16:35:58 2005
+++ head/sbin/init/Makefile Fri Apr 22 18:47:07 2005
@@ -12,6 +12,8 @@
DPADD= ${LIBUTIL} ${LIBCRYPT}
LDADD= -lutil -lcrypt
+# Make init statically linked by default. It's not worth the pain of having
+# a dynamically linked init as seen by ia64 woes.
NO_SHARED?= YES
.include <bsd.prog.mk>
diff -ru src/usr.bin/make/Makefile head/usr.bin/make/Makefile
--- src/usr.bin/make/Makefile Thu Apr 21 16:41:48 2005
+++ head/usr.bin/make/Makefile Fri Apr 22 18:28:13 2005
@@ -9,6 +9,10 @@
NO_WERROR=
WARNS?= 3
+
+# Build as a static binary. It costs only 100k of additional
+# disk space, buf provides measureable speed increase for make-intensive
+# operations, such as pkg_version(1), `make world' and so on.
NO_SHARED?= YES
CFLAGS+=-DMAKE_VERSION=\"5200408120\"
diff -ru src/usr.sbin/pccard/Makefile.inc head/usr.sbin/pccard/Makefile.inc
--- src/usr.sbin/pccard/Makefile.inc Thu Apr 21 16:42:21 2005
+++ head/usr.sbin/pccard/Makefile.inc Fri Apr 22 18:31:57 2005
@@ -1,5 +1,7 @@
# $FreeBSD: src/usr.sbin/pccard/Makefile.inc,v 1.9 2004/12/21 09:59:45 ru Exp $
+# Must be compiled static so that it is possible
+# to use them early in the boot process.
NO_SHARED?= YES
.include "../Makefile.inc"
--- patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-doc
mailing list