Skip to content

Undefined Symbols While Compiling to x86_64-unknown-uefi #66320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gurry opened this issue Nov 12, 2019 · 2 comments
Closed

Undefined Symbols While Compiling to x86_64-unknown-uefi #66320

gurry opened this issue Nov 12, 2019 · 2 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-x86_64 Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@gurry
Copy link
Contributor

gurry commented Nov 12, 2019

I'm trying to compile this crate to the x86_64-unknown-uefi target and getting errors at link time. rust-lld seems not to be able to find symbols __sync_val_compare_and_swap_16 and __sync_lock_test_and_set_16. I believe they are compiler intrinsics, so perhaps they should've come from rustc or the compiler_builtins crate.

Build commandline used: cargo xbuild --target x86_64-unknown-uefi
Nightly version: rustc 1.40.0-nightly (9e34664 2019-11-08)
Host: Windows 10 x64
Build output:

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "link" "/NOLOGO" "/NXCOMPAT" "/nodefaultlib" "/entry:efi_main" "/subsystem:efi_application" "/LIBPATH:C:\\Projects\\personal\\uefi-practice\\target/sysroot\\lib\\rustlib\\x86_64-unknown-uefi\\lib" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.123mw28k7zdzq2hs.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.168luiprrv56txez.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.16ttvqfum6y188eu.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.1dalg2fy51wb8lah.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.1odqm0xkwcmyhq3o.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.24j9n0hj0zaekqvr.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.31oq7a7pt1mgmvjv.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.38ggyki2ov1emb8e.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.3mrbkqg5o6j3v878.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.3y9802a992jwu9sz.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.437tepsiq7p53qdq.rcgu.o" "C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.l05bl28cf0s74oy.rcgu.o" "/OUT:C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps\\uefi_practice-f7df25972b29a10d.efi" "/OPT:REF,NOICF" "/DEBUG" "/LIBPATH:C:\\Projects\\personal\\uefi-practice\\target\\x86_64-unknown-uefi\\debug\\deps" "/LIBPATH:C:\\Projects\\personal\\uefi-practice\\target\\debug\\deps" "/LIBPATH:C:\\Projects\\personal\\uefi-practice\\target/sysroot\\lib\\rustlib\\x86_64-unknown-uefi\\lib" "C:\\Projects\\personal\\uefi-practice\\target\\sysroot\\lib\\rustlib\\x86_64-unknown-uefi\\lib\\librustc_std_workspace_core-4db334855bda32b0.rlib" "C:\\Projects\\personal\\uefi-practice\\target\\sysroot\\lib\\rustlib\\x86_64-unknown-uefi\\lib\\libcore-8f5696ff045f66ab.rlib" "C:\\Projects\\personal\\uefi-practice\\target\\sysroot\\lib\\rustlib\\x86_64-unknown-uefi\\lib\\libcompiler_builtins-1bdfce1174c15c42.rlib"
  = note: rust-lld: error: undefined symbol: __sync_val_compare_and_swap_16
          >>> referenced by libcompiler_builtins-1bdfce1174c15c42.rlib(compiler_builtins-1bdfce1174c15c42.compiler_builtins.en09gzh0-cgu.3.rcgu.o):(__llvm_memcpy_element_unordered_atomic_16)
          >>> referenced by libcompiler_builtins-1bdfce1174c15c42.rlib(compiler_builtins-1bdfce1174c15c42.compiler_builtins.en09gzh0-cgu.3.rcgu.o):(__llvm_memmove_element_unordered_atomic_16)
          >>> referenced by libcompiler_builtins-1bdfce1174c15c42.rlib(compiler_builtins-1bdfce1174c15c42.compiler_builtins.en09gzh0-cgu.3.rcgu.o):(__llvm_memmove_element_unordered_atomic_16)
          >>> referenced by libcompiler_builtins-1bdfce1174c15c42.rlib(compiler_builtins-1bdfce1174c15c42.compiler_builtins.en09gzh0-cgu.3.rcgu.o):(__llvm_memmove_element_unordered_atomic_16)

          rust-lld: error: undefined symbol: __sync_lock_test_and_set_16
          >>> referenced by libcompiler_builtins-1bdfce1174c15c42.rlib(compiler_builtins-1bdfce1174c15c42.compiler_builtins.en09gzh0-cgu.3.rcgu.o):(__llvm_memcpy_element_unordered_atomic_16)
          >>> referenced by libcompiler_builtins-1bdfce1174c15c42.rlib(compiler_builtins-1bdfce1174c15c42.compiler_builtins.en09gzh0-cgu.3.rcgu.o):(__llvm_memmove_element_unordered_atomic_16)
          >>> referenced by libcompiler_builtins-1bdfce1174c15c42.rlib(compiler_builtins-1bdfce1174c15c42.compiler_builtins.en09gzh0-cgu.3.rcgu.o):(__llvm_memmove_element_unordered_atomic_16)
          >>> referenced by libcompiler_builtins-1bdfce1174c15c42.rlib(compiler_builtins-1bdfce1174c15c42.compiler_builtins.en09gzh0-cgu.3.rcgu.o):(__llvm_memmove_element_unordered_atomic_16)
          >>> referenced by libcompiler_builtins-1bdfce1174c15c42.rlib(compiler_builtins-1bdfce1174c15c42.compiler_builtins.en09gzh0-cgu.3.rcgu.o):(__llvm_memset_element_unordered_atomic_16)
@jonas-schievink jonas-schievink added A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-x86_64 Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 12, 2019
@parched
Copy link
Contributor

parched commented Nov 12, 2019

Should be fixed once compiler_builtins is updated to include this fix rust-lang/compiler-builtins#324

@gurry
Copy link
Contributor Author

gurry commented Nov 13, 2019

Fixed with compiler_builtins version 0.1.21

@gurry gurry closed this as completed Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-x86_64 Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants