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

cargo objdump fails on -triple flag when used with a recent LLVM 11 #269

Open
airelil opened this issue Oct 10, 2020 · 2 comments
Open

cargo objdump fails on -triple flag when used with a recent LLVM 11 #269

airelil opened this issue Oct 10, 2020 · 2 comments

Comments

@airelil
Copy link

airelil commented Oct 10, 2020

Running cargo objdump --bin app --release -- -disassemble -no-show-raw-insn -print-imm-hex as suggested in Inspecting section of QEMU chapter can produce the following error:

cargo objdump --bin app --release -- -disassemble -no-show-raw-insn -print-imm-hex
    Finished release [optimized + debuginfo] target(s) in 0.02s
llvm-objdump: Unknown command line argument '-triple'.  Try: '/home/vk/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objdump --help'
llvm-objdump: Did you mean '--triple'?
llvm-objdump: Unknown command line argument '-disassemble'.  Try: '/home/vk/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objdump --help'
llvm-objdump: Did you mean '--disassemble'?
llvm-objdump: Unknown command line argument '-no-show-raw-insn'.  Try: '/home/vk/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objdump --help'
llvm-objdump: Did you mean '--no-show-raw-insn'?
llvm-objdump: for the --reloc option: may only occur zero or one times!
llvm-objdump: Unknown command line argument '-print-imm-hex'.  Try: '/home/vk/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objdump --help'
llvm-objdump: Did you mean '--print-imm-hex'?

It seems that it's fixed with rust-embedded/cargo-binutils@aa5464b, but might not been yet published on crates.io (rust-embedded/cargo-binutils#93)
I'm using Ubuntu 20.04 with following llvm-objdump version:

bin/llvm-objdump --version
LLVM (http://llvm.org/):
  LLVM version 11.0.0-rust-1.47.0-stable
  Optimized build.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: ivybridge

The workaround for me was installing cargo-binutils from GitHub and running it with double hyphens for all flags:

cargo install --git https://github.com/rust-embedded/cargo-binutils.git

cargo objdump --bin app --release -- --disassemble --no-show-raw-insn --print-imm-hex
@ghost
Copy link

ghost commented Oct 11, 2020

I have exactly the same problem on windows.

bors bot added a commit that referenced this issue Oct 12, 2020
270: llvm-objdump: Use two hyphens in flags to objdump r=eldruin a=adhoore

LLVM 11 changed the behavior of these tools.
See #269

Co-authored-by: Alexander D'hoore <dhoore.alexander@gmail.com>
@burrbull
Copy link
Member

Is issue actual?

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

2 participants