From 082f868572fcc2aaec0cbdefc2d55afc17951c6e Mon Sep 17 00:00:00 2001 From: nub31 Date: Thu, 26 Jun 2025 15:29:59 +0200 Subject: [PATCH] ... --- src/compiler/CLI/CLI.csproj | 9 ++++++ src/compiler/CLI/Program.cs | 33 ++++++++++++++-------- src/compiler/CLI/runtime/libruntime_x64.a | Bin 0 -> 3890 bytes 3 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 src/compiler/CLI/runtime/libruntime_x64.a diff --git a/src/compiler/CLI/CLI.csproj b/src/compiler/CLI/CLI.csproj index 02350ff..fec4a24 100644 --- a/src/compiler/CLI/CLI.csproj +++ b/src/compiler/CLI/CLI.csproj @@ -14,4 +14,13 @@ + + + + + + + + + diff --git a/src/compiler/CLI/Program.cs b/src/compiler/CLI/Program.cs index ae71806..e59d992 100644 --- a/src/compiler/CLI/Program.cs +++ b/src/compiler/CLI/Program.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Reflection; using CLI; using Generation.QBE; using Syntax; @@ -26,18 +27,13 @@ Directory.CreateDirectory(BIN_INT_DIR); var files = new List(); -var compileOnly = false; -string? outPath = null; +string? runtimePath = null; foreach (var arg in args) { - if (arg == "-c") + if (arg.StartsWith("-r=")) { - compileOnly = true; - } - else if (arg.StartsWith("-o=")) - { - outPath = arg.Substring("-o=".Length); + runtimePath = arg.Substring("-r=".Length); } else { @@ -99,10 +95,25 @@ if (diagnostics.Any(diagnostic => diagnostic.Severity == DiagnosticSeverity.Erro return 1; } -var objectFiles = new List +var objectFiles = new List(); + +if (runtimePath == null) { - "libruntime.a" -}; + const string RUNTIME_NAME = "libruntime_x64"; + await using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(RUNTIME_NAME); + if (stream == null) + { + throw new Exception("Runtime stream is null"); + } + + var tmpDir = Directory.CreateTempSubdirectory("nub"); + runtimePath = Path.Combine(tmpDir.FullName, RUNTIME_NAME + ".a"); + + await using var writer = new FileStream(runtimePath, FileMode.Create, FileAccess.Write); + await stream.CopyToAsync(writer); +} + +objectFiles.Add(runtimePath); foreach (var boundSyntaxTree in boundSyntaxTrees) { diff --git a/src/compiler/CLI/runtime/libruntime_x64.a b/src/compiler/CLI/runtime/libruntime_x64.a new file mode 100644 index 0000000000000000000000000000000000000000..607bb706f972112dc8f8c53cb3842c7cd6901a14 GIT binary patch literal 3890 zcmb_f&2Jk;6rXjPHaJaVDufCxXb>MN5^U`#v1l6=m*8{{e5q1|1QciOZezE#H(IYn zT!DZVp;!?pM-CwM*uS9SfJ9mjt~lj{D#Rg3MKT|Ua*GgBdB52idpuc_w(yf?-n`%Y znAw@}+w~LEZcr*8OCI9=NNZ{|)_cw~*{t-KPcp_Hp!VC~Hfl3AYS$XYLa81GmD)n# zyjNQY%M8?3rs`Eoi%nsqVciSGaM7(*N(DCv+-AY|iyG(qRYqytAaZ;!sDz$OE4;j= zO2~pnEv!^M+n0|z=n1ovlj6xHrm`uHK*Y~?e)EQZZ{t(#! z>%vK9Ev2meyLXMOlJf!L(11hej_*l*nwS~ed6pbVg>4!I_4{!8!#j!xO%?%BTqPvGcc>_34g96+b+82<~fPdnJ3cj8=zy1UqK z9TL0U&tXsYYW`vmiF;h~N*8-aTw3x+NCINdNFJqzJQqO{#9on{r3U^QNCFo_XW%%#M9;MGrE>>+V2YH|6yMWrO_%>P{6;_DbnW>gBbvR8F0HCp2h zYCwY85VgPWL|6w&z;6PjTJb-EB!EX5S9}K~LFIWcQrT@O%{+f;yq+hCi$#F{7&Vpu z5slaVIr#vX7fm522Z~qsXx`w}J^IMtFG~Hg!C#a5n!&4kv0?D)UNF1ftcGrpWEe!U ztVV%%-nBz-DP;C(H*}d@tk;ofbt5vT?wwfP$Hr1-<>Ah7tC-sF|!(I&hMK1`O z6oX7&xo{?Mt0=br9h_2N>$TUENSYHpV~@#mk*e@jW61r~aF#i0I<9~utcgCVjYu^j z^?g!4LlQjhrjAp_yvk9a}vB;_4EmE19|0yUM%=r(K4P09D!SG}0sOp6> zt9T_}B7+($AIPub$Qa*~#OM0cyNSa*W;}A5XHOK{C-2|qP&CMNT?Tb5EFyoi9lilw}PT1}n^04}Zg-@_&Du0#P~4j z(_%nfv~Qf`-F^!pCJxA*in*rs)52~Se8;=?q zSA)uO&h2Ut)??Nmgnl98=cU9PanC=f2B_Lae>MAHKL4N^kduxt_eDo*(5Zg_odNUy literal 0 HcmV?d00001