checkUndefined.sh revision 41afa0fe1d4d91d48502f164a70c92549adde3e5
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# Copyright (C) 2006-2010 Sun Microsystems, Inc.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# This file is part of VirtualBox Open Source Edition (OSE), as
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers# available from http://www.virtualbox.org. This file is free software;
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# you can redistribute it and/or modify it under the terms of the GNU
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# General Public License (GPL) as published by the Free Software
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# Foundation, in version 2 as it comes in the "COPYING" file of the
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# Clara, CA 95054 USA or visit http://www.sun.com if you need
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# additional information or have any questions.
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# Compare undefined symbols in a shared or static object against a new-line
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering# separated list of grep patterns in a text file.
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering# Usage: /bin/sh <script name> <object> <allowed undefined symbols> [--static]
a9cdc94f7ff40f22a3cf9472f612a80730a1b010Dave Reisner# Currently only works for native objects on Linux platforms
4d7859d173282e16bb75254c2b4ec14a915ef30bKay Sievers echo $* 1>&2
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poetteringif test $# -lt 3 || test $# -gt 4 || test ! -r "$target" || test ! -r "$symbols"; then
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering if test ! -r "$target"; then
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering elif test ! -r "$symbols"; then
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poetteringif test $# -eq 4 && test "$static" != "--static"; then
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poettering echoerr "Usage: $0 <object> <allowed undefined symbols> [--static]"
46e65dcc3a522b5e992e165b5e61d14254026859Lennart Poettering echoerr "$0: '$hostos' not a valid hostos string. supported 'linux' 'solaris'"
e7e55dbdc38f929805ab2407fbd50886043a9e7cDavid Herrmannif test ! -x "$objdumpbin"; then
e7e55dbdc38f929805ab2407fbd50886043a9e7cDavid Herrmann echoerr "$0: '$objdumpbin' not found or not executable."
2087a7aff26ea5d1bc2c7c29add3275328f36baaLennart Poetteringundefined=`$objdumpbin $command $target | $grepbin '*UND*' | $grepbin -v -f $symbols | kmk_sed -e 's/^.*[[:blank:]]\(.*\)/\1/'`
e7e55dbdc38f929805ab2407fbd50886043a9e7cDavid Herrmann echoerr "$0: following symbols not defined in $symbols:"