xref: /illumos-gate/usr/src/cmd/sgs/link_audit/common/symbindrep.ksh (revision 8b80e8cb6855118d46f605e91b5ed4ce83417395)
1#!/bin/ksh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# ident	"%Z%%M%	%I%	%E% SMI"
25#
26# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
27# Use is subject to license terms.
28
29usage() {
30	echo "usage: symbindrep -[$optlet] utility"
31	echo "	-f <bindfromlist>"
32	echo "		A colon sperated list of libraries that will have"
33	echo "		symbol references tracked.  Only symbol references"
34	echo "		originating from these libraries will be tracked."
35	echo "		The default is to track symbol references from"
36	echo "		all libraries."
37	echo "	-t <bindtolist>"
38	echo "		A colon separated list of libraries to track"
39	echo "		symbol bindings.  Only bindings to objects in"
40	echo "		these objects will be tracked.  The default is to"
41	echo "		track bindings to all objects."
42	echo "	-l <bindreplib>"
43	echo "		specify an alternate symbindrep.so to use."
44}
45
46bindto=""
47bindfrom=""
48symbindreplib32="/opt/SUNWonld/lib/32/symbindrep.so.1"
49symbindreplib64="/opt/SUNWonld/lib/64/symbindrep.so.1"
50
51optlet="f:t:l:"
52
53while getopts $optlet c
54do
55	case $c in
56	f)
57		bindfrom="$OPTARG"
58		;;
59	t)
60		bindto="$OPTARG"
61		;;
62	l)
63		symbindreplib32="$OPTARG"
64		symbindreplib64="$OPTARG"
65		;;
66	\?)
67		usage
68		exit 1
69		;;
70	esac
71done
72shift `expr $OPTIND - 1`
73
74#
75# Build environment variables
76#
77
78SYMBINDREP_BINDTO="$bindto" \
79SYMBINDREP_BINDFROM="$bindfrom" \
80LD_BIND_NOW=1 \
81LD_AUDIT_32="$symbindreplib32" \
82LD_AUDIT_64="$symbindreplib64" \
83$*
84
85exit 0
86