aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2016-01-04 22:25:46 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-01-04 22:25:46 +0000
commitaa3245fa600b0880fe232e7176332f362d85274a (patch)
tree003e6cc1e131cb03fae50f43dbf310af7add0147
parentc32a88b5e411b684a694cc64328d06420e12373d (diff)
parent9c0014cefe273baf30e66c12146101a133dae892 (diff)
downloadndk-aa3245fa600b0880fe232e7176332f362d85274a.tar.gz
Merge "Apply version script if present"
am: 9c0014cefe * commit '9c0014cefe273baf30e66c12146101a133dae892': Apply version script if present
-rwxr-xr-xbuild/tools/gen-platforms.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/build/tools/gen-platforms.sh b/build/tools/gen-platforms.sh
index b9287c92a..c66576a12 100755
--- a/build/tools/gen-platforms.sh
+++ b/build/tools/gen-platforms.sh
@@ -392,6 +392,7 @@ get_default_compiler_for_arch()
# $3: variables list
# $4: destination file
# $5: compiler command
+# $6: version script (optional)
gen_shared_lib ()
{
local LIBRARY=$1
@@ -399,6 +400,7 @@ gen_shared_lib ()
local VARS="$3"
local DSTFILE="$4"
local CC="$5"
+ local VERSION_SCRIPT="$6"
# Now generate a small C source file that contains similarly-named stubs
echo "/* Auto-generated file, do not edit */" > $TMPC
@@ -413,6 +415,9 @@ gen_shared_lib ()
# Build it with our cross-compiler. It will complain about conflicting
# types for built-in functions, so just shut it up.
COMMAND="$CC -Wl,-shared,-Bsymbolic -Wl,-soname,$LIBRARY -nostdlib -o $TMPO $TMPC -Wl,--exclude-libs,libgcc.a -w"
+ if [ -n "$VERSION_SCRIPT" ]; then
+ COMMAND="$COMMAND -Wl,--version-script=$VERSION_SCRIPT -Wl,--no-undefined-version"
+ fi
echo "## COMMAND: $COMMAND"
$COMMAND
if [ $? != 0 ] ; then
@@ -474,9 +479,14 @@ gen_shared_libraries ()
vars=$(remove_unwanted_variable_symbols $ARCH $LIB $vars)
numfuncs=$(echo $funcs | wc -w)
numvars=$(echo $vars | wc -w)
+ version_script=""
+
+ if [ -f "$SYMDIR/$LIB.versions.txt" ]; then
+ version_script="$SYMDIR/$LIB.versions.txt"
+ fi
log "Generating $ARCH shared library for $LIB ($numfuncs functions + $numvars variables)"
- gen_shared_lib $LIB "$funcs" "$vars" "$DSTDIR/$LIB" "$CC"
+ gen_shared_lib $LIB "$funcs" "$vars" "$DSTDIR/$LIB" "$CC" "$version_script"
done
}