Skip to content

Commit

Permalink
[FIX] now files in subdirectorys will automticly have the directory f…
Browse files Browse the repository at this point in the history
…rom where the compilation is called as the root for the outfile + [FIX] removing debug print from ObjectBuilder
  • Loading branch information
Cr0a3 committed Aug 25, 2024
1 parent 45ad2e7 commit 1cb2720
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/Obj/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ impl ObjectBuilder {
offset = -4;
}

eprintln!("{:?}", link);

obj.add_relocation(secText, Relocation {
offset: (link.at as i64 + offset) as u64 + {if let Some(off) = off { *off } else { 0 }},
symbol: to_sym.to_owned(),
Expand Down
15 changes: 14 additions & 1 deletion tools/simplelang/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,20 @@ pub fn main() -> Result<(), Box<dyn Error>> {
if let Some(out) = cli.arg_val("out") {
outfile = out;
} else {
outfile = format!("{}.o", infile.split('.').collect::<Vec<&str>>()[0]);
let file = infile.split("/").collect::<Vec<&str>>().last().unwrap_or(&&infile.as_str()).to_string();
let slices = file.split(".").collect::<Vec<&str>>();

let mut name = String::new();

for slice in &slices {
if slices.last() == Some(slice) {
break;
}

name.push_str(slice);
}

outfile = format!("{}.o", name);
}

let mut triple = Triple::host();
Expand Down

0 comments on commit 1cb2720

Please sign in to comment.