gpt4 book ai didi

rust - 为什么在将自定义目标添加到rust(arm-unknown-linux-uclibceabihf)时得到VFP注册参数?

转载 作者:行者123 更新时间:2023-12-03 11:45:09 26 4
gpt4 key购买 nike

我正在遵循上一个 rust 新闻通讯:https://rust-embedded.github.io/embedonomicon/custom-target.html的指南,并遇到与软/硬浮点配置有关的问题。
我通过将mipsel-unknown-linux-uclibc.json与arm-unknown-linux-gnueabihf.json合并来创建新目标,以获得以下结果:

{
"arch": "arm",
"data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
"dynamic-linking": true,
"env": "uclibc",
"executables": true,
"features": "+strict-align,+v6,+vfp2",
"has-elf-tls": true,
"has-rpath": true,
"is-builtin": false,
"linker-flavor": "gcc",
"linker-is-gnu": true,
"linker": "/home/ykoehler/work/tools/arm-5.3-uclibc-1.0.12/usr/bin/arm-buildroot-linux-uclibcgnueabihf-gcc",
"llvm-target": "arm-unknown-linux-uclibceabihf",
"max-atomic-width": 64,
"os": "linux",
"position-independent-executables": true,
"pre-link-args": {
"gcc": [
"-Wl,--as-needed",
"-Wl,-z,noexecstack"
]
},
"relro-level": "full",
"target-c-int-width": "32",
"target-endian": "little",
"target-family": "unix",
"target-mcount": "_mcount",
"target-pointer-width": "32",
"vendor": "unknown"
}
当我使用新的自定义目标编译带有 cargo 的无标准程序时:
cargo build -Z build-std=core --target arm-unknown-linux-uclibceabihf.json
我收到以下错误:
   Compiling app v0.1.0 (/home/ykoehler/work/app)
error: linking with `/home/ykoehler/work/tools/arm-5.3-uclibc-1.0.12/usr/bin/arm-buildroot-linux-uclibcgnueabihf-gcc` failed: exit code: 1
|
= note: "/home/ykoehler/work/tools/arm-5.3-uclibc-1.0.12/usr/bin/arm-buildroot-linux-uclibcgnueabihf-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-L" "/home/ykoehler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-uclibceabihf/lib" "/home/ykoehler/work/app/target/arm-unknown-linux-uclibceabihf/release/deps/app-92459304df1651f0.app.2jjler86-cgu.0.rcgu.o" "-o" "/home/ykoehler/work/app/target/arm-unknown-linux-uclibceabihf/release/deps/app-92459304df1651f0" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/ykoehler/work/app/target/arm-unknown-linux-uclibceabihf/release/deps" "-L" "/home/ykoehler/work/app/target/release/deps" "-L" "/home/ykoehler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/arm-unknown-linux-uclibceabihf/lib" "-Wl,-Bstatic" "/home/ykoehler/work/app/target/arm-unknown-linux-uclibceabihf/release/deps/librustc_std_workspace_core-375ea25c872246b5.rlib" "/home/ykoehler/work/app/target/arm-unknown-linux-uclibceabihf/release/deps/libcore-34e07d1b528fc142.rlib" "/home/ykoehler/work/app/target/arm-unknown-linux-uclibceabihf/release/deps/libcompiler_builtins-a34a2e58700fb5e5.rlib" "-Wl,-Bdynamic"
= note: /home/ykoehler/work/tools/arm-5.3-uclibc-1.0.12/usr/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabihf/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ld: error: /home/ykoehler/work/app/target/arm-unknown-linux-uclibceabihf/release/deps/app-92459304df1651f0 uses VFP register arguments, /home/ykoehler/work/app/target/arm-unknown-linux-uclibceabihf/release/deps/app-92459304df1651f0.app.2jjler86-cgu.0.rcgu.o does not
/home/ykoehler/work/tools/arm-5.3-uclibc-1.0.12/usr/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabihf/5.3.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ld: failed to merge target specific data of file /home/ykoehler/work/app/target/arm-unknown-linux-uclibceabihf/release/deps/app-92459304df1651f0.app.2jjler86-cgu.0.rcgu.o
/home/ykoehler/work/tools/arm-5.3-uclibc-1.0.12/usr/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/Scrt1.o: In function `_start':
/var/tmp/tool-chains/buildroot-2016.02-5.3-arm/src/buildroot-2016.02/output/build/uclibc-1.0.12/libc/sysdeps/linux/arm/crt1.S:217: undefined reference to `__uClibc_main'
/var/tmp/tool-chains/buildroot-2016.02-5.3-arm/src/buildroot-2016.02/output/build/uclibc-1.0.12/libc/sysdeps/linux/arm/crt1.S:235: undefined reference to `abort'
/var/tmp/tool-chains/buildroot-2016.02-5.3-arm/src/buildroot-2016.02/output/build/uclibc-1.0.12/libc/sysdeps/linux/arm/crt1.S:235: undefined reference to `main'
collect2: error: ld returned 1 exit status


error: aborting due to previous error

error: could not compile `app`.

To learn more, run the command again with --verbose.
此错误表明,从网上阅读有关错误消息的信息时,其他部分使用硬浮点数时,某些代码是使用软浮点数编译的。但是,错误指定的两个文件似乎都是由rust生成的,我不清楚为什么rust会根据我在自定义目标定义文件中提供的信息生成任何软 float 代码。
任何帮助表示赞赏。

最佳答案

我相信您只需要使用arm-unknown-linux-gnueabihf作为llvm-target即可。 VFP错误与可用的浮点指令集有关(即eabihf中的hf代表硬浮点)。我正在努力使armv7-unknown-linux-uclibceabihf目标在rust中工作。在使armv7-unknown-linux-uclibceabihf目标在 rust 中工作时,我收到了相同的VFP错误,事实证明,我只需要对armv7-unknown-linux-gnueabihf使用llvm-target即可。
另外,这是我的armv7-unknown-linux-uclibceabihf的规范文件以供比较:

{
"abi-blacklist": [
"stdcall",
"fastcall",
"vectorcall",
"thiscall",
"win64",
"sysv64"
],
"arch": "arm",
"data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
"dynamic-linking": true,
"env": "uclibc",
"executables": true,
"features": "+v7,+vfp3,-d32,+thumb2,-neon",
"has-elf-tls": true,
"has-rpath": true,
"linker-flavor": "gcc",
"linker-is-gnu": true,
"llvm-target": "armv7-unknown-linux-gnueabihf",
"max-atomic-width": 64,
"os": "linux",
"position-independent-executables": true,
"pre-link-args": {
"gcc": [
"-Wl,--as-needed",
"-Wl,-z,noexecstack"
]
},
"relro-level": "full",
"target-c-int-width": "32",
"target-endian": "little",
"target-family": "unix",
"target-mcount": "\u0001__gnu_mcount_nc",
"target-pointer-width": "32",
"vendor": "unknown"
}

干杯

关于rust - 为什么在将自定义目标添加到rust(arm-unknown-linux-uclibceabihf)时得到VFP注册参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62936931/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com