Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3012)

Unified Diff: build/config/BUILD.gn

Issue 1539353002: GN(android): Default libs logic from runtime_library -> default_libs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/config/android/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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",
« no previous file with comments | « no previous file | build/config/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698