0041-crossgcc-gmp-Add-upstream-fix-for-GCC-15.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From ee3925486f3567b9fe45cb98a88b9acc64991127 Mon Sep 17 00:00:00 2001
  2. From: Leah Rowe <leah@libreboot.org>
  3. Date: Tue, 29 Apr 2025 21:15:22 +0100
  4. Subject: [PATCH 1/1] crossgcc/gmp: Add upstream fix for GCC 15
  5. See:
  6. https://gmplib.org/list-archives/gmp-devel/2025-January/006279.html
  7. by default, upstream GCC-15 now defaults to -std=c23, instead
  8. of -std=c17, which can cause some build issues.
  9. GMP has this patch on their mailing list for GCC-15 (see link).
  10. Signed-off-by: Leah Rowe <leah@libreboot.org>
  11. ---
  12. .../gmp-6.3.0_acinclude-m4-fix-std-c23.patch | 43 +++++++++++++++++++
  13. 1 file changed, 43 insertions(+)
  14. create mode 100644 util/crossgcc/patches/gmp-6.3.0_acinclude-m4-fix-std-c23.patch
  15. diff --git a/util/crossgcc/patches/gmp-6.3.0_acinclude-m4-fix-std-c23.patch b/util/crossgcc/patches/gmp-6.3.0_acinclude-m4-fix-std-c23.patch
  16. new file mode 100644
  17. index 0000000000..b884b62df7
  18. --- /dev/null
  19. +++ b/util/crossgcc/patches/gmp-6.3.0_acinclude-m4-fix-std-c23.patch
  20. @@ -0,0 +1,43 @@
  21. +From b1b61bc8ab19659f0fb8c0f87edcd79ae1bfef7e Mon Sep 17 00:00:00 2001
  22. +From: Rudi Heitbaum <rudi@heitbaum.com>
  23. +Date: Wed, 22 Jan 2025 02:34:09 +0100
  24. +Subject: [PATCH 1/1] acinclude.m4: fix -std=c23 build failure
  25. +
  26. +Add prototype to configure test function as c23 removes unprototyped
  27. +functions.
  28. +
  29. +gcc-15 switched to -std=c23 by default:
  30. +
  31. + https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
  32. +
  33. +As a result `configure` fails with:
  34. + conftest.c: In function 'f':
  35. + conftest.c:12:48: error: too many arguments to function 'g'; expected 0, have 6
  36. + 12 | for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
  37. + | ^ ~
  38. + conftest.c:7:6: note: declared here
  39. + 7 | void g(){}
  40. + | ^
  41. +
  42. +Link: https://gmplib.org/list-archives/gmp-bugs/2024-November/005550.html
  43. +Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
  44. +---
  45. + acinclude.m4 | 2 +-
  46. + 1 file changed, 1 insertion(+), 1 deletion(-)
  47. +
  48. +diff --git a/acinclude.m4 b/acinclude.m4
  49. +index 9cf9483..1eed843 100644
  50. +--- a/acinclude.m4
  51. ++++ b/acinclude.m4
  52. +@@ -609,7 +609,7 @@ GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 1],
  53. +
  54. + #if defined (__GNUC__) && ! defined (__cplusplus)
  55. + typedef unsigned long long t1;typedef t1*t2;
  56. +-void g(){}
  57. ++void g(int,const t1 *,t1,t1 *,const t1 *,int){}
  58. + void h(){}
  59. + static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
  60. + {t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
  61. +--
  62. +2.39.5
  63. +
  64. --
  65. 2.39.5