Skip to content

Commit 1427d28

Browse files
authored
Merge pull request #137 from mkroening/llvm-as
Add rust-as exposing llvm-as
2 parents 19509f4 + 1c8ff54 commit 1427d28

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/bin/rust-as.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
cargo_binutils::Tool::As.rust_exec()
3+
}

src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {
340340

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

372372
// post process output
373373
let processed_output = match tool {
374-
Tool::Ar | Tool::Cov | Tool::Lld | Tool::Objcopy | Tool::Profdata | Tool::Strip => {
375-
output.stdout.into()
376-
}
374+
Tool::Ar
375+
| Tool::As
376+
| Tool::Cov
377+
| Tool::Lld
378+
| Tool::Objcopy
379+
| Tool::Profdata
380+
| Tool::Strip => output.stdout.into(),
377381
Tool::Nm | Tool::Objdump | Tool::Readobj => postprocess::demangle(&output.stdout),
378382
Tool::Size => postprocess::size(&output.stdout),
379383
};

src/tool.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::rustc::rustlib;
1010
#[derive(Clone, Copy, PartialEq, Eq)]
1111
pub enum Tool {
1212
Ar,
13+
As,
1314
Cov,
1415
Lld,
1516
Nm,
@@ -25,6 +26,7 @@ impl Tool {
2526
pub fn name(self) -> &'static str {
2627
match self {
2728
Tool::Ar => "ar",
29+
Tool::As => "as",
2830
Tool::Cov => "cov",
2931
Tool::Lld => "lld",
3032
Tool::Nm => "nm",
@@ -102,7 +104,7 @@ impl Tool {
102104
// Whether this tool requires the project to be previously built
103105
pub fn needs_build(self) -> bool {
104106
match self {
105-
Tool::Ar | Tool::Cov | Tool::Lld | Tool::Profdata => false,
107+
Tool::Ar | Tool::As | Tool::Cov | Tool::Lld | Tool::Profdata => false,
106108
Tool::Nm | Tool::Objcopy | Tool::Objdump | Tool::Readobj | Tool::Size | Tool::Strip => {
107109
true
108110
}

0 commit comments

Comments
 (0)