summaryrefslogtreecommitdiff
path: root/usr/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/tools')
-rw-r--r--usr/src/tools/scripts/check_rtime.141
-rw-r--r--usr/src/tools/scripts/check_rtime.pl65
2 files changed, 91 insertions, 15 deletions
diff --git a/usr/src/tools/scripts/check_rtime.1 b/usr/src/tools/scripts/check_rtime.1
index 0b56ff6853..7f1cc966ac 100644
--- a/usr/src/tools/scripts/check_rtime.1
+++ b/usr/src/tools/scripts/check_rtime.1
@@ -1,5 +1,5 @@
.\" ident "%Z%%M% %I% %E% SMI"
-.\" Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+.\" Copyright 2008 Sun Microsystems, Inc. All rights reserved.
.\" Use is subject to license terms.
.\"
.\" CDDL HEADER START
@@ -21,7 +21,7 @@
.\"
.\" CDDL HEADER END
.\"
-.TH check_rtime 1 "23 Apr 2007"
+.TH check_rtime 1 "10 Jan 2008"
.SH NAME
.I check_rtime
\- check ELF runtime attributes
@@ -129,20 +129,23 @@ See also the section ENVIRONMENT VARIABLES.
uses \fBelfdump(1)\fP to look for a concatenated relocation
section in shared objects, the existence of text relocations,
whether debugging or symbol table information exists, whether
-applications have a non-executable stack defined, and for duplicate
-entries in the symbol sorting sections.
+applications have a non-executable stack defined, duplicate
+entries in the symbol sorting sections, and for direct bindings.
These checks are carried out for the following reasons:
.TP 4
\(bu
A concatenated relocation section (\fI.SUNW_reloc\fP)
provides optimal symbol table
access as runtime, and thus reduces the overhead of relocating
-the shared object. The link-edit of a dynamic object with
-the \fB-z combreloc\fP option is required to generate a combined
-relocation section.
-.sp
-Not inheriting \fB$(DYNFLAGS)\fP from
-\fIlib/Makefile.lib\fP is the typical reason for not having a
+the shared object. In past releases, the link-edit of a dynamic object with
+the \fB-z combreloc\fP option was required to generate a combined
+relocation section. However, with the integration of 6642769, this section
+combination is a default behavior of the link-editor.
+.sp
+In past releases, not inheriting \fB$(DYNFLAGS)\fP from
+\fIlib/Makefile.lib\fP was the typical reason for not having a
+concatenated relocation section. The misguided use of the
+\fB-z nocombreloc\fP option will also prevent the creation of a
concatenated relocation section. A missing concatenated relocation section
is displayed as:
.sp
@@ -258,6 +261,24 @@ foo: .SUNW_dynsymsort: duplicate ADDRESS: sym1, sym2
.br
foo: .SUNW_dyntlssort: duplicate OFFSET: sym1, sym2
.RE
+.sp
+.TP
+\(bu
+\fBOSNet\fP dynamic ELF objects are expected to employ direct bindings whenever
+feasible. This runtime binding technique helps to avoid accidental
+interposition problems, and provides a more optimal
+runtime symbol search model.
+.sp
+Not inheriting the correct \fB$(LDFLAGS)\fP from \fIcmd/Makefile.cmd\fP,
+or the correct \fB$(DYNFLAGS)\fP from \fIlib/Makefile.lib\fP, are the
+typical reasons for not enabling direct bindings. Dynamic objects that
+do not contain direct binding information are displayed as:
+.sp
+.RS 6
+foo: object has no direct bindings \\
+.br
+ <no -B direct or -z direct?>
+.RE
.sp
.LP
diff --git a/usr/src/tools/scripts/check_rtime.pl b/usr/src/tools/scripts/check_rtime.pl
index 891904e530..52d76434dd 100644
--- a/usr/src/tools/scripts/check_rtime.pl
+++ b/usr/src/tools/scripts/check_rtime.pl
@@ -21,7 +21,7 @@
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
@@ -59,12 +59,12 @@
# Define all global variables (required for strict)
-use vars qw($SkipDirs $SkipFiles $SkipTextrelFiles);
+use vars qw($SkipDirs $SkipFiles $SkipTextrelFiles $SkipDirectBindFiles);
use vars qw($SkipUndefDirs $SkipUndefFiles $SkipUnusedDirs $SkipUnusedFiles);
use vars qw($SkipStabFiles $SkipNoExStkFiles $SkipCrleConf);
use vars qw($UnusedNoise $Prog $Mach $Isalist $Env $Ena64 $Tmpdir $Error);
use vars qw($UnusedFiles $UnusedPaths $LddNoU $Crle32 $Crle64 $Conf32 $Conf64);
-use vars qw($SkipInterps $SkipSymSort $OldDeps %opt);
+use vars qw($SkipDirectBindDirs $SkipInterps $SkipSymSort $OldDeps %opt);
use strict;
@@ -107,6 +107,20 @@ $SkipTextrelFiles = qr{ ^(?:
)$
}x;
+# Define any directories or files that are allowed to have no direct bound
+# symbols
+$SkipDirectBindDirs = qr{
+ usr/ucb
+}x;
+
+$SkipDirectBindFiles = qr{ ^(?:
+ unix |
+ sbcp |
+ libproc.so.1 |
+ libnisdb.so.2
+ )$
+}x;
+
# Define any files that are allowed undefined references.
$SkipUndefDirs = qr{
usr/lib/elfedit/ | # elfedit modules have callbacks
@@ -465,6 +479,7 @@ sub ProcFile {
my(@Elf, @Ldd, $Dyn, $Intp, $Dll, $Ttl, $Sym, $Interp, $Stack);
my($Sun, $Relsz, $Pltsz, $Uns, $Tex, $Stab, $Strip, $Lddopt, $SymSort);
my($Val, $Header, $SkipLdd, $IsX86, $RWX);
+ my($HasDirectBinding);
# Ignore symbolic links.
if (-l $FullPath) {
@@ -490,7 +505,7 @@ sub ProcFile {
# Determine whether we have a executable (static or dynamic) or a
# shared object.
- @Elf = split(/\n/, `elfdump -epdic $FullPath 2>&1`);
+ @Elf = split(/\n/, `elfdump -epdicy $FullPath 2>&1`);
$Dyn = $Intp = $Dll = $Stack = $IsX86 = $RWX = 0;
$Interp = 1;
@@ -772,6 +787,7 @@ LDD: foreach my $Line (@Ldd) {
$Sun = $Relsz = $Pltsz = $Dyn = $Stab = $SymSort = 0;
$Tex = $Strip = 1;
+ $HasDirectBinding = 0;
$Header = 'None';
ELF: foreach my $Line (@Elf) {
@@ -802,7 +818,30 @@ ELF: foreach my $Line (@Elf) {
} elsif ($Line =~ /^Dynamic Section/) {
$Header = 'Dyn';
next;
- } elsif ($Header ne 'Dyn') {
+ } elsif ($Line =~ /^Syminfo Section/) {
+ $Header = 'Syminfo';
+ next;
+ } elsif (($Header ne 'Dyn') && ($Header ne 'Syminfo')) {
+ next;
+ }
+
+ # Look into the Syminfo section.
+ # Does this object have at least one Directly Bound symbol?
+ if (($Header eq 'Syminfo')) {
+ my(@Symword);
+
+ if ($HasDirectBinding == 1) {
+ next;
+ }
+
+ @Symword = split(' ', $Line);
+
+ if (!defined($Symword[1])) {
+ next;
+ }
+ if ($Symword[1] =~ /B/) {
+ $HasDirectBinding = 1;
+ }
next;
}
@@ -854,6 +893,11 @@ ELF: foreach my $Line (@Elf) {
next;
}
+ # Is this object built with -B direct flag on?
+ if ($Line =~ / DIRECT /) {
+ $HasDirectBinding = 1;
+ }
+
# Does this object specify a runpath.
if ($opt{i} && ($Line =~ /RPATH/)) {
my($Rpath) = (split(' ', $Line))[3];
@@ -881,6 +925,17 @@ ELF: foreach my $Line (@Elf) {
"\tdebugging sections should be deleted\t<no strip -x?>");
}
+ # Identify an object that is not built with either -B direct or
+ # -z direct.
+ if (($RelPath =~ $SkipDirectBindDirs) ||
+ ($File =~ $SkipDirectBindFiles)) {
+ goto DONESTAB;
+ }
+ if ($Relsz && ($HasDirectBinding == 0)) {
+ OutMsg($Ttl++, $RelPath,
+ "\tobject has no direct bindings\t<no -B direct or -z direct?>");
+ }
+
DONESTAB:
# All objects should have a full symbol table to provide complete