Harry-Chen / blog-comments

Use issues to store comments of harrychen.xyz
2 stars 0 forks source link

2022/03/31/arm-isa-exchange-and-veneer/ #18

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

ARM 指令集切换与 Veneer / Thunk - Harry Chen's Blog

众所周知,ARM 架构到目前共有三种获得广泛应用的指令集:AArch32(简称 A32,原本称为 ARM 指令集)、AArch64(简称 A64,原本称为 ARM64 指令集)和 Thumb(简称 T32)。这三种指令集各自也有很多版本演进,基于不同微架构的 CPU 支持的指令集(以及版本)也不同,如:

https://harrychen.xyz/2022/03/31/arm-isa-exchange-and-veneer/

scateu commented 2 years ago

高产橙!

victoryang00 commented 2 years ago

mold啥时候能生产啊,看asahi linux m1上调mold实现爽飞。

Harry-Chen commented 2 years ago

mold啥时候能生产啊,看asahi linux m1上调mold实现爽飞。

mold 是不是只支持 x86_64

victoryang00 commented 2 years ago

mold 是不是只支持 x86_64

mold currently supports x86-64, i386, ARM32, ARM64 and 64-bit RISC-V. https://github.com/rui314/mold/blob/f9768c63528f57ad380b25576016b06ec85929ea/elf/elf.h#L648 是个不错的linker参考实现。

Harry-Chen commented 2 years ago

mold 是不是只支持 x86_64

mold currently supports x86-64, i386, ARM32, ARM64 and 64-bit RISC-V. https://github.com/rui314/mold/blob/f9768c63528f57ad380b25576016b06ec85929ea/elf/elf.h#L648 是个不错的linker参考实现。

随手试了一下:

clang --target=arm-none-eabi --sysroot=/home/harry/gcc-arm-none-eabi-10.3-2021.10/bin/../arm-none-eabi -L /home/harry/gcc-arm-none-eabi-10.3-2021.10/bin/../arm-none-eabi/lib/thumb/v7-a/nofp -L /home/harry/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/thumb/v7-a/nofp/ -fuse-ld=mold -march=armv6 -O3 -mthumb main.o impl.o -o test
ld.mold: elf/arch-arm32.cc:227: void mold::elf::InputSection<mold::elf::ARM32>::apply_reloc_alloc(Context<mold::elf::E> &, mold::elf::u8 *) [E = mold::elf::ARM32]: Assertion `T' failed.
clang: error: unable to execute command: Aborted (core dumped)
clang: error: ld.lld command failed due to signal (use -v to see invocation)

hhhhh,看来没有完全实现

Harry-Chen commented 2 years ago

mold 是不是只支持 x86_64

mold currently supports x86-64, i386, ARM32, ARM64 and 64-bit RISC-V. https://github.com/rui314/mold/blob/f9768c63528f57ad380b25576016b06ec85929ea/elf/elf.h#L648 是个不错的linker参考实现。

随手试了一下:

clang --target=arm-none-eabi --sysroot=/home/harry/gcc-arm-none-eabi-10.3-2021.10/bin/../arm-none-eabi -L /home/harry/gcc-arm-none-eabi-10.3-2021.10/bin/../arm-none-eabi/lib/thumb/v7-a/nofp -L /home/harry/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/thumb/v7-a/nofp/ -fuse-ld=mold -march=armv6 -O3 -mthumb main.o impl.o -o test
ld.mold: elf/arch-arm32.cc:227: void mold::elf::InputSection<mold::elf::ARM32>::apply_reloc_alloc(Context<mold::elf::E> &, mold::elf::u8 *) [E = mold::elf::ARM32]: Assertion `T' failed.
clang: error: unable to execute command: Aborted (core dumped)
clang: error: ld.lld command failed due to signal (use -v to see invocation)

hhhhh,看来没有完全实现

更正一下,看起来 mold 是正确的,具体内容更新到了正文中。