load-linker.exec 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. ; Copyright (c) 1993-2005 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ; Load the linker. -*- Mode: Scheme; -*-
  3. ; Run this script with ,exec ,load l.exec.
  4. ; After the script is loaded, you can, in principle, do whatever
  5. ; you might do in the usual linker image. For example, you might do
  6. ; (this is from the Makefile)
  7. ;
  8. ; ,in link-config
  9. ; (load-configuration "interfaces.scm")
  10. ; (load-configuration "packages.scm")
  11. ; (flatload initial-structures)
  12. ; (load "initial.scm")
  13. ; (link-initial-system)
  14. ;
  15. ; This is intended to be used to debug new versions of the compiler or
  16. ; static linker.
  17. (config '(run (define :arguments :values))) ;temporary hack
  18. (translate "=scheme48/" "./")
  19. (load-package 'flatloading)
  20. (open 'flatloading)
  21. (define (r x) (config `(run ,x)))
  22. (r '(define-structure source-file-names (export (%file-name% :syntax))
  23. (open scheme-level-1
  24. syntactic
  25. fluids)
  26. (begin (define-syntax %file-name%
  27. (syntax-rules ()
  28. ((%file-name%) (fluid $source-file-name)))))))
  29. (r '(define-structure enumerated enumerated-interface
  30. (open scheme-level-1 signals)
  31. (files (rts defenum scm))))
  32. (r '(define-structure architecture vm-architecture-interface
  33. (open scheme-level-1 signals enumerated)
  34. (files (rts arch))))
  35. (config '(structure reflective-tower-maker
  36. (export-reflective-tower-maker)))
  37. ; Make the new linker obtain its table, record, etc. structures from
  38. ; the currently running Scheme.
  39. (config '(load "packages.scm"))
  40. (config '(structure %run-time-structures run-time-structures-interface))
  41. (config '(structure %features-structures features-structures-interface))
  42. (r
  43. '(define-structure %linker-structures
  44. (make-linker-structures %run-time-structures
  45. %features-structures
  46. (make-compiler-structures %run-time-structures
  47. %features-structures))))
  48. ; Load the linker's interface and structure definitions.
  49. (config '(load "interfaces.scm"
  50. "vm/shared-interfaces.scm"
  51. "more-interfaces.scm"))
  52. (let ((z (config '(run %linker-structures)))
  53. (env (config interaction-environment)))
  54. (config (lambda () (flatload z env))))
  55. ; Load the linker.
  56. (load-package 'link-config)
  57. ; Initialize
  58. (in 'link-config
  59. '(open scheme packages packages-internal
  60. reflective-tower-maker))
  61. (in 'linker '(run (set! *debug-linker?* #t)))
  62. (in 'link-config '(open flatloading)) ; A different one.
  63. ; ,open debuginfo packages-internal compiler scan syntactic meta-types
  64. ; (in 'link-config '(dump "l.image"))
  65. ; ,exec (usual-stuff)
  66. (define (usual-stuff)
  67. (in 'link-config)
  68. (run '(begin (load-configuration "interfaces.scm")
  69. (load-configuration "packages.scm")
  70. (flatload initial-structures)))
  71. (load "initial.scm"))