Hi,
As already tracked at [1], building an arm32 fails with a OE sdk. This
is caused
by the fact that it is a Canadian build (or at least looks like it). In
my case:
"--build=x86_64-linux --host=x86_64-ve-linux --target=arm-ve-linux-gnueabi"
As a consequence it will skip the check for rdynamic, see [2]. 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 hence Daniel's strings can
find it,
but not as exported symbols so nm -D won't see them e.g..
Attached is patch to workaround that (for Dunfell), by assuming rdynamic
is needed
when the host is linux. I am bit in doubt this cannot always be checked,
the only thing
we want to know if it cc1 needs rdynamic to make the symbols available,
I guess that
can be inspected, without running it. I don't have a true Canadian
setup, so I can't
test that.
Some more fun, the plugin_default_version_check compares the configure
arguments,
I have no idea how that is supposed to work for a cross compiler, so I
simply disabled it.
Furthermore the nativesdk gcc must match the cross gcc (and have some
headers and libraries available):
+TOOLCHAIN_HOST_TASK += " \
+ nativesdk-binutils \
+ nativesdk-binutils-symlinks \
+ nativesdk-cpp \
+ nativesdk-cpp-symlinks \
+ nativesdk-gcc \
+ nativesdk-gcc-plugins \
+ nativesdk-gcc-symlinks \
+ nativesdk-g++ \
+ nativesdk-g++-symlinks \
+ nativesdk-gmp-dev \
+ nativesdk-libmpc-dev \
+ nativesdk-openssl-dev \
+"
Regards,
Jeroen
[1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=14681
[2] https://github.com/gcc-mirror/gcc/blob/master/config/gcc-plugin.m4#L52
From 59c3a48d1102d388858452a3b788fdc08291f02c Mon Sep 17 00:00:00 2001
From: Jeroen Hofstee <[email protected]>
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
diff --git a/meta/recipes-devtools/gcc/gcc-9.3.inc b/meta/recipes-devtools/gcc/gcc-9.3.inc
index c171f673e9..802e41707d 100644
--- a/meta/recipes-devtools/gcc/gcc-9.3.inc
+++ b/meta/recipes-devtools/gcc/gcc-9.3.inc
@@ -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"
diff --git a/meta/recipes-devtools/gcc/gcc-9.3/0001-guess-rdynamic-is-needed-for-a-canadian-build-with-a.patch b/meta/recipes-devtools/gcc/gcc-9.3/0001-guess-rdynamic-is-needed-for-a-canadian-build-with-a.patch
new file mode 100644
index 0000000000..37cef3e775
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-9.3/0001-guess-rdynamic-is-needed-for-a-canadian-build-with-a.patch
@@ -0,0 +1,36 @@
+From aa04699d1ce672e7355d6421c43421def9a5cb67 Mon Sep 17 00:00:00 2001
+From: Jeroen Hofstee <[email protected]>
+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
+
diff --git a/meta/recipes-devtools/gcc/gcc-9.3/0002-rdynamic-autoconf-i-f.patch b/meta/recipes-devtools/gcc/gcc-9.3/0002-rdynamic-autoconf-i-f.patch
new file mode 100644
index 0000000000..a5c74cbc8b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-9.3/0002-rdynamic-autoconf-i-f.patch
@@ -0,0 +1,36 @@
+From 3e89d8ea4ec0d1dcbc646b75466c815368d7e792 Mon Sep 17 00:00:00 2001
+From: Jeroen Hofstee <[email protected]>
+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
+
diff --git a/meta/recipes-devtools/gcc/gcc-9.3/0003-disable-configure-arguments-comparison.patch b/meta/recipes-devtools/gcc/gcc-9.3/0003-disable-configure-arguments-comparison.patch
new file mode 100644
index 0000000000..bf26176ed7
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-9.3/0003-disable-configure-arguments-comparison.patch
@@ -0,0 +1,33 @@
+From fbb24532266605fdc8ceaf21a680b86e2a44973a Mon Sep 17 00:00:00 2001
+From: Jeroen Hofstee <[email protected]>
+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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#164830):
https://lists.openembedded.org/g/openembedded-core/message/164830
Mute This Topic: https://lists.openembedded.org/mt/90687587/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-