From 85ce72412d070b19ae4665dd26435e34fa79613d Mon Sep 17 00:00:00 2001 From: Lionel VITTE Date: Thu, 2 Feb 2023 11:28:27 +0100 Subject: [PATCH] GCC: make symbols are dynamically available and plugins work The Canadian build will skip the check for rdynamic. And hence the gcc symbols are not dynamically available and the gcc plugins won't work. The opt_pass.*set_pass_param symbols are there but not as exported symbols so nm -D won't see them e.g.. Based on the patch found here https://lists.openembedded.org/g/openembedded-core/topic/rfc_build_linux_with_a_oe/90687587 Change-Id: I4860565319a786f5cc511f50cbfcabad9278ed4b Signed-off-by: Lionel VITTE --- recipes-devtools/gcc/gcc-source_11.3.bbappend | 4 + ...31-make-gcc-plugins-work-for-the-sdk.patch | 80 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 recipes-devtools/gcc/gcc-source_11.3.bbappend create mode 100644 recipes-devtools/gcc/gcc/0031-make-gcc-plugins-work-for-the-sdk.patch diff --git a/recipes-devtools/gcc/gcc-source_11.3.bbappend b/recipes-devtools/gcc/gcc-source_11.3.bbappend new file mode 100644 index 0000000..1700ff6 --- /dev/null +++ b/recipes-devtools/gcc/gcc-source_11.3.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:prepend:stm32mpcommon := "${THISDIR}/gcc:" +SRC_URI += " \ + file://0031-make-gcc-plugins-work-for-the-sdk.patch \ +" diff --git a/recipes-devtools/gcc/gcc/0031-make-gcc-plugins-work-for-the-sdk.patch b/recipes-devtools/gcc/gcc/0031-make-gcc-plugins-work-for-the-sdk.patch new file mode 100644 index 0000000..921786b --- /dev/null +++ b/recipes-devtools/gcc/gcc/0031-make-gcc-plugins-work-for-the-sdk.patch @@ -0,0 +1,80 @@ +From a426b2c12053304035854184976637a665d3396a Mon Sep 17 00:00:00 2001 +From: Lionel VITTE +Date: Wed, 1 Feb 2023 15:29:23 +0100 +Subject: [PATCH] make gcc-plugins work for the sdk + +Upstream-Status: Pending +--- + config/gcc-plugin.m4 | 11 ++++++++++- + gcc/configure | 12 +++++++++++- + gcc/plugin.c | 5 +++++ + 3 files changed, 26 insertions(+), 2 deletions(-) + +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 +diff --git a/gcc/configure b/gcc/configure +index 27ca7dfa4..a731fbbdc 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -32137,8 +32137,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 +diff --git a/gcc/plugin.c b/gcc/plugin.c +index d47fa512a..21a98c223 100644 +--- a/gcc/plugin.c ++++ b/gcc/plugin.c +@@ -980,9 +980,14 @@ 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.17.1 +