shithub: mc

Download patch

ref: a95129996beaf2388eda0cc8864c0a4d3628b56a
parent: 448a5890b3ec77e741d881f02a199a941275883b
parent: 644e4fd2b841d47dc914c614501ef0e01674f267
author: Ori Bernstein <orib@google.com>
date: Thu Sep 27 11:23:45 EDT 2012

Merge branch 'master' of git+ssh://git.eigenstate.org/git/ori/mc

Conflicts:
	libstd/bld.sh

--- a/configure
+++ b/configure
@@ -33,7 +33,7 @@
 OS=`uname`
 
 echo export INST_ROOT=$prefix > config.mk
-echo \#define Instroot "\"$prefix\"" > config.h
+echo '#define Instroot "' $prefix '"' > config.h
 
 case $OS in
     *Linux*)
@@ -41,8 +41,8 @@
         echo '#define Fprefix ""' >> config.h
         ;;
     *Darwin*)
-        echo '\#define Asmcmd "as -g -o %s %s"' >> config.h
-        echo '\#define Fprefix "_"' >> config.h
+        echo '#define Asmcmd "as -g -o %s %s"' >> config.h
+        echo '#define Fprefix "_"' >> config.h
         ;;
     *)
         echo 'Unknown architecture. Assuming Linux ABI.'
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -1,9 +1,12 @@
 include ../config.mk
 
-all: 
+all: libstd.a
+
+libstd.a:
 	./bld.sh
 .PHONY: clean
 clean:
+	./bld.sh clean
 
 install:
 	mkdir -p  $(INST_ROOT)/myr/lib/
--- a/libstd/bld.sh
+++ b/libstd/bld.sh
@@ -55,19 +55,22 @@
 
 OBJ="$(echo $ASM | sed 's/\.s/.o /g') $(echo $MYR | sed 's/\.myr/.o /g')"
 USE="$(echo $MYR | sed 's/\.myr/.use /g' | sed "s/-$SYS//g")"
-rm -f $OBJ test libstd.a
-assem $ASM
-use $MYR
-build $MYR
+if [ "$1" = "clean" ]; then
+    echo rm -f $OBJ test libstd.a
+    rm -f $OBJ test libstd.a
+else
+    assem $ASM
+    use $MYR
+    build $MYR
 
-echo $MU -mo std $USE
-$MU -mo std $USE
-echo ar -rcs libstd.a $OBJ
-ar -rcs libstd.a $OBJ
+    echo $MU -mo std $USE
+    $MU -mo std $USE
+    echo ar -rcs libstd.a $OBJ
+    ar -rcs libstd.a $OBJ
 
-# build test program
-build test.myr
-COMP="$LD -o test test.o -L. -lstd"
-echo $COMP
-$COMP
-
+    # build test program
+    build test.myr
+    COMP="$LD -o test test.o -L. -lstd"
+    echo $COMP
+    $COMP
+fi
--- a/libstd/start-linux.s
+++ b/libstd/start-linux.s
@@ -5,7 +5,7 @@
     /* enter the main program */
     call	main
     /* exit */
-    movq	%rax,%rbx
+    movq	%rax,%rdi
     movq	$60,%rax
-    sysenter
+    syscall
 
--