Advertisement
arter97

Untitled

Oct 14th, 2016
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 12.73 KB | None | 0 0
  1. diff --git a/build/android/increase_size_for_speed.gypi b/build/android/increase_size_for_speed.gypi
  2. index c5600b1..95d4e8c 100644
  3. --- a/build/android/increase_size_for_speed.gypi
  4. +++ b/build/android/increase_size_for_speed.gypi
  5. @@ -16,12 +16,12 @@
  6.            'conditions': [
  7.              ['OS=="android"', {
  8.                'cflags!': ['-Os'],
  9. -              'cflags': ['-O2'],
  10. +              'cflags': ['-Ofast', '-fno-fast-math'],
  11.              }],
  12. -            # Do not merge -Os and -O2 in GCC LTO.
  13. -            # LTO merges all optimization options at link-time. -O2 takes
  14. +            # Do not merge -Os and -Ofast -fno-fast-math in GCC LTO.
  15. +            # LTO merges all optimization options at link-time. -Ofast -fno-fast-math takes
  16.              # precedence over -Os. Avoid using LTO simultaneously
  17. -            # on -Os and -O2 parts for that reason.
  18. +            # on -Os and -Ofast -fno-fast-math parts for that reason.
  19.              ['OS=="android" and clang==0 and use_lto==1', {
  20.                'cflags!': [
  21.                  '-flto',
  22. diff --git a/build/common.gypi b/build/common.gypi
  23. index db3d63f..68916b3d 100644
  24. --- a/build/common.gypi
  25. +++ b/build/common.gypi
  26. @@ -623,6 +623,7 @@
  27.  
  28.        # Clang stuff.
  29.        'make_clang_dir%': 'third_party/llvm-build/Release+Asserts',
  30. +      'host_clang_dir%': 'third_party/llvm-build/host',
  31.        # Set this to true when building with Clang.
  32.        # See https://chromium.googlesource.com/chromium/src/+/master/docs/clang.md for details.
  33.        # If this is set, clang is used as both host and target compiler in
  34. @@ -690,8 +691,8 @@
  35.        # On Android/GCC, the variables must *not* be enabled at the same time.
  36.        # In this case LTO would 'merge' the optimization flags at link-time
  37.        # which would lead to all code be optimized with -O2. See crbug.com/407544
  38. -      'use_lto%': 0,
  39. -      'use_lto_o2%': 0,
  40. +      'use_lto%': 1,
  41. +      'use_lto_o2%': 1,
  42.  
  43.        # Allowed level of identical code folding in the gold linker.
  44.        'gold_icf_level%': 'all',
  45. @@ -1374,6 +1375,7 @@
  46.      'clang%': '<(clang)',
  47.      'host_clang%': '<(host_clang)',
  48.      'make_clang_dir%': '<(make_clang_dir)',
  49. +    'host_clang_dir%': 'third_party/llvm-build/host',
  50.      'use_lld%': '<(use_lld)',
  51.  
  52.      # Control which version of clang to use when building for iOS.  If set to
  53. @@ -2321,11 +2323,11 @@
  54.          'arm_thumb%': 0,
  55.        }],
  56.        ['arm_version==7', {
  57. -        'arm_arch%': 'armv7-a',
  58. -        'arm_tune%': 'generic-armv7-a',
  59. +        'arm_arch%': '',
  60. +        'arm_tune%': 'krait',
  61.          'conditions': [
  62.            ['arm_neon==1', {
  63. -            'arm_fpu%': 'neon',
  64. +            'arm_fpu%': 'neon-vfpv4',
  65.            }, {
  66.              'arm_fpu%': 'vfpv3-d16',
  67.            }],
  68. @@ -2399,8 +2401,8 @@
  69.        }],
  70.  
  71.        ['host_clang==1', {
  72. -        'host_cc': '<(make_clang_dir)/bin/clang',
  73. -        'host_cxx': '<(make_clang_dir)/bin/clang++',
  74. +        'host_cc': '<(host_clang_dir)/bin/clang',
  75. +        'host_cxx': '<(host_clang_dir)/bin/clang++',
  76.        }, {
  77.          'host_cc': '<!(which gcc)',
  78.          'host_cxx': '<!(which g++)',
  79. @@ -3050,12 +3052,6 @@
  80.              # third-party code either.
  81.              'cflags!': [ '-Wall' ],
  82.            }],
  83. -          # TODO: Fix all warnings on chromeos too.
  84. -          [ 'os_posix==1 and OS!="mac" and OS!="ios" and (clang!=1 or chromeos==1)', {
  85. -            'cflags!': [
  86. -              '-Werror',
  87. -            ],
  88. -          }],
  89.            [ 'OS=="win"', {
  90.              'defines': [
  91.                '_CRT_SECURE_NO_DEPRECATE',
  92. @@ -3594,7 +3590,7 @@
  93.          # Enable -Werror by default, but put it in a variable so it can
  94.          # be disabled in ~/.gyp/include.gypi on the valgrind builders.
  95.          'variables': {
  96. -          'werror%': '-Werror',
  97. +          'werror%': '',
  98.            'libraries_for_target%': '',
  99.            'conditions' : [
  100.              # Enable -Wextra for chromium_code when we control the compiler.
  101. @@ -3912,6 +3908,7 @@
  102.                    ['arm_tune!=""', {
  103.                      'cflags': [
  104.                        '-mtune=<(arm_tune)',
  105. +                      '-mcpu=<(arm_tune)',
  106.                      ],
  107.                      'conditions': [
  108.                        ['use_lto==1 or use_lto_o2==1', {
  109. @@ -5985,8 +5982,8 @@
  110.        'make_global_settings': [
  111.          ['CC', '<(make_clang_dir)/bin/clang'],
  112.          ['CXX', '<(make_clang_dir)/bin/clang++'],
  113. -        ['CC.host', '$(CC)'],
  114. -        ['CXX.host', '$(CXX)'],
  115. +        ['CC.host', '<(host_clang_dir)/bin/clang'],
  116. +        ['CXX.host', '<(host_clang_dir)/bin/clang++'],
  117.        ],
  118.      }],
  119.      ['clang==1 and OS=="win"', {
  120. @@ -6108,7 +6105,6 @@
  121.          'target_conditions': [
  122.            ['_toolset=="target"', {
  123.              'ldflags': [
  124. -              '-Wl,--plugin-opt,O1',
  125.                # Allows the linker to apply ICF to the LTO object file. Also, when
  126.                # targeting ARM, wWithout this flag, LTO produces a .text section
  127.                # that is larger than the maximum call displacement, preventing the
  128. diff --git a/build/config/arm.gni b/build/config/arm.gni
  129. index 6eeca62..cd80dd3 100644
  130. --- a/build/config/arm.gni
  131. +++ b/build/config/arm.gni
  132. @@ -60,7 +60,8 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
  133.    } else if (arm_version == 7) {
  134.      arm_arch = "armv7-a"
  135.      if (arm_tune == "") {
  136. -      arm_tune = "generic-armv7-a"
  137. +      arm_tune = "krait"
  138. +      arm_arch = ""
  139.      }
  140.  
  141.      if (arm_float_abi == "") {
  142. @@ -75,7 +76,7 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
  143.      }
  144.  
  145.      if (arm_use_neon) {
  146. -      arm_fpu = "neon"
  147. +      arm_fpu = "neon-vfpv4"
  148.      } else {
  149.        arm_fpu = "vfpv3-d16"
  150.      }
  151. diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
  152. index 5e6d530..e294558 100644
  153. --- a/build/config/compiler/BUILD.gn
  154. +++ b/build/config/compiler/BUILD.gn
  155. @@ -354,13 +354,17 @@ config("compiler") {
  156.      # Additionally, on cast Android x86, --icf=all causes issues.
  157.      if (is_android && current_cpu == "x86") {
  158.        ldflags += [ "-Wl,--icf=none" ]
  159. -    } else if (is_clang || is_chromeos ||
  160. -               (current_cpu != "x86" && current_cpu != "x64")) {
  161. -      ldflags += [ "-Wl,--icf=all" ]
  162.      } else if (!is_android) {
  163.        ldflags += [ "-Wl,--icf=safe" ]
  164.      }
  165.    }
  166. +  if ((current_cpu != "x86" && current_cpu != "x64")) {
  167. +      ldflags += [ "-fuse-ld=qcld" ]
  168. +  } else {
  169. +      ldflags += [ "-Wl,-O1" ]
  170. +  }
  171. +
  172. +#  ldflags += [ "-Wl,-O1", "-Wl,--as-needed", "-Wl,--relax", "-Wl,--sort-common", "-Wl,--gc-sections" ]
  173.  
  174.    if (linux_use_bundled_binutils) {
  175.      cflags += [ "-B$binutils_path" ]
  176. @@ -441,15 +445,15 @@ config("compiler") {
  177.      ldflags += [ "-flto" ]
  178.  
  179.      # Apply a lower LTO optimization level as the default is too slow.
  180. -    if (is_linux) {
  181. -      if (use_lld) {
  182. -        ldflags += [ "-Wl,--lto-O1" ]
  183. -      } else {
  184. -        ldflags += [ "-Wl,-plugin-opt,O1" ]
  185. -      }
  186. -    } else if (is_mac) {
  187. -      ldflags += [ "-Wl,-mllvm,-O1" ]
  188. -    }
  189. +#    if (is_linux) {
  190. +#      if (use_lld) {
  191. +#        ldflags += [ "-Wl,--lto-O1" ]
  192. +#      } else {
  193. +#        ldflags += [ "-Wl,-plugin-opt,O1" ]
  194. +#      }
  195. +#    } else if (is_mac) {
  196. +#      ldflags += [ "-Wl,-mllvm,-O1" ]
  197. +#    }
  198.  
  199.      # Work-around for http://openradar.appspot.com/20356002
  200.      if (is_mac) {
  201. @@ -464,8 +468,8 @@ config("compiler") {
  202.        ldflags += [ "-Wl,-plugin-opt,-function-sections" ]
  203.      }
  204.  
  205. -    cflags += [ "-fwhole-program-vtables" ]
  206. -    ldflags += [ "-fwhole-program-vtables" ]
  207. +#    cflags += [ "-fwhole-program-vtables" ]
  208. +#    ldflags += [ "-fwhole-program-vtables" ]
  209.    }
  210.  
  211.    # Pass the same C/C++ flags to the objective C/C++ compiler.
  212. @@ -515,10 +519,10 @@ config("compiler_cpu_abi") {
  213.          ldflags += [ "--target=arm-linux-gnueabihf" ]
  214.        }
  215.        if (!is_nacl) {
  216. -        cflags += [
  217. -          "-march=$arm_arch",
  218. -          "-mfloat-abi=$arm_float_abi",
  219. -        ]
  220. +        if (arm_arch != "") {
  221. +          cflags += [ "-march=$arm_arch" ]
  222. +        }
  223. +        cflags += [ "-mfloat-abi=$arm_float_abi" ]
  224.          if (arm_use_thumb) {
  225.            cflags += [ "-mthumb" ]
  226.            if (is_android && !is_clang) {
  227. @@ -528,7 +532,7 @@ config("compiler_cpu_abi") {
  228.          }
  229.        }
  230.        if (arm_tune != "") {
  231. -        cflags += [ "-mtune=$arm_tune" ]
  232. +        cflags += [ "-mtune=$arm_tune", "-mcpu=$arm_tune" ]
  233.        }
  234.      } else if (current_cpu == "arm64") {
  235.        if (is_clang && !is_android && !is_nacl) {
  236. @@ -1048,9 +1052,6 @@ config("chromium_code") {
  237.      cflags = [ "/W4" ]  # Warning level 4.
  238.    } else {
  239.      cflags = [ "-Wall" ]
  240. -    if (treat_warnings_as_errors) {
  241. -      cflags += [ "-Werror" ]
  242. -    }
  243.      if (is_clang) {
  244.        # Enable -Wextra for chromium_code when we control the compiler.
  245.        cflags += [ "-Wextra" ]
  246. @@ -1104,11 +1105,6 @@ config("no_chromium_code") {
  247.        "_CRT_NONSTDC_NO_DEPRECATE",
  248.      ]
  249.    } else {
  250. -    # GCC may emit unsuppressible warnings so don't add -Werror for no chromium
  251. -    # code. crbug.com/589724
  252. -    if (treat_warnings_as_errors && is_clang) {
  253. -      cflags += [ "-Werror" ]
  254. -    }
  255.      if (is_clang && !is_nacl) {
  256.        # TODO(thakis): Remove !is_nacl once
  257.        # https://codereview.webrtc.org/1552863002/ made its way into chromium.
  258. @@ -1290,7 +1286,7 @@ if (is_win) {
  259.      common_optimize_on_ldflags += [
  260.        # Specifically tell the linker to perform optimizations.
  261.        # See http://lwn.net/Articles/192624/ .
  262. -      "-Wl,-O1",
  263. +      # "-Wl,-O1",
  264.        "-Wl,--gc-sections",
  265.      ]
  266.  
  267. @@ -1334,7 +1330,7 @@ config("optimize") {
  268.      # Favor size over speed.
  269.      cflags = [ "-Os" ] + common_optimize_on_cflags
  270.    } else {
  271. -    cflags = [ "-O2" ] + common_optimize_on_cflags
  272. +    cflags = [ "-Ofast", "-fno-fast-math" ] + common_optimize_on_cflags
  273.    }
  274.    ldflags = common_optimize_on_ldflags
  275.  }
  276. @@ -1349,7 +1345,7 @@ config("optimize_no_wpo") {
  277.      # Favor size over speed.
  278.      cflags = [ "-Os" ] + common_optimize_on_cflags
  279.    } else {
  280. -    cflags = [ "-O2" ] + common_optimize_on_cflags
  281. +    cflags = [ "-Ofast", "-fno-fast-math" ] + common_optimize_on_cflags
  282.    }
  283.    ldflags = common_optimize_on_ldflags
  284.  }
  285. @@ -1420,7 +1416,7 @@ config("optimize_max") {
  286.          ]
  287.        }
  288.      } else {
  289. -      cflags = [ "-O2" ] + common_optimize_on_cflags
  290. +      cflags = [ "-Ofast", "-fno-fast-math" ] + common_optimize_on_cflags
  291.      }
  292.    }
  293.  }
  294. @@ -1428,7 +1424,7 @@ config("optimize_max") {
  295.  # This config can be used to override the default settings for per-component
  296.  # and whole-program optimization, optimizing the particular target for speed
  297.  # instead of code size. This config is exactly the same as "optimize_max"
  298. -# except that we use -O3 instead of -O2 on non-win, non-IRT platforms.
  299. +# except that we use -Ofast -fno-fast-math instead of -Ofast -fno-fast-math on non-win, non-IRT platforms.
  300.  #
  301.  # TODO(crbug.com/621335) - rework how all of these configs are related
  302.  # so that we don't need this disclaimer.
  303. @@ -1463,7 +1459,7 @@ config("optimize_speed") {
  304.          ]
  305.        }
  306.      } else {
  307. -      cflags = [ "-O3" ] + common_optimize_on_cflags
  308. +      cflags = [ "-Ofast", "-fno-fast-math" ] + common_optimize_on_cflags
  309.      }
  310.    }
  311.  }
  312. diff --git a/build/nocompile.gni b/build/nocompile.gni
  313. index 1b292d7..c71caeb 100644
  314. --- a/build/nocompile.gni
  315. +++ b/build/nocompile.gni
  316. @@ -78,7 +78,7 @@ if (enable_nocompile_tests) {
  317.        args = [
  318.          "4",  # number of compilers to invoke in parallel.
  319.          "{{source}}",
  320. -        "-Wall -Werror -Wfatal-errors " + "-I" +
  321. +        "-Wall -Wfatal-errors " + "-I" +
  322.              rebase_path("//", root_build_dir),
  323.          "{{output}}",
  324.        ]
  325. diff --git a/build/nocompile.gypi b/build/nocompile.gypi
  326. index 4f61add..e9194f9 100644
  327. --- a/build/nocompile.gypi
  328. +++ b/build/nocompile.gypi
  329. @@ -82,7 +82,7 @@
  330.              '<(nocompile_driver)',
  331.              '4', # number of compilers to invoke in parallel.
  332.              '<(RULE_INPUT_PATH)',
  333. -            '-Wall -Werror -Wfatal-errors -I<(DEPTH)',
  334. +            '-Wall -Wfatal-errors -I<(DEPTH)',
  335.              '<(nc_result_path)',
  336.              ],
  337.            'message': 'Generating no compile results for <(RULE_INPUT_PATH)',
  338. diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn
  339. index 548722d..fccc61c 100644
  340. --- a/build/toolchain/linux/BUILD.gn
  341. +++ b/build/toolchain/linux/BUILD.gn
  342. @@ -78,7 +78,16 @@ gcc_toolchain("x86") {
  343.    }
  344.  }
  345.  
  346. -clang_toolchain("clang_x64") {
  347. +# sdclang can't compile for host
  348. +gcc_toolchain("clang_x64") {
  349. +  cc = "../../third_party/llvm-build/host/bin/clang"
  350. +  cxx = "../../third_party/llvm-build/host/bin/clang++"
  351. +
  352. +  readelf = "readelf"
  353. +  nm = "nm"
  354. +  ar = "ar"
  355. +  ld = cxx
  356. +
  357.    toolchain_args = {
  358.      current_cpu = "x64"
  359.      current_os = "linux"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement