From 32ca15d7d733202bd1495d1beed7251bd566ec2d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 7 Nov 2013 10:52:47 +0100 Subject: [PATCH] Write DWARF files list in correct order. * module/system/vm/assembler.scm (link-debug): Fix order of writing the source files list; it was being written backwards. --- module/system/vm/assembler.scm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm index f1663c010..95e6c14ee 100644 --- a/module/system/vm/assembler.scm +++ b/module/system/vm/assembler.scm @@ -1761,15 +1761,18 @@ it will be added to the GC roots at runtime." ;; uleb128 for each of directory the file was found in, the ;; modification time, and the file's size in bytes. We pass ;; zero for the latter three fields. - (vlist-for-each (match-lambda - ((file . code) - (put-bytevector line-port (string->utf8 file)) - (put-u8 line-port 0) - (put-uleb128 line-port 0) ; directory - (put-uleb128 line-port 0) ; mtime - (put-uleb128 line-port 0) ; size - )) - files) + (vlist-fold-right + (lambda (pair seed) + (match pair + ((file . code) + (put-bytevector line-port (string->utf8 file)) + (put-u8 line-port 0) + (put-uleb128 line-port 0) ; directory + (put-uleb128 line-port 0) ; mtime + (put-uleb128 line-port 0))) ; size + seed) + #f + files) (put-u8 line-port 0) ; 0 byte terminating file list. ;; Patch prologue length.