diff mbox series

[5/9] libgcc-common: apply multilib symlinks for nativesdk libgcc

Message ID 20250121085526.1370937-5-hongxu.jia@windriver.com
State New
Headers show
Series [1/9] perl: fix do_install failed for nativesdk-perl | expand

Commit Message

Hongxu Jia Jan. 21, 2025, 8:55 a.m. UTC
Due to the supported SDKMACHINE includes:

  aarch64, i586, i686, loongarch64, ppc64, ppc64le, riscv64, x86_64

Only i586 and x86_64, i686 and x86_64 have multilib relationship,
so create multilib symlinks for i686,i586,x86_64 nativesdk. It will
have no regression when nativesdk-gcc disable multilib support in
which the symlinks is broken

[ YOCTO #15722 ]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/recipes-devtools/gcc/libgcc-common.inc | 40 +++++++++++++++++++++
 1 file changed, 40 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/gcc/libgcc-common.inc b/meta/recipes-devtools/gcc/libgcc-common.inc
index e3db17d700..ac284a0031 100644
--- a/meta/recipes-devtools/gcc/libgcc-common.inc
+++ b/meta/recipes-devtools/gcc/libgcc-common.inc
@@ -140,6 +140,46 @@  fakeroot python do_multilib_install() {
         os.symlink(src, dest)
 }
 
+# this makes multilib gcc files findable for nativesdk gcc
+# to link multilib nativesdk gcc library
+# e.g.
+# For x86_64 nativesdk-libgcc
+#    sysroots/x86_64-pokysdk-linux/usr/lib/i686-pokysdk-linux/14.2.0
+# by creating this symlink to it
+#    sysroots/x86_64-pokysdk-linux/usr/lib64/x86_64-pokysdk-linux/14.2.0/32
+#
+# For i686 nativesdk-libgcc
+#    sysroots/i686-pokysdk-linux/usr/lib64/x86_64-pokysdk-linux/14.2.0
+# by creating this symlink to it
+#    sysroots/i686-pokysdk-linux/usr/lib/i686-pokysdk-linux/14.2.0/64
+
+fakeroot python do_multilib_install:class-nativesdk() {
+    sdk_arch = d.getVar('SDK_ARCH')
+    if sdk_arch not in ['x86_64', 'i686']:
+        return
+
+    binv = d.getVar('BINV')
+    if d.getVar('SDK_ARCH') == 'x86_64':
+        tune_arch = 'i686'
+        tune_bitness = '32'
+        tune_baselib = 'lib'
+    elif d.getVar('SDK_ARCH') in ['i686', 'i586']:
+        tune_arch = 'x86_64'
+        tune_bitness = '64'
+        tune_baselib = 'lib64'
+
+    src = '../../../' + tune_baselib + '/' + \
+        tune_arch + d.getVar('SDK_VENDOR') + \
+        '-' + d.getVar('SDK_OS') + '/' + binv + '/'
+
+    dest = d.getVar('D') + d.getVar('libdir') + '/' + \
+        d.getVar('SDK_SYS') + '/' + binv + '/' + tune_bitness
+
+    if os.path.lexists(dest):
+        os.unlink(dest)
+    os.symlink(src, dest)
+}
+
 def get_original_os(d):
     vendoros = d.expand('${TARGET_ARCH}${ORIG_TARGET_VENDOR}-${TARGET_OS}')
     for suffix in [d.getVar('ABIEXTENSION'), d.getVar('LIBCEXTENSION')]: