1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-07 16:59:22 +00:00

gcc: Fix riscv multilib issues in plain toolchains

RISC-V multilib currently doesn't work at all. We could disable multilib for
the riscv platform but that would then behave differently to all our others.
Instead, copy the non-multilib config over the multilib config for now for
riscv, meaning we can keep the platforms similar.

This isn't quite enough as the triplet specific c++ headers are in the wrong
place leading to compiler issues and testimage failures. Work around that too
until someone adds full multilib support for the platform (if desired).

(From OE-Core rev: 3081f62c18fcee642ab43efa717c8f71d51ae587)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2025-05-14 15:29:16 +01:00
parent 4f7ad219f4
commit 420d5b1611
2 changed files with 11 additions and 0 deletions
@@ -34,6 +34,7 @@ python gcc_multilib_setup() {
'%s/aarch64/aarch64-linux.h' % src_conf_dir,
'%s/aarch64/aarch64-cores.def' % src_conf_dir,
'%s/arm/linux-eabi.h' % src_conf_dir,
'%s/riscv/t-linux*' % src_conf_dir,
'%s/*/linux.h' % src_conf_dir,
'%s/linux.h' % src_conf_dir)
@@ -45,6 +46,9 @@ python gcc_multilib_setup() {
bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir))
bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path))
# For now, force the riscv multilib view to our own meaning we can always enable multilib
bb.utils.copyfile('%s/riscv/t-linux' % src_conf_dir, '%s/riscv/t-linux-multilib' % build_conf_dir)
pn = d.getVar('PN')
multilibs = (d.getVar('MULTILIB_VARIANTS') or '').split()
if not multilibs and pn != "nativesdk-gcc":
@@ -145,6 +149,7 @@ python gcc_multilib_setup() {
'i686' : ['gcc/config/i386/t-linux64'],
'mips' : ['gcc/config/mips/t-linux64'],
'mips64' : ['gcc/config/mips/t-linux64'],
'riscv64' : ['gcc/config/riscv/t-linux-multilib'],
'powerpc' : ['gcc/config/rs6000/t-linux64'],
'powerpc64' : ['gcc/config/rs6000/t-linux64'],
'aarch64' : ['gcc/config/aarch64/t-aarch64'],
@@ -161,6 +166,7 @@ python gcc_multilib_setup() {
'powerpc64' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'],
'aarch64' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
'arm' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
'riscv64' : ['gcc/config/linux.h'],
}
libdir32 = 'SYSTEMLIBS_DIR'
@@ -144,6 +144,11 @@ do_install:append:class-target () {
ln -sf ../${X86ARCH32}${TARGET_VENDOR}-${TARGET_OS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}/32
fi
if [ "${TARGET_ARCH}" = "riscv64" -a "${MULTILIB_VARIANTS}" = "" ]; then
mv ${D}${includedir}/c++/${BINV}/${TARGET_SYS}/bits/* ${D}${includedir}/c++/${BINV}/bits
mv ${D}${includedir}/c++/${BINV}/${TARGET_SYS}/ext/* ${D}${includedir}/c++/${BINV}/ext
fi
if [ "${TCLIBC}" != "glibc" ]; then
case "${TARGET_OS}" in
"linux-musl" | "linux-*spe") extra_target_os="linux";;