0002-RISC-V-fix-build-issue-with-gcc-4.9.x.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From e5253b777eefef7d66d3bd1c641de6d133d3573d Mon Sep 17 00:00:00 2001
  2. From: Romain Naour <romain.naour@gmail.com>
  3. Date: Tue, 2 May 2023 14:21:55 +0200
  4. Subject: [PATCH] RISC-V: fix build issue with gcc 4.9.x
  5. GCC should still build with GCC 4.8.3 or newer [1]
  6. using C++03 by default. But a recent change in
  7. RISC-V port introduced a C++11 feature "std::log2" [2].
  8. Use log2 from the C header, without the namespace [3].
  9. [1] https://gcc.gnu.org/install/prerequisites.html
  10. [2] https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=7caa1ae5e451e780fbc4746a54e3f19d4f4304dc
  11. [3] https://stackoverflow.com/questions/26733413/error-log2-is-not-a-member-of-std
  12. Fixes:
  13. https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/4202276589
  14. gcc/ChangeLog:
  15. * config/riscv/genrvv-type-indexer.cc: Use log2 from the C header, without
  16. the namespace.
  17. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  18. Upstream: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=87c347c2897537a6aa391efbfc5ed00c625434fe
  19. Signed-off-by: Romain Naour <romain.naour@gmail.com>
  20. ---
  21. gcc/config/riscv/genrvv-type-indexer.cc | 4 ++--
  22. 1 file changed, 2 insertions(+), 2 deletions(-)
  23. diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/genrvv-type-indexer.cc
  24. index e677b55290c..eebe382d1c3 100644
  25. --- a/gcc/config/riscv/genrvv-type-indexer.cc
  26. +++ b/gcc/config/riscv/genrvv-type-indexer.cc
  27. @@ -115,9 +115,9 @@ same_ratio_eew_type (unsigned sew, int lmul_log2, unsigned eew, bool unsigned_p,
  28. if (sew == eew)
  29. elmul_log2 = lmul_log2;
  30. else if (sew > eew)
  31. - elmul_log2 = lmul_log2 - std::log2 (sew / eew);
  32. + elmul_log2 = lmul_log2 - log2 (sew / eew);
  33. else /* sew < eew */
  34. - elmul_log2 = lmul_log2 + std::log2 (eew / sew);
  35. + elmul_log2 = lmul_log2 + log2 (eew / sew);
  36. if (float_p)
  37. return floattype (eew, elmul_log2);
  38. --
  39. 2.34.3