Index: build/config/BUILD.gn |
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn |
index 18bd77509a5c045f587cbf0c1235fd61174b450c..694f98bc39febea784c3cb759badd2c2783ee695 100644 |
--- a/build/config/BUILD.gn |
+++ b/build/config/BUILD.gn |
@@ -11,6 +11,10 @@ import("//build/config/sanitizers/sanitizers.gni") |
import("//build/config/ui.gni") |
import("//build/toolchain/goma.gni") |
+if (is_android) { |
+ import("//build/config/android/config.gni") |
+} |
+ |
declare_args() { |
# When set (the default) enables C++ iterator debugging in debug builds. |
# Iterator debugging is always off in release builds (technically, this flag |
@@ -363,18 +367,32 @@ config("default_libs") { |
# target that needs it. |
] |
} else if (is_android) { |
- # Android uses -nostdlib so we need to add even libc here. |
- libs = [ |
- # TODO(brettw) write a version of this, hopefully we can express this |
- # without forking out to GCC just to get the library name. The android |
- # toolchain directory should probably be extracted into a .gni file that |
- # this file and the android toolchain .gn file can share. |
- # # Manually link the libgcc.a that the cross compiler uses. |
- # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)', |
- "c", |
+ ldflags = [ "-nostdlib" ] |
+ lib_dirs = [ "$android_libcpp_root/libs/$android_app_abi" ] |
+ |
+ # The libc++ runtime library (must come first). |
+ # ASan needs to dynamically link to libc++ even in static builds so |
+ # that it can interpose operator new. |
+ if (is_component_build || is_asan) { |
+ libs = [ "c++_shared" ] |
brettw
2016/01/05 18:36:44
On Linux the difference between SDK and runtime li
agrieve
2016/01/06 02:09:54
Looks like libatomic is along the same lines as li
|
+ } else { |
+ libs = [ "c++_static" ] |
+ } |
+ |
+ # libgcc must come before libdl for ld.bfd (MIPS) |
+ libs += [ |
+ # Manually link the libgcc.a that the cross compiler uses. This is |
+ # absolute because the linker will look inside the sysroot if it's not. |
+ rebase_path(android_libgcc_file), |
+ "c", # Required because of -nostdlib |
"dl", |
"m", |
] |
+ |
+ # Clang with libc++ does not require an explicit atomic library reference. |
+ if (!is_clang) { |
+ libs += [ "atomic" ] |
+ } |
} else if (is_mac) { |
libs = [ |
"AppKit.framework", |