From owner-freebsd-hackers Mon Aug 20 0:17: 3 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from obsecurity.dyndns.org (adsl-63-207-60-7.dsl.lsan03.pacbell.net [63.207.60.7]) by hub.freebsd.org (Postfix) with ESMTP id 7779637B413 for ; Mon, 20 Aug 2001 00:16:55 -0700 (PDT) (envelope-from kris@obsecurity.org) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id 03B8B66D15; Mon, 20 Aug 2001 00:16:54 -0700 (PDT) Date: Mon, 20 Aug 2001 00:16:54 -0700 From: Kris Kennaway To: hackers@FreeBSD.org Subject: [PATCH] install -s -s(trip-me-harder) Message-ID: <20010820001654.A32129@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="LQksG6bCIzRHxTLp" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --LQksG6bCIzRHxTLp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable What do people think about the following patch to install(1) to make it strip additional useless (at runtime - they may be used for debugging purposes) symbols and ELF sections from binaries at install-time, if the '-s' option is used multiple times? This usually saves a few tens of kilobytes per binary. Kris Index: xinstall.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr2/ncvs/src/usr.bin/xinstall/xinstall.c,v retrieving revision 1.38.2.3 diff -u -r1.38.2.3 xinstall.c --- xinstall.c 2001/08/01 06:48:41 1.38.2.3 +++ xinstall.c 2001/08/20 07:13:17 @@ -92,7 +92,7 @@ void install __P((char *, char *, u_long, u_int)); void install_dir __P((char *)); u_long numeric_id __P((char *, char *)); -void strip __P((char *)); +void strip __P((char *, int)); int trymmap __P((int)); void usage __P((void)); =20 @@ -108,6 +108,7 @@ u_int iflags; char *flags, *group, *owner, *to_name; =20 + dostrip =3D 0; iflags =3D 0; group =3D owner =3D NULL; while ((ch =3D getopt(argc, argv, "B:bCcdf:g:Mm:o:pSsv")) !=3D -1) @@ -156,7 +157,7 @@ safecopy =3D 1; break; case 's': - dostrip =3D 1; + dostrip++; break; case 'v': verbose =3D 1; @@ -349,7 +350,7 @@ } =20 if (dostrip) { - strip(tempcopy ? tempfile : to_name); + strip(tempcopy ? tempfile : to_name, dostrip); =20 /* * Re-open our fd on the target, in case we used a strip @@ -696,8 +697,9 @@ * use strip(1) to strip the target file */ void -strip(to_name) +strip(to_name, level) char *to_name; + int level; { int serrno, status; =20 @@ -708,7 +710,12 @@ errno =3D serrno; err(EX_TEMPFAIL, "fork"); case 0: - execlp("strip", "strip", to_name, (char *)NULL); + if (level > 1) + execlp("strip", "strip", "-s", "-R", ".comment", + "-R", ".note", "-N", "gcc2_compiled", + to_name, (char *)NULL); + else + execlp("strip", "strip", to_name, (char *)NULL); err(EX_OSERR, "exec(strip)"); default: if (wait(&status) =3D=3D -1 || status) { --LQksG6bCIzRHxTLp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7gLllWry0BWjoQKURAg2dAKCtt4dPOqlM4nq7kaDI32UePvAsOQCbBrin wkgPf7WRzRn8u9fNGysBao0= =7vkE -----END PGP SIGNATURE----- --LQksG6bCIzRHxTLp-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message