Repository: rust
Issue: rust-lld errors with duplicate symbol: __rustc_debug_gdb_scripts_section__ for embeded target.
Labels: A-linkage,T-compiler,C-bug,WG-embedded

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](https://github.com/japaric/xargo/issues/218) 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)
```