Skip to content

Add rust-as exposing llvm-as #137

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

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/bin/rust-as.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
cargo_binutils::Tool::As.rust_exec()
}
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {

match tool {
// Tools that don't need a build
Tool::Ar | Tool::Cov | Tool::Lld | Tool::Profdata => {}
Tool::Ar | Tool::As | Tool::Cov | Tool::Lld | Tool::Profdata => {}
// for some tools we change the CWD (current working directory) and
// make the artifact path relative. This makes the path that the
// tool will print easier to read. e.g. `libfoo.rlib` instead of
Expand Down Expand Up @@ -386,9 +386,13 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {

// post process output
let processed_output = match tool {
Tool::Ar | Tool::Cov | Tool::Lld | Tool::Objcopy | Tool::Profdata | Tool::Strip => {
output.stdout.into()
}
Tool::Ar
| Tool::As
| Tool::Cov
| Tool::Lld
| Tool::Objcopy
| Tool::Profdata
| Tool::Strip => output.stdout.into(),
Tool::Nm | Tool::Objdump | Tool::Readobj => postprocess::demangle(&output.stdout),
Tool::Size => postprocess::size(&output.stdout),
};
Expand Down
4 changes: 3 additions & 1 deletion src/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::rustc::rustlib;
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Tool {
Ar,
As,
Cov,
Lld,
Nm,
Expand All @@ -25,6 +26,7 @@ impl Tool {
pub fn name(self) -> &'static str {
match self {
Tool::Ar => "ar",
Tool::As => "as",
Tool::Cov => "cov",
Tool::Lld => "lld",
Tool::Nm => "nm",
Expand Down Expand Up @@ -102,7 +104,7 @@ impl Tool {
// Whether this tool requires the project to be previously built
pub fn needs_build(self) -> bool {
match self {
Tool::Ar | Tool::Cov | Tool::Lld | Tool::Profdata => false,
Tool::Ar | Tool::As | Tool::Cov | Tool::Lld | Tool::Profdata => false,
Tool::Nm | Tool::Objcopy | Tool::Objdump | Tool::Readobj | Tool::Size | Tool::Strip => {
true
}
Expand Down