From 59c3a48d1102d388858452a3b788fdc08291f02c Mon Sep 17 00:00:00 2001
From: Jeroen Hofstee <jhofstee@victronenergy.com>
Date: Sun, 24 Apr 2022 23:11:47 +0200
Subject: [PATCH] make gcc-plugins work for the sdk
fixes https://bugzilla.yoctoproject.org/show_bug.cgi?id=14681
---
meta/recipes-devtools/gcc/gcc-9.3.inc | 3 ++
...s-needed-for-a-canadian-build-with-a.patch | 36 +++++++++++++++++++
.../gcc-9.3/0002-rdynamic-autoconf-i-f.patch | 36 +++++++++++++++++++
...sable-configure-arguments-comparison.patch | 33 +++++++++++++++++
4 files changed, 108 insertions(+)
create mode 100644 meta/recipes-devtools/gcc/gcc-9.3/0001-guess-rdynamic-is-needed-for-a-canadian-build-with-a.patch
create mode 100644 meta/recipes-devtools/gcc/gcc-9.3/0002-rdynamic-autoconf-i-f.patch
create mode 100644 meta/recipes-devtools/gcc/gcc-9.3/0003-disable-configure-arguments-comparison.patch
@@ -74,6 +74,9 @@ SRC_URI = "\
file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \
file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \
file://0001-Backport-fix-for-PR-tree-optimization-97236-fix-bad-.patch \
+ file://0001-guess-rdynamic-is-needed-for-a-canadian-build-with-a.patch \
+ file://0002-rdynamic-autoconf-i-f.patch \
+ file://0003-disable-configure-arguments-comparison.patch \
"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
SRC_URI[sha256sum] = "71e197867611f6054aa1119b13a0c0abac12834765fe2d81f35ac57f84f742d1"
new file mode 100644
@@ -0,0 +1,36 @@
+From aa04699d1ce672e7355d6421c43421def9a5cb67 Mon Sep 17 00:00:00 2001
+From: Jeroen Hofstee <jhofstee@victronenergy.com>
+Date: Sun, 24 Apr 2022 18:49:07 +0200
+Subject: [PATCH 1/3] guess -rdynamic is needed for a canadian build with a
+ linux host
+
+https://bugzilla.yoctoproject.org/show_bug.cgi?id=14681
+---
+ config/gcc-plugin.m4 | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
+index 8f2787191..966d4c14e 100644
+--- a/config/gcc-plugin.m4
++++ b/config/gcc-plugin.m4
+@@ -77,7 +77,16 @@ AC_DEFUN([GCC_ENABLE_PLUGINS],
+ AC_MSG_RESULT([$plugin_rdynamic])
+ fi
+ else
+- AC_MSG_RESULT([unable to check])
++ case "${host}" in
++ *-*-linux*)
++ AC_MSG_RESULT([unable to check, guessing -rdynamic is needed])
++ plugin_rdynamic=yes
++ pluginlibs="-rdynamic"
++ ;;
++ *)
++ AC_MSG_RESULT([unable to check])
++ ;;
++ esac
+ fi
+
+ # Check -ldl
+--
+2.25.1
+
new file mode 100644
@@ -0,0 +1,36 @@
+From 3e89d8ea4ec0d1dcbc646b75466c815368d7e792 Mon Sep 17 00:00:00 2001
+From: Jeroen Hofstee <jhofstee@victronenergy.com>
+Date: Sun, 24 Apr 2022 20:42:15 +0200
+Subject: [PATCH 2/3] rdynamic: autoconf -i -f
+
+---
+ gcc/configure | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/configure b/gcc/configure
+index bb86eb091..983da5a71 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -29975,8 +29975,18 @@ $as_echo_n "checking for -rdynamic... " >&6; }
+ $as_echo "$plugin_rdynamic" >&6; }
+ fi
+ else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to check" >&5
++ case "${host}" in
++ *-*-linux*)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to check, guessing -rdynamic is needed" >&5
++$as_echo "unable to check, guessing -rdynamic is needed" >&6; }
++ plugin_rdynamic=yes
++ pluginlibs="-rdynamic"
++ ;;
++ *)
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to check" >&5
+ $as_echo "unable to check" >&6; }
++ ;;
++ esac
+ fi
+
+ # Check -ldl
+--
+2.25.1
+
new file mode 100644
@@ -0,0 +1,33 @@
+From fbb24532266605fdc8ceaf21a680b86e2a44973a Mon Sep 17 00:00:00 2001
+From: Jeroen Hofstee <jhofstee@victronenergy.com>
+Date: Sun, 24 Apr 2022 20:43:17 +0200
+Subject: [PATCH 3/3] disable configure arguments comparison
+
+These will differ for a native versus cross-compiler.
+---
+ gcc/plugin.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/gcc/plugin.c b/gcc/plugin.c
+index 2896c6a93..98c901961 100644
+--- a/gcc/plugin.c
++++ b/gcc/plugin.c
+@@ -977,9 +977,15 @@ plugin_default_version_check (struct plugin_gcc_version *gcc_version,
+ return false;
+ if (strcmp (gcc_version->revision, plugin_version->revision))
+ return false;
++
++#if 0
++ /* In case of a cross compiler, this compares the cross config with the native
++ config, which will always fail, at least for OE. Disable it. */
+ if (strcmp (gcc_version->configuration_arguments,
+ plugin_version->configuration_arguments))
+ return false;
++#endif
++
+ return true;
+ }
+
+--
+2.25.1
+
--
2.25.1