Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/strip gc old strip



details:   https://anonhg.NetBSD.org/src/rev/0a3086abbc17
branches:  trunk
changeset: 467630:0a3086abbc17
user:      kristerw <kristerw%NetBSD.org@localhost>
date:      Fri Mar 26 19:38:20 1999 +0000

description:
gc old strip

diffstat:

 usr.bin/strip/Makefile |   25 ---
 usr.bin/strip/strip.1  |   77 -----------
 usr.bin/strip/strip.c  |  322 -------------------------------------------------
 3 files changed, 0 insertions(+), 424 deletions(-)

diffs (truncated from 436 to 300 lines):

diff -r 835b01065ac5 -r 0a3086abbc17 usr.bin/strip/Makefile
--- a/usr.bin/strip/Makefile    Fri Mar 26 19:35:30 1999 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#      $NetBSD: Makefile,v 1.17 1997/10/18 15:04:56 mrg Exp $
-#      @(#)Makefile    8.1 (Berkeley) 6/6/93
-
-PROG=  strip
-
-proginstall::  .NOTMAIN hackinstall
-.PHONY:                hackinstall
-
-.include <bsd.prog.mk>
-
-PROGNAME?= ${PROG}
-hackinstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
-.if !defined(UPDATE)
-.PHONY: ${DESTDIR}${BINDIR}/${PROGNAME}
-.endif
-.if !defined(BUILD)
-${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
-.endif
-
-.PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
-${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG}
-       ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 ${.ALLSRC} ${.TARGET}
-       -if [ "${STRIPFLAG}" != "" ]; then ./strip ${.TARGET}; fi
-       chmod ${BINMODE} ${.TARGET}
-       -if [ "${COPY}" = "" ]; then rm -f ./strip; fi
diff -r 835b01065ac5 -r 0a3086abbc17 usr.bin/strip/strip.1
--- a/usr.bin/strip/strip.1     Fri Mar 26 19:35:30 1999 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-.\"    $NetBSD: strip.1,v 1.6 1997/10/19 23:30:38 lukem Exp $
-.\"
-.\" Copyright (c) 1989, 1990, 1993
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)strip.1    8.1 (Berkeley) 6/6/93
-.\"
-.Dd June 6, 1993
-.Dt STRIP 1
-.Os
-.Sh NAME
-.Nm strip
-.Nd remove unnecessary information from executable files
-.Sh SYNOPSIS
-.Nm
-.Op Fl d
-.Op Fl x
-.Op Fl X
-.Ar file ...
-.Sh DESCRIPTION
-The
-.Nm
-utility
-deletes the relocation information and symbol table used by
-assemblers, loaders and debuggers.
-This significantly
-decreases the size of the installed binaries and saves disk space.
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl d
-Delete only debugging and empty symbols.
-.It Fl X
-Delete only debugging, empty, and compiler identification symbols.
-.It Fl x
-Delete only debugging, empty, compiler identification, and local symbols.
-.El
-.Pp
-.Nm
-exits 0 on success and 1 if an error occurred.
-.Sh SEE ALSO
-.Xr cc 1 ,
-.Xr ld 1 ,
-.Xr stab 5
-.Sh HISTORY
-A
-.Nm
-command appeared in
-.At v6 .
diff -r 835b01065ac5 -r 0a3086abbc17 usr.bin/strip/strip.c
--- a/usr.bin/strip/strip.c     Fri Mar 26 19:35:30 1999 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-/*     $NetBSD: strip.c,v 1.19 1998/02/20 09:27:20 mycroft Exp $       */
-
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\
-       The Regents of the University of California.  All rights reserved.\n");
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)strip.c    8.3 (Berkeley) 5/16/95";
-#else
-__RCSID("$NetBSD: strip.c,v 1.19 1998/02/20 09:27:20 mycroft Exp $");
-#endif
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-#include <a.out.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-typedef struct exec EXEC;
-typedef struct nlist NLIST;
-
-#define        strx    n_un.n_strx
-
-int main __P((int, char *[]));
-
-int    main __P((int, char **));
-static int s_stab __P((const char *, int, EXEC *, struct stat *));
-static int s_sym __P((const char *, int, EXEC *, struct stat *));
-static void usage __P((void));
-
-static int xflag = 0;
-static int Xflag = 0;
-
-int
-main(argc, argv)
-       int argc;
-       char *argv[];
-{
-       int fd;
-       EXEC *ep;
-       struct stat sb;
-       int (*sfcn)__P((const char *, int, EXEC *, struct stat *));
-       int ch, errors;
-       char *fn;
-
-       sfcn = s_sym;
-       while ((ch = getopt(argc, argv, "dxX")) != -1)
-               switch(ch) {
-               case 'x':
-                       xflag = 1;
-                       /*FALLTHROUGH*/
-               case 'X':
-                       Xflag = 1;
-                       /*FALLTHROUGH*/
-               case 'd':
-                       sfcn = s_stab;
-                       break;
-               case '?':
-               default:
-                       usage();
-               }
-       argc -= optind;
-       argv += optind;
-
-       errors = 0;
-#define        ERROR(e) errno = e; errors |= 1; warn("%s:", fn); continue;
-       while ((fn = *argv++) != NULL) {
-               if ((fd = open(fn, O_RDWR)) < 0) {
-                       ERROR(errno);
-               }
-               if (fstat(fd, &sb)) {
-                       (void)close(fd);
-                       ERROR(errno);
-               }
-               if (sb.st_size < sizeof(EXEC)) {
-                       (void)close(fd);
-                       ERROR(EFTYPE);
-               }
-               if ((ep = (EXEC *)mmap(NULL, sb.st_size, PROT_READ|PROT_WRITE,
-                   MAP_FILE|MAP_SHARED, fd, (off_t)0)) == (EXEC *)-1) {
-                       (void)close(fd);
-                       ERROR(errno);
-               }
-               if (N_BADMAG(*ep)) {
-                       munmap((caddr_t)ep, sb.st_size);
-                       (void)close(fd);
-                       ERROR(EFTYPE);
-               }
-               errors |= sfcn(fn, fd, ep, &sb);
-               munmap((caddr_t)ep, sb.st_size);
-               if (close(fd)) {
-                       ERROR(errno);
-               }
-       }
-#undef ERROR
-       exit(errors);
-}
-
-static int
-s_sym(fn, fd, ep, sp)
-       const char *fn;
-       int fd;
-       EXEC *ep;
-       struct stat *sp;
-{
-       char *neweof;
-       int zmagic;
-
-       zmagic = ep->a_data &&
-                (N_GETMAGIC(*ep) == ZMAGIC || N_GETMAGIC(*ep) == QMAGIC);
-
-       /*
-        * If no symbols or data/text relocation info and
-        * the file data segment size is already minimized, quit.
-        */
-       if (!ep->a_syms && !ep->a_trsize && !ep->a_drsize) {
-#if 0
-               if (!zmagic)
-                       return 0;
-               if (sp->st_size < N_TRELOFF(*ep))
-#endif
-                       return 0;
-       }
-
-       /*
-        * New file size is the header plus text and data segments; OMAGIC
-        * and NMAGIC formats have the text/data immediately following the
-        * header.  ZMAGIC format wastes the rest of of header page.
-        */
-       neweof = (char *)ep + N_TRELOFF(*ep);
-
-#if 0
-       /*
-        * Unfortunately, this can't work correctly without changing the way
-        * the loader works.  We could cap it at one page, or even fiddle with
-        * a_data and a_bss, but this only works for CLBYTES == NBPG.  If we
-        * are on a system where, e.g., CLBYTES is 8k and NBPG is 4k, and we
-        * happen to remove 4.5k, we will lose.  And we really don't want to
-        * fiddle with pages, because that breaks binary compatibility.  Lose.
-        */
-



Home | Main Index | Thread Index | Old Index