Merge

Mon, 17 Nov 2014 19:35:09 +0000

author
coleenp
date
Mon, 17 Nov 2014 19:35:09 +0000
changeset 7359
2f445c5048df
parent 7358
327e7269f90d
parent 7357
b2399f0d9611
child 7361
b00e231d3cb2
child 7362
10842d23f20a

Merge

make/solaris/makefiles/add_gnu_debuglink.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/fix_empty_sec_hdr_flags.make file | annotate | diff | comparison | revisions
src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c file | annotate | diff | comparison | revisions
src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c file | annotate | diff | comparison | revisions
     1.1 --- a/make/solaris/makefiles/add_gnu_debuglink.make	Mon Jun 30 14:58:52 2014 -0400
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,54 +0,0 @@
     1.4 -#
     1.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 -#
     1.8 -# This code is free software; you can redistribute it and/or modify it
     1.9 -# under the terms of the GNU General Public License version 2 only, as
    1.10 -# published by the Free Software Foundation.
    1.11 -#
    1.12 -# This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 -# version 2 for more details (a copy is included in the LICENSE file that
    1.16 -# accompanied this code).
    1.17 -#
    1.18 -# You should have received a copy of the GNU General Public License version
    1.19 -# 2 along with this work; if not, write to the Free Software Foundation,
    1.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 -#
    1.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 -# or visit www.oracle.com if you need additional information or have any
    1.24 -# questions.
    1.25 -#  
    1.26 -#
    1.27 -
    1.28 -# Rules to build add_gnu_debuglink, used by vm.make on Solaris
    1.29 -
    1.30 -# Allow $(ADD_GNU_DEBUGLINK) to be called from any directory.
    1.31 -# We don't set or use the GENERATED macro to avoid affecting
    1.32 -# other HotSpot Makefiles.
    1.33 -TOPDIR                    = $(shell echo `pwd`)
    1.34 -ADD_GNU_DEBUGLINK         = $(TOPDIR)/../generated/add_gnu_debuglink
    1.35 -
    1.36 -ADD_GNU_DEBUGLINK_DIR     = $(GAMMADIR)/src/os/solaris/add_gnu_debuglink
    1.37 -ADD_GNU_DEBUGLINK_SRC     = $(ADD_GNU_DEBUGLINK_DIR)/add_gnu_debuglink.c
    1.38 -ADD_GNU_DEBUGLINK_FLAGS   = 
    1.39 -LIBS_ADD_GNU_DEBUGLINK   += -lelf
    1.40 -
    1.41 -ifeq ("${Platform_compiler}", "sparcWorks")
    1.42 -# Enable the following ADD_GNU_DEBUGLINK_FLAGS addition if you need to
    1.43 -# compare the built ELF objects.
    1.44 -#
    1.45 -# The -g option makes static data global and the "-W0,-noglobal"
    1.46 -# option tells the compiler to not globalize static data using a unique
    1.47 -# globalization prefix. Instead force the use of a static globalization
    1.48 -# prefix based on the source filepath so the objects from two identical
    1.49 -# compilations are the same.
    1.50 -#
    1.51 -# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
    1.52 -#       seem to work. I got "-W0,-noglobal" from Kelly and that works.
    1.53 -#ADD_GNU_DEBUGLINK_FLAGS += -W0,-noglobal
    1.54 -endif # Platform_compiler == sparcWorks
    1.55 -
    1.56 -$(ADD_GNU_DEBUGLINK): $(ADD_GNU_DEBUGLINK_SRC)
    1.57 -	$(CC) -g -o $@ $< $(ADD_GNU_DEBUGLINK_FLAGS) $(LIBS_ADD_GNU_DEBUGLINK)
     2.1 --- a/make/solaris/makefiles/defs.make	Mon Jun 30 14:58:52 2014 -0400
     2.2 +++ b/make/solaris/makefiles/defs.make	Mon Nov 17 19:35:09 2014 +0000
     2.3 @@ -1,5 +1,5 @@
     2.4  #
     2.5 -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
     2.6 +# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
     2.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8  #
     2.9  # This code is free software; you can redistribute it and/or modify it
    2.10 @@ -133,6 +133,55 @@
    2.11          OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
    2.12        endif
    2.13  
    2.14 +      ifneq ($(OBJCOPY),)
    2.15 +        # OBJCOPY version check:
    2.16 +        # - version number is last blank separate word on first line
    2.17 +        # - version number formats that have been seen:
    2.18 +        #   - <major>.<minor>
    2.19 +        #   - <major>.<minor>.<micro>
    2.20 +        #
    2.21 +        # Full Debug Symbols on Solaris needs version 2.21.1 or newer.
    2.22 +        #
    2.23 +        OBJCOPY_VERS_CHK := $(shell \
    2.24 +          $(OBJCOPY) --version \
    2.25 +            | sed -n \
    2.26 +                  -e 's/.* //' \
    2.27 +                  -e '/^[01]\./b bad' \
    2.28 +                  -e '/^2\./{' \
    2.29 +                  -e '  s/^2\.//' \
    2.30 +                  -e '  /^[0-9]$$/b bad' \
    2.31 +                  -e '  /^[0-9]\./b bad' \
    2.32 +                  -e '  /^1[0-9]$$/b bad' \
    2.33 +                  -e '  /^1[0-9]\./b bad' \
    2.34 +                  -e '  /^20\./b bad' \
    2.35 +                  -e '  /^21\.0$$/b bad' \
    2.36 +                  -e '  /^21\.0\./b bad' \
    2.37 +                  -e '}' \
    2.38 +                  -e ':good' \
    2.39 +                  -e 's/.*/VALID_VERSION/p' \
    2.40 +                  -e 'q' \
    2.41 +                  -e ':bad' \
    2.42 +                  -e 's/.*/BAD_VERSION/p' \
    2.43 +                  -e 'q' \
    2.44 +          )
    2.45 +        ifeq ($(OBJCOPY_VERS_CHK),BAD_VERSION)
    2.46 +          _JUNK_ := $(shell \
    2.47 +            echo >&2 "WARNING: $(OBJCOPY) --version info:"; \
    2.48 +            $(OBJCOPY) --version | sed -n -e 's/^/WARNING: /p' -e 'q' >&2; \
    2.49 +            echo >&2 "WARNING: an objcopy version of 2.21.1 or newer" \
    2.50 +              "is needed to create valid .debuginfo files."; \
    2.51 +            echo >&2 "WARNING: ignoring above objcopy command."; \
    2.52 +            echo >&2 "WARNING: patch 149063-01 or newer contains the" \
    2.53 +              "correct Solaris 10 SPARC version."; \
    2.54 +            echo >&2 "WARNING: patch 149064-01 or newer contains the" \
    2.55 +              "correct Solaris 10 X86 version."; \
    2.56 +            echo >&2 "WARNING: Solaris 11 Update 1 contains the" \
    2.57 +              "correct version."; \
    2.58 +            )
    2.59 +          OBJCOPY=
    2.60 +        endif
    2.61 +      endif
    2.62 +
    2.63        ifeq ($(OBJCOPY),)
    2.64          _JUNK_ := $(shell \
    2.65            echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.")
     3.1 --- a/make/solaris/makefiles/dtrace.make	Mon Jun 30 14:58:52 2014 -0400
     3.2 +++ b/make/solaris/makefiles/dtrace.make	Mon Nov 17 19:35:09 2014 +0000
     3.3 @@ -1,5 +1,5 @@
     3.4  #
     3.5 -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     3.6 +# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
     3.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8  #
     3.9  # This code is free software; you can redistribute it and/or modify it
    3.10 @@ -96,25 +96,16 @@
    3.11  XLIBJVM_DTRACE_DEBUGINFO   = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO)
    3.12  XLIBJVM_DTRACE_DIZ         = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ)
    3.13  
    3.14 -$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
    3.15 +$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
    3.16  	@echo Making $@
    3.17  	$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
    3.18  	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \
    3.19  		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
    3.20  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    3.21 -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
    3.22 -# Clear the SHF_ALLOC flag (if set) from empty section headers.
    3.23 -# An empty section header has sh_addr == 0 and sh_size == 0.
    3.24 -# This problem has only been seen on Solaris X64, but we call this tool
    3.25 -# on all Solaris builds just in case.
    3.26 -	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
    3.27  	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO)
    3.28 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    3.29 -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
    3.30 -#         $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ;
    3.31  # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not
    3.32  # in the link name:
    3.33 -	( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) )
    3.34 +	( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) )
    3.35    ifeq ($(STRIP_POLICY),all_strip)
    3.36  	$(QUIETLY) $(STRIP) $@
    3.37    else
    3.38 @@ -131,20 +122,16 @@
    3.39    endif
    3.40  endif
    3.41  
    3.42 -$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
    3.43 +$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
    3.44  	@echo Making $@
    3.45  	$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
    3.46  	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \
    3.47  		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
    3.48  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    3.49 -# Clear the SHF_ALLOC flag (if set) from empty section headers.
    3.50 -	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
    3.51  	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO)
    3.52 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    3.53 -#         $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ;
    3.54  # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not
    3.55  # in the link name:
    3.56 -	( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) )
    3.57 +	( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) )
    3.58    ifeq ($(STRIP_POLICY),all_strip)
    3.59  	$(QUIETLY) $(STRIP) $@
    3.60    else
    3.61 @@ -201,17 +188,13 @@
    3.62  $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp 
    3.63  	$(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
    3.64  
    3.65 -$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
    3.66 +$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
    3.67  	@echo Making $@
    3.68  	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
    3.69  		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
    3.70  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    3.71 -# Clear the SHF_ALLOC flag (if set) from empty section headers.
    3.72 -	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
    3.73  	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO)
    3.74 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    3.75 -#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
    3.76 -	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@
    3.77 +	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
    3.78    ifeq ($(STRIP_POLICY),all_strip)
    3.79  	$(QUIETLY) $(STRIP) $@
    3.80    else
    3.81 @@ -226,17 +209,13 @@
    3.82    endif
    3.83  endif
    3.84  
    3.85 -$(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
    3.86 +$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
    3.87  	@echo Making $@
    3.88  	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I.  \
    3.89  		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
    3.90  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    3.91 -# Clear the SHF_ALLOC flag (if set) from empty section headers.
    3.92 -	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
    3.93  	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
    3.94 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    3.95 -#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
    3.96 -	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@
    3.97 +	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
    3.98    ifeq ($(STRIP_POLICY),all_strip)
    3.99  	$(QUIETLY) $(STRIP) $@
   3.100    else
     4.1 --- a/make/solaris/makefiles/fix_empty_sec_hdr_flags.make	Mon Jun 30 14:58:52 2014 -0400
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,54 +0,0 @@
     4.4 -#
     4.5 -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     4.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 -#
     4.8 -# This code is free software; you can redistribute it and/or modify it
     4.9 -# under the terms of the GNU General Public License version 2 only, as
    4.10 -# published by the Free Software Foundation.
    4.11 -#
    4.12 -# This code is distributed in the hope that it will be useful, but WITHOUT
    4.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.14 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.15 -# version 2 for more details (a copy is included in the LICENSE file that
    4.16 -# accompanied this code).
    4.17 -#
    4.18 -# You should have received a copy of the GNU General Public License version
    4.19 -# 2 along with this work; if not, write to the Free Software Foundation,
    4.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.21 -#
    4.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.23 -# or visit www.oracle.com if you need additional information or have any
    4.24 -# questions.
    4.25 -#  
    4.26 -#
    4.27 -
    4.28 -# Rules to build fix_empty_sec_hdr_flags, used by vm.make on Solaris
    4.29 -
    4.30 -# Allow $(FIX_EMPTY_SEC_HDR_FLAGS) to be called from any directory.
    4.31 -# We don't set or use the GENERATED macro to avoid affecting
    4.32 -# other HotSpot Makefiles.
    4.33 -TOPDIR                          = $(shell echo `pwd`)
    4.34 -FIX_EMPTY_SEC_HDR_FLAGS         = $(TOPDIR)/../generated/fix_empty_sec_hdr_flags
    4.35 -
    4.36 -FIX_EMPTY_SEC_HDR_FLAGS_DIR     = $(GAMMADIR)/src/os/solaris/fix_empty_sec_hdr_flags
    4.37 -FIX_EMPTY_SEC_HDR_FLAGS_SRC     = $(FIX_EMPTY_SEC_HDR_FLAGS_DIR)/fix_empty_sec_hdr_flags.c
    4.38 -FIX_EMPTY_SEC_HDR_FLAGS_FLAGS   = 
    4.39 -LIBS_FIX_EMPTY_SEC_HDR_FLAGS   += -lelf
    4.40 -
    4.41 -ifeq ("${Platform_compiler}", "sparcWorks")
    4.42 -# Enable the following FIX_EMPTY_SEC_HDR_FLAGS_FLAGS addition if you need to
    4.43 -# compare the built ELF objects.
    4.44 -#
    4.45 -# The -g option makes static data global and the "-W0,-noglobal"
    4.46 -# option tells the compiler to not globalize static data using a unique
    4.47 -# globalization prefix. Instead force the use of a static globalization
    4.48 -# prefix based on the source filepath so the objects from two identical
    4.49 -# compilations are the same.
    4.50 -#
    4.51 -# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
    4.52 -#       seem to work. I got "-W0,-noglobal" from Kelly and that works.
    4.53 -#FIX_EMPTY_SEC_HDR_FLAGS_FLAGS += -W0,-noglobal
    4.54 -endif # Platform_compiler == sparcWorks
    4.55 -
    4.56 -$(FIX_EMPTY_SEC_HDR_FLAGS): $(FIX_EMPTY_SEC_HDR_FLAGS_SRC)
    4.57 -	$(CC) -g -o $@ $< $(FIX_EMPTY_SEC_HDR_FLAGS_FLAGS) $(LIBS_FIX_EMPTY_SEC_HDR_FLAGS)
     5.1 --- a/make/solaris/makefiles/jsig.make	Mon Jun 30 14:58:52 2014 -0400
     5.2 +++ b/make/solaris/makefiles/jsig.make	Mon Nov 17 19:35:09 2014 +0000
     5.3 @@ -1,5 +1,5 @@
     5.4  #
     5.5 -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     5.6 +# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
     5.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8  #
     5.9  # This code is free software; you can redistribute it and/or modify it
    5.10 @@ -47,22 +47,13 @@
    5.11  LFLAGS_JSIG += -mt -xnolib
    5.12  endif
    5.13  
    5.14 -$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
    5.15 +$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
    5.16  	@echo Making signal interposition lib...
    5.17  	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
    5.18                           $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl
    5.19  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    5.20 -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
    5.21 -# Clear the SHF_ALLOC flag (if set) from empty section headers.
    5.22 -# An empty section header has sh_addr == 0 and sh_size == 0.
    5.23 -# This problem has only been seen on Solaris X64, but we call this tool
    5.24 -# on all Solaris builds just in case.
    5.25 -	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
    5.26  	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
    5.27 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    5.28 -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
    5.29 -#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
    5.30 -	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJSIG_DEBUGINFO) $@
    5.31 +	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
    5.32    ifeq ($(STRIP_POLICY),all_strip)
    5.33  	$(QUIETLY) $(STRIP) $@
    5.34    else
     6.1 --- a/make/solaris/makefiles/saproc.make	Mon Jun 30 14:58:52 2014 -0400
     6.2 +++ b/make/solaris/makefiles/saproc.make	Mon Nov 17 19:35:09 2014 +0000
     6.3 @@ -1,5 +1,5 @@
     6.4  #
     6.5 -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     6.6 +# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
     6.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8  #
     6.9  # This code is free software; you can redistribute it and/or modify it
    6.10 @@ -90,7 +90,7 @@
    6.11  #SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER
    6.12  
    6.13  
    6.14 -$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE)
    6.15 +$(LIBSAPROC): $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE)
    6.16  	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
    6.17  	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
    6.18  	  exit 1; \
    6.19 @@ -121,17 +121,8 @@
    6.20  	           -c -o $(SADISOBJ)
    6.21  	
    6.22  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    6.23 -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
    6.24 -# Clear the SHF_ALLOC flag (if set) from empty section headers.
    6.25 -# An empty section header has sh_addr == 0 and sh_size == 0.
    6.26 -# This problem has only been seen on Solaris X64, but we call this tool
    6.27 -# on all Solaris builds just in case.
    6.28 -	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
    6.29  	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
    6.30 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    6.31 -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
    6.32 -#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
    6.33 -	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBSAPROC_DEBUGINFO) $@
    6.34 +	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
    6.35    ifeq ($(STRIP_POLICY),all_strip)
    6.36  	$(QUIETLY) $(STRIP) $@
    6.37    else
     7.1 --- a/make/solaris/makefiles/vm.make	Mon Jun 30 14:58:52 2014 -0400
     7.2 +++ b/make/solaris/makefiles/vm.make	Mon Nov 17 19:35:09 2014 +0000
     7.3 @@ -1,5 +1,5 @@
     7.4  #
     7.5 -# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     7.6 +# Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
     7.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8  #
     7.9  # This code is free software; you can redistribute it and/or modify it
    7.10 @@ -153,14 +153,6 @@
    7.11  include $(MAKEFILES_DIR)/dtrace.make
    7.12  
    7.13  #----------------------------------------------------------------------
    7.14 -# add_gnu_debuglink tool
    7.15 -include $(MAKEFILES_DIR)/add_gnu_debuglink.make
    7.16 -
    7.17 -#----------------------------------------------------------------------
    7.18 -# fix_empty_sec_hdr_flags tool
    7.19 -include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make
    7.20 -
    7.21 -#----------------------------------------------------------------------
    7.22  # JVM
    7.23  
    7.24  JVM      = jvm
    7.25 @@ -299,7 +291,7 @@
    7.26  LINK_VM = $(LINK_LIB.CXX)
    7.27  endif
    7.28  # making the library:
    7.29 -$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE)
    7.30 +$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE)
    7.31  ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
    7.32  	@echo Linking vm...
    7.33  	$(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK)
    7.34 @@ -307,17 +299,8 @@
    7.35  	$(QUIETLY) $(LINK_LIB.CXX/POST_HOOK)
    7.36  	$(QUIETLY) rm -f $@.1 && ln -s $@ $@.1
    7.37  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    7.38 -# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
    7.39 -# Clear the SHF_ALLOC flag (if set) from empty section headers.
    7.40 -# An empty section header has sh_addr == 0 and sh_size == 0.
    7.41 -# This problem has only been seen on Solaris X64, but we call this tool
    7.42 -# on all Solaris builds just in case.
    7.43 -	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
    7.44  	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
    7.45 -# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
    7.46 -# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
    7.47 -#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
    7.48 -	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@
    7.49 +	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
    7.50    ifeq ($(STRIP_POLICY),all_strip)
    7.51  	$(QUIETLY) $(STRIP) $@
    7.52    else
     8.1 --- a/make/windows/makefiles/sa.make	Mon Jun 30 14:58:52 2014 -0400
     8.2 +++ b/make/windows/makefiles/sa.make	Mon Nov 17 19:35:09 2014 +0000
     8.3 @@ -111,7 +111,7 @@
     8.4  SA_LFLAGS = $(SA_LFLAGS) -map -debug
     8.5  !endif
     8.6  !if "$(BUILDARCH)" == "i486"
     8.7 -SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS)
     8.8 +SA_LFLAGS = /SAFESEH $(SA_LFLAGS)
     8.9  !endif
    8.10  
    8.11  SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG)
     9.1 --- a/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c	Mon Jun 30 14:58:52 2014 -0400
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,285 +0,0 @@
     9.4 -/*
     9.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     9.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 - *
     9.8 - * This code is free software; you can redistribute it and/or modify it
     9.9 - * under the terms of the GNU General Public License version 2 only, as
    9.10 - * published by the Free Software Foundation.
    9.11 - *
    9.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
    9.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.15 - * version 2 for more details (a copy is included in the LICENSE file that
    9.16 - * accompanied this code).
    9.17 - *
    9.18 - * You should have received a copy of the GNU General Public License version
    9.19 - * 2 along with this work; if not, write to the Free Software Foundation,
    9.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.21 - *
    9.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.23 - * or visit www.oracle.com if you need additional information or have any
    9.24 - * questions.
    9.25 - *
    9.26 - */
    9.27 -
    9.28 -/*
    9.29 - * Name:        add_gnu_debuglink.c
    9.30 - *
    9.31 - * Description: Add a ".gnu_debuglink" section that refers to the specified
    9.32 - *     debug_info_path to the specified ELF object.
    9.33 - *
    9.34 - *     This program is adapted from the example program shown on the
    9.35 - *     elf(3elf) man page and from code from the Solaris compiler
    9.36 - *     driver.
    9.37 - */
    9.38 -
    9.39 -/*
    9.40 - * needed to define SHF_EXCLUDE
    9.41 - */
    9.42 -#define ELF_TARGET_ALL
    9.43 -
    9.44 -#include <fcntl.h>
    9.45 -#include <stdio.h>
    9.46 -#include <libelf.h>
    9.47 -#include <stdlib.h>
    9.48 -#include <string.h>
    9.49 -#include <unistd.h>
    9.50 -
    9.51 -static void failure(void);
    9.52 -static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf,
    9.53 -                                        size_t len);
    9.54 -
    9.55 -void
    9.56 -main(int argc, char ** argv) {
    9.57 -                                 /* new ELF section name */
    9.58 -    static char SEC_NAME[] = ".gnu_debuglink";
    9.59 -
    9.60 -    unsigned char buffer[8 * 1024];  /* I/O buffer */
    9.61 -    int           buffer_len;        /* buffer length */
    9.62 -    char *        debug_info_path;   /* debug info path */
    9.63 -    void *        ehdr;              /* ELF header */
    9.64 -    Elf *         elf;               /* ELF descriptor */
    9.65 -    char *        elf_ident;         /* ELF identity string */
    9.66 -    char *        elf_obj;           /* elf_obj file */
    9.67 -    int           fd;                /* descriptor for files */
    9.68 -    unsigned int  file_crc = 0;      /* CRC for debug info file */
    9.69 -    int           is_elfclass64;     /* is an ELFCLASS64 file? */
    9.70 -    Elf_Data *    link_dat;          /* ELF data for new debug info link */
    9.71 -    Elf_Data *    name_dat;          /* ELF data for new section name */
    9.72 -    Elf_Scn *     new_scn;           /* new ELF section descriptor */
    9.73 -    void *        new_shdr;          /* new ELF section header */
    9.74 -    Elf_Scn *     scn;               /* ELF section descriptor */
    9.75 -    void *        shdr;              /* ELF section header */
    9.76 -
    9.77 -    if (argc != 3) {
    9.78 -        (void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]);
    9.79 -        exit(2);
    9.80 -    }
    9.81 -
    9.82 -    debug_info_path = argv[1];  /* save for later */
    9.83 -    if ((fd = open(debug_info_path, O_RDONLY)) == -1) {
    9.84 -        (void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path);
    9.85 -        exit(3);
    9.86 -    }
    9.87 -
    9.88 -    (void) printf("Computing CRC for '%s'\n", debug_info_path);
    9.89 -    (void) fflush(stdout);
    9.90 -    /* compute CRC for the debug info file */
    9.91 -    for (;;) {
    9.92 -        int len = read(fd, buffer, sizeof buffer);
    9.93 -        if (len <= 0) {
    9.94 -            break;
    9.95 -        }
    9.96 -        file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
    9.97 -    }
    9.98 -    (void) close(fd);
    9.99 -
   9.100 -    /* open the elf_obj */
   9.101 -    elf_obj = argv[2];
   9.102 -    if ((fd = open(elf_obj, O_RDWR)) == -1) {
   9.103 -        (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
   9.104 -        exit(4);
   9.105 -    }
   9.106 -
   9.107 -    (void) printf("Opening '%s' for update\n", elf_obj);
   9.108 -    (void) fflush(stdout);
   9.109 -    (void) elf_version(EV_CURRENT);  /* coordinate ELF versions */
   9.110 -
   9.111 -    /* obtain the ELF descriptors from the input file */
   9.112 -    if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
   9.113 -        failure();
   9.114 -    }
   9.115 -
   9.116 -    /* determine if ELFCLASS64 or not? */
   9.117 -    elf_ident = elf_getident(elf, NULL);
   9.118 -    is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
   9.119 -
   9.120 -    /* get the ELF header */
   9.121 -    if (is_elfclass64) {
   9.122 -        ehdr = elf64_getehdr(elf);
   9.123 -    } else {
   9.124 -        ehdr = elf32_getehdr(elf);
   9.125 -    }
   9.126 -    if (ehdr == NULL) {
   9.127 -        failure();
   9.128 -    }
   9.129 -
   9.130 -    /* get the ELF section descriptor */
   9.131 -    if (is_elfclass64) {
   9.132 -        scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
   9.133 -    } else {
   9.134 -        scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
   9.135 -    }
   9.136 -    if (scn == NULL) {
   9.137 -        failure();
   9.138 -    }
   9.139 -
   9.140 -    /* get the section header */
   9.141 -    if (is_elfclass64) {
   9.142 -        shdr = elf64_getshdr(scn);
   9.143 -    } else {
   9.144 -        shdr = elf32_getshdr(scn);
   9.145 -    }
   9.146 -    if (shdr == NULL) {
   9.147 -        failure();
   9.148 -    }
   9.149 -
   9.150 -    (void) printf("Adding ELF data for new section name\n");
   9.151 -    (void) fflush(stdout);
   9.152 -    name_dat = elf_newdata(scn);
   9.153 -    name_dat->d_buf = (void *) SEC_NAME;
   9.154 -    if (is_elfclass64) {
   9.155 -        name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1;
   9.156 -    } else {
   9.157 -        name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1;
   9.158 -    }
   9.159 -    name_dat->d_align = 1;
   9.160 -    name_dat->d_size = strlen(SEC_NAME) + 1;
   9.161 -
   9.162 -    new_scn = elf_newscn(elf);
   9.163 -
   9.164 -    if (is_elfclass64) {
   9.165 -        new_shdr = elf64_getshdr(new_scn);
   9.166 -        ((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
   9.167 -        ((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
   9.168 -        ((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size;
   9.169 -        ((Elf64_Shdr *) new_shdr)->sh_addralign = 1;
   9.170 -        ((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
   9.171 -    } else {
   9.172 -        new_shdr = elf32_getshdr(new_scn);
   9.173 -        ((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
   9.174 -        ((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
   9.175 -        ((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size;
   9.176 -        ((Elf32_Shdr *) new_shdr)->sh_addralign = 1;
   9.177 -        ((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
   9.178 -    }
   9.179 -
   9.180 -    (void) printf("Adding ELF data for debug_info_path value\n");
   9.181 -    (void) fflush(stdout);
   9.182 -    (void) memset(buffer, 0, sizeof buffer);
   9.183 -    buffer_len = strlen(debug_info_path) + 1;  /* +1 for NUL */
   9.184 -    (void) strncpy((char *) buffer, debug_info_path, buffer_len);
   9.185 -    if (buffer_len % 4 != 0) {
   9.186 -        /* not on a 4 byte boundary so pad to the next one */
   9.187 -        buffer_len += (4 - buffer_len % 4);
   9.188 -    }
   9.189 -    /* save the CRC */
   9.190 -    (void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc);
   9.191 -    buffer_len += sizeof file_crc;
   9.192 -
   9.193 -    link_dat = elf_newdata(new_scn);
   9.194 -    link_dat->d_type = ELF_T_BYTE;
   9.195 -    link_dat->d_size = buffer_len;
   9.196 -    link_dat->d_buf = buffer;
   9.197 -    link_dat->d_align = 1;
   9.198 -
   9.199 -    (void) printf("Saving updates to '%s'\n", elf_obj);
   9.200 -    (void) fflush(stdout);
   9.201 -    (void) elf_update(elf, ELF_C_NULL);   /* recalc ELF memory structures */
   9.202 -    (void) elf_update(elf, ELF_C_WRITE);  /* write out changes to ELF obj */
   9.203 -    (void) elf_end(elf);                  /* done with ELF obj */
   9.204 -    (void) close(fd);
   9.205 -
   9.206 -    (void) printf("Done updating '%s'\n", elf_obj);
   9.207 -    (void) fflush(stdout);
   9.208 -    exit(0);
   9.209 -}  /* end main */
   9.210 -
   9.211 -
   9.212 -static void
   9.213 -failure() {
   9.214 -    (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
   9.215 -    exit(5);
   9.216 -}
   9.217 -
   9.218 -
   9.219 -/*
   9.220 - * The CRC used in gnu_debuglink, retrieved from
   9.221 - * http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files.
   9.222 - */
   9.223 -
   9.224 -static unsigned int
   9.225 -gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) {
   9.226 -    static const unsigned int crc32_table[256] = {
   9.227 -        0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
   9.228 -        0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
   9.229 -        0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
   9.230 -        0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
   9.231 -        0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
   9.232 -        0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
   9.233 -        0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
   9.234 -        0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
   9.235 -        0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
   9.236 -        0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
   9.237 -        0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
   9.238 -        0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
   9.239 -        0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
   9.240 -        0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
   9.241 -        0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
   9.242 -        0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
   9.243 -        0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
   9.244 -        0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
   9.245 -        0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
   9.246 -        0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
   9.247 -        0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
   9.248 -        0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
   9.249 -        0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
   9.250 -        0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
   9.251 -        0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
   9.252 -        0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
   9.253 -        0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
   9.254 -        0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
   9.255 -        0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
   9.256 -        0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
   9.257 -        0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
   9.258 -        0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
   9.259 -        0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
   9.260 -        0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
   9.261 -        0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
   9.262 -        0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
   9.263 -        0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
   9.264 -        0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
   9.265 -        0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
   9.266 -        0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
   9.267 -        0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
   9.268 -        0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
   9.269 -        0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
   9.270 -        0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
   9.271 -        0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
   9.272 -        0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
   9.273 -        0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
   9.274 -        0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
   9.275 -        0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
   9.276 -        0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
   9.277 -        0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
   9.278 -        0x2d02ef8d
   9.279 -    };
   9.280 -
   9.281 -    unsigned char *end;
   9.282 -
   9.283 -    crc = ~crc & 0xffffffff;
   9.284 -    for (end = buf + len; buf < end; ++buf) {
   9.285 -        crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
   9.286 -    }
   9.287 -    return ~crc & 0xffffffff;
   9.288 -}
    10.1 --- a/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c	Mon Jun 30 14:58:52 2014 -0400
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,181 +0,0 @@
    10.4 -/*
    10.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
    10.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.7 - *
    10.8 - * This code is free software; you can redistribute it and/or modify it
    10.9 - * under the terms of the GNU General Public License version 2 only, as
   10.10 - * published by the Free Software Foundation.
   10.11 - *
   10.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   10.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   10.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   10.15 - * version 2 for more details (a copy is included in the LICENSE file that
   10.16 - * accompanied this code).
   10.17 - *
   10.18 - * You should have received a copy of the GNU General Public License version
   10.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   10.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   10.21 - *
   10.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   10.23 - * or visit www.oracle.com if you need additional information or have any
   10.24 - * questions.
   10.25 - *
   10.26 - */
   10.27 -
   10.28 -/*
   10.29 - * Name:        fix_empty_sec_hdr_flags.c
   10.30 - *
   10.31 - * Description: Remove the SHF_ALLOC flag from "empty" section headers.
   10.32 - *     An "empty" section header has sh_addr == 0 and sh_size == 0.
   10.33 - *
   10.34 - *     This program is adapted from the example program shown on the
   10.35 - *     elf(3elf) man page and from code from the Solaris compiler
   10.36 - *     driver.
   10.37 - */
   10.38 -
   10.39 -#include <fcntl.h>
   10.40 -#include <stdio.h>
   10.41 -#include <libelf.h>
   10.42 -#include <stdlib.h>
   10.43 -#include <string.h>
   10.44 -#include <unistd.h>
   10.45 -
   10.46 -static void failure(void);
   10.47 -
   10.48 -void
   10.49 -main(int argc, char ** argv) {
   10.50 -    void *        ehdr;           /* ELF header */
   10.51 -    unsigned int  i;              /* section counter */
   10.52 -    int           fd;             /* descriptor for file */
   10.53 -    Elf *         elf;            /* ELF descriptor */
   10.54 -    char *        elf_ident;      /* ELF identity string */
   10.55 -    char *        elf_obj;        /* elf_obj file */
   10.56 -    int           fix_count;      /* number of flags fixed */
   10.57 -    int           is_elfclass64;  /* is an ELFCLASS64 file? */
   10.58 -    Elf_Scn *     scn;            /* ELF section descriptor */
   10.59 -    void *        shdr;           /* ELF section header */
   10.60 -    Elf_Data *    shstrtab;       /* ELF section header string table */
   10.61 -
   10.62 -    if (argc != 2) {
   10.63 -        (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
   10.64 -        exit(2);
   10.65 -    }
   10.66 -
   10.67 -    /* open the elf_obj */
   10.68 -    elf_obj = argv[1];
   10.69 -    if ((fd = open(elf_obj, O_RDWR)) == -1) {
   10.70 -        (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
   10.71 -        exit(3);
   10.72 -    }
   10.73 -
   10.74 -    (void) printf("Opening '%s' for update\n", elf_obj);
   10.75 -    (void) fflush(stdout);
   10.76 -    (void) elf_version(EV_CURRENT);  /* coordinate ELF versions */
   10.77 -
   10.78 -    /* obtain the ELF descriptors from the input file */
   10.79 -    if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
   10.80 -        failure();
   10.81 -    }
   10.82 -
   10.83 -    /* determine if ELFCLASS64 or not? */
   10.84 -    elf_ident = elf_getident(elf, NULL);
   10.85 -    is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
   10.86 -
   10.87 -    /* get the ELF header */
   10.88 -    if (is_elfclass64) {
   10.89 -        ehdr = elf64_getehdr(elf);
   10.90 -    } else {
   10.91 -        ehdr = elf32_getehdr(elf);
   10.92 -    }
   10.93 -    if (ehdr == NULL) {
   10.94 -        failure();
   10.95 -    }
   10.96 -
   10.97 -    /* get the ELF section descriptor */
   10.98 -    if (is_elfclass64) {
   10.99 -        scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
  10.100 -    } else {
  10.101 -        scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
  10.102 -    }
  10.103 -    if (scn == NULL) {
  10.104 -        failure();
  10.105 -    }
  10.106 -
  10.107 -    /* get the section header string table */
  10.108 -    shstrtab = elf_getdata(scn, NULL);
  10.109 -    if (shstrtab == NULL) {
  10.110 -        failure();
  10.111 -    }
  10.112 -
  10.113 -    fix_count = 0;
  10.114 -
  10.115 -    /* traverse the sections of the input file */
  10.116 -    for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
  10.117 -        int    has_flag_set;  /* is SHF_ALLOC flag set? */
  10.118 -        int    is_empty;      /* is section empty? */
  10.119 -        char * name;          /* short hand pointer */
  10.120 -
  10.121 -        /* get the section header */
  10.122 -        if (is_elfclass64) {
  10.123 -            shdr = elf64_getshdr(scn);
  10.124 -        } else {
  10.125 -            shdr = elf32_getshdr(scn);
  10.126 -        }
  10.127 -        if (shdr == NULL) {
  10.128 -            failure();
  10.129 -        }
  10.130 -
  10.131 -        if (is_elfclass64) {
  10.132 -            name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
  10.133 -        } else {
  10.134 -            name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
  10.135 -        }
  10.136 -
  10.137 -        if (is_elfclass64) {
  10.138 -            has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
  10.139 -            is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
  10.140 -                ((Elf64_Shdr *) shdr)->sh_size == 0;
  10.141 -        } else {
  10.142 -            has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
  10.143 -            is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
  10.144 -                ((Elf32_Shdr *) shdr)->sh_size == 0;
  10.145 -        }
  10.146 -
  10.147 -        if (is_empty && has_flag_set) {
  10.148 -            (void) printf("section[%u] '%s' is empty, "
  10.149 -                "but SHF_ALLOC flag is set.\n", i, name);
  10.150 -            (void) printf("Clearing the SHF_ALLOC flag.\n");
  10.151 -
  10.152 -            if (is_elfclass64) {
  10.153 -                ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
  10.154 -            } else {
  10.155 -                ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
  10.156 -            }
  10.157 -            fix_count++;
  10.158 -        }
  10.159 -    }  /* end for each ELF section */
  10.160 -
  10.161 -    if (fix_count > 0) {
  10.162 -        (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
  10.163 -        (void) fflush(stdout);
  10.164 -        (void) elf_update(elf, ELF_C_NULL);   /* recalc ELF memory structures */
  10.165 -        (void) elf_update(elf, ELF_C_WRITE);  /* write out changes to ELF obj */
  10.166 -    } else {
  10.167 -        (void) printf("No SHF_ALLOC flags needed to be cleared.\n");
  10.168 -    }
  10.169 -
  10.170 -    (void) elf_end(elf);                  /* done with ELF obj */
  10.171 -    (void) close(fd);
  10.172 -
  10.173 -    (void) printf("Done %s '%s'\n",
  10.174 -               (fix_count > 0) ? "updating" : "with", elf_obj);
  10.175 -    (void) fflush(stdout);
  10.176 -    exit(0);
  10.177 -}  /* end main */
  10.178 -
  10.179 -
  10.180 -static void
  10.181 -failure() {
  10.182 -    (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
  10.183 -    exit(6);
  10.184 -}

mercurial