rust-lang / rust-lang/rust

linking armv7-unknown-linux-ohos target, rust-lld: error: undefined symbol: rust_eh_personality

Open
#153,468 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-LTO A-panic A-runtime C-bug O-Arm T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Rust: stable 1.94
OS: Linux

building armv7-unknown-linux-ohos target with lto and panic=abort, got error like below:

armv7-unknown-linux-ohos
error: linking with `/home/runner/work/Img/Img/ohos/bin/clang` failed: exit status: 1
  |
  = note:  "/home/runner/work/Img/Img/ohos/bin/clang" "-Wl,--dynamic-list" "-Wl,/home/runner/work/Img/Img/build-dir/armv7-unknown-linux-ohos/lto/deps/rustcBy7okg/list" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/armv7-unknown-linux-ohos/lib/libcompiler_builtins-*.rlib" "-Wl,-Bdynamic" "-lunwind" "-lc" "-L" "/home/runner/work/Img/Img/build-dir/armv7-unknown-linux-ohos/lto/deps/rustcBy7okg/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-Wl,-plugin-opt=O3,-plugin-opt=mcpu=generic" "-L" "<sysroot>/lib/rustlib/armv7-unknown-linux-ohos/lib" "-o" "/home/runner/work/Img/Img/build-dir/armv7-unknown-linux-ohos/lto/deps/img-e0d60e6646497ee1" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-all" "-nodefaultlibs" "-Wl,-rpath,$ORIGIN/../../../../../../../.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-ohos/lib,--enable-new-dtags,-z,origin" "--target=armv7--linux-ohos" "-Wl,--icf=all" "-Wl,--relax" "-Wl,--gc-sections" "-Wl,-z,norelro" "-Wl,--as-needed" "-Wl,--discard-all" "-Wl,--build-id=none" "-Wl,--strip-all" "-Wl,--no-eh-frame-hdr" "--sysroot=ohos-root"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: undefined symbol: rust_eh_personality
          >>> referenced by compiler_builtins.d02eefdade3806ec-cgu.134
          >>>               compiler_builtins-4738115301af169b.compiler_builtins.d02eefdade3806ec-cgu.134.rcgu.o:(.ARM.extab.text.__udivmoddi4+0x0) in archive /home/runner/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-ohos/lib/libcompiler_builtins-4738115301af169b.rlib
          clang-15: error: linker command failed with exit code 1 (use -v to see invocation)

same code,
aarch64-unknown-linux-ohos and x86_64-unknown-linux-ohos targets build succeed!
only armv7-unknown-linux-ohos failed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the armv7-unknown-linux-ohos build with Rust 1.94, LTO, and panic=abort, then compare it with the successful aarch64 and x86_64 builds. Inspect the shown linker arguments and compiler_builtins archive to trace why rust_eh_personality is unresolved. Done means the armv7 target links successfully under the reported configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.