Fix static string addressing
[scheme.git] / codegen.scm
index 5303b4975854be55bfc5d36aedcf5e607ebe8db9..25d99a199da43889ef289b1e6af1292595aa4af0 100644 (file)
     ('bool-literal (emit "movq $~a, %rax" (if e 1 0)))
     ('int-literal (emit "movq $~a, %rax" e))
     
-    ('static-string (emit "movq $~a, %rax" (cadr e))) ; move label
+    ('static-string (emit "movq (~a), %rax" (cadr e))) ; move label
 
     (else (error #f "don't know how to codegen this"))))
 
     (let ((transformed (extract program)))
       (cons strings transformed))))
 
-(define (codegen-string-data s)
+(define (emit-string-data s)
   (emit "~a:" (car s))
   (emit "\t.string \"~a\"" (cdr s)))
 
 
     (emit "\t.data")
 
-    (for-each codegen-string-data strings)))
+    (for-each emit-string-data strings)))
 
 (define (compile-to-binary program output)
   (when (not (eq? (typecheck program) 'int)) (error #f "not an int"))