diff mbox series

[1/2] classes/recipes: Switch virtual/XXX-gcc to virtual/cross-cc (and c++/binutils)

Message ID 20250115204830.4030611-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series [1/2] classes/recipes: Switch virtual/XXX-gcc to virtual/cross-cc (and c++/binutils) | expand

Commit Message

Richard Purdie Jan. 15, 2025, 8:48 p.m. UTC
The idea of the base class dependency is to say "yes, I need a C cross compiler"
and this was never meant to be gcc specific. Looking at the codebase, whilst we
code triplets into this, it does overcomplicate things as there are only ever
limited, "target", "sdk" and the class extended versions like mutlilib.

After much thought, we can simplify this to virtual/cross-cc and virtual/cross-sdk-cc.

This lets us remove the "gcc" specific element as well as removing the over
complicated triplet usage.

At the same time, change the much less widely used "g++" variant to "c++" for
similar reasons and remove the triplet from virtual/XXX-binutils too.

Backwards compatibility mappings could be left but are just going to confuse
things in future so we'll just require users to update.

This simplification, whilst disruptive for any toolchain focused layers, will
make improved toolchain selection in the future much easier.

Since we no longer have overlapping variables, some code for that can just
be removed. The class extension code does need to start remapping some variables
but not the crosssdk target recipe names.

This patch is in two pieces, this one handles the renaming with the functional
changes separate in a second for easier review even if this breaks bisection.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes-global/base.bbclass              | 12 +----------
 meta/classes-global/staging.bbclass           |  4 ++--
 meta/classes-recipe/image_types_wic.bbclass   |  2 +-
 meta/classes-recipe/kernel-yocto.bbclass      |  4 ++--
 meta/classes-recipe/kernel.bbclass            |  2 +-
 meta/classes-recipe/uki.bbclass               |  2 +-
 meta/conf/distro/include/tclibc-baremetal.inc |  4 ++--
 meta/conf/distro/include/tcmode-default.inc   | 20 +++++++++++--------
 meta/lib/oe/classextend.py                    |  4 +++-
 meta/recipes-core/glibc/glibc.inc             |  2 +-
 meta/recipes-core/meta/wic-tools.bb           |  2 +-
 meta/recipes-core/musl/libssp-nonshared.bb    |  4 ++--
 meta/recipes-core/musl/musl_git.bb            |  4 ++--
 meta/recipes-core/newlib/newlib.inc           |  2 +-
 meta/recipes-core/picolibc/picolibc_git.bb    |  2 +-
 .../binutils/binutils-cross-canadian.inc      |  2 +-
 .../binutils/binutils-cross.inc               |  2 +-
 .../binutils/binutils-crosssdk_2.43.1.bb      |  2 ++
 .../binutils/binutils-testsuite_2.43.1.bb     |  6 +++---
 meta/recipes-devtools/gcc/gcc-common.inc      |  3 ++-
 .../gcc/gcc-cross-canadian.inc                |  2 +-
 meta/recipes-devtools/gcc/gcc-cross.inc       |  4 ++--
 meta/recipes-devtools/gcc/gcc-crosssdk.inc    |  4 ++--
 meta/recipes-devtools/gcc/gcc-runtime.inc     |  5 +++--
 meta/recipes-devtools/gcc/gcc-sanitizers.inc  |  8 ++++----
 meta/recipes-devtools/gcc/libgcc-initial.inc  |  2 +-
 meta/recipes-devtools/gcc/libgcc.inc          |  2 +-
 meta/recipes-devtools/gcc/libgfortran.inc     |  2 +-
 .../gdb/gdb-cross-canadian.inc                |  2 +-
 .../recipes-devtools/go/go-cross-canadian.inc |  4 ++--
 meta/recipes-devtools/go/go-crosssdk.inc      |  2 +-
 .../rust/rust-cross-canadian.inc              |  2 +-
 32 files changed, 62 insertions(+), 62 deletions(-)

Comments

Richard Purdie Jan. 16, 2025, 4:56 p.m. UTC | #1
I should perhaps talk about the issues this patch series highlights.

My first observation is a conflcit between my choice of "virtual/cross-
sdk-cc" and our renaming wanting it to become "virtual/nativesdk-cross-
sdk-cc" due to MLPREFIX being needed/added for multilibs. I'm torn on
going through another iteration trying to see if "virtual/nativesdk-
cross-cc" works better, I suspect it will.

My second set of concerns are around the usability. The patch
implements DEPENDS remapping but not task[depend] handling so you end
up with changes like:

-POPULATESYSROOTDEPS:class-target = "virtual/cross-binutils:do_populate_sysroot"
+POPULATESYSROOTDEPS:class-target = "${PREFERRED_PROVIDER_virtual/cross-binutils}:do_populate_sysroot"

