projects
/
scheme.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2a42546
)
Always use PIC for static string codegen
author
Luke Lau
<luke_lau@icloud.com>
Mon, 29 Jul 2019 12:18:11 +0000
(13:18 +0100)
committer
Luke Lau
<luke_lau@icloud.com>
Mon, 29 Jul 2019 12:18:11 +0000
(13:18 +0100)
codegen.scm
patch
|
blob
|
history
diff --git
a/codegen.scm
b/codegen.scm
index 7c1c3a150727c969a991021fd2c3470e221f573e..00e01296af20661539f8fda3d882c6fa39547092 100644
(file)
--- a/
codegen.scm
+++ b/
codegen.scm
@@
-249,11
+249,6
@@
(emit "pop %rbp") ; restore caller's base pointer
(emit "ret")))
(emit "pop %rbp") ; restore caller's base pointer
(emit "ret")))
-(define (codegen-string label)
- (case target
- ('darwin (emit "movq ~a@GOTPCREL(%rip), %rax" label))
- ('linux (emit "lea $~a, %rax" label))))
-
(define cur-label 0)
(define (fresh-label)
(set! cur-label (+ 1 cur-label))
(define cur-label 0)
(define (fresh-label)
(set! cur-label (+ 1 cur-label))
@@
-300,7
+295,8
@@
('bool-literal (emit "movq $~a, %rax" (if e 1 0)))
('int-literal (emit "movq $~a, %rax" e))
('bool-literal (emit "movq $~a, %rax" (if e 1 0)))
('int-literal (emit "movq $~a, %rax" e))
- ('static-string (codegen-string (cadr e)))
+ ('static-string (emit "movq ~a@GOTPCREL(%rip), %rax"
+ (cadr e)))
(else (error #f "don't know how to codegen this"))))
(else (error #f "don't know how to codegen this"))))