[v2] ccache: Fix build with gcc12/mips

Message ID 20220412170331.3234683-1-raj.khem@gmail.com
State New
Headers show
Series [v2] ccache: Fix build with gcc12/mips | expand

Commit Message

Khem Raj April 12, 2022, 5:03 p.m. UTC
Avoid gcc12 failure to inline function on mips

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...t-Do-not-use-always_inline-with-mips.patch | 33 +++++++++++++++++++
 meta/recipes-devtools/ccache/ccache_4.6.bb    |  7 +++-
 2 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/ccache/ccache/0001-fmt-Do-not-use-always_inline-with-mips.patch

Comments

Khem Raj April 14, 2022, 5:48 a.m. UTC | #1
Please drop this patch, since it was a gcc bug which has been now
fixed in gcc trunk [1] and we will have this fix in gcc 12

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105234

On Tue, Apr 12, 2022 at 10:03 AM Khem Raj <raj.khem@gmail.com> wrote:
>
> Avoid gcc12 failure to inline function on mips
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  ...t-Do-not-use-always_inline-with-mips.patch | 33 +++++++++++++++++++
>  meta/recipes-devtools/ccache/ccache_4.6.bb    |  7 +++-
>  2 files changed, 39 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-devtools/ccache/ccache/0001-fmt-Do-not-use-always_inline-with-mips.patch
>
> diff --git a/meta/recipes-devtools/ccache/ccache/0001-fmt-Do-not-use-always_inline-with-mips.patch b/meta/recipes-devtools/ccache/ccache/0001-fmt-Do-not-use-always_inline-with-mips.patch
> new file mode 100644
> index 00000000000..90cf27b4187
> --- /dev/null
> +++ b/meta/recipes-devtools/ccache/ccache/0001-fmt-Do-not-use-always_inline-with-mips.patch
> @@ -0,0 +1,33 @@
> +From e57ce7af6f1ef0400aa847d79a7d3bc8803838bd Mon Sep 17 00:00:00 2001
> +From: Khem Raj <raj.khem@gmail.com>
> +Date: Mon, 11 Apr 2022 20:09:18 -0700
> +Subject: [PATCH] fmt: Do not use always_inline with mips
> +
> +mips/gcc-12 is not able to inline this function as reported here [1]
> +For now workaround this for mips by not forcing always_inline attribute
> +on functions
> +
> +[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105234
> +
> +Upstream-Status: Inappropriate [GCC MIPS Workaround]
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +---
> + src/third_party/fmt/core.h | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/src/third_party/fmt/core.h b/src/third_party/fmt/core.h
> +index 92a7aa1..e343ae0 100644
> +--- a/src/third_party/fmt/core.h
> ++++ b/src/third_party/fmt/core.h
> +@@ -212,7 +212,7 @@
> + #endif
> +
> + #ifndef FMT_INLINE
> +-#  if FMT_GCC_VERSION || FMT_CLANG_VERSION
> ++#  if (FMT_GCC_VERSION || FMT_CLANG_VERSION) && !defined (__mips__)
> + #    define FMT_INLINE inline __attribute__((always_inline))
> + #  else
> + #    define FMT_INLINE inline
> +--
> +2.35.1
> +
> diff --git a/meta/recipes-devtools/ccache/ccache_4.6.bb b/meta/recipes-devtools/ccache/ccache_4.6.bb
> index f019679cf18..740f92fb45e 100644
> --- a/meta/recipes-devtools/ccache/ccache_4.6.bb
> +++ b/meta/recipes-devtools/ccache/ccache_4.6.bb
> @@ -11,7 +11,9 @@ LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=ff5327dc93e2b286c931dda3d6079da9"
>
>  DEPENDS = "zstd"
>
> -SRC_URI = "https://github.com/ccache/ccache/releases/download/v${PV}/${BP}.tar.gz"
> +SRC_URI = "https://github.com/ccache/ccache/releases/download/v${PV}/${BP}.tar.gz \
> +           file://0001-fmt-Do-not-use-always_inline-with-mips.patch \
> +          "
>  SRC_URI[sha256sum] = "73a1767ac6b7c0404a1a55f761a746d338e702883c7137fbf587023062258625"
>
>  UPSTREAM_CHECK_URI = "https://github.com/ccache/ccache/releases/"
> @@ -24,3 +26,6 @@ BBCLASSEXTEND = "native nativesdk"
>
>  PACKAGECONFIG[docs] = "-DENABLE_DOCUMENTATION=ON,-DENABLE_DOCUMENTATION=OFF,asciidoc"
>  PACKAGECONFIG[redis] = "-DREDIS_STORAGE_BACKEND=ON,-DREDIS_STORAGE_BACKEND=OFF,hiredis"
> +PACKAGECONFIG[tests] = "-DENABLE_TESTING=ON,-DENABLE_TESTING=OFF,,"
> +
> +lcl_maybe_fortify:mipsarch = ""
> --
> 2.35.1
>
Richard Purdie April 14, 2022, 8:24 a.m. UTC | #2
On Wed, 2022-04-13 at 22:48 -0700, Khem Raj wrote:
> Please drop this patch, since it was a gcc bug which has been now
> fixed in gcc trunk [1] and we will have this fix in gcc 12
> 
> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105234

Gone from master-next.

Cheers,

Richard

Patch

diff --git a/meta/recipes-devtools/ccache/ccache/0001-fmt-Do-not-use-always_inline-with-mips.patch b/meta/recipes-devtools/ccache/ccache/0001-fmt-Do-not-use-always_inline-with-mips.patch
new file mode 100644
index 00000000000..90cf27b4187
--- /dev/null
+++ b/meta/recipes-devtools/ccache/ccache/0001-fmt-Do-not-use-always_inline-with-mips.patch
@@ -0,0 +1,33 @@ 
+From e57ce7af6f1ef0400aa847d79a7d3bc8803838bd Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 11 Apr 2022 20:09:18 -0700
+Subject: [PATCH] fmt: Do not use always_inline with mips
+
+mips/gcc-12 is not able to inline this function as reported here [1]
+For now workaround this for mips by not forcing always_inline attribute
+on functions
+
+[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105234
+
+Upstream-Status: Inappropriate [GCC MIPS Workaround]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/third_party/fmt/core.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/third_party/fmt/core.h b/src/third_party/fmt/core.h
+index 92a7aa1..e343ae0 100644
+--- a/src/third_party/fmt/core.h
++++ b/src/third_party/fmt/core.h
+@@ -212,7 +212,7 @@
+ #endif
+ 
+ #ifndef FMT_INLINE
+-#  if FMT_GCC_VERSION || FMT_CLANG_VERSION
++#  if (FMT_GCC_VERSION || FMT_CLANG_VERSION) && !defined (__mips__)
+ #    define FMT_INLINE inline __attribute__((always_inline))
+ #  else
+ #    define FMT_INLINE inline
+-- 
+2.35.1
+
diff --git a/meta/recipes-devtools/ccache/ccache_4.6.bb b/meta/recipes-devtools/ccache/ccache_4.6.bb
index f019679cf18..740f92fb45e 100644
--- a/meta/recipes-devtools/ccache/ccache_4.6.bb
+++ b/meta/recipes-devtools/ccache/ccache_4.6.bb
@@ -11,7 +11,9 @@  LIC_FILES_CHKSUM = "file://LICENSE.adoc;md5=ff5327dc93e2b286c931dda3d6079da9"
 
 DEPENDS = "zstd"
 
-SRC_URI = "https://github.com/ccache/ccache/releases/download/v${PV}/${BP}.tar.gz"
+SRC_URI = "https://github.com/ccache/ccache/releases/download/v${PV}/${BP}.tar.gz \
+           file://0001-fmt-Do-not-use-always_inline-with-mips.patch \
+          "
 SRC_URI[sha256sum] = "73a1767ac6b7c0404a1a55f761a746d338e702883c7137fbf587023062258625"
 
 UPSTREAM_CHECK_URI = "https://github.com/ccache/ccache/releases/"
@@ -24,3 +26,6 @@  BBCLASSEXTEND = "native nativesdk"
 
 PACKAGECONFIG[docs] = "-DENABLE_DOCUMENTATION=ON,-DENABLE_DOCUMENTATION=OFF,asciidoc"
 PACKAGECONFIG[redis] = "-DREDIS_STORAGE_BACKEND=ON,-DREDIS_STORAGE_BACKEND=OFF,hiredis"
+PACKAGECONFIG[tests] = "-DENABLE_TESTING=ON,-DENABLE_TESTING=OFF,,"
+
+lcl_maybe_fortify:mipsarch = ""