[compiler-rt] r270616 - [asan] Workaround LD_PRELOAD bug in the Android linker.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 14:25:01 PDT 2016


Author: eugenis
Date: Tue May 24 16:25:00 2016
New Revision: 270616

URL: http://llvm.org/viewvc/llvm-project?rev=270616&view=rev
Log:
[asan] Workaround LD_PRELOAD bug in the Android linker.

Modified:
    compiler-rt/trunk/lib/asan/scripts/asan_device_setup

Modified: compiler-rt/trunk/lib/asan/scripts/asan_device_setup
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/scripts/asan_device_setup?rev=270616&r1=270615&r2=270616&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/scripts/asan_device_setup (original)
+++ compiler-rt/trunk/lib/asan/scripts/asan_device_setup Tue May 24 16:25:00 2016
@@ -308,11 +308,18 @@ function generate_zygote_wrapper { # fro
   local _from=$1
   local _to=$2
   local _asan_rt=$3
+  if [[ PRE_L -eq 0 ]]; then
+    # LD_PRELOAD parsing is broken in N if it starts with ":". Luckily, it is
+    # unset in the system environment since L.
+    local _ld_preload=$_asan_rt
+  else
+    local _ld_preload=\$LD_PRELOAD:$_asan_rt
+  fi
   cat <<EOF >"$TMPDIR/$_from"
 #!/system/bin/sh-from-zygote
 ASAN_OPTIONS=$ASAN_OPTIONS \\
 ASAN_ACTIVATION_OPTIONS=include_if_exists=/data/local/tmp/asan.options.%b \\
-LD_PRELOAD=\$LD_PRELOAD:$_asan_rt \\
+LD_PRELOAD=$_ld_preload \\
 exec $_to \$@
 
 EOF




More information about the llvm-commits mailing list