hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 813b4792a247a86da3fc1c78fcd54f2cca21446d
parent e76aa414d7f0cbdda05099fb115add36d4c88cc1
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon,  1 Nov 2021 11:27:07 +0100

cmd/hare: add assembly debug symbols

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mcmd/hare/plan.ha | 6+++---
Mcmd/hare/schedule.ha | 14+++++++-------
Mcmd/hare/subcmds.ha | 4++--
3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/cmd/hare/plan.ha b/cmd/hare/plan.ha @@ -197,10 +197,10 @@ fn execute( return exec::check(&st); }; -fn mkfile(plan: *plan, ext: str) str = { +fn mkfile(plan: *plan, input: str, ext: str) str = { static let namebuf: [32]u8 = [0...]; - const name = fmt::bsprintf(namebuf, "temp.{}.{}", - plan.counter, ext); + const name = fmt::bsprintf(namebuf, "temp.{}.{}.{}", + input, plan.counter, ext); plan.counter += 1; return path::join(plan.workdir, name); }; diff --git a/cmd/hare/schedule.ha b/cmd/hare/schedule.ha @@ -111,7 +111,7 @@ fn sched_as(plan: *plan, output: str, input: str, depend: *task...) *task = { output = output, depend = mkdepends(depend...), cmd = alloc([ - os::tryenv("AS", "as"), "-o", output, input, + os::tryenv("AS", "as"), "-g", "-o", output, input, ]), }); append(plan.scheduled, task); @@ -148,7 +148,8 @@ fn sched_hare_object( }; }; - let ssa = mkfile(plan, "ssa"); + const ns = unparse::identstr(namespace); + let ssa = mkfile(plan, ns, "ssa"); let harec = alloc(task { status = status::SCHEDULED, output = ssa, @@ -175,7 +176,6 @@ fn sched_hare_object( let current = false; let output = if (len(namespace) != 0) { let version = hex::encodestr(ver.hash); - let ns = unparse::identstr(namespace); let env = module::identuscore(namespace); defer free(env); @@ -224,7 +224,7 @@ fn sched_hare_object( append(harec.cmd, "-D", plan.context.defines[i]); }; - yield mkfile(plan, "o"); // TODO: Should exes go in the cache? + yield mkfile(plan, ns, "o"); // TODO: Should exes go in the cache? }; for (let i = 0z; i < len(ver.inputs); i += 1) { @@ -243,10 +243,10 @@ fn sched_hare_object( append(plan.scheduled, harec); }; - let s = mkfile(plan, "s"); + let s = mkfile(plan, ns, "s"); let qbe = sched_qbe(plan, s, harec); let hare_obj = sched_as(plan, - if (mixed) mkfile(plan, "o") else output, + if (mixed) mkfile(plan, ns, "o") else output, s, qbe); if (!mixed) { return hare_obj; @@ -262,7 +262,7 @@ fn sched_hare_object( if (!strings::has_suffix(path, ".s")) { continue; }; - append(objs, sched_as(plan, mkfile(plan, "o"), path)); + append(objs, sched_as(plan, mkfile(plan, ns, "o"), path)); }; return sched_ar(plan, output, objs...); }; diff --git a/cmd/hare/subcmds.ha b/cmd/hare/subcmds.ha @@ -275,7 +275,7 @@ fn run(args: []str) void = { sched_module(&plan, dep, &depends); }; - const output = mkfile(&plan, "out"); + const output = mkfile(&plan, "", "out"); sched_hare_exe(&plan, ver, output, depends...); match (plan_execute(&plan, verbose)) { case void => void; @@ -431,7 +431,7 @@ fn test(args: []str) void = { const have_output = len(output) != 0; if (!have_output) { - output = mkfile(&plan, "out"); + output = mkfile(&plan, "", "out"); }; if (len(ver.inputs) == 0) { sched_ld(&plan, strings::dup(output), depends...);