#!/bin/sh # Extract symbols from the fips source code for functions that are wrapped. # Output is a version script, (suitable to be passed to the linker # through a compiler flag -f -Wl,--version-script=), which # indicates that the extracted symbols should be exported from # libfips, while all other symbols are private. # We have two different patterns for identifying wrapped # functions. The first is a call to one of the DEFER macros # (GLWRAP_DEFER, TIMED_DEFER, WGLWRAP_DEFER_WITH_RETURN, etc.). In # this case, the name of the wrapped function appears as the first or # second argument to the macro, (second for the case of of # _WITH_RETURN macro). deferred=`grep 'DEFER[ (]*e*gl' $@ | sed -s 's/.*DEFER *(\([^,)]*\).*/\1/'` deferred_return=`grep 'DEFER_WITH_RETURN *([^,]*, *e*gl' $@ | sed -s 's/.*DEFER_WITH_RETURN *([^,]*, *\([^,)]*\).*/\1/'` # The second-case is functions for which we either implement or call # the underlying "real" function. In these cases, the code uses the # convention of having a function or a function-pointer with a name of # the form *wrap_real_ wrapped=`grep wrap_real_ $@ | sed -e 's/.*wrap_real_\([a-zA-Z0-9_]*\).*/\1/'` # With those two lists collected, all we need is a simple template for # a version script, along with alphabetic sorting and uniquifying of # the list, (and adding tabs for nice-looking indentation and ';' # separators). cat <