changeset 5875:493615a206a9 jdk7u261-b02 jdk7u261-ga jdk7u271-b00

8233410: Better Build Scripting Summary: Also includes more complete backport of JDK-8199552 (relro) Reviewed-by: mbalao
author andrew
date Sun, 12 Apr 2020 04:39:04 +0100
parents 0a35083e9c76
children 5530d69c4b0c
files make/bsd/makefiles/gcc.make make/bsd/makefiles/jsig.make make/bsd/makefiles/saproc.make make/linux/makefiles/gcc.make make/linux/makefiles/jsig.make make/linux/makefiles/saproc.make make/solaris/makefiles/gcc.make make/solaris/makefiles/jsig.make make/solaris/makefiles/saproc.make
diffstat 9 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/make/bsd/makefiles/gcc.make	Tue Apr 07 18:30:22 2020 +0100
+++ b/make/bsd/makefiles/gcc.make	Sun Apr 12 04:39:04 2020 +0100
@@ -264,6 +264,9 @@
   # Enable linker optimization
   LFLAGS += -Xlinker -O1
 
+  # Create a RELRO section for memory segments that should be read-only after relocation
+  LFLAGS += -Xlinker -z -Xlinker relro
+
   # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
   SONAMEFLAG = -Xlinker -soname=SONAME
 
--- a/make/bsd/makefiles/jsig.make	Tue Apr 07 18:30:22 2020 +0100
+++ b/make/bsd/makefiles/jsig.make	Sun Apr 12 04:39:04 2020 +0100
@@ -49,6 +49,11 @@
 
 LFLAGS_JSIG += -D_GNU_SOURCE -pthread $(LDFLAGS_HASH_STYLE)
 
+ifneq ($(OS_VENDOR), Darwin)
+# Create a RELRO section for memory segments that should be read-only after relocation
+LFLAGS_JSIG += -Xlinker -z -Xlinker relro
+endif
+
 # DEBUG_BINARIES overrides everything, use full -g debug information
 ifeq ($(DEBUG_BINARIES), true)
   JSIG_DEBUG_CFLAGS = -g
--- a/make/bsd/makefiles/saproc.make	Tue Apr 07 18:30:22 2020 +0100
+++ b/make/bsd/makefiles/saproc.make	Sun Apr 12 04:39:04 2020 +0100
@@ -85,6 +85,8 @@
 
 ifneq ($(OS_VENDOR), Darwin)
 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
+# Create a RELRO section for memory segments that should be read-only after relocation
+SA_LFLAGS += -Xlinker -z -Xlinker relro
 endif
 SA_LFLAGS += $(LDFLAGS_HASH_STYLE)
 
--- a/make/linux/makefiles/gcc.make	Tue Apr 07 18:30:22 2020 +0100
+++ b/make/linux/makefiles/gcc.make	Sun Apr 12 04:39:04 2020 +0100
@@ -210,6 +210,9 @@
 endif
 LFLAGS += $(LDFLAGS_HASH_STYLE)
 
+# Create a RELRO section for memory segments that should be read-only after relocation
+LFLAGS += -Xlinker -z -Xlinker relro
+
 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
 MAPFLAG = -Xlinker --version-script=FILENAME
 
--- a/make/linux/makefiles/jsig.make	Tue Apr 07 18:30:22 2020 +0100
+++ b/make/linux/makefiles/jsig.make	Sun Apr 12 04:39:04 2020 +0100
@@ -51,6 +51,9 @@
 
 LFLAGS_JSIG += -D_GNU_SOURCE -D_REENTRANT $(LDFLAGS_HASH_STYLE)
 
+# Create a RELRO section for memory segments that should be read-only after relocation
+LFLAGS_JSIG += -Xlinker -z -Xlinker relro
+
 # DEBUG_BINARIES overrides everything, use full -g debug information
 ifeq ($(DEBUG_BINARIES), true)
   JSIG_DEBUG_CFLAGS = -g
--- a/make/linux/makefiles/saproc.make	Tue Apr 07 18:30:22 2020 +0100
+++ b/make/linux/makefiles/saproc.make	Sun Apr 12 04:39:04 2020 +0100
@@ -79,6 +79,9 @@
 endif
 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE)
 
+# Create a RELRO section for memory segments that should be read-only after relocation
+SA_LFLAGS += -Xlinker -z -Xlinker relro
+
 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
 	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
 	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
--- a/make/solaris/makefiles/gcc.make	Tue Apr 07 18:30:22 2020 +0100
+++ b/make/solaris/makefiles/gcc.make	Sun Apr 12 04:39:04 2020 +0100
@@ -171,6 +171,9 @@
 # Enable linker optimization
 LFLAGS += -Xlinker -O1
 
+# Create a RELRO section for memory segments that should be read-only after relocation
+LFLAGS += -Xlinker -z -Xlinker relro
+
 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
 MAPFLAG = -Xlinker --version-script=FILENAME 
 else 
--- a/make/solaris/makefiles/jsig.make	Tue Apr 07 18:30:22 2020 +0100
+++ b/make/solaris/makefiles/jsig.make	Sun Apr 12 04:39:04 2020 +0100
@@ -52,6 +52,11 @@
 LFLAGS_JSIG += -mt -xnolib
 endif
 
+ifdef USE_GNULD
+# Create a RELRO section for memory segments that should be read-only after relocation
+LFLAGS_JSIG += -Xlinker -z -Xlinker relro
+endif
+
 $(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
 	@echo Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
--- a/make/solaris/makefiles/saproc.make	Tue Apr 07 18:30:22 2020 +0100
+++ b/make/solaris/makefiles/saproc.make	Sun Apr 12 04:39:04 2020 +0100
@@ -63,6 +63,11 @@
 SA_LFLAGS += -mt -xnolib -norunpath
 endif
 
+ifdef USE_GNULD
+# Create a RELRO section for memory segments that should be read-only after relocation
+SA_LFLAGS += -Xlinker -z -Xlinker relro
+endif
+
 # The libproc Pstack_iter() interface changed in Nevada-B159.
 # Use 'uname -r -v' to determine the Solaris version as per
 # Solaris Nevada team request. This logic needs to match: