|
4 | 4 | # $(2) is the target triple
|
5 | 5 | # $(3) is the host triple
|
6 | 6 |
|
| 7 | +# If you are making non-backwards compatible changes to the runtime, |
| 8 | +# set this flag to 1. It will cause stage1 to use the snapshot |
| 9 | +# runtime rather than the runtime from the working directory. |
| 10 | +USE_SNAPSHOT_RUNTIME=0 |
| 11 | + |
7 | 12 | define TARGET_STAGE_N
|
8 | 13 |
|
9 | 14 | $$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.ll: \
|
@@ -58,11 +63,17 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC): \
|
58 | 63 | endef
|
59 | 64 |
|
60 | 65 | # The stage0 (snapshot) compiler produces binaries that expect the
|
61 |
| -# snapshot runtime. Therefore, the stage1 compiler and libraries |
62 |
| -# (which are produced by stage0) should use the runtime from the |
63 |
| -# snapshot. The stage2 compiler and libraries (which are produced by |
64 |
| -# stage1) will be the first that are expecting to run against the |
65 |
| -# runtime as defined in the working directory. |
| 66 | +# snapshot runtime. Normally the working directory runtime and |
| 67 | +# snapshot runtime are compatible, so this is no problem. But |
| 68 | +# sometimes we want to make non-backwards-compatible changes. In |
| 69 | +# those cases, the stage1 compiler and libraries (which are produced |
| 70 | +# by stage0) should use the runtime from the snapshot. The stage2 |
| 71 | +# compiler and libraries (which are produced by stage1) will be the |
| 72 | +# first that are expecting to run against the runtime as defined in |
| 73 | +# the working directory. |
| 74 | +# |
| 75 | +# The catch is that you may not add new functions to the runtime |
| 76 | +# in this case! |
66 | 77 | #
|
67 | 78 | # Arguments are the same as for TARGET_BASE_STAGE_N
|
68 | 79 | define TARGET_RT_FROM_SNAPSHOT
|
@@ -96,15 +107,25 @@ $(foreach source,$(CFG_TARGET_TRIPLES), \
|
96 | 107 | $(eval $(call TARGET_STAGE_N,2,$(target),$(source))) \
|
97 | 108 | $(eval $(call TARGET_STAGE_N,3,$(target),$(source)))))
|
98 | 109 |
|
99 |
| -$(eval $(call TARGET_RT_FROM_SNAPSHOT,0,$(CFG_HOST_TRIPLE),$(CFG_HOST_TRIPLE))) |
| 110 | +# Host triple either uses the snapshot runtime or runtime from |
| 111 | +# working directory, depending on the USE_SNAPSHOT_RUNTIME var. |
| 112 | +ifeq ($(USE_SNAPSHOT_RUNTIME),1) |
| 113 | + $(foreach src,$(CFG_HOST_TRIPLE),\ |
| 114 | + $(eval $(call TARGET_RT_FROM_SNAPSHOT,0,$(src),$(src)))) |
| 115 | +else |
| 116 | + $(foreach src,$(CFG_HOST_TRIPLE),\ |
| 117 | + $(eval $(call TARGET_RT_FROM_WD,0,$(src),$(src)))) |
| 118 | +endif |
100 | 119 |
|
| 120 | +# Non-host triples build the stage0 runtime from the working directory |
| 121 | +$(foreach source,$(CFG_TARGET_TRIPLES), \ |
| 122 | + $(foreach target,$(NON_HOST_TRIPLES), \ |
| 123 | + $(eval $(call TARGET_RT_FROM_WD,0,$(target),$(source))))) |
| 124 | + |
| 125 | +# After stage0, always build the stage0 runtime from the working directory |
101 | 126 | $(foreach source,$(CFG_TARGET_TRIPLES), \
|
102 | 127 | $(foreach target,$(CFG_TARGET_TRIPLES), \
|
103 | 128 | $(eval $(call TARGET_RT_FROM_WD,1,$(target),$(source))) \
|
104 | 129 | $(eval $(call TARGET_RT_FROM_WD,2,$(target),$(source))) \
|
105 | 130 | $(eval $(call TARGET_RT_FROM_WD,3,$(target),$(source)))))
|
106 | 131 |
|
107 |
| -# Non-host triples build the stage0 runtime from the working directory |
108 |
| -$(foreach source,$(CFG_TARGET_TRIPLES), \ |
109 |
| - $(foreach target,$(NON_HOST_TRIPLES), \ |
110 |
| - $(eval $(call TARGET_RT_FROM_WD,0,$(target),$(source))))) |
|
0 commit comments