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

Linker script does not get saved with -C save-temps #41208

Closed
jethrogb opened this issue Apr 10, 2017 · 3 comments
Closed

Linker script does not get saved with -C save-temps #41208

jethrogb opened this issue Apr 10, 2017 · 3 comments

Comments

@jethrogb
Copy link
Contributor

jethrogb commented Apr 10, 2017

I ran into this error after upgrading to a more recent Rust version while using a linker script.

This script here is just to trigger the linker error so you can see the linker command line:

# lkr.scr
{ global: X; local: *; };
$ rustc --version
rustc 1.16.0 (30cf806ef 2017-03-10)
$ rustc /dev/null --crate-type cdylib -C save-temps -C link-args=-Wl,--version-script=lkr.scr 
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" 
		  "null.0.o" "-o" "libnull.so" 
		  "-Wl,--version-script=/tmp/rustc.YcKvz9S1aalw/list" 
		  "-Wl,--gc-sections" "-nodefaultlibs" "-L" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" 
		  "-Wl,-Bstatic" "-Wl,-Bdynamic" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-13f36e2630c2d79b.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-a2ef7979b4b3e1d5.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-d22754c8c52de3a1.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-1cc5fcd37568ebc4.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-3b9d178f1de89528.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-93bb403c9fc56f72.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-c53f99154bf815c4.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-17a71bb92a82956c.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-739908a2e215dd88.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-3f4289353c600297.rlib" 
		  "/home/jethro/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-07bfb3bcb2a51da0.rlib" 
		  "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" 
		  "c" "-l" "m" "-l" "rt" "-l" "util" "-shared" 
		  "-Wl,--version-script=lkr.scr"
  = note: /usr/bin/ld: anonymous version tag cannot be combined with other version tags
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

$ cat /tmp/rustc.YcKvz9S1aalw/list
cat: /tmp/rustc.YcKvz9S1aalw/list: No such file or directory
$ 
@michaelwoerister
Copy link
Member

Thanks for the report! So do I understand this correctly: You'd like that the linker script, that the compiler always creates, to not be automatically deleted when -C save-temps is specified?

@jethrogb
Copy link
Contributor Author

Yes

@Mark-Simulacrum
Copy link
Member

Closing in favor of #38068 as it will be fixed by it (that's marked as E-mentor and E-easy by the way!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants