load-linker.exec 2.8 KB

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