PGO errors on native with symbols generated by `wit_bindgen::generate!`

未关闭
#1,509 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #1577 来自 @carabistouflette —— 已关闭,未合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust, wasm

调研方向

使用 scripts/build、scripts/build-examples 和文档中记录的 PGO 命令重现 khutulun-dev 中的失败,然后将生成的链接器输入与 floria-plugins.wit 文件和相关的 cargo-pgo issue 进行比较。当 PGO 构建在针对 wit_bindgen::generate! 生成的符号时不再出现 rust-lld 错误并完成,即视为完成。

由索引模型根据 Issue 内容生成。

描述

gen-rust

While trying to create a PGO build of a complex program that uses wasmtime as well as wasmtime::component::bindgen I encountered a linker error during the PGO optimization phase:

 "/home/xxx/.cargo/target/x86_64-unknown-linux-gnu/release/deps/{libregex-c07ab95555f39da0,libregex_automata-7ee923d5f6c2717f,libaho_corasick-5c8f4fd45dbfd81d,libmemchr-6bf3bd84cc706660,libregex_syntax-29ae9a4cd46cd534,libpuccini_plugin_sdk_tosca_2_0-e5bae6e4238f19b8,libchrono-cdb2d612e7931659,libiana_time_zone-e1ddac5c8d3f6e30,libbase64-bc218090048adb9e,libfloria_plugin_sdk-2d3041ed2aa76b6f,libwit_bindgen-d74a0375665663a5,libwaki-0efdb38898b964aa,libform_urlencoded-b370f73aedd7d6ac,libpercent_encoding-3f263064c2841206,libwit_bindgen-fb809008eb3c2160,libwit_bindgen_rt-0a4c48ecc7933c57,libbitflags-50780dc367a8909d,libhttp-25d9a9cb8324f3c8,libitoa-6dd9b0b770f89707,libbytes-fe6d9b7a8a9571c5,libanyhow-8b765c7e03803d5b,libordered_float-1bbdc6eb007024dd,libserde-6a94ee0c090e296d,libserde_core-67855228a5a4e304,libnum_traits-24fe799717f9791d}.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustctoZu3J/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/xxx/.cargo/target/x86_64-unknown-linux-gnu/release/deps/libpuccini_plugin_tosca_2_0.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: /tmp/rustctoZu3J/list:4: ; expected, but got cabi_post_floria:plugins/dispatch
          >>>     cabi_post_floria:plugins/dispatch#[method]custom-resource.replica;
          >>>     ^
          collect2: error: ld returned 1 exit status

As you can see, it seems to have something to do with the symbol name for the C ABI. I opened this issue first on cargo-pgo but it's a head-scratcher.

Maybe we can try to figure this out together?

Steps to Reproduce

Not trivial, but the best way is this:

Clone and install the khutulun-dev repository. And then try to PGO Puccini:

cd puccini
scripts/build
scripts/build-examples
PGO=true WASM_PRECOMPILE=false LTO=false scripts/build -r

(We don't actually need to disable Wasm precompile and LTO, but they don't make a different for this bug and this will get you the results faster)

For reference, here is the WIT file used.

Versions and Environment

Wasmtime version or commit: 41.0.0

Operating system: Fedora 43

Architecture: x86-64

主要语言
Rust
星标
1.5k
派生
306
平均合并
1 天 4 小时
30 天内合并 PR
21

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bytecodealliance/wit-bindgen 的其他 Issue

查看 bytecodealliance/wit-bindgen 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。