summaryrefslogtreecommitdiff
path: root/usr/src/tools/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/tools/scripts')
-rw-r--r--usr/src/tools/scripts/Makefile4
-rw-r--r--usr/src/tools/scripts/cddlchk.129
-rw-r--r--usr/src/tools/scripts/check_rtime.121
-rw-r--r--usr/src/tools/scripts/check_rtime.pl84
-rw-r--r--usr/src/tools/scripts/mapfilechk.178
-rw-r--r--usr/src/tools/scripts/mapfilechk.py143
-rw-r--r--usr/src/tools/scripts/nightly.sh27
7 files changed, 353 insertions, 33 deletions
diff --git a/usr/src/tools/scripts/Makefile b/usr/src/tools/scripts/Makefile
index 522b046f25..a3df5d4e4d 100644
--- a/usr/src/tools/scripts/Makefile
+++ b/usr/src/tools/scripts/Makefile
@@ -19,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
@@ -76,6 +76,7 @@ PYFILES= \
copyrightchk \
hdrchk \
hg-active \
+ mapfilechk \
rtichk \
wsdiff
@@ -92,6 +93,7 @@ MAN1FILES= \
hdrchk.1 \
hgsetup.1 \
jstyle.1 \
+ mapfilechk.1 \
mkacr.1 \
nightly.1 \
sccscheck.1 \
diff --git a/usr/src/tools/scripts/cddlchk.1 b/usr/src/tools/scripts/cddlchk.1
index f2c916adb6..67e393160b 100644
--- a/usr/src/tools/scripts/cddlchk.1
+++ b/usr/src/tools/scripts/cddlchk.1
@@ -17,10 +17,9 @@
.\"
.\" CDDL HEADER END
.\"
-.\" Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+.\" Copyright 2009 Sun Microsystems, Inc. All rights reserved.
.\" Use is subject to license terms.
.\"
-.\" ident "%Z%%M% %I% %E% SMI"
.TH cddlchk 1 "1 June 2008"
.SH NAME
cddlchk \- Check for valid CDDL header blocks
@@ -52,11 +51,24 @@ Report on all files, not just those with invalid headers
Load an exceptions file containing a list of files, directories and
file extensions to be ignored.
Exceptions may be one of three types:
-.nf
- * File paths
- * Directories, specified with a trailing '/'
- * File extensions, specified with a leading '*.'
-.fi
+.RS +4
+.TP
+.ie t \(bu
+.el o
+File paths
+.RE
+.RS +4
+.TP
+.ie t \(bu
+.el o
+Directories, specified with a trailing '/'
+.RE
+.RS +4
+.TP
+.ie t \(bu
+.el o
+File extensions, specified with a leading '*.'
+.RE
.LP
.SH EXIT STATUS
.TP 4
@@ -71,5 +83,4 @@ One or more errors or warnings were reported.
.LP
.TP 4
.B 2
-Invalid command-line arguments were specified to the command, or one
-of the command-line help functions was invoked.
+Invalid command-line arguments were specified to the command.
diff --git a/usr/src/tools/scripts/check_rtime.1 b/usr/src/tools/scripts/check_rtime.1
index 2ad2d5ca91..91be6b4776 100644
--- a/usr/src/tools/scripts/check_rtime.1
+++ b/usr/src/tools/scripts/check_rtime.1
@@ -1,5 +1,4 @@
-.\" ident "%Z%%M% %I% %E% SMI"
-.\" Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+.\" Copyright 2009 Sun Microsystems, Inc. All rights reserved.
.\" Use is subject to license terms.
.\"
.\" CDDL HEADER START
@@ -21,12 +20,12 @@
.\"
.\" CDDL HEADER END
.\"
-.TH check_rtime 1 "21 April 2008"
+.TH check_rtime 1 "29 January 2009"
.SH NAME
.I check_rtime
\- check ELF runtime attributes
.SH SYNOPSIS
-\fBcheck_rtime [-a] [-d depdir] [-i] [-m] [-o] [-s] file | dir, ...\fP
+\fBcheck_rtime [-a] [-d depdir] [-i] [-m] [-o] [-s] [-v] file | dir, ...\fP
.LP
.SH DESCRIPTION
.IX "OS-Net build tools" "check_rtime" "" "\fBcheck_rtime\fP"
@@ -358,6 +357,16 @@ foo: non-conforming mcs(1) comment <no $(POST_PROCESS)?>
.RE
.sp
.LP
+.I check_rtime
+uses \fBpvs(1)\fP to display version definitions under the \fB-v\fP option.
+Each symbol defined by the object is shown along with the version it belongs to.
+Changes to the symbols defined by an object, or the versions they belong to,
+do not necessarily indicate an error condition, but
+provides information that is often useful for gatekeepers to track
+changes in a release.
+.RE
+.sp
+.LP
.SH OPTIONS
.LP
The following options are supported:
@@ -402,6 +411,10 @@ more appropriate for sorting and diffing with previous build results.
.TP
.B \-s
Determine whether \fI.stabs\fP sections exist.
+.TP
+.B \-v
+Provide version definition information. Each symbol defined by the object
+is printed along with the version it is assigned to.
.LP
.SH ALTERNATIVE DEPENDENCY MAPPING
As
diff --git a/usr/src/tools/scripts/check_rtime.pl b/usr/src/tools/scripts/check_rtime.pl
index e57a5dc88c..da8988a33b 100644
--- a/usr/src/tools/scripts/check_rtime.pl
+++ b/usr/src/tools/scripts/check_rtime.pl
@@ -303,7 +303,7 @@ if ($Mach =~ /sparc/) {
}
# Check that we have arguments.
-if ((getopts('ad:imos', \%opt) == 0) || ($#ARGV == -1)) {
+if ((getopts('ad:imosv', \%opt) == 0) || ($#ARGV == -1)) {
print "usage: $Prog [-a] [-d depdir] [-m] [-o] [-s] file | dir, ...\n";
print "\t[-a]\t\tprocess all files (ignore any exception lists)\n";
print "\t[-d dir]\testablish dependencies from under directory\n";
@@ -311,6 +311,7 @@ if ((getopts('ad:imos', \%opt) == 0) || ($#ARGV == -1)) {
print "\t[-m]\t\tprocess mcs(1) comments\n";
print "\t[-o]\t\tproduce one-liner output (prefixed with pathname)\n";
print "\t[-s]\t\tprocess .stab and .symtab entries\n";
+ print "\t[-v]\t\tprocess version definition entries\n";
exit 1;
} else {
my($Proto);
@@ -465,7 +466,7 @@ sub ProcFile {
my(@Elf, @Ldd, $Dyn, $Intp, $Dll, $Ttl, $Sym, $Interp, $Stack);
my($Sun, $Relsz, $Pltsz, $Tex, $Stab, $Strip, $Lddopt, $SymSort);
my($Val, $Header, $SkipLdd, $IsX86, $RWX, $UnDep);
- my($HasDirectBinding);
+ my($HasDirectBinding, $HasVerdef);
# Ignore symbolic links.
if (-l $FullPath) {
@@ -491,7 +492,7 @@ sub ProcFile {
# Determine whether we have a executable (static or dynamic) or a
# shared object.
- @Elf = split(/\n/, `elfdump -epdicy $FullPath 2>&1`);
+ @Elf = split(/\n/, `elfdump -epdicyv $FullPath 2>&1`);
$Dyn = $Intp = $Dll = $Stack = $IsX86 = $RWX = 0;
$Interp = 1;
@@ -795,6 +796,7 @@ DYN:
$Sun = $Relsz = $Pltsz = $Dyn = $Stab = $SymSort = 0;
$Tex = $Strip = 1;
$HasDirectBinding = 0;
+ $HasVerdef = 0;
$Header = 'None';
ELF: foreach my $Line (@Elf) {
@@ -828,6 +830,9 @@ ELF: foreach my $Line (@Elf) {
} elsif ($Line =~ /^Syminfo Section/) {
$Header = 'Syminfo';
next;
+ } elsif ($Line =~ /^Version Definition Section/) {
+ $HasVerdef = 1;
+ next;
} elsif (($Header ne 'Dyn') && ($Header ne 'Syminfo')) {
next;
}
@@ -955,6 +960,11 @@ DONESTAB:
# If there are symbol sort sections in this object, report on
# any that have duplicate addresses.
ProcSymSort($FullPath, $RelPath, \$Ttl) if $SymSort;
+
+ # If -v was specified, and the object has a version definition
+ # section, generate output showing each public symbol and the
+ # version it belongs to.
+ ProcVerdef($FullPath, $RelPath, \$Ttl) if $HasVerdef && $opt{v};
}
@@ -1049,6 +1059,74 @@ sub ProcSymSort {
}
+## ProcVerdef(FullPath, RelPath)
+#
+# Examine the version definition section for the given object and report
+# each public symbol along with the version it belongs to.
+#
+sub ProcVerdef {
+
+ my($FullPath, $RelPath, $RefTtl) = @_;
+ my $line;
+ my $cur_ver = '';
+ my $tab = $opt{o} ? '' : "\t";
+
+ # pvs -dov provides information about the versioning hierarchy
+ # in the file. Lines are of the format:
+ # path - version[XXX];
+ # where [XXX] indicates optional information, such as flags
+ # or inherited versions.
+ #
+ # Private versions are allowed to change freely, so ignore them.
+ open(PVS, "pvs -dov $FullPath|") ||
+ die "$Prog: Unable to execute pvs (version definition section)\n";
+
+ while ($line = <PVS>) {
+ chomp $line;
+
+ if ($line =~ /^[^\s]+\s+-\s+([^;]+)/) {
+ my $ver = $1;
+
+ next if $ver =~ /private/i;
+ OutMsg($$RefTtl++, $RelPath, "${tab}VERDEF=$ver");
+ }
+ }
+ close PVS;
+
+ # pvs -dos lists the symbols assigned to each version definition.
+ # Lines are of the format:
+ # path - version: symbol;
+ # path - version: symbol (size);
+ # where the (size) is added to data items, but not for functions.
+ # We strip off the size, if present.
+
+ open(PVS, "pvs -dos $FullPath|") ||
+ die "$Prog: Unable to execute pvs (version definition section)\n";
+ while ($line = <PVS>) {
+ chomp $line;
+ if ($line =~ /^[^\s]+\s+-\s+([^:]+):\s*([^\s;]+)/) {
+ my $ver = $1;
+ my $sym = $2;
+
+ next if $ver =~ /private/i;
+
+ if ($opt{o}) {
+ OutMsg($$RefTtl++, $RelPath,
+ "VERSION=$ver, SYMBOL=$sym");
+ } else {
+ if ($cur_ver ne $ver) {
+ OutMsg($$RefTtl++, $RelPath, "\tVERSION=$ver");
+ $cur_ver = $ver;
+ }
+ OutMsg($$RefTtl++, $RelPath, "\t\tSYMBOL=$sym");
+ }
+ }
+ }
+
+ close PVS;
+}
+
+
sub ProcDir {
my($FullDir, $RelDir) = @_;
my($NewFull, $NewRel);
diff --git a/usr/src/tools/scripts/mapfilechk.1 b/usr/src/tools/scripts/mapfilechk.1
new file mode 100644
index 0000000000..ca34f5e050
--- /dev/null
+++ b/usr/src/tools/scripts/mapfilechk.1
@@ -0,0 +1,78 @@
+.\" CDDL HEADER START
+.\"
+.\" The contents of this file are subject to the terms of the
+.\" Common Development and Distribution License (the "License").
+.\" You may not use this file except in compliance with the License.
+.\"
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+.\" or http://www.opensolaris.org/os/licensing.
+.\" See the License for the specific language governing permissions
+.\" and limitations under the License.
+.\"
+.\" When distributing Covered Code, include this CDDL HEADER in each
+.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+.\" If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying
+.\" information: Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.\" CDDL HEADER END
+.\"
+.\" Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+.\" Use is subject to license terms.
+.TH mapfilechk 1 "27 January 2009"
+.SH NAME
+mapfilechk \- Check for valid link-editor mapfile header blocks
+.SH SYNOPSIS
+.nf
+\fBmapfilechk \fR [\fB-v\fR] [\fB-x\fR \fIexceptions_file\fR] [\fIpath\fR...]
+.fi
+.LP
+.SH DESCRIPTION
+.IX "OS-Net build tools" "mapfilechk" "" "\fBmapfilechk\fP"
+mapfilechk inspects link-editor mapfiles for missing, obsolete,
+or corrupt mapfile header blocks.
+.LP
+.SH OPTIONS
+.LP
+.TP 4
+.B \-v
+Report on all files, not just those with invalid headers
+.LP
+.TP 4
+.B \-x \fIexceptions_file\fR
+Load an exceptions file containing a list of files, directories and
+file extensions to be ignored.
+Exceptions may be one of three types:
+.RS +4
+.TP
+.ie t \(bu
+.el o
+File paths
+.RE
+.RS +4
+.TP
+.ie t \(bu
+.el o
+Directories, specified with a trailing '/'
+.RE
+.RS +4
+.TP
+.ie t \(bu
+.el o
+File extensions, specified with a leading '*.'
+.RE
+.LP
+.SH EXIT STATUS
+.TP 4
+.B 0
+The command completed successfully.
+No errors or warnings were reported
+.LP
+.TP 4
+.B 1
+The command completed unsuccessfully.
+One or more errors or warnings were reported.
+.LP
+.TP 4
+.B 2
+Invalid command-line arguments were specified to the command.
diff --git a/usr/src/tools/scripts/mapfilechk.py b/usr/src/tools/scripts/mapfilechk.py
new file mode 100644
index 0000000000..10f15440da
--- /dev/null
+++ b/usr/src/tools/scripts/mapfilechk.py
@@ -0,0 +1,143 @@
+#! /usr/bin/python
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Check for valid link-editor mapfile comment blocks in source files.
+#
+
+import sys, os, getopt, fnmatch
+
+sys.path.append(os.path.join(os.path.dirname(__file__), '../lib/python'))
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+from onbld.Checks.Mapfile import mapfilechk
+
+class ExceptionList(object):
+ def __init__(self):
+ self.dirs = []
+ self.files = []
+ self.extensions = []
+
+ def load(self, exfile):
+ fh = None
+ try:
+ fh = open(exfile, 'r')
+ except IOError, e:
+ sys.stderr.write('Failed to open exception list: '
+ '%s: %s\n' % (e.filename, e.strerror))
+ sys.exit(2)
+
+ for line in fh:
+ line = line.strip()
+
+ if line.strip().endswith('/'):
+ self.dirs.append(line[0:-1])
+ elif line.startswith('*.'):
+ self.extensions.append(line)
+ else:
+ self.files.append(line)
+
+ fh.close()
+
+ def match(self, filename):
+ if os.path.isdir(filename):
+ return filename in self.dirs
+ else:
+ if filename in self.files:
+ return True
+
+ for pat in self.extensions:
+ if fnmatch.fnmatch(filename, pat):
+ return True
+
+ def __contains__(self, elt):
+ return self.match(elt)
+
+def usage():
+ progname = os.path.split(sys.argv[0])[1]
+ sys.stderr.write('''Usage: %s [-v] [-x exceptions] paths...
+ -v report on all files, not just those with errors.
+ -x exceptions load an exceptions file
+''' % progname)
+ sys.exit(2)
+
+
+def check(filename, opts):
+ try:
+ fh = open(filename, 'r')
+ except IOError, e:
+ sys.stderr.write("failed to open '%s': %s\n" %
+ (e.filename, e.strerror))
+ return 1
+ else:
+ return mapfilechk(fh, verbose=opts['verbose'],
+ output=sys.stdout)
+
+def walker(opts, dirname, fnames):
+ for f in fnames:
+ path = os.path.join(dirname, f)
+
+ if not os.path.isdir(path):
+ if not path in opts['exclude']:
+ opts['status'] |= check(path, opts)
+ else:
+ if path in opts['exclude']:
+ fnames.remove(f)
+
+def walkpath(path, opts):
+ if os.path.isdir(path):
+ os.path.walk(path, walker, opts)
+ else:
+ if not path in opts['exclude']:
+ opts['status'] |= check(path, opts)
+
+def main(args):
+ options = {
+ 'status': 0,
+ 'verbose': False,
+ 'exclude': ExceptionList()
+ }
+
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], 'avx:')
+ except getopt.GetoptError:
+ usage()
+ sys.exit(2)
+
+ for opt, arg in opts:
+ if opt == '-v':
+ options['verbose'] = True
+ elif opt == '-x':
+ options['exclude'].load(arg)
+
+ for path in args:
+ walkpath(path, options)
+
+ return options['status']
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
diff --git a/usr/src/tools/scripts/nightly.sh b/usr/src/tools/scripts/nightly.sh
index 9786f18d8a..2c52b89b28 100644
--- a/usr/src/tools/scripts/nightly.sh
+++ b/usr/src/tools/scripts/nightly.sh
@@ -21,7 +21,7 @@
#
#
-# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Based on the nightly script from the integration folks,
@@ -2928,7 +2928,6 @@ if [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then
echo "\n==== Check ELF runtime attributes ====\n" | \
tee -a $LOGFILE >> $mail_msg_file
- LDDUSAGE="^ldd: does not support -e"
LDDWRONG="wrong class"
CRLERROR="^crle:"
CRLECONF="^crle: configuration file:"
@@ -2938,7 +2937,7 @@ if [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then
rm -f $RUNTIMEREF
if [ -f $RUNTIMEOUT ]; then
- egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \
+ egrep -v "$LDDWRONG|$CRLERROR|$CRLECONF" \
$RUNTIMEOUT > $RUNTIMEREF
fi
@@ -2949,20 +2948,13 @@ if [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then
else
rtime_sflag="-s"
fi
- check_rtime -d $checkroot -i -m -o $rtime_sflag $checkroot 2>&1 | \
+ check_rtime -d $checkroot -i -m -v -o $rtime_sflag $checkroot 2>&1 | \
egrep -v ": unreferenced object=$checkroot/.*/lib(w|intl|thread|pthread).so" | \
egrep -v ": unused object=$checkroot/.*/lib(w|intl|thread|pthread).so" | \
sort > $RUNTIMEOUT
# Determine any processing errors that will affect the final output
# and display these first.
- grep -l "$LDDUSAGE" $RUNTIMEOUT > /dev/null
- if (( $? == 0 )) ; then
- echo "WARNING: ldd(1) does not support -e. The version of ldd(1)" | \
- tee -a $LOGFILE >> $mail_msg_file
- echo "on your system is old - 4390308 (s81_30) is required.\n" | \
- tee -a $LOGFILE >> $mail_msg_file
- fi
grep -l "$LDDWRONG" $RUNTIMEOUT > /dev/null
if (( $? == 0 )) ; then
echo "WARNING: wrong class message detected. ldd(1) was unable" | \
@@ -2990,21 +2982,24 @@ if [ "$r_FLAG" = "y" -a "$build_ok" = "y" ]; then
egrep '<dependency no longer necessary>' $RUNTIMEOUT | \
tee -a $LOGFILE >> $mail_msg_file
- # NEEDED= and RPATH= are informational; report anything else that we
+ # NEEDED= and RPATH= are generated by the -i option
+ # VERDEF= and VERSION= are generated by the -v option.
+ # These lines are informational; report anything else that we
# haven't already.
- egrep -v "NEEDED=|RPATH=|$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \
- $RUNTIMEOUT | tee -a $LOGFILE >> $mail_msg_file
+ egrep -v "NEEDED=|RPATH=|VERDEF=|VERSION=" $RUNTIMEOUT \
+ | egrep -v "$LDDWRONG|$CRLERROR|$CRLECONF" \
+ | tee -a $LOGFILE >> $mail_msg_file
# probably should compare against a 'known ok runpaths' list
if [ ! -f $RUNTIMEREF ]; then
- egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" \
+ egrep -v "$LDDWRONG|$CRLERROR|$CRLECONF" \
$RUNTIMEOUT > $RUNTIMEREF
fi
echo "\n==== Diff ELF runtime attributes (since last build) ====\n" \
>> $mail_msg_file
- egrep -v "$LDDUSAGE|$LDDWRONG|$CRLERROR|$CRLECONF" $RUNTIMEOUT | \
+ egrep -v "$LDDWRONG|$CRLERROR|$CRLECONF" $RUNTIMEOUT | \
diff $RUNTIMEREF - >> $mail_msg_file
fi