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