0013-build-config-compiler-set-generic-riscv64-flags.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From a42e058e178f7993351b30a928ac4e464eb16aa9 Mon Sep 17 00:00:00 2001
  2. From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
  3. Date: Fri, 14 Jan 2022 05:06:56 +0000
  4. Subject: [PATCH 13/21] build: config: compiler: set generic riscv64 flags
  5. Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
  6. Signed-off-by: Loh Tien Hock <tienhock.loh@starfivetech.com>
  7. ---
  8. build/config/compiler/BUILD.gn | 14 +++++++++++++-
  9. 1 file changed, 13 insertions(+), 1 deletion(-)
  10. diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
  11. index c9b6fb9c83114..43043a135afa7 100644
  12. --- a/build/config/compiler/BUILD.gn
  13. +++ b/build/config/compiler/BUILD.gn
  14. @@ -1158,6 +1158,17 @@ config("compiler_cpu_abi") {
  15. cflags += [ "-m64" ]
  16. ldflags += [ "-m64" ]
  17. }
  18. + } else if (current_cpu == "riscv64") {
  19. + cflags += [
  20. + "-m64",
  21. + "--target=riscv64-linux-gnu",
  22. + "-mno-relax",
  23. + "-mabi=lp64d",
  24. + ]
  25. + ldflags += [
  26. + "--target=riscv64-linux-gnu",
  27. + "-mno-relax",
  28. + ]
  29. } else if (current_cpu == "s390x") {
  30. cflags += [ "-m64" ]
  31. ldflags += [ "-m64" ]
  32. @@ -1626,7 +1637,8 @@ config("chromium_code") {
  33. if (!is_debug && !using_sanitizer && current_cpu != "s390x" &&
  34. current_cpu != "s390" && current_cpu != "ppc64" &&
  35. - current_cpu != "mips" && current_cpu != "mips64") {
  36. + current_cpu != "mips" && current_cpu != "mips64" &&
  37. + current_cpu != "riscv64") {
  38. # Non-chromium code is not guaranteed to compile cleanly with
  39. # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are
  40. # disabled, so only do that for Release build.
  41. --
  42. 2.25.1