unicorn
unicorn copied to clipboard
Add Backend Support for LoongArch64
Add backend support for LoongArch64, fixing the conflicts with tcg function tcg_out_dupi_vec. The codes are tested by the unit tests on a LoongArch and a x86 machine.
Hello, nice contribution and looks good.
However, before getting merged, changes you need to do at least include:
- Add
UC_ARCH_LONGARCHand relatedUC_MODEdefinitions to unicorn.h - Add a small sample like other architectures.
- Generate register definitions like other archs.
And bonus (maybe in later PR):
- Write a few unit tests
- Generate definitions for all CPU models
- Update bindings
Thank you for this PR.
I try to compile it on Loong Arch Linux, but during the linking phase I get the following error:
[ 92%] Bundling unicorn_archive
/usr/bin/ld: libaarch64-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libm68k-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libmips-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libmipsel-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libmips64-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libmips64el-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libsparc-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libsparc64-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libppc-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libppc64-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libriscv32-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libriscv64-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libs390x-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
/usr/bin/ld: libtricore-softmmu.a(tcg.c.o):(.bss+0x0): multiple definition of `use_lsx_instructions'; libx86_64-softmmu.a(tcg.c.o):(.bss+0x0): first defined here
[ 92%] Built target bundling_target
collect2: 错误:ld 返回 1
@wtdcode This PR adds support for a new backend rather than a new target.
@bet4it I see. Anyway I can test this?
Why not add LoongArch support in your DebianOnQEMU project😄
Why not add LoongArch support in your
DebianOnQEMUproject😄
QEMU supports that? I will check and build ;)
Doesn't build on current Debian rootfs because kernel building has not been merged so far and compilers lack linux headers.
Tried on Loong Archlinux, gcc core dumped while clang give the same error as @yetist suggest. I will investigate a bit more later.
@bet4it I made it work by https://github.com/wtdcode/DebianOnQEMU?tab=readme-ov-file#loongarch64 ;)
@wtdcode
Tried on Loong Archlinux,
gcccore dumped while clang give the same error as @yetist suggest. I will investigate a bit more later.
Is there any latest progress on this issue?