0028-build-config-compiler-add-build-flags-for-clang.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 20c72b8a114d65b82decba916133c7c56c1e84b5 Mon Sep 17 00:00:00 2001
  2. From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
  3. Date: Mon, 25 Jul 2022 14:29:11 +0800
  4. Subject: [PATCH 28/68] build: config: compiler: add build flags for clang
  5. This will resolve build failure on v8 when using clang.
  6. Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
  7. ---
  8. build/config/compiler/BUILD.gn | 15 +++++++++++++--
  9. 1 file changed, 13 insertions(+), 2 deletions(-)
  10. diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
  11. index 2b09584757ad..e2eadac1dafb 100644
  12. --- a/build/config/compiler/BUILD.gn
  13. +++ b/build/config/compiler/BUILD.gn
  14. @@ -1511,6 +1511,8 @@ config("default_warnings") {
  15. # this as well. http://crbug.com/316352
  16. "-Wno-unneeded-internal-declaration",
  17. "-Wno-unused-function",
  18. + "-Wno-invalid-offsetof",
  19. + "-Wno-range-loop-construct",
  20. ]
  21. if (!is_nacl || is_nacl_saigo) {
  22. @@ -1938,8 +1940,17 @@ config("no_incompatible_pointer_warnings") {
  23. # Shared settings for both "optimize" and "optimize_max" configs.
  24. # IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags.
  25. if (is_win) {
  26. - common_optimize_on_cflags = [
  27. - "/Ob2", # Both explicit and auto inlining.
  28. + common_optimize_on_cflags = []
  29. + if(is_clang) {
  30. + common_optimize_on_cflags += [
  31. + "/Ob2", # Both explicit and auto inlining.
  32. + ]
  33. + } else {
  34. + common_optimize_on_cflags += [
  35. + "/Ob3", # Both explicit and auto inlining.
  36. + ]
  37. + }
  38. + common_optimize_on_cflags += [
  39. "/Oy-", # Disable omitting frame pointers, must be after /O2.
  40. "/Zc:inline", # Remove unreferenced COMDAT (faster links).
  41. ]
  42. --
  43. 2.30.2