for the 4 cases I found where this is done in core. Not the end of the
world but will catch someone out in future (probably me).

The need to hack around the problem with allarch due to ordering issues
is a bad sign too.

I'd note that if we accepted the syntax above more widely, we could do
that everywhere and not need the remapping. It is really ugly and
unreadable though so I'm thinking that would be the wrong move.

One alternative to the second patch's approach could be "filter"
implementation for variables (Joshua once had a prototype of it) which
would help DEPENDS but not task flags.

Another would be to drop this "in metadata" approach and move the
remapping to bitbake and make it API. This was going to be my original
approach until I realised something was possible in the metadata.

Thanks for Joshua for talking through this for a minute, it has
encouraged me to write down the issues/questions.

There is unfortunately a little bit of deadline pressure too since M2
is due on Monday and I'd ideally prefer to get a change like this into
M2.

Cheers,

Richard
ChenQi Jan. 17, 2025, 10:13 a.m. UTC | #2
On 1/17/25 00:56, Richard Purdie via lists.openembedded.org wrote:
> I should perhaps talk about the issues this patch series highlights.
>
> My first observation is a conflcit between my choice of "virtual/cross-
> sdk-cc" and our renaming wanting it to become "virtual/nativesdk-cross-
> sdk-cc" due to MLPREFIX being needed/added for multilibs. I'm torn on
> going through another iteration trying to see if "virtual/nativesdk-
> cross-cc" works better, I suspect it will.
I just tried. Yes. It works better.
>
> My second set of concerns are around the usability. The patch
> implements DEPENDS remapping but not task[depend] handling so you end
> up with changes like:
>
> -POPULATESYSROOTDEPS:class-target = "virtual/cross-binutils:do_populate_sysroot"
> +POPULATESYSROOTDEPS:class-target = "${PREFERRED_PROVIDER_virtual/cross-binutils}:do_populate_sysroot"

I think if we put the remapping in the bb.event.RecipeTaskPreProcess 
event handler, we can avoid doing changes like above. The allarch hack 
is also not needed.

I'm testing a patch locally, no error so far. I'll send out the patch if 
things work, or just add some more info here if things fail.

Regards,

Qi

>
> for the 4 cases I found where this is done in core. Not the end of the
> world but will catch someone out in future (probably me).
>
> The need to hack around the problem with allarch due to ordering issues
> is a bad sign too.
>
> I'd note that if we accepted the syntax above more widely, we could do
> that everywhere and not need the remapping. It is really ugly and
> unreadable though so I'm thinking that would be the wrong move.
>
> One alternative to the second patch's approach could be "filter"
> implementation for variables (Joshua once had a prototype of it) which
> would help DEPENDS but not task flags.
>
> Another would be to drop this "in metadata" approach and move the
> remapping to bitbake and make it API. This was going to be my original
> approach until I realised something was possible in the metadata.
>
> Thanks for Joshua for talking through this for a minute, it has
> encouraged me to write down the issues/questions.
>
> There is unfortunately a little bit of deadline pressure too since M2
> is due on Monday and I'd ideally prefer to get a change like this into
> M2.
>
> Cheers,
>
> Richard
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#209969): https://lists.openembedded.org/g/openembedded-core/message/209969
> Mute This Topic: https://lists.openembedded.org/mt/110650523/7304865
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Qi.Chen@eng.windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
ChenQi Jan. 17, 2025, 10:29 a.m. UTC | #3
Hi Richard,

I adjusted your second patch a little bit and things seem to work well. 
I've sent out the patch.
https://lists.openembedded.org/g/openembedded-core/message/209982

The testing matrix include:
1) bitbake core-image-minimal
2) enable multilib; IMAGE_INSTALL:append = " lib32-sysstat"; bitbake 
core-image-minimal; start qemu
3) bitbake core-image-minimal -c populate_sdk
4) bitbake -n world

Regards,
Qi

