Skip to content
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

rust-lld errors with duplicate symbol: __rustc_debug_gdb_scripts_section__ for embeded target. #52909

Open
jparris opened this issue Jul 31, 2018 · 4 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-embedded Working group: Embedded systems

Comments

@jparris
Copy link

jparris commented Jul 31, 2018

Hi,

I'm using cargo xbuild to compile & link my code to a embedded target. @phil-opp the maintainer of cargo xbuild believes that this is a rust-ldd issue beginning with the second comment.

In short beginning with at least nightly-2018-03-06 I started getting linking error with the signature note: rust-lld: error: duplicate symbol: __rustc_debug_gdb_scripts_section_

My code is currently a private gitlab repo (I'd be happy to add anyone who needs access) but this issue has also been seen with https://github.com/toothbrush7777777/uefi-app-x64.

I've been working around this by adding the --release flag; but I'm at a point where I'd like to add gdb support.

ymir:munin$ just build
RUST_TARGET_PATH=`pwd`/arch/x86_64 cargo xbuild --target=x86_64-uefi
   Compiling bootloader v0.1.0 (file:///home/parrisj/src/munin) 
error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "link" "/Subsystem:EFI_Application" "/Entry:efi_main" "/LIBPATH:/home/parrisj/src/munin/target/sysroot/lib/rustlib/x86_64-uefi/lib" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.16i0u6jlhoj1fwbo.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.16u6js6g0l3k1ic6.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.170lmw1sqqfe80qo.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.1im38lueib99jsk0.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.1y16o1qfye96o7m0.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.2670nmqs1be3ww7y.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.2c1y7jr7pp6yeu55.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.2xj8e5u0nv6enw9x.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.49a7n47po4ttqjl7.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.4xq48u46a1pwiqn7.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.81jpvh8cn5k8ng8.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.8xzrsc1ux72v29j.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.98g0d9x8aw3akpe.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.9fcb3syd3ne5k0n.rcgu.o" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.c6lbtaiefvx3wya.rcgu.o" "/OUT:/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.efi" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.crate.allocator.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/LIBPATH:/home/parrisj/src/munin/target/x86_64-uefi/debug/deps" "/LIBPATH:/home/parrisj/src/munin/target/debug/deps" "/LIBPATH:/home/parrisj/src/munin/target/sysroot/lib/rustlib/x86_64-uefi/lib" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/liblibuefi-73eea763ee59199f.rlib" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/libcty-5c786bc06dad6f6a.rlib" "/home/parrisj/src/munin/target/x86_64-uefi/debug/deps/libbitflags-5e29547bdbbce63f.rlib" "/home/parrisj/src/munin/target/sysroot/lib/rustlib/x86_64-uefi/lib/liballoc-326639068cfe9737.rlib" "/home/parrisj/src/munin/target/sysroot/lib/rustlib/x86_64-uefi/lib/libcore-27ea11fcee464c1f.rlib" "/home/parrisj/src/munin/target/sysroot/lib/rustlib/x86_64-uefi/lib/libcompiler_builtins-e9fbcd04a1fe51f6.rlib"
  = note: rust-lld: error: duplicate symbol: __rustc_debug_gdb_scripts_section__ in /home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.16i0u6jlhoj1fwbo.rcgu.o and in /home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.16u6js6g0l3k1ic6.rcgu.o
          rust-lld: error: duplicate symbol: __rustc_debug_gdb_scripts_section__ in /home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.16i0u6jlhoj1fwbo.rcgu.o and in /home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.170lmw1sqqfe80qo.rcgu.o
          rust-lld: error: duplicate symbol: __rustc_debug_gdb_scripts_section__ in /home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.16i0u6jlhoj1fwbo.rcgu.o and in /home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.1im38lueib99jsk0.rcgu.o
          rust-lld: error: duplicate symbol: __rustc_debug_gdb_scripts_section__ in /home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.16i0u6jlhoj1fwbo.rcgu.o and in /home/parrisj/src/munin/target/x86_64-uefi/debug/deps/bootloader-49ecc39b692d6c5e.1y16o1qfye96o7m0.rcgu.o
...

Target Triple

{
  "llvm-target": "x86_64-pc-windows-msvc",
  "target-endian": "little",
  "target-pointer-width": "64",
  "target-c-int-width": "32",
  "os": "uefi",
  "arch": "x86_64",
  "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
  "linker": "rust-lld",
  "linker-flavor": "lld-link",
  "pre-link-args": {
    "lld-link": [
      "/Subsystem:EFI_Application",
      "/Entry:efi_main"
    ]
  },
  "panic-strategy": "abort",
  "default-hidden-visibility": true,
  "executables": true,
  "exe-suffix": ".efi",
  "is-like-windows": true
}

Version Info

$ rustc --version
rustc 1.29.0-nightly (54628c8ea 2018-07-30)
$ cargo --version
cargo 1.29.0-nightly (2cd36b4ed 2018-07-25)
@toothbrush7777777
Copy link

@jparris FYI, the name is LLD not LDD.

@GabrielMajeri
Copy link
Contributor

I've also had this issue. As a (temporary?) workaround, for both debug and release builds, you can add "emit-debug-gdb-scripts": false to your target.json (see here for an example).

The disadvantage is that you do not get GDB scripts embedded into your binary. That script would tell GDB to load Rust pretty printers. Due to issue #33159, pretty printers don't work anyway, so nothing of value is lost.

@jparris jparris changed the title rust-ldd errors with duplicate symbol: __rustc_debug_gdb_scripts_section__ for embeded target. rust-lld errors with duplicate symbol: __rustc_debug_gdb_scripts_section__ for embeded target. Jul 31, 2018
@jparris
Copy link
Author

jparris commented Jul 31, 2018

@toothbrush7777777 doh
@GabrielMajeri thanks for the pointer to "emit-debug-gdb-scripts" it's a reasonable work around for now.

@memoryruins memoryruins added the A-linkage Area: linking into static, shared libraries and binaries label Sep 15, 2018
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-embedded Working group: Embedded systems labels Nov 9, 2019
@jonas-schievink
Copy link
Contributor

@jparris Is this still an issue?

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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-embedded Working group: Embedded systems
Projects
None yet
Development

No branches or pull requests

5 participants