可以在musllibc linux上执行裸金属靶向二进制吗

发布于 2025-01-30 19:05:05 字数 944 浏览 4 评论 0 原文

我的二进制文件编译了 https://developer.arm.com/-/media/media/files/downloads/gnu-a/gnu-a/10.3-2021.07/binrel/binrel/gcc-arm-arm-10.3 -2021.07-x86_64-arm-none-eabi.tar.xz

带有链接标志:

-lstdc++ -Wl,-z,relro,-z,now -pass-exit-codes -lm -Wall '--specs=rdimon.specs' -lrdimon '-mcpu=cortex-a72.cortex-a53' -mthumb -static

成功编译,但是当我在OpenWrt路由器上执行此文件时,它说:

分段故障。

我认为也可以在Linux系统上执行裸机二进制,它与任何OS没有任何关系,而与CPU模型没有任何关系。我对吗?

仅供参考:

我的芯片型号是Rockchip 3389,ARMV8,4 Cortex-A72 Core和2 Cortex-A53 Core,在AARCH64模式下运行

my binary file compiled use toolchain from https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz,

with link flag:

-lstdc++ -Wl,-z,relro,-z,now -pass-exit-codes -lm -Wall '--specs=rdimon.specs' -lrdimon '-mcpu=cortex-a72.cortex-a53' -mthumb -static

compiled successfully, but when I execute this file on my openwrt router, it said:

Segmentation fault.

I think a bare-metal binary can also be executed on a linux system, it doesn't have any relationships with any os, only with a cpu model. Am I right?

FYI:

my chip model was rockchip 3389, armv8, 4 cortex-a72 core and 2 cortex-a53 core, run under aarch64 mode

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乖乖兔^ω^ 2025-02-06 19:05:05
  1. 我认为也可以在Linux系统上执行裸机二进制,它与任何OS没有任何关系,而仅与CPU模型。我是吗?
    不,你不是。

  2. 如果您的SOC具有A72和A53内核,则您不会使用正确的编译器:如果您为其编写裸机程序,则必须使用工具链,而不是 arm-none-eabi 一个,

  3. OpenWrt是一个Linux操作系统:在 glibc -基于linux系统,您将使用 aarch64-none-none-linux-gnu 工具链,但是当针对 musl-libc 基于基于的系统时,例如,您应该使用a aarch64-linux-musl toolchain。 P>

  1. I think a bare-metal binary can also be executed on a linux system, it doesn't have any relationships with any os, only with a cpu model. Am I right?
    No, you are not.

  2. If your SoC has A72 and A53 cores, you are not using the right compiler: if you were writing bare-metal programs for it, you would have to use the aarch64-none-elf toolchain, and not the arm-none-eabi one,

  3. OpenWRT is a Linux operating system: on a glibc-based Linux system, you would use the aarch64-none-linux-gnu toolchain, but when targeting a musl-libc-based system, you should for example use a aarch64-linux-musl toolchain.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文