On 1/17/25 18:13, Chen Qi via lists.openembedded.org wrote:
> On 1/17/25 00:56, Richard Purdie via lists.openembedded.org wrote:
>> I should perhaps talk about the issues this patch series highlights.
>>
>> My first observation is a conflcit between my choice of "virtual/cross-
>> sdk-cc" and our renaming wanting it to become "virtual/nativesdk-cross-
>> sdk-cc" due to MLPREFIX being needed/added for multilibs. I'm torn on
>> going through another iteration trying to see if "virtual/nativesdk-
>> cross-cc" works better, I suspect it will.
> I just tried. Yes. It works better.
>>
>> My second set of concerns are around the usability. The patch
>> implements DEPENDS remapping but not task[depend] handling so you end
>> up with changes like:
>>
>> -POPULATESYSROOTDEPS:class-target = 
>> "virtual/cross-binutils:do_populate_sysroot"
>> +POPULATESYSROOTDEPS:class-target = 
>> "${PREFERRED_PROVIDER_virtual/cross-binutils}:do_populate_sysroot"
>
> I think if we put the remapping in the bb.event.RecipeTaskPreProcess 
> event handler, we can avoid doing changes like above. The allarch hack 
> is also not needed.
>
> I'm testing a patch locally, no error so far. I'll send out the patch 
> if things work, or just add some more info here if things fail.
>
> Regards,
>
> Qi
>
>>
>> for the 4 cases I found where this is done in core. Not the end of the
>> world but will catch someone out in future (probably me).
>>
>> The need to hack around the problem with allarch due to ordering issues
>> is a bad sign too.
>>
>> I'd note that if we accepted the syntax above more widely, we could do
>> that everywhere and not need the remapping. It is really ugly and
>> unreadable though so I'm thinking that would be the wrong move.
>>
>> One alternative to the second patch's approach could be "filter"
>> implementation for variables (Joshua once had a prototype of it) which
>> would help DEPENDS but not task flags.
>>
>> Another would be to drop this "in metadata" approach and move the
>> remapping to bitbake and make it API. This was going to be my original
>> approach until I realised something was possible in the metadata.
>>
>> Thanks for Joshua for talking through this for a minute, it has
>> encouraged me to write down the issues/questions.
>>
>> There is unfortunately a little bit of deadline pressure too since M2
>> is due on Monday and I'd ideally prefer to get a change like this into
>> M2.
>>
>> Cheers,
>>
>> Richard
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#209981): https://lists.openembedded.org/g/openembedded-core/message/209981
> Mute This Topic: https://lists.openembedded.org/mt/110650523/3618072
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Qi.Chen@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index c8268abcdf7..dbbf6cef8c8 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -48,7 +48,7 @@  def get_base_dep(d):
         return ""
     return "${BASE_DEFAULT_DEPS}"
 
-BASE_DEFAULT_DEPS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}compilerlibs virtual/libc"
+BASE_DEFAULT_DEPS = "virtual/cross-cc virtual/compilerlibs virtual/libc"
 
 BASEDEPENDS = ""
 BASEDEPENDS:class-target = "${@get_base_dep(d)}"
