assembler: give proper permissions to .data section
authorAndy Wingo <wingo@pobox.com>
Tue, 20 Aug 2013 20:08:25 +0000 (22:08 +0200)
committerAndy Wingo <wingo@pobox.com>
Sat, 24 Aug 2013 13:28:03 +0000 (15:28 +0200)
* module/system/vm/assembler.scm (link-data): Give stringbufs the
  "shared" flag already, so we don't attempt to set it at runtime.  Give
  .data sections the SHF_WRITE flag.

module/system/vm/assembler.scm

index 2c46c3b..b2d917d 100644 (file)
@@ -801,8 +801,13 @@ should be .data or .rodata), and return the resulting linker object.
        (modulo (- alignment (modulo address alignment)) alignment)))
 
   (define tc7-vector 13)
-  (define tc7-narrow-stringbuf 39)
-  (define tc7-wide-stringbuf (+ 39 #x400))
+  (define stringbuf-shared-flag #x100)
+  (define stringbuf-wide-flag #x400)
+  (define tc7-stringbuf 39)
+  (define tc7-narrow-stringbuf
+    (+ tc7-stringbuf stringbuf-shared-flag))
+  (define tc7-wide-stringbuf
+    (+ tc7-stringbuf stringbuf-shared-flag stringbuf-wide-flag))
   (define tc7-ro-string (+ 21 #x200))
   (define tc7-rtl-program 69)
 
@@ -941,7 +946,10 @@ should be .data or .rodata), and return the resulting linker object.
                 (lp (1+ i)
                     (align (+ (byte-length obj) pos) 8)
                     (cons (make-linker-symbol obj-label pos) labels)))
-              (make-object asm name buf '() labels))))))))
+              (make-object asm name buf '() labels
+                           #:flags (match name
+                                     ('.data (logior SHF_ALLOC SHF_WRITE))
+                                     ('.rodata SHF_ALLOC))))))))))
 
 (define (link-constants asm)
   "Link sections to hold constants needed by the program text emitted