Merge "Uncanary the build." into ndk-release-r20
diff --git a/build/core/build-binary.mk b/build/core/build-binary.mk
index 9219219..fff49af 100644
--- a/build/core/build-binary.mk
+++ b/build/core/build-binary.mk
@@ -528,7 +528,7 @@
 # Handle the static and shared libraries this module depends on
 #
 
-my_ldflags := $(TARGET_LDFLAGS) $(LOCAL_LDFLAGS) $(NDK_APP_LDFLAGS)
+my_ldflags := $(TARGET_LDFLAGS) $(NDK_APP_LDFLAGS) $(LOCAL_LDFLAGS)
 ifneq ($(filter armeabi%,$(TARGET_ARCH_ABI)),)
     my_ldflags += $(TARGET_$(my_link_arm_mode)_LDFLAGS)
 endif
diff --git a/docs/changelogs/Changelog-r20.md b/docs/changelogs/Changelog-r20.md
index f92aa9d..6f00b9b 100644
--- a/docs/changelogs/Changelog-r20.md
+++ b/docs/changelogs/Changelog-r20.md
@@ -26,6 +26,9 @@
      * MIDI (`<amidi/AMidi.h>`).
      * Binder.
      * Extensions to several APIs from previous releases.
+ * [Issue 908]: `LOCAL_LDFLAGS` now take precedence over `APP_LDFLAGS`.
+
+[Issue 908]: https://github.com/android-ndk/ndk/issues/908
 
 ## Known Issues
 
diff --git a/ndk-stack.py b/ndk-stack.py
index 4cbe879..93aa029 100755
--- a/ndk-stack.py
+++ b/ndk-stack.py
@@ -42,7 +42,14 @@
     # And from there construct the llvm-symbolizer path.
     llvm_bin = os.path.join(ndk_root, 'toolchains', 'llvm', 'prebuilt', arch,
                             'bin')
-    return os.path.join(llvm_bin, 'llvm-symbolizer')
+    path = os.path.join(llvm_bin, 'llvm-symbolizer')
+    if os.path.exists(path):
+        return path
+
+    # Okay, maybe we're a standalone toolchain? (https://github.com/android-ndk/ndk/issues/931)
+    # In that case, llvm-symbolizer and ndk-stack are conveniently in
+    # the same directory...
+    return os.path.abspath(os.path.join(ndk_bin, 'llvm-symbolizer'))
 
 
 def main():