From 61a99f4a9f1d169849ffc2483634a391d3b16a90 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Mon, 29 Jul 2019 13:18:11 +0100 Subject: [PATCH] Always use PIC for static string codegen --- codegen.scm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/codegen.scm b/codegen.scm index 7c1c3a1..00e0129 100644 --- a/codegen.scm +++ b/codegen.scm @@ -249,11 +249,6 @@ (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)) @@ -300,7 +295,8 @@ ('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")))) -- 2.30.2