Skip to content

Commit 1fcf564

Browse files
author
Fei Yang
committed
Merge branch 'master' into riscv-port
2 parents 597049c + d52392c commit 1fcf564

File tree

98 files changed

+2454
-518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2454
-518
lines changed

make/CreateJmods.gmk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@ else
226226
JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM}'
227227
endif
228228

229+
# For reproducible builds specify the jmod --date using SOURCE_DATE in ISO-8601
230+
ifeq ($(ENABLE_REPRODUCIBLE_BUILD), true)
231+
JMOD_SOURCE_DATE := --date $(SOURCE_DATE_ISO_8601)
232+
else
233+
JMOD_SOURCE_DATE :=
234+
endif
235+
229236
# Create jmods in the support dir and then move them into place to keep the
230237
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
231238
$(eval $(call SetupExecute, create_$(JMOD_FILE), \
@@ -237,6 +244,7 @@ $(eval $(call SetupExecute, create_$(JMOD_FILE), \
237244
COMMAND := $(JMOD) create --module-version $(VERSION_SHORT) \
238245
--target-platform '$(OPENJDK_MODULE_TARGET_PLATFORM)' \
239246
--module-path $(JMODS_DIR) $(JMOD_FLAGS) \
247+
$(JMOD_SOURCE_DATE) \
240248
$(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
241249
POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
242250
))

make/InitSupport.gmk

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -313,6 +313,15 @@ else # $(HAS_SPEC)=true
313313
SOURCE_DATE := $$(shell $$(DATE) +"%s")
314314
endif
315315
export SOURCE_DATE_EPOCH := $$(SOURCE_DATE)
316+
ifeq ($$(IS_GNU_DATE), yes)
317+
export SOURCE_DATE_ISO_8601 := $$(shell $$(DATE) --utc \
318+
--date="@$$(SOURCE_DATE_EPOCH)" \
319+
+"%Y-%m-%dT%H:%M:%SZ" 2> /dev/null)
320+
else
321+
export SOURCE_DATE_ISO_8601 := $$(shell $$(DATE) -u \
322+
-j -f "%s" "$$(SOURCE_DATE_EPOCH)" \
323+
+"%Y-%m-%dT%H:%M:%SZ" 2> /dev/null)
324+
endif
316325
endef
317326

318327
# Parse COMPARE_BUILD into COMPARE_BUILD_*

make/autoconf/basic_tools.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,16 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
357357
AC_SUBST(IS_GNU_TIME)
358358
359359
# Check if it's GNU date
360+
AC_MSG_CHECKING([if date is the GNU version])
360361
check_date=`$DATE --version 2>&1 | $GREP GNU`
361362
if test "x$check_date" != x; then
363+
AC_MSG_RESULT([yes])
362364
IS_GNU_DATE=yes
363365
else
366+
AC_MSG_RESULT([no])
364367
IS_GNU_DATE=no
365368
fi
369+
AC_SUBST(IS_GNU_DATE)
366370
367371
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
368372
UTIL_REQUIRE_PROGS(DSYMUTIL, dsymutil)

make/autoconf/boot-jdk.m4

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,16 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
379379
380380
# Finally, set some other options...
381381
382+
# Determine if the boot jdk jar supports the --date option
383+
if $JAR --help 2>&1 | $GREP -q "\-\-date=TIMESTAMP"; then
384+
BOOT_JDK_JAR_SUPPORTS_DATE=true
385+
else
386+
BOOT_JDK_JAR_SUPPORTS_DATE=false
387+
fi
388+
AC_MSG_CHECKING([if Boot JDK jar supports --date=TIMESTAMP])
389+
AC_MSG_RESULT([$BOOT_JDK_JAR_SUPPORTS_DATE])
390+
AC_SUBST(BOOT_JDK_JAR_SUPPORTS_DATE)
391+
382392
# When compiling code to be executed by the Boot JDK, force compatibility with the
383393
# oldest supported bootjdk.
384394
OLDEST_BOOT_JDK=`$ECHO $DEFAULT_ACCEPTABLE_BOOT_VERSIONS \

make/autoconf/spec.gmk.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ BUILD_JDK:=@BUILD_JDK@
371371
CREATE_BUILDJDK:=@CREATE_BUILDJDK@
372372
EXTERNAL_BUILDJDK:=@EXTERNAL_BUILDJDK@
373373

374+
# Whether the boot jdk jar supports --date=TIMESTAMP
375+
BOOT_JDK_JAR_SUPPORTS_DATE:=@BOOT_JDK_JAR_SUPPORTS_DATE@
376+
374377
# When compiling Java source to be run by the boot jdk
375378
# use these extra flags, eg -source 6 -target 6
376379
BOOT_JDK_SOURCETARGET:=@BOOT_JDK_SOURCETARGET@
@@ -707,6 +710,7 @@ CODESIGN:=@CODESIGN@
707710
CP:=@CP@
708711
CUT:=@CUT@
709712
DATE:=@DATE@
713+
IS_GNU_DATE:=@IS_GNU_DATE@
710714
DIFF:=@DIFF@
711715
DIRNAME:=@DIRNAME@
712716
DSYMUTIL:=@DSYMUTIL@

make/autoconf/util.m4

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -236,13 +236,15 @@ AC_DEFUN([UTIL_GET_MATCHING_VALUES],
236236
# $2: input date/time string
237237
AC_DEFUN([UTIL_GET_EPOCH_TIMESTAMP],
238238
[
239-
timestamp=$($DATE --utc --date=$2 +"%s" 2> /dev/null)
240-
if test "x$timestamp" = x; then
241-
# GNU date format did not work, try BSD date options
242-
timestamp=$($DATE -j -f "%F %T" "$2" "+%s" 2> /dev/null)
239+
if test "x$IS_GNU_DATE" = xyes; then
240+
# GNU date
241+
timestamp=$($DATE --utc --date=$2 +"%s" 2> /dev/null)
242+
else
243+
# BSD date
244+
timestamp=$($DATE -u -j -f "%F %T" "$2" "+%s" 2> /dev/null)
243245
if test "x$timestamp" = x; then
244246
# Perhaps the time was missing
245-
timestamp=$($DATE -j -f "%F %T" "$2 00:00:00" "+%s" 2> /dev/null)
247+
timestamp=$($DATE -u -j -f "%F %T" "$2 00:00:00" "+%s" 2> /dev/null)
246248
# If this did not work, we give up and return the empty string
247249
fi
248250
fi

make/common/JarArchive.gmk

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -193,7 +193,7 @@ define SetupJarArchiveBody
193193
$1_UPDATE_CONTENTS=\
194194
if [ "`$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
195195
$(ECHO) " updating" `$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
196-
$$($1_JAR_CMD) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents; \
196+
$$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents; \
197197
fi $$(NEWLINE)
198198
# The s-variants of the above macros are used when the jar is created from scratch.
199199
# NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
@@ -212,25 +212,27 @@ define SetupJarArchiveBody
212212
| $(SED) 's|$$(src)/|-C $$(src) |g' >> \
213213
$$($1_BIN)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
214214
endif
215-
$1_SUPDATE_CONTENTS=$$($1_JAR_CMD) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)
215+
$1_SUPDATE_CONTENTS=$$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)
216216

217217
# Use a slightly shorter name for logging, but with enough path to identify this jar.
218218
$1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_JAR))
219219

220+
# If reproducible build and the boot jdk jar supports --date option
221+
# then specify the --date using SOURCE_DATE in ISO-8601
222+
$1_JAR_OPTIONS :=
223+
ifeq ($$(ENABLE_REPRODUCIBLE_BUILD), true)
224+
ifeq ($$(BOOT_JDK_JAR_SUPPORTS_DATE), true)
225+
$1_JAR_OPTIONS += --date $(SOURCE_DATE_ISO_8601)
226+
endif
227+
endif
220228
ifneq (,$$($1_CHECK_COMPRESS_JAR))
221-
$1_JAR_CREATE_OPTIONS := c0fm
222-
$1_JAR_UPDATE_OPTIONS := u0f
223-
ifeq ($(COMPRESS_JARS), true)
224-
$1_JAR_CREATE_OPTIONS := cfm
225-
$1_JAR_UPDATE_OPTIONS := uf
229+
ifneq ($(COMPRESS_JARS), true)
230+
$1_JAR_OPTIONS += --no-compress
226231
endif
227-
else
228-
$1_JAR_CREATE_OPTIONS := cfm
229-
$1_JAR_UPDATE_OPTIONS := uf
230232
endif
231233

232234
# Include all variables of significance in the vardeps file
233-
$1_VARDEPS := $$($1_JAR_CMD) $$($1_JAR_CREATE_OPTIONS) $$($1_MANIFEST) \
235+
$1_VARDEPS := $$($1_JAR_CMD) $$($1_JAR_OPTIONS) $$($1_MANIFEST) \
234236
$$($1_JARMAIN) $$($1_EXTRA_MANIFEST_ATTR) $$($1_ORIG_DEPS) $$($1_SRCS) \
235237
$$($1_INCLUDES) $$($1_EXCLUDES) $$($1_EXCLUDE_FILES) $$($1_EXTRA_FILES)
236238
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$$($1_JARNAME).vardeps)
@@ -255,7 +257,7 @@ define SetupJarArchiveBody
255257
$$(if $$($1_EXTRA_MANIFEST_ATTR), \
256258
$(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE) $$(NEWLINE)) \
257259
$(ECHO) Creating $$($1_NAME) $$(NEWLINE) \
258-
$$($1_JAR_CMD) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \
260+
$$($1_JAR_CMD) --create $$($1_JAR_OPTIONS) --file $$@ --manifest $$($1_MANIFEST_FILE) $$(NEWLINE) \
259261
$$($1_SCAPTURE_CONTENTS) \
260262
$$($1_SCAPTURE_METAINF) \
261263
$$($1_SUPDATE_CONTENTS) \

make/jdk/src/classes/build/tools/makezipreproducible/MakeZipReproducible.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,22 @@
3434
import java.util.zip.ZipFile;
3535
import java.util.zip.ZipInputStream;
3636
import java.util.zip.ZipOutputStream;
37+
import java.time.Instant;
38+
import java.time.ZoneOffset;
39+
import java.time.LocalDateTime;
3740

3841
/**
3942
* Generate a zip file in a "reproducible" manner from the input zip file.
4043
* Standard zip tools rely on OS file list querying whose ordering can vary
4144
* by platform architecture, this class ensures the zip entries are ordered
42-
* and also supports SOURCE_DATE_EPOCH timestamps.
45+
* and also supports SOURCE_DATE_EPOCH timestamps which will set the ZipEntry
46+
* local time in UTC.
4347
*/
4448
public class MakeZipReproducible {
4549
String input_file = null;
4650
String fname = null;
4751
String zname = "";
48-
long timestamp = -1L;
52+
LocalDateTime timestamp = null;
4953
boolean verbose = false;
5054

5155
// Keep a sorted Set of ZipEntrys to be processed, so that the zip is reproducible
@@ -117,7 +121,9 @@ boolean parseArgs(String args[]) {
117121
break;
118122
case 't':
119123
// SOURCE_DATE_EPOCH timestamp specified
120-
timestamp = Long.parseLong(args[++count]) * 1000;
124+
long epochSeconds = Long.parseLong(args[++count]);
125+
Instant instant = Instant.ofEpochSecond(epochSeconds);
126+
timestamp = LocalDateTime.ofInstant(instant, ZoneOffset.UTC);
121127
break;
122128
case 'v':
123129
verbose = true;
@@ -194,8 +200,8 @@ void addEntry(ZipOutputStream zos, ZipEntry entry, InputStream entryInputStream)
194200
}
195201

196202
// Set to specified timestamp if set otherwise leave as original lastModified time
197-
if (timestamp != -1L) {
198-
entry.setTime(timestamp);
203+
if (timestamp != null) {
204+
entry.setTimeLocal(timestamp);
199205
}
200206

201207
zos.putNextEntry(entry);

make/modules/java.rmi/Launcher.gmk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ include LauncherCommon.gmk
2727

2828
$(eval $(call SetupBuildLauncher, rmiregistry, \
2929
MAIN_CLASS := sun.rmi.registry.RegistryImpl, \
30+
JAVA_ARGS := -Djava.security.manager=allow, \
3031
))

make/modules/jdk.jstatd/Launcher.gmk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -27,4 +27,5 @@ include LauncherCommon.gmk
2727

2828
$(eval $(call SetupBuildLauncher, jstatd, \
2929
MAIN_CLASS := sun.tools.jstatd.Jstatd, \
30+
JAVA_ARGS := -Djava.security.manager=allow, \
3031
))

0 commit comments

Comments
 (0)