Skip to content

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

@Wyvern

Description

@Wyvern

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LTOArea: Link-time optimization (LTO)A-panicArea: Panicking machineryA-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-bugCategory: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions