summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-06-01 21:44:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-06-01 21:44:40 +0000
commit98969c9e21deea8c51f1865d89b9e1e694cc033a (patch)
treee2736f25f67d84acc9327c290c5b1c9ee892f1a7
parent5a00833a0ce72a1423dfff4f5db2d4b168529e2a (diff)
Add compatibility interfaces for new names binutils-based strip(1) prefers
for some of it's options ok miod kettenis drahn
-rw-r--r--usr.bin/strip/strip.114
-rw-r--r--usr.bin/strip/strip.c13
2 files changed, 19 insertions, 8 deletions
diff --git a/usr.bin/strip/strip.1 b/usr.bin/strip/strip.1
index 0c19918ec28..d6a7eba7d29 100644
--- a/usr.bin/strip/strip.1
+++ b/usr.bin/strip/strip.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: strip.1,v 1.12 2010/05/24 23:42:39 jmc Exp $
+.\" $OpenBSD: strip.1,v 1.13 2010/06/01 21:44:39 deraadt Exp $
.\"
.\" Copyright (c) 1989, 1990 The Regents of the University of California.
.\" All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)strip.1 6.6 (Berkeley) 5/26/91
.\"
-.Dd $Mdocdate: May 24 2010 $
+.Dd $Mdocdate: June 1 2010 $
.Dt STRIP 1
.Os
.Sh NAME
@@ -37,7 +37,7 @@
.Nd remove unnecessary information from executable files
.Sh SYNOPSIS
.Nm strip
-.Op Fl dx
+.Op Fl dgsx
.Op Fl o Ar outfile
.Ar
.Sh DESCRIPTION
@@ -51,18 +51,22 @@ decreases the size of the installed binaries and saves disk space.
.Pp
The options are as follows:
.Bl -tag -width Ds
-.It Fl d
+.It Fl d | g
Delete only debugging and empty symbols.
.It Fl o Ar outfile
Place the stripped output into the specified file instead of modifying
the input file.
This option requires that only one input file be supplied.
+.It Fl s
+Delete all symbols.
.It Fl x
Delete only debugging, compiler identification, and local symbols.
.El
.Pp
.Nm
exits 0 on success or 1 if an error occurred.
+.Pp
+When conflicting options are combined, the later options win.
.Sh SEE ALSO
.Xr cc 1 ,
.Xr ld 1 ,
@@ -76,7 +80,7 @@ specification,
though its presence is optional.
.Pp
The flags
-.Op Fl dox
+.Op Fl dgosx
are extensions to that specification.
.Sh HISTORY
A
diff --git a/usr.bin/strip/strip.c b/usr.bin/strip/strip.c
index d7082b97ccb..ca93ac84b7e 100644
--- a/usr.bin/strip/strip.c
+++ b/usr.bin/strip/strip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strip.c,v 1.28 2010/05/24 23:42:39 jmc Exp $ */
+/* $OpenBSD: strip.c,v 1.29 2010/06/01 21:44:39 deraadt Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -83,14 +83,20 @@ main(int argc, char *argv[])
off_t newsize;
sfcn = s_sym;
- while ((ch = getopt(argc, argv, "dxo:")) != -1)
+ while ((ch = getopt(argc, argv, "dgsxo:")) != -1)
switch(ch) {
case 'x':
xflag = 1;
/*FALLTHROUGH*/
+ case 'g':
case 'd':
sfcn = s_stab;
break;
+ case 's':
+ /* reset back to the defaults */
+ xflag = 0;
+ sfcn = s_sym;
+ break;
case 'o':
ofile = optarg;
break;
@@ -427,7 +433,8 @@ usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-dx] [-o outfile] file ...\n", __progname);
+ fprintf(stderr, "usage: %s [-dgsx] [-o outfile] file ...\n",
+ __progname);
exit(1);
}