57 # image, so just use the external build jdk instead. |
57 # image, so just use the external build jdk instead. |
58 ifeq ($(EXTERNAL_BUILDJDK), true) |
58 ifeq ($(EXTERNAL_BUILDJDK), true) |
59 INTERIM_IMAGE_DIR := $(BUILD_JDK) |
59 INTERIM_IMAGE_DIR := $(BUILD_JDK) |
60 endif |
60 endif |
61 |
61 |
|
62 # Save the stderr output of the command and print it along with stdout in case |
|
63 # something goes wrong. |
62 $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR) |
64 $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR) |
63 $(call MakeDir, $(LINK_OPT_DIR)) |
65 $(call MakeDir, $(LINK_OPT_DIR)) |
64 $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@)) |
66 $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $@)) |
65 $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE))) |
67 $(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE))) |
66 $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.raw \ |
68 $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.raw \ |
67 -Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \ |
69 -Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \ |
68 -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \ |
70 -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \ |
69 build.tools.classlist.HelloClasslist \ |
71 build.tools.classlist.HelloClasslist \ |
70 $(LOG_DEBUG) 2>&1 > $(JLI_TRACE_FILE) |
72 2> $(LINK_OPT_DIR)/stderr > $(JLI_TRACE_FILE) \ |
|
73 || ( \ |
|
74 exitcode=$$? ; \ |
|
75 $(ECHO) "ERROR: Failed to generate link optimization data." \ |
|
76 "This is likely a problem with the newly built JVM/JDK." ; \ |
|
77 $(CAT) $(LINK_OPT_DIR)/stderr $(JLI_TRACE_FILE) ; \ |
|
78 exit $$exitcode \ |
|
79 ) |
71 $(GREP) -v HelloClasslist $@.raw > $@ |
80 $(GREP) -v HelloClasslist $@.raw > $@ |
72 |
81 |
73 # The jli trace is created by the same recipe as classlist. By declaring these |
82 # The jli trace is created by the same recipe as classlist. By declaring these |
74 # dependencies, make will correctly rebuild both jli trace and classlist |
83 # dependencies, make will correctly rebuild both jli trace and classlist |
75 # incrementally using the single recipe above. |
84 # incrementally using the single recipe above. |