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

Unified Diff: build/config/compiler/BUILD.gn

Issue 1108173002: Roll //build, //native_client, and a few more targets of opportunity. Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Test fix Created 5 years, 8 months 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 | « build/config/clang/BUILD.gn ('k') | build/config/crypto.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/compiler/BUILD.gn
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 42dc584116663456fa212ae6c3b7d4d4ce4704db..c2171549fea963a3ecdfb6f1286e04a20295bb5b 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -165,7 +165,7 @@ config("compiler") {
defines += [ "CR_CLANG_REVISION=" +
exec_script("//tools/clang/scripts/posix-print-revision.py",
[],
- "value") ]
+ "trim string") ]
}
# Mac-specific compiler flags setup.
@@ -194,16 +194,11 @@ config("compiler") {
cflags_objcc = [ "-fobjc-call-cxx-cdtors" ]
cflags_c += [ "-std=c99" ]
- cflags_cc += [ "-std=gnu++11" ]
ldflags += common_mac_flags
} else if (is_posix) {
# Non-Mac Posix compiler flags setup.
# -----------------------------------
- if (gcc_version >= 48) {
- cflags_cc += [ "-std=gnu++11" ]
- }
-
if (enable_profiling && !is_debug) {
# The GYP build spams this define into every compilation unit, as we do
# here, but it only appears to be used in base and a couple other places.
@@ -246,98 +241,93 @@ config("compiler") {
]
}
} else if (current_cpu == "arm") {
- # Don't set the compiler flags for the WebView build. These will come
- # from the Android build system.
- if (!is_android_webview_build) {
+ cflags += [
+ "-march=$arm_arch",
+ "-mfloat-abi=$arm_float_abi",
+ ]
+ if (arm_tune != "") {
+ cflags += [ "-mtune=$arm_tune" ]
+ }
+ if (arm_use_thumb) {
+ cflags += [ "-mthumb" ]
+ if (is_android && !is_clang) { # Clang doesn't support this option.
+ cflags += [ "-mthumb-interwork" ]
+ }
+ }
+ if (!is_clang) {
+ # Clang doesn't support these flags.
cflags += [
- "-march=$arm_arch",
- "-mfloat-abi=$arm_float_abi",
+ # The tree-sra optimization (scalar replacement for
+ # aggregates enabling subsequent optimizations) leads to
+ # invalid code generation when using the Android NDK's
+ # compiler (r5-r7). This can be verified using
+ # webkit_unit_tests' WTF.Checked_int8_t test.
+ "-fno-tree-sra",
+
+ # The following option is disabled to improve binary
+ # size and performance in gcc 4.9.
+ "-fno-caller-saves",
]
- if (arm_tune != "") {
- cflags += [ "-mtune=$arm_tune" ]
- }
- if (arm_use_thumb) {
- cflags += [ "-mthumb" ]
- if (is_android && !is_clang) { # Clang doesn't support this option.
- cflags += [ "-mthumb-interwork" ]
- }
- }
- if (!is_clang) {
- # Clang doesn't support these flags.
- cflags += [
- # The tree-sra optimization (scalar replacement for
- # aggregates enabling subsequent optimizations) leads to
- # invalid code generation when using the Android NDK's
- # compiler (r5-r7). This can be verified using
- # webkit_unit_tests' WTF.Checked_int8_t test.
- "-fno-tree-sra",
-
- # The following option is disabled to improve binary
- # size and performance in gcc 4.9.
- "-fno-caller-saves",
- ]
- }
}
} else if (current_cpu == "mipsel") {
- # Don't set the compiler flags for the WebView build. These will come
- # from the Android build system.
- if (!is_android_webview_build) {
- if (mips_arch_variant == "r6") {
- cflags += [
+ if (mips_arch_variant == "r6") {
+ cflags += [
+ "-mips32r6",
+ "-Wa,-mips32r6",
+ ]
+ if (is_android) {
+ ldflags += [
"-mips32r6",
- "-Wa,-mips32r6",
- ]
- if (is_android) {
- ldflags += [
- "-mips32r6",
- "-Wl,-melf32ltsmip",
- ]
- }
- } else if (mips_arch_variant == "r2") {
- cflags += [
- "-mips32r2",
- "-Wa,-mips32r2",
- ]
- if (mips_float_abi == "hard" && mips_fpu_mode != "") {
- cflags += [ "-m$mips_fpu_mode" ]
- }
- } else if (mips_arch_variant == "r1") {
- cflags += [
- "-mips32",
- "-Wa,-mips32",
+ "-Wl,-melf32ltsmip",
]
}
-
- if (mips_dsp_rev == 1) {
- cflags += [ "-mdsp" ]
- } else if (mips_dsp_rev == 2) {
- cflags += [ "-mdspr2" ]
+ } else if (mips_arch_variant == "r2") {
+ cflags += [
+ "-mips32r2",
+ "-Wa,-mips32r2",
+ ]
+ if (mips_float_abi == "hard" && mips_fpu_mode != "") {
+ cflags += [ "-m$mips_fpu_mode" ]
}
+ } else if (mips_arch_variant == "r1") {
+ cflags += [
+ "-mips32",
+ "-Wa,-mips32",
+ ]
+ }
- cflags += [ "-m${mips_float_abi}-float" ]
+ if (mips_dsp_rev == 1) {
+ cflags += [ "-mdsp" ]
+ } else if (mips_dsp_rev == 2) {
+ cflags += [ "-mdspr2" ]
}
+
+ cflags += [ "-m${mips_float_abi}-float" ]
} else if (current_cpu == "mips64el") {
- # Don't set the compiler flags for the WebView build. These will come
- # from the Android build system.
- if (!is_android_webview_build) {
- if (mips_arch_variant == "r6") {
- cflags += [
- "-mips64r6",
- "-Wa,-mips64r6",
- ]
- ldflags += [ "-mips64r6" ]
- } else if (mips_arch_variant == "r2") {
- cflags += [
- "-mips64r2",
- "-Wa,-mips64r2",
- ]
- ldflags += [ "-mips64r2" ]
- }
+ if (mips_arch_variant == "r6") {
+ cflags += [
+ "-mips64r6",
+ "-Wa,-mips64r6",
+ ]
+ ldflags += [ "-mips64r6" ]
+ } else if (mips_arch_variant == "r2") {
+ cflags += [
+ "-mips64r2",
+ "-Wa,-mips64r2",
+ ]
+ ldflags += [ "-mips64r2" ]
}
}
defines += [ "_FILE_OFFSET_BITS=64" ]
+ if (!is_android) {
+ defines += [
+ "_LARGEFILE_SOURCE",
+ "_LARGEFILE64_SOURCE",
+ ]
+ }
+
# Omit unwind support in official builds to save space. We can use breakpad
# for these builds.
if (is_chrome_branded && is_official_build) {
@@ -418,7 +408,18 @@ config("compiler") {
# ------------------------------------
if (is_clang) {
cflags += [ "-fcolor-diagnostics" ]
+ }
+
+ # C++11 compiler flags setup.
+ # ---------------------------
+ if (is_linux || is_android || is_nacl) {
+ # gnu++11 instead of c++11 is needed because some code uses typeof() (a
+ # GNU extension).
+ # TODO(thakis): Eventually switch this to c++11 instead,
+ # http://crbug.com/427584
cflags_cc += [ "-std=gnu++11" ]
+ } else if (!is_win) {
+ cflags_cc += [ "-std=c++11" ]
}
# Android-specific flags setup.
@@ -433,15 +434,6 @@ config("compiler") {
# Clang doesn't support these flags.
cflags += [ "-finline-limit=64" ]
}
- if (is_android_webview_build) {
- # Android predefines this as 1; undefine it here so Chromium can redefine
- # it later to be 2 for chromium code and unset for third party code. This
- # works because cflags are added before defines.
- # TODO(brettw) the above comment seems incorrect. We specify defines
- # before cflags on our compiler command lines.
- cflags += [ "-U_FORTIFY_SOURCE" ]
- }
-
if (is_asan) {
# Android build relies on -Wl,--gc-sections removing unreachable code.
# ASan instrumentation for globals inhibits this and results in a library
@@ -451,11 +443,10 @@ config("compiler") {
}
defines += [ "ANDROID" ]
- if (!is_android_webview_build) {
- # The NDK has these things, but doesn't define the constants
- # to say that it does. Define them here instead.
- defines += [ "HAVE_SYS_UIO_H" ]
- }
+
+ # The NDK has these things, but doesn't define the constants
+ # to say that it does. Define them here instead.
+ defines += [ "HAVE_SYS_UIO_H" ]
# Use gold for Android for most CPU architectures.
if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") {
@@ -500,7 +491,7 @@ config("compiler") {
}
config("compiler_arm_fpu") {
- if (current_cpu == "arm" && !is_android_webview_build) {
+ if (current_cpu == "arm") {
cflags = [ "-mfpu=$arm_fpu" ]
}
}
@@ -573,7 +564,7 @@ config("runtime_library") {
# TODO(jdduke) Re-enable on mips after resolving linking
# issues with libc++ (crbug.com/456380).
- if (cpu_arch != "mipsel" && cpu_arch != "mips64el") {
+ if (current_cpu != "mipsel" && current_cpu != "mips64el") {
ldflags += [ "-Wl,--warn-shared-textrel" ]
}
ldflags += [ "-nostdlib" ]
@@ -684,20 +675,6 @@ config("no_chromium_code") {
"-Wno-deprecated",
]
}
-
- if (is_android_webview_build) {
- # There is a class of warning which:
- # 1) Android always enables and also treats as errors
- # 2) Chromium ignores in third party code
- # So we re-enable those warnings when building Android.
- cflags += [
- "-Wno-address",
- "-Wno-format-security",
- "-Wno-return-type",
- "-Wno-sequence-point",
- ]
- cflags_cc += [ "-Wno-non-virtual-dtor" ]
- }
}
# rtti ------------------------------------------------------------------------
@@ -983,7 +960,7 @@ if (is_win) {
# TODO(jdduke) Re-enable on mips after resolving linking
# issues with libc++ (crbug.com/456380).
- if (cpu_arch != "mipsel" && cpu_arch != "mips64el") {
+ if (current_cpu != "mipsel" && current_cpu != "mips64el") {
common_optimize_on_ldflags += [
# Warn in case of text relocations.
"-Wl,--warn-shared-textrel",
« no previous file with comments | « build/config/clang/BUILD.gn ('k') | build/config/crypto.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698