8033602: wrong stabs data in libjvm.debuginfo on JDK 8 - SPARC

Sat, 15 Nov 2014 11:22:07 -0800

author
dcubed
date
Sat, 15 Nov 2014 11:22:07 -0800
changeset 7354
8c76e844a7f9
parent 7353
84e11eeec136
child 7355
89266fdfa9e6

8033602: wrong stabs data in libjvm.debuginfo on JDK 8 - SPARC
8034005: cannot debug in synchronizer.o or objectMonitor.o on Solaris X86
Summary: Solaris needs objcopy version of 2.21.1 or newer is needed to create valid .debuginfo files.
Reviewed-by: dsamersoff, sspitsyn, dholmes, ihse

make/solaris/makefiles/add_gnu_debuglink.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/defs.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/dtrace.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/fix_empty_sec_hdr_flags.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/jsig.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/saproc.make file | annotate | diff | comparison | revisions
make/solaris/makefiles/vm.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	Fri Nov 14 07:51:50 2014 -0800
     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	Fri Nov 14 07:51:50 2014 -0800
     2.2 +++ b/make/solaris/makefiles/defs.make	Sat Nov 15 11:22:07 2014 -0800
     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	Fri Nov 14 07:51:50 2014 -0800
     3.2 +++ b/make/solaris/makefiles/dtrace.make	Sat Nov 15 11:22:07 2014 -0800
     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	Fri Nov 14 07:51:50 2014 -0800
     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	Fri Nov 14 07:51:50 2014 -0800
     5.2 +++ b/make/solaris/makefiles/jsig.make	Sat Nov 15 11:22:07 2014 -0800
     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	Fri Nov 14 07:51:50 2014 -0800
     6.2 +++ b/make/solaris/makefiles/saproc.make	Sat Nov 15 11:22:07 2014 -0800
     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	Fri Nov 14 07:51:50 2014 -0800
     7.2 +++ b/make/solaris/makefiles/vm.make	Sat Nov 15 11:22:07 2014 -0800
     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/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c	Fri Nov 14 07:51:50 2014 -0800
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,285 +0,0 @@
     8.4 -/*
     8.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     8.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 - *
     8.8 - * This code is free software; you can redistribute it and/or modify it
     8.9 - * under the terms of the GNU General Public License version 2 only, as
    8.10 - * published by the Free Software Foundation.
    8.11 - *
    8.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
    8.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.15 - * version 2 for more details (a copy is included in the LICENSE file that
    8.16 - * accompanied this code).
    8.17 - *
    8.18 - * You should have received a copy of the GNU General Public License version
    8.19 - * 2 along with this work; if not, write to the Free Software Foundation,
    8.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.21 - *
    8.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    8.23 - * or visit www.oracle.com if you need additional information or have any
    8.24 - * questions.
    8.25 - *
    8.26 - */
    8.27 -
    8.28 -/*
    8.29 - * Name:        add_gnu_debuglink.c
    8.30 - *
    8.31 - * Description: Add a ".gnu_debuglink" section that refers to the specified
    8.32 - *     debug_info_path to the specified ELF object.
    8.33 - *
    8.34 - *     This program is adapted from the example program shown on the
    8.35 - *     elf(3elf) man page and from code from the Solaris compiler
    8.36 - *     driver.
    8.37 - */
    8.38 -
    8.39 -/*
    8.40 - * needed to define SHF_EXCLUDE
    8.41 - */
    8.42 -#define ELF_TARGET_ALL
    8.43 -
    8.44 -#include <fcntl.h>
    8.45 -#include <stdio.h>
    8.46 -#include <libelf.h>
    8.47 -#include <stdlib.h>
    8.48 -#include <string.h>
    8.49 -#include <unistd.h>
    8.50 -
    8.51 -static void failure(void);
    8.52 -static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf,
    8.53 -                                        size_t len);
    8.54 -
    8.55 -void
    8.56 -main(int argc, char ** argv) {
    8.57 -                                 /* new ELF section name */
    8.58 -    static char SEC_NAME[] = ".gnu_debuglink";
    8.59 -
    8.60 -    unsigned char buffer[8 * 1024];  /* I/O buffer */
    8.61 -    int           buffer_len;        /* buffer length */
    8.62 -    char *        debug_info_path;   /* debug info path */
    8.63 -    void *        ehdr;              /* ELF header */
    8.64 -    Elf *         elf;               /* ELF descriptor */
    8.65 -    char *        elf_ident;         /* ELF identity string */
    8.66 -    char *        elf_obj;           /* elf_obj file */
    8.67 -    int           fd;                /* descriptor for files */
    8.68 -    unsigned int  file_crc = 0;      /* CRC for debug info file */
    8.69 -    int           is_elfclass64;     /* is an ELFCLASS64 file? */
    8.70 -    Elf_Data *    link_dat;          /* ELF data for new debug info link */
    8.71 -    Elf_Data *    name_dat;          /* ELF data for new section name */
    8.72 -    Elf_Scn *     new_scn;           /* new ELF section descriptor */
    8.73 -    void *        new_shdr;          /* new ELF section header */
    8.74 -    Elf_Scn *     scn;               /* ELF section descriptor */
    8.75 -    void *        shdr;              /* ELF section header */
    8.76 -
    8.77 -    if (argc != 3) {
    8.78 -        (void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]);
    8.79 -        exit(2);
    8.80 -    }
    8.81 -
    8.82 -    debug_info_path = argv[1];  /* save for later */
    8.83 -    if ((fd = open(debug_info_path, O_RDONLY)) == -1) {
    8.84 -        (void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path);
    8.85 -        exit(3);
    8.86 -    }
    8.87 -
    8.88 -    (void) printf("Computing CRC for '%s'\n", debug_info_path);
    8.89 -    (void) fflush(stdout);
    8.90 -    /* compute CRC for the debug info file */
    8.91 -    for (;;) {
    8.92 -        int len = read(fd, buffer, sizeof buffer);
    8.93 -        if (len <= 0) {
    8.94 -            break;
    8.95 -        }
    8.96 -        file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
    8.97 -    }
    8.98 -    (void) close(fd);
    8.99 -
   8.100 -    /* open the elf_obj */
   8.101 -    elf_obj = argv[2];
   8.102 -    if ((fd = open(elf_obj, O_RDWR)) == -1) {
   8.103 -        (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
   8.104 -        exit(4);
   8.105 -    }
   8.106 -
   8.107 -    (void) printf("Opening '%s' for update\n", elf_obj);
   8.108 -    (void) fflush(stdout);
   8.109 -    (void) elf_version(EV_CURRENT);  /* coordinate ELF versions */
   8.110 -
   8.111 -    /* obtain the ELF descriptors from the input file */
   8.112 -    if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
   8.113 -        failure();
   8.114 -    }
   8.115 -
   8.116 -    /* determine if ELFCLASS64 or not? */
   8.117 -    elf_ident = elf_getident(elf, NULL);
   8.118 -    is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
   8.119 -
   8.120 -    /* get the ELF header */
   8.121 -    if (is_elfclass64) {
   8.122 -        ehdr = elf64_getehdr(elf);
   8.123 -    } else {
   8.124 -        ehdr = elf32_getehdr(elf);
   8.125 -    }
   8.126 -    if (ehdr == NULL) {
   8.127 -        failure();
   8.128 -    }
   8.129 -
   8.130 -    /* get the ELF section descriptor */
   8.131 -    if (is_elfclass64) {
   8.132 -        scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
   8.133 -    } else {
   8.134 -        scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
   8.135 -    }
   8.136 -    if (scn == NULL) {
   8.137 -        failure();
   8.138 -    }
   8.139 -
   8.140 -    /* get the section header */
   8.141 -    if (is_elfclass64) {
   8.142 -        shdr = elf64_getshdr(scn);
   8.143 -    } else {
   8.144 -        shdr = elf32_getshdr(scn);
   8.145 -    }
   8.146 -    if (shdr == NULL) {
   8.147 -        failure();
   8.148 -    }
   8.149 -
   8.150 -    (void) printf("Adding ELF data for new section name\n");
   8.151 -    (void) fflush(stdout);
   8.152 -    name_dat = elf_newdata(scn);
   8.153 -    name_dat->d_buf = (void *) SEC_NAME;
   8.154 -    if (is_elfclass64) {
   8.155 -        name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1;
   8.156 -    } else {
   8.157 -        name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1;
   8.158 -    }
   8.159 -    name_dat->d_align = 1;
   8.160 -    name_dat->d_size = strlen(SEC_NAME) + 1;
   8.161 -
   8.162 -    new_scn = elf_newscn(elf);
   8.163 -
   8.164 -    if (is_elfclass64) {
   8.165 -        new_shdr = elf64_getshdr(new_scn);
   8.166 -        ((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
   8.167 -        ((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
   8.168 -        ((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size;
   8.169 -        ((Elf64_Shdr *) new_shdr)->sh_addralign = 1;
   8.170 -        ((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
   8.171 -    } else {
   8.172 -        new_shdr = elf32_getshdr(new_scn);
   8.173 -        ((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
   8.174 -        ((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
   8.175 -        ((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size;
   8.176 -        ((Elf32_Shdr *) new_shdr)->sh_addralign = 1;
   8.177 -        ((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
   8.178 -    }
   8.179 -
   8.180 -    (void) printf("Adding ELF data for debug_info_path value\n");
   8.181 -    (void) fflush(stdout);
   8.182 -    (void) memset(buffer, 0, sizeof buffer);
   8.183 -    buffer_len = strlen(debug_info_path) + 1;  /* +1 for NUL */
   8.184 -    (void) strncpy((char *) buffer, debug_info_path, buffer_len);
   8.185 -    if (buffer_len % 4 != 0) {
   8.186 -        /* not on a 4 byte boundary so pad to the next one */
   8.187 -        buffer_len += (4 - buffer_len % 4);
   8.188 -    }
   8.189 -    /* save the CRC */
   8.190 -    (void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc);
   8.191 -    buffer_len += sizeof file_crc;
   8.192 -
   8.193 -    link_dat = elf_newdata(new_scn);
   8.194 -    link_dat->d_type = ELF_T_BYTE;
   8.195 -    link_dat->d_size = buffer_len;
   8.196 -    link_dat->d_buf = buffer;
   8.197 -    link_dat->d_align = 1;
   8.198 -
   8.199 -    (void) printf("Saving updates to '%s'\n", elf_obj);
   8.200 -    (void) fflush(stdout);
   8.201 -    (void) elf_update(elf, ELF_C_NULL);   /* recalc ELF memory structures */
   8.202 -    (void) elf_update(elf, ELF_C_WRITE);  /* write out changes to ELF obj */
   8.203 -    (void) elf_end(elf);                  /* done with ELF obj */
   8.204 -    (void) close(fd);
   8.205 -
   8.206 -    (void) printf("Done updating '%s'\n", elf_obj);
   8.207 -    (void) fflush(stdout);
   8.208 -    exit(0);
   8.209 -}  /* end main */
   8.210 -
   8.211 -
   8.212 -static void
   8.213 -failure() {
   8.214 -    (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
   8.215 -    exit(5);
   8.216 -}
   8.217 -
   8.218 -
   8.219 -/*
   8.220 - * The CRC used in gnu_debuglink, retrieved from
   8.221 - * http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files.
   8.222 - */
   8.223 -
   8.224 -static unsigned int
   8.225 -gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) {
   8.226 -    static const unsigned int crc32_table[256] = {
   8.227 -        0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
   8.228 -        0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
   8.229 -        0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
   8.230 -        0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
   8.231 -        0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
   8.232 -        0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
   8.233 -        0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
   8.234 -        0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
   8.235 -        0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
   8.236 -        0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
   8.237 -        0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
   8.238 -        0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
   8.239 -        0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
   8.240 -        0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
   8.241 -        0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
   8.242 -        0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
   8.243 -        0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
   8.244 -        0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
   8.245 -        0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
   8.246 -        0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
   8.247 -        0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
   8.248 -        0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
   8.249 -        0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
   8.250 -        0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
   8.251 -        0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
   8.252 -        0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
   8.253 -        0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
   8.254 -        0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
   8.255 -        0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
   8.256 -        0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
   8.257 -        0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
   8.258 -        0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
   8.259 -        0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
   8.260 -        0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
   8.261 -        0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
   8.262 -        0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
   8.263 -        0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
   8.264 -        0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
   8.265 -        0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
   8.266 -        0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
   8.267 -        0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
   8.268 -        0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
   8.269 -        0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
   8.270 -        0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
   8.271 -        0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
   8.272 -        0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
   8.273 -        0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
   8.274 -        0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
   8.275 -        0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
   8.276 -        0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
   8.277 -        0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
   8.278 -        0x2d02ef8d
   8.279 -    };
   8.280 -
   8.281 -    unsigned char *end;
   8.282 -
   8.283 -    crc = ~crc & 0xffffffff;
   8.284 -    for (end = buf + len; buf < end; ++buf) {
   8.285 -        crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
   8.286 -    }
   8.287 -    return ~crc & 0xffffffff;
   8.288 -}
     9.1 --- a/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c	Fri Nov 14 07:51:50 2014 -0800
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,181 +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:        fix_empty_sec_hdr_flags.c
    9.30 - *
    9.31 - * Description: Remove the SHF_ALLOC flag from "empty" section headers.
    9.32 - *     An "empty" section header has sh_addr == 0 and sh_size == 0.
    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 -#include <fcntl.h>
    9.40 -#include <stdio.h>
    9.41 -#include <libelf.h>
    9.42 -#include <stdlib.h>
    9.43 -#include <string.h>
    9.44 -#include <unistd.h>
    9.45 -
    9.46 -static void failure(void);
    9.47 -
    9.48 -void
    9.49 -main(int argc, char ** argv) {
    9.50 -    void *        ehdr;           /* ELF header */
    9.51 -    unsigned int  i;              /* section counter */
    9.52 -    int           fd;             /* descriptor for file */
    9.53 -    Elf *         elf;            /* ELF descriptor */
    9.54 -    char *        elf_ident;      /* ELF identity string */
    9.55 -    char *        elf_obj;        /* elf_obj file */
    9.56 -    int           fix_count;      /* number of flags fixed */
    9.57 -    int           is_elfclass64;  /* is an ELFCLASS64 file? */
    9.58 -    Elf_Scn *     scn;            /* ELF section descriptor */
    9.59 -    void *        shdr;           /* ELF section header */
    9.60 -    Elf_Data *    shstrtab;       /* ELF section header string table */
    9.61 -
    9.62 -    if (argc != 2) {
    9.63 -        (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
    9.64 -        exit(2);
    9.65 -    }
    9.66 -
    9.67 -    /* open the elf_obj */
    9.68 -    elf_obj = argv[1];
    9.69 -    if ((fd = open(elf_obj, O_RDWR)) == -1) {
    9.70 -        (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
    9.71 -        exit(3);
    9.72 -    }
    9.73 -
    9.74 -    (void) printf("Opening '%s' for update\n", elf_obj);
    9.75 -    (void) fflush(stdout);
    9.76 -    (void) elf_version(EV_CURRENT);  /* coordinate ELF versions */
    9.77 -
    9.78 -    /* obtain the ELF descriptors from the input file */
    9.79 -    if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
    9.80 -        failure();
    9.81 -    }
    9.82 -
    9.83 -    /* determine if ELFCLASS64 or not? */
    9.84 -    elf_ident = elf_getident(elf, NULL);
    9.85 -    is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
    9.86 -
    9.87 -    /* get the ELF header */
    9.88 -    if (is_elfclass64) {
    9.89 -        ehdr = elf64_getehdr(elf);
    9.90 -    } else {
    9.91 -        ehdr = elf32_getehdr(elf);
    9.92 -    }
    9.93 -    if (ehdr == NULL) {
    9.94 -        failure();
    9.95 -    }
    9.96 -
    9.97 -    /* get the ELF section descriptor */
    9.98 -    if (is_elfclass64) {
    9.99 -        scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
   9.100 -    } else {
   9.101 -        scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
   9.102 -    }
   9.103 -    if (scn == NULL) {
   9.104 -        failure();
   9.105 -    }
   9.106 -
   9.107 -    /* get the section header string table */
   9.108 -    shstrtab = elf_getdata(scn, NULL);
   9.109 -    if (shstrtab == NULL) {
   9.110 -        failure();
   9.111 -    }
   9.112 -
   9.113 -    fix_count = 0;
   9.114 -
   9.115 -    /* traverse the sections of the input file */
   9.116 -    for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
   9.117 -        int    has_flag_set;  /* is SHF_ALLOC flag set? */
   9.118 -        int    is_empty;      /* is section empty? */
   9.119 -        char * name;          /* short hand pointer */
   9.120 -
   9.121 -        /* get the section header */
   9.122 -        if (is_elfclass64) {
   9.123 -            shdr = elf64_getshdr(scn);
   9.124 -        } else {
   9.125 -            shdr = elf32_getshdr(scn);
   9.126 -        }
   9.127 -        if (shdr == NULL) {
   9.128 -            failure();
   9.129 -        }
   9.130 -
   9.131 -        if (is_elfclass64) {
   9.132 -            name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
   9.133 -        } else {
   9.134 -            name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
   9.135 -        }
   9.136 -
   9.137 -        if (is_elfclass64) {
   9.138 -            has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
   9.139 -            is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
   9.140 -                ((Elf64_Shdr *) shdr)->sh_size == 0;
   9.141 -        } else {
   9.142 -            has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
   9.143 -            is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
   9.144 -                ((Elf32_Shdr *) shdr)->sh_size == 0;
   9.145 -        }
   9.146 -
   9.147 -        if (is_empty && has_flag_set) {
   9.148 -            (void) printf("section[%u] '%s' is empty, "
   9.149 -                "but SHF_ALLOC flag is set.\n", i, name);
   9.150 -            (void) printf("Clearing the SHF_ALLOC flag.\n");
   9.151 -
   9.152 -            if (is_elfclass64) {
   9.153 -                ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
   9.154 -            } else {
   9.155 -                ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
   9.156 -            }
   9.157 -            fix_count++;
   9.158 -        }
   9.159 -    }  /* end for each ELF section */
   9.160 -
   9.161 -    if (fix_count > 0) {
   9.162 -        (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
   9.163 -        (void) fflush(stdout);
   9.164 -        (void) elf_update(elf, ELF_C_NULL);   /* recalc ELF memory structures */
   9.165 -        (void) elf_update(elf, ELF_C_WRITE);  /* write out changes to ELF obj */
   9.166 -    } else {
   9.167 -        (void) printf("No SHF_ALLOC flags needed to be cleared.\n");
   9.168 -    }
   9.169 -
   9.170 -    (void) elf_end(elf);                  /* done with ELF obj */
   9.171 -    (void) close(fd);
   9.172 -
   9.173 -    (void) printf("Done %s '%s'\n",
   9.174 -               (fix_count > 0) ? "updating" : "with", elf_obj);
   9.175 -    (void) fflush(stdout);
   9.176 -    exit(0);
   9.177 -}  /* end main */
   9.178 -
   9.179 -
   9.180 -static void
   9.181 -failure() {
   9.182 -    (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
   9.183 -    exit(6);
   9.184 -}

mercurial