xref: /titanic_41/usr/src/cmd/sgs/link_audit/common/symbindrep.ksh (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
17c478bd9Sstevel@tonic-gate#!/bin/ksh
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*20c1c355SRod Evans# Common Development and Distribution License (the "License").
7*20c1c355SRod Evans# You may not use this file except in compliance with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
22*20c1c355SRod Evans# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate
247c478bd9Sstevel@tonic-gateusage() {
257c478bd9Sstevel@tonic-gate	echo "usage: symbindrep -[$optlet] utility"
267c478bd9Sstevel@tonic-gate	echo "	-f <bindfromlist>"
277c478bd9Sstevel@tonic-gate	echo "		A colon sperated list of libraries that will have"
287c478bd9Sstevel@tonic-gate	echo "		symbol references tracked.  Only symbol references"
297c478bd9Sstevel@tonic-gate	echo "		originating from these libraries will be tracked."
307c478bd9Sstevel@tonic-gate	echo "		The default is to track symbol references from"
317c478bd9Sstevel@tonic-gate	echo "		all libraries."
327c478bd9Sstevel@tonic-gate	echo "	-t <bindtolist>"
337c478bd9Sstevel@tonic-gate	echo "		A colon separated list of libraries to track"
347c478bd9Sstevel@tonic-gate	echo "		symbol bindings.  Only bindings to objects in"
357c478bd9Sstevel@tonic-gate	echo "		these objects will be tracked.  The default is to"
367c478bd9Sstevel@tonic-gate	echo "		track bindings to all objects."
377c478bd9Sstevel@tonic-gate	echo "	-l <bindreplib>"
387c478bd9Sstevel@tonic-gate	echo "		specify an alternate symbindrep.so to use."
397c478bd9Sstevel@tonic-gate}
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gatebindto=""
427c478bd9Sstevel@tonic-gatebindfrom=""
437c478bd9Sstevel@tonic-gatesymbindreplib32="/opt/SUNWonld/lib/32/symbindrep.so.1"
447c478bd9Sstevel@tonic-gatesymbindreplib64="/opt/SUNWonld/lib/64/symbindrep.so.1"
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gateoptlet="f:t:l:"
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gatewhile getopts $optlet c
497c478bd9Sstevel@tonic-gatedo
507c478bd9Sstevel@tonic-gate	case $c in
517c478bd9Sstevel@tonic-gate	f)
527c478bd9Sstevel@tonic-gate		bindfrom="$OPTARG"
537c478bd9Sstevel@tonic-gate		;;
547c478bd9Sstevel@tonic-gate	t)
557c478bd9Sstevel@tonic-gate		bindto="$OPTARG"
567c478bd9Sstevel@tonic-gate		;;
577c478bd9Sstevel@tonic-gate	l)
587c478bd9Sstevel@tonic-gate		symbindreplib32="$OPTARG"
597c478bd9Sstevel@tonic-gate		symbindreplib64="$OPTARG"
607c478bd9Sstevel@tonic-gate		;;
617c478bd9Sstevel@tonic-gate	\?)
627c478bd9Sstevel@tonic-gate		usage
637c478bd9Sstevel@tonic-gate		exit 1
647c478bd9Sstevel@tonic-gate		;;
657c478bd9Sstevel@tonic-gate	esac
667c478bd9Sstevel@tonic-gatedone
677c478bd9Sstevel@tonic-gateshift `expr $OPTIND - 1`
687c478bd9Sstevel@tonic-gate
697c478bd9Sstevel@tonic-gate#
707c478bd9Sstevel@tonic-gate# Build environment variables
717c478bd9Sstevel@tonic-gate#
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gateSYMBINDREP_BINDTO="$bindto" \
747c478bd9Sstevel@tonic-gateSYMBINDREP_BINDFROM="$bindfrom" \
757c478bd9Sstevel@tonic-gateLD_BIND_NOW=1 \
767c478bd9Sstevel@tonic-gateLD_AUDIT_32="$symbindreplib32" \
777c478bd9Sstevel@tonic-gateLD_AUDIT_64="$symbindreplib64" \
787c478bd9Sstevel@tonic-gate$*
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gateexit 0
81