@@ -312,16 +312,6 @@  python base_eventhandler() {
         if statusheader:
             bb.plain('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines)))
 
-    # This code is to silence warnings where the SDK variables overwrite the 
-    # target ones and we'd see duplicate key names overwriting each other
-    # for various PREFERRED_PROVIDERS
-    if isinstance(e, bb.event.RecipePreFinalise):
-        if d.getVar("TARGET_PREFIX") == d.getVar("SDK_PREFIX"):
-            d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils")
-            d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc")
-            d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++")
-            d.delVar("PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs")
-
     if isinstance(e, bb.event.RecipeParsed):
         #
         # If we have multiple providers of virtual/X and a PREFERRED_PROVIDER_virtual/X is set
diff --git a/meta/classes-global/staging.bbclass b/meta/classes-global/staging.bbclass
index d9ccf32a739..c58ac63c57d 100644
--- a/meta/classes-global/staging.bbclass
+++ b/meta/classes-global/staging.bbclass
@@ -128,8 +128,8 @@  do_populate_sysroot[vardeps] += "${SYSROOT_PREPROCESS_FUNCS}"
 do_populate_sysroot[vardepsexclude] += "BB_MULTI_PROVIDER_ALLOWED"
 
 POPULATESYSROOTDEPS = ""
-POPULATESYSROOTDEPS:class-target = "virtual/${HOST_PREFIX}binutils:do_populate_sysroot"
-POPULATESYSROOTDEPS:class-nativesdk = "virtual/${HOST_PREFIX}binutils:do_populate_sysroot"
+POPULATESYSROOTDEPS:class-target = "virtual/cross-binutils:do_populate_sysroot"
+POPULATESYSROOTDEPS:class-nativesdk = "virtual/sdk-binutils:do_populate_sysroot"
 do_populate_sysroot[depends] += "${POPULATESYSROOTDEPS}"
 
 SSTATETASKS += "do_populate_sysroot"
diff --git a/meta/classes-recipe/image_types_wic.bbclass b/meta/classes-recipe/image_types_wic.bbclass
index 9a2996658a4..1b422b62802 100644
--- a/meta/classes-recipe/image_types_wic.bbclass
+++ b/meta/classes-recipe/image_types_wic.bbclass
@@ -111,7 +111,7 @@  do_image_wic[deptask] += "do_image_complete"
 WKS_FILE_DEPENDS_DEFAULT = '${@bb.utils.contains_any("BUILD_ARCH", [ 'x86_64', 'i686' ], "syslinux-native", "",d)}'
 WKS_FILE_DEPENDS_DEFAULT += "bmaptool-native cdrtools-native btrfs-tools-native squashfs-tools-native e2fsprogs-native erofs-utils-native"
 # Unified kernel images need objcopy
-WKS_FILE_DEPENDS_DEFAULT += "virtual/${TARGET_PREFIX}binutils"
+WKS_FILE_DEPENDS_DEFAULT += "virtual/cross-binutils"
 WKS_FILE_DEPENDS_BOOTLOADERS = ""
 WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot os-release"
 WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux systemd-boot os-release"
diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index 7d80e9aa527..dea9eba1c2b 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -454,8 +454,8 @@  do_qa_unpack() {
     return
 }
 
-do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}binutils:do_populate_sysroot"
-do_kernel_configme[depends] += "virtual/${TARGET_PREFIX}gcc:do_populate_sysroot"
+do_kernel_configme[depends] += "virtual/cross-binutils:do_populate_sysroot"
+do_kernel_configme[depends] += "virtual/cross-cc:do_populate_sysroot"
 do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot"
 do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
 do_kernel_configme[dirs] += "${S} ${B}"
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index b052b71be77..c01f816f67f 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -12,7 +12,7 @@  KERNEL_PACKAGE_NAME ??= "kernel"
 KERNEL_DEPLOYSUBDIR ??= "${@ "" if (d.getVar("KERNEL_PACKAGE_NAME") == "kernel") else d.getVar("KERNEL_PACKAGE_NAME") }"
 
 PROVIDES += "virtual/kernel"
-DEPENDS += "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}gcc kmod-native bc-native bison-native"
+DEPENDS += "virtual/cross-binutils virtual/cross-cc kmod-native bc-native bison-native"
 DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lzo", "lzop-native", "", d)}"
 DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.lz4", "lz4-native", "", d)}"
 DEPENDS += "${@bb.utils.contains("INITRAMFS_FSTYPES", "cpio.zst", "zstd-native", "", d)}"
diff --git a/meta/classes-recipe/uki.bbclass b/meta/classes-recipe/uki.bbclass
index 441e4a7f8ea..92f690526dc 100644
--- a/meta/classes-recipe/uki.bbclass
+++ b/meta/classes-recipe/uki.bbclass
@@ -64,7 +64,7 @@  DEPENDS += "\
     os-release \
     systemd-boot \
     systemd-boot-native \
-    virtual/${TARGET_PREFIX}binutils \
+    virtual/cross-binutils \
     virtual/kernel \
 "
 
diff --git a/meta/conf/distro/include/tclibc-baremetal.inc b/meta/conf/distro/include/tclibc-baremetal.inc
index f3d27bbaaeb..abea5a71629 100644
--- a/meta/conf/distro/include/tclibc-baremetal.inc
+++ b/meta/conf/distro/include/tclibc-baremetal.inc
@@ -19,10 +19,10 @@  IMAGE_LINGUAS = ""
 LIBC_DEPENDENCIES = ""
 
 EXTRA_OECONF:pn-gcc-cross-${TARGET_ARCH}:append = " --without-headers"
-DEPENDS:remove:pn-meta-toolchain = "virtual/libc virtual/${TARGET_PREFIX}compilerlibs"
+DEPENDS:remove:pn-meta-toolchain = "virtual/libc virtual/compilerlibs"
 
 # certain compiler libs cannot be used without libc, avoid the dependence on compilerlibs
-BASEDEPENDS:remove:class-target = "virtual/${TARGET_PREFIX}compilerlibs"
+BASEDEPENDS:remove:class-target = "virtual/compilerlibs"
 
 TARGET_OS = "elf"
 TARGET_OS:arm = "eabi"
diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc
index c0817a2bf5c..67e83302a33 100644
--- a/meta/conf/distro/include/tcmode-default.inc
+++ b/meta/conf/distro/include/tcmode-default.inc
@@ -2,16 +2,20 @@ 
 # Default toolchain configuration
 #
 
-PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "binutils-cross-${TARGET_ARCH}"
-PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "gcc-cross-${TARGET_ARCH}"
-PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "gcc-cross-${TARGET_ARCH}"
-PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "gcc-runtime"
+PREFERRED_PROVIDER_virtual/cross-binutils = "${MLPREFIX}binutils-cross-${TARGET_ARCH}"
+PREFERRED_PROVIDER_virtual/cross-cc = "${MLPREFIX}gcc-cross-${TARGET_ARCH}"
+PREFERRED_PROVIDER_virtual/cross-c++ = "${MLPREFIX}gcc-cross-${TARGET_ARCH}"
+PREFERRED_PROVIDER_virtual/compilerlibs = "gcc-runtime"
 PREFERRED_PROVIDER_gdb = "gdb"
 
-PREFERRED_PROVIDER_virtual/${SDK_PREFIX}binutils ?= "binutils-crosssdk-${SDK_SYS}"
-PREFERRED_PROVIDER_virtual/${SDK_PREFIX}gcc = "gcc-crosssdk-${SDK_SYS}"
-PREFERRED_PROVIDER_virtual/${SDK_PREFIX}g++ = "gcc-crosssdk-${SDK_SYS}"
-PREFERRED_PROVIDER_virtual/${SDK_PREFIX}compilerlibs = "nativesdk-gcc-runtime"
+PREFERRED_PROVIDER_virtual/cross-binutils:class-nativesdk ?= "binutils-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/cross-cc:class-nativesdk = "gcc-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/cross-c++:class-nativesdk = "gcc-crosssdk-${SDK_SYS}"
+
+PREFERRED_PROVIDER_virtual/cross-sdk-binutils ?= "binutils-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/cross-sdk-cc = "gcc-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/cross-sdk-c++ = "gcc-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/sdk-compilerlibs = "nativesdk-gcc-runtime"
 
 # Default libc config
 PREFERRED_PROVIDER_virtual/gettext ??= "gettext"
diff --git a/meta/lib/oe/classextend.py b/meta/lib/oe/classextend.py
index 5161d33d2d2..7dd4bf94e7f 100644
--- a/meta/lib/oe/classextend.py
+++ b/meta/lib/oe/classextend.py
@@ -32,8 +32,10 @@  class ClassExtender(object):
         if name.endswith("-" + self.extname):
             name = name.replace("-" + self.extname, "")
         if name.startswith("virtual/"):
+            if "cross-sdk" in name:
+                return name
             # Assume large numbers of dashes means a triplet is present and we don't need to convert
-            if name.count("-") >= 3 and name.endswith(("-go", "-binutils", "-gcc", "-g++")):
+            if name.count("-") >= 3 and name.endswith(("-go",)):
                 return name
             subs = name.split("/", 1)[1]
             if not subs.startswith(self.extname):
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
index b08a70aa46a..d8f20c87dd6 100644
--- a/meta/recipes-core/glibc/glibc.inc
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -1,7 +1,7 @@ 
 require glibc-common.inc
 require glibc-ld.inc
 
-DEPENDS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils libgcc-initial linux-libc-headers"
+DEPENDS = "virtual/cross-cc virtual/cross-binutils libgcc-initial linux-libc-headers"
 
 PROVIDES = "virtual/libc"
 PROVIDES += "virtual/libintl virtual/libiconv"
diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb
index 76494e7fca4..fa983ed5f12 100644
--- a/meta/recipes-core/meta/wic-tools.bb
+++ b/meta/recipes-core/meta/wic-tools.bb
@@ -7,7 +7,7 @@  DEPENDS = "\
            mtools-native bmaptool-native grub-native cdrtools-native \
            btrfs-tools-native squashfs-tools-native pseudo-native \
            e2fsprogs-native util-linux-native tar-native erofs-utils-native \
-           virtual/${TARGET_PREFIX}binutils \
+           virtual/cross-binutils \
            "
 DEPENDS:append:x86 = " syslinux-native syslinux grub-efi systemd-boot"
 DEPENDS:append:x86-64 = " syslinux-native syslinux grub-efi systemd-boot"
diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
index e9f652fc3ea..fde3bc97b47 100644
--- a/meta/recipes-core/musl/libssp-nonshared.bb
+++ b/meta/recipes-core/musl/libssp-nonshared.bb
@@ -11,8 +11,8 @@  SRC_URI = "file://stack_chk.c"
 
 INHIBIT_DEFAULT_DEPS = "1"
 
-DEPENDS = "virtual/${TARGET_PREFIX}binutils \
-           virtual/${TARGET_PREFIX}gcc \
+DEPENDS = "virtual/cross-binutils \
+           virtual/cross-cc \
 "
 
 do_configure[noexec] = "1"
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index 1509c2e3108..7a695e7e19d 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -20,8 +20,8 @@  S = "${WORKDIR}/git"
 
 PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt"
 
-DEPENDS = "virtual/${TARGET_PREFIX}binutils \
-           virtual/${TARGET_PREFIX}gcc \
+DEPENDS = "virtual/cross-binutils \
+           virtual/cross-cc \
            libgcc-initial \
            linux-libc-headers \
            bsd-headers \
diff --git a/meta/recipes-core/newlib/newlib.inc b/meta/recipes-core/newlib/newlib.inc
index 34b0f3f747b..668eaa9e96d 100644
--- a/meta/recipes-core/newlib/newlib.inc
+++ b/meta/recipes-core/newlib/newlib.inc
@@ -20,7 +20,7 @@  SRC_URI = "git://sourceware.org/git/newlib-cygwin.git;protocol=https;branch=main
 SRCREV="ad11e2587f83d61357a32c61c36d72ea4f39315e"
 
 INHIBIT_DEFAULT_DEPS = "1"
-DEPENDS = "virtual/${TARGET_PREFIX}gcc"
+DEPENDS = "virtual/cross-cc"
 
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
diff --git a/meta/recipes-core/picolibc/picolibc_git.bb b/meta/recipes-core/picolibc/picolibc_git.bb
index fdb159328fa..e6735184cd5 100644
--- a/meta/recipes-core/picolibc/picolibc_git.bb
+++ b/meta/recipes-core/picolibc/picolibc_git.bb
@@ -1,7 +1,7 @@ 
 require picolibc.inc
 
 INHIBIT_DEFAULT_DEPS = "1"
-DEPENDS = "virtual/${TARGET_PREFIX}gcc"
+DEPENDS = "virtual/cross-cc"
 
 PROVIDES += "virtual/libc virtual/libiconv virtual/libintl"
 
diff --git a/meta/recipes-devtools/binutils/binutils-cross-canadian.inc b/meta/recipes-devtools/binutils/binutils-cross-canadian.inc
index 62ebb3f5bc4..a322114b52f 100644
--- a/meta/recipes-devtools/binutils/binutils-cross-canadian.inc
+++ b/meta/recipes-devtools/binutils/binutils-cross-canadian.inc
@@ -4,7 +4,7 @@  SUMMARY = "GNU binary utilities (cross-canadian for ${TARGET_ARCH} target)"
 PN = "binutils-cross-canadian-${TRANSLATED_TARGET_ARCH}"
 BPN = "binutils"
 
-DEPENDS = "flex-native bison-native virtual/${HOST_PREFIX}gcc virtual/nativesdk-libc nativesdk-zlib nativesdk-gettext nativesdk-flex"
+DEPENDS = "flex-native bison-native virtual/cross-sdk-cc virtual/nativesdk-libc nativesdk-zlib nativesdk-gettext nativesdk-flex"
 EXTRA_OECONF += "--with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \
                 --enable-poison-system-directories \
                 "
diff --git a/meta/recipes-devtools/binutils/binutils-cross.inc b/meta/recipes-devtools/binutils/binutils-cross.inc
index 835d4fa69b7..b908393c1f8 100644
--- a/meta/recipes-devtools/binutils/binutils-cross.inc
+++ b/meta/recipes-devtools/binutils/binutils-cross.inc
@@ -1,5 +1,5 @@ 
 inherit cross
-PROVIDES = "virtual/${TARGET_PREFIX}binutils"
+PROVIDES = "virtual/cross-binutils"
 
 PN = "binutils-cross-${TARGET_ARCH}"
 BPN = "binutils"
diff --git a/meta/recipes-devtools/binutils/binutils-crosssdk_2.43.1.bb b/meta/recipes-devtools/binutils/binutils-crosssdk_2.43.1.bb
index 6752659304e..afc91a9b3bd 100644
--- a/meta/recipes-devtools/binutils/binutils-crosssdk_2.43.1.bb
+++ b/meta/recipes-devtools/binutils/binutils-crosssdk_2.43.1.bb
@@ -1,5 +1,7 @@ 
 require binutils-cross_${PV}.bb
 
+PROVIDES = "virtual/cross-sdk-binutils"
+
 inherit crosssdk
 
 PN = "binutils-crosssdk-${SDK_SYS}"
diff --git a/meta/recipes-devtools/binutils/binutils-testsuite_2.43.1.bb b/meta/recipes-devtools/binutils/binutils-testsuite_2.43.1.bb
index f2facd52c3a..e5e159bc718 100644
--- a/meta/recipes-devtools/binutils/binutils-testsuite_2.43.1.bb
+++ b/meta/recipes-devtools/binutils/binutils-testsuite_2.43.1.bb
@@ -21,9 +21,9 @@  do_configure() {
 }
 
 # target depends
-DEPENDS += "virtual/${TARGET_PREFIX}binutils"
-DEPENDS += "virtual/${TARGET_PREFIX}gcc"
-DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs"
+DEPENDS += "virtual/cross-binutils"
+DEPENDS += "virtual/cross-cc"
+DEPENDS += "virtual/${MLPREFIX}compilerlibs"
 DEPENDS += "virtual/${MLPREFIX}libc"
 
 python check_prepare() {
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
index 01de93cc3c4..de559eb9c3f 100644
--- a/meta/recipes-devtools/gcc/gcc-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -11,7 +11,8 @@  CVE_PRODUCT = "gcc"
 inherit autotools gettext texinfo
 
 BPN = "gcc"
-COMPILERDEP = "virtual/${TARGET_PREFIX}gcc:do_gcc_stash_builddir"
+COMPILERDEP = "${MLPREFIX}gcc-cross-${TARGET_ARCH}:do_gcc_stash_builddir"
+COMPILERDEP:class-nativesdk = "gcc-crosssdk-${SDK_SYS}:do_gcc_stash_builddir"
 
 python extract_stashed_builddir () {
     src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}")
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
index bbe91ad0f9b..a97329e58fd 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -3,7 +3,7 @@  inherit cross-canadian
 SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)"
 PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
 
-DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc nativesdk-gettext flex-native virtual/libc"
+DEPENDS = "virtual/cross-sdk-cc virtual/cross-cc virtual/cross-sdk-binutils virtual/nativesdk-libc nativesdk-gettext flex-native virtual/libc"
 
 GCCMULTILIB = "--enable-multilib"
 
diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc
index f85ccd5c23d..4549f92c2f7 100644
--- a/meta/recipes-devtools/gcc/gcc-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross.inc
@@ -2,8 +2,8 @@  inherit cross
 
 INHIBIT_DEFAULT_DEPS = "1"
 EXTRADEPENDS = ""
-DEPENDS = "virtual/${TARGET_PREFIX}binutils ${EXTRADEPENDS} ${NATIVEDEPS}"
-PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
+DEPENDS = "virtual/cross-binutils ${EXTRADEPENDS} ${NATIVEDEPS}"
+PROVIDES = "virtual/cross-cc virtual/c++"
 python () {
     if d.getVar("TARGET_OS").startswith("linux"):
         d.setVar("EXTRADEPENDS", "linux-libc-headers")
diff --git a/meta/recipes-devtools/gcc/gcc-crosssdk.inc b/meta/recipes-devtools/gcc/gcc-crosssdk.inc
index 7eaad2314cd..1adce65cf89 100644
--- a/meta/recipes-devtools/gcc/gcc-crosssdk.inc
+++ b/meta/recipes-devtools/gcc/gcc-crosssdk.inc
@@ -8,7 +8,7 @@  SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
 
 GCCMULTILIB = "--disable-multilib"
 
-DEPENDS = "virtual/${TARGET_PREFIX}binutils gettext-native ${NATIVEDEPS}"
-PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
+DEPENDS = "virtual/cross-sdk-binutils gettext-native ${NATIVEDEPS}"
+PROVIDES = "virtual/cross-sdk-cc virtual/cross-sdk-c++"
 
 gcc_multilib_setup[vardepsexclude] = "MULTILIB_VARIANTS"
diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
index 7afe34ebed7..7380123ab6b 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -156,8 +156,9 @@  do_install:append:class-target () {
 }
 
 INHIBIT_DEFAULT_DEPS = "1"
-DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc virtual/${MLPREFIX}libc"
-PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
+DEPENDS = "virtual/cross-cc virtual/cross-c++ ${MLPREFIX}libgcc virtual/${MLPREFIX}libc"
+DEPENDS:class-nativesdk = "virtual/cross-sdk-cc virtual/cross-sdk-c++ ${MLPREFIX}libgcc virtual/${MLPREFIX}libc"
+PROVIDES = "virtual/${MLPREFIX}compilerlibs"
 
 BBCLASSEXTEND = "nativesdk"
 
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers.inc b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
index 8c98e9cf8a3..4163e87e1fc 100644
--- a/meta/recipes-devtools/gcc/gcc-sanitizers.inc
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
@@ -48,7 +48,7 @@  do_install () {
 
 INHIBIT_DEFAULT_DEPS = "1"
 ALLOW_EMPTY:${PN} = "1"
-DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc"
+DEPENDS = "virtual/crypt gcc-runtime virtual/cross-cc"
 
 # used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 DEBUG_OPTIMIZATION:append = " -Wno-error"
@@ -75,9 +75,9 @@  RRECOMMENDS:${PN}:append:powerpc64 = " liblsan libtsan"
 RRECOMMENDS:${PN}:append:aarch64 = " liblsan libtsan"
 RRECOMMENDS:${PN}:append:riscv64 = " liblsan libtsan"
 
-do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
-do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
-do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
+do_package_write_ipk[depends] += "virtual/${MLPREFIX}compilerlibs:do_packagedata"
+do_package_write_deb[depends] += "virtual/${MLPREFIX}compilerlibs:do_packagedata"
+do_package_write_rpm[depends] += "virtual/${MLPREFIX}compilerlibs:do_packagedata"
 
 # Only x86, powerpc, sparc, s390, arm, aarch64 and loongarch64 are supported
 COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64|loongarch64|riscv64).*-linux'
diff --git a/meta/recipes-devtools/gcc/libgcc-initial.inc b/meta/recipes-devtools/gcc/libgcc-initial.inc
index 8251e3c2869..ce100d7ddce 100644
--- a/meta/recipes-devtools/gcc/libgcc-initial.inc
+++ b/meta/recipes-devtools/gcc/libgcc-initial.inc
@@ -29,7 +29,7 @@ 
 
 require libgcc-common.inc
 
-DEPENDS = "virtual/${TARGET_PREFIX}gcc"
+DEPENDS = "virtual/cross-cc"
 
 LICENSE = "GPL-3.0-with-GCC-exception"
 
diff --git a/meta/recipes-devtools/gcc/libgcc.inc b/meta/recipes-devtools/gcc/libgcc.inc
index 84a2d930df2..95544753826 100644
--- a/meta/recipes-devtools/gcc/libgcc.inc
+++ b/meta/recipes-devtools/gcc/libgcc.inc
@@ -1,6 +1,6 @@ 
 require libgcc-common.inc
 
-DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ virtual/${MLPREFIX}libc"
+DEPENDS = "virtual/cross-cc virtual/cross-c++ virtual/${MLPREFIX}libc"
 
 do_install:append:class-target () {
 	if [ "${TCLIBC}" != "glibc" ]; then
diff --git a/meta/recipes-devtools/gcc/libgfortran.inc b/meta/recipes-devtools/gcc/libgfortran.inc
index 2a08872c259..4560421ed1f 100644
--- a/meta/recipes-devtools/gcc/libgfortran.inc
+++ b/meta/recipes-devtools/gcc/libgfortran.inc
@@ -49,7 +49,7 @@  do_install () {
 
 # avoid virtual/libc
 INHIBIT_DEFAULT_DEPS = "1"
-DEPENDS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}compilerlibs"
+DEPENDS = "virtual/cross-cc virtual/compilerlibs"
 
 BBCLASSEXTEND = "nativesdk"
 
diff --git a/meta/recipes-devtools/gdb/gdb-cross-canadian.inc b/meta/recipes-devtools/gdb/gdb-cross-canadian.inc
index 058ffbc9c55..b4b6742d13e 100644
--- a/meta/recipes-devtools/gdb/gdb-cross-canadian.inc
+++ b/meta/recipes-devtools/gdb/gdb-cross-canadian.inc
@@ -7,7 +7,7 @@  PN = "gdb-cross-canadian-${TRANSLATED_TARGET_ARCH}"
 BPN = "gdb"
 
 DEPENDS = "nativesdk-ncurses nativesdk-expat nativesdk-gettext nativesdk-gmp nativesdk-mpfr \
-           virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc"
+           virtual/cross-sdk-cc virtual/cross-sdk-binutils virtual/nativesdk-libc"
 
 GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'"
 
diff --git a/meta/recipes-devtools/go/go-cross-canadian.inc b/meta/recipes-devtools/go/go-cross-canadian.inc
index dd485b6799b..7be6fe778f4 100644
--- a/meta/recipes-devtools/go/go-cross-canadian.inc
+++ b/meta/recipes-devtools/go/go-cross-canadian.inc
@@ -1,8 +1,8 @@ 
 inherit cross-canadian
 
 DEPENDS = "go-native virtual/${HOST_PREFIX}go virtual/nativesdk-${HOST_PREFIX}go-runtime \
-           virtual/${HOST_PREFIX}gcc virtual/nativesdk-libc \
-           virtual/nativesdk-${HOST_PREFIX}compilerlibs"
+           virtual/cross-sdk-cc virtual/nativesdk-libc \
+           virtual/nativesdk-compilerlibs"
 PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"
 
 # it uses gcc on build machine during go-cross-canadian bootstrap, but
diff --git a/meta/recipes-devtools/go/go-crosssdk.inc b/meta/recipes-devtools/go/go-crosssdk.inc
index 12939005c06..f2a0521ccf5 100644
--- a/meta/recipes-devtools/go/go-crosssdk.inc
+++ b/meta/recipes-devtools/go/go-crosssdk.inc
@@ -1,6 +1,6 @@ 
 inherit crosssdk
 
-DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils"
+DEPENDS = "go-native virtual/cross-sdk-cc virtual/nativesdk-compilerlibs virtual/cross-sdk-binutils"
 PN = "go-crosssdk-${SDK_SYS}"
 PROVIDES = "virtual/${TARGET_PREFIX}go"
 
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index c34b839d159..0c2f6144b84 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -9,7 +9,7 @@  LICENSE = "MIT"
 
 MODIFYTOS = "0"
 
-DEPENDS += "virtual/${SDK_PREFIX}gcc virtual/nativesdk-libc virtual/nativesdk-${SDK_PREFIX}compilerlibs"
+DEPENDS += "virtual/cross-sdk-cc virtual/nativesdk-libc virtual/nativesdk-compilerlibs"
 
 SRC_URI += "file://target-rust-ccld.c"
 LIC_FILES_CHKSUM = "file://target-rust-ccld.c;md5=af4e0e29f81a34cffe05aa07c89e93e9;endline=7"