summaryrefslogtreecommitdiffstats
path: root/core/shared_library.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2011-07-20 15:42:53 -0700
committerYing Wang <wangying@google.com>2011-07-20 15:42:53 -0700
commitb934e49c3a1e890b2dcc716ebce3a136a7d10b8f (patch)
tree7a4244d2028ac42bff9bc67d7b46a8a8c1752128 /core/shared_library.mk
parent0142f05119ae2a1371f1a2bdc658832460a7ecbf (diff)
downloadbuild-b934e49c3a1e890b2dcc716ebce3a136a7d10b8f.zip
build-b934e49c3a1e890b2dcc716ebce3a136a7d10b8f.tar.gz
build-b934e49c3a1e890b2dcc716ebce3a136a7d10b8f.tar.bz2
Put the NDK library paths ahead of TARGET_GLOBAL_LD_DIRS
To avoid race condition: Say a module with LOCAL_NDK_VERSION built in the full source tree, Before this change it may be linked against TARGET_GLOBAL_LD_DIRS/libc.so that's being partially written out by the linker, because there is no dependency between the module and TARGET_GLOBAL_LD_DIRS/libc.so. Change-Id: If6e4921d226fee133b53e4d819a07b48f4fca016
Diffstat (limited to 'core/shared_library.mk')
-rw-r--r--core/shared_library.mk8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 47a089a..ca639eb 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -31,8 +31,12 @@ my_target_libgcc := $(TARGET_LIBGCC)
my_target_crtbegin_so_o := $(TARGET_CRTBEGIN_SO_O)
my_target_crtend_so_o := $(TARGET_CRTEND_SO_O)
ifdef LOCAL_NDK_VERSION
-my_target_global_ld_dirs += $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
- $(my_ndk_version_root)/usr/lib)
+# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
+# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
+my_target_global_ld_dirs := \
+ $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
+ $(my_ndk_version_root)/usr/lib) \
+ $(my_target_global_ld_dirs)
my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
my_target_crtbegin_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_so.o)
my_target_crtend_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_so.o)