From a94b482b001d99ecffdb31067319773cbde4501e Mon Sep 17 00:00:00 2001 From: Shagun Agrawal Date: Wed, 30 Oct 2024 00:34:36 +0530 Subject: Add emission for functions Able to execute "hello, world" program. Some segmentation faults in specific test steps. Executables not exiting on their own. --- src/cljcc/driver.clj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/cljcc/driver.clj') diff --git a/src/cljcc/driver.clj b/src/cljcc/driver.clj index 8485574..14b9e18 100644 --- a/src/cljcc/driver.clj +++ b/src/cljcc/driver.clj @@ -9,7 +9,8 @@ [clojure.pprint :as pp] [cljcc.log :as log] [cljcc.util :refer [get-os handle-sh mac-aarch64? make-file-name]] - [cljcc.parser :as p])) + [cljcc.parser :as p] + [clojure.string :as str])) (defn- validate-os [] (let [os (get-os)] @@ -44,7 +45,9 @@ assembly-out-file-path (make-file-name directory (remove-extension filename) "s") _ (println assembly-output) _ (spit assembly-out-file-path assembly-output) - output-file (str directory "/" file-without-ext) + output-file (if (:generate-object-file options) + (str directory "/" (str file-without-ext ".o")) + (str directory "/" file-without-ext)) output (if (:generate-object-file options) (handle-sh "gcc" "-c" assembly-file "-o" output-file) (handle-sh "gcc" assembly-file "-o" output-file))] -- cgit v1.2.3