cs: repairs for Linux build

This commit is contained in:
Matthew Flatt 2018-04-15 07:22:18 -06:00
parent 82517622c7
commit 69f5395d5d
2 changed files with 9 additions and 1 deletions

View File

@ -97,7 +97,7 @@ void racket_boot(int argc, char **argv, char *self, long segment_offset,
lseek(fd1, pos1, SEEK_SET);
Sregister_boot_file_fd("petite", fd1);
fd2 = open(self, O_RDONLY | O_BINARY);
fd2 = open(self, O_RDONLY | BOOT_O_BINARY);
lseek(fd2, pos2, SEEK_SET);
Sregister_boot_file_fd("scheme", fd2);
}

View File

@ -31,13 +31,21 @@
(add-racket-section src-file dest-file #".rackboot"
(lambda (pos)
(values data 'any1 'any2))))
(define (ensure-executable dest-file)
(let* ([perms1 (file-or-directory-permissions dest-file 'bits)]
[perms2 (bitwise-ior user-read-bit user-write-bit user-execute-bit
perms1)])
(unless (equal? perms1 perms2)
(file-or-directory-permissions dest-file perms2))))
(cond
[start-pos
;; Success as ELF
(ensure-executable dest-file)
start-pos]
[else
;; Not ELF; just append to the end
(copy-file src-file dest-file #t)
(ensure-executable dest-file)
(define pos (file-size dest-file))
(call-with-output-file*
dest-file