--- old/make/autoconf/spec.gmk.in 2018-03-05 17:41:03.000000000 +0100 +++ new/make/autoconf/spec.gmk.in 2018-03-05 17:41:03.000000000 +0100 @@ -513,6 +513,8 @@ NM:=@NM@ GNM:=@GNM@ STRIP:=@STRIP@ +OBJDUMP:=@OBJDUMP@ +CXXFILT:=@CXXFILT@ LIPO:=@LIPO@ INSTALL_NAME_TOOL:=@INSTALL_NAME_TOOL@ --- old/make/autoconf/toolchain.m4 2018-03-05 17:41:03.000000000 +0100 +++ new/make/autoconf/toolchain.m4 2018-03-05 17:41:03.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -720,12 +720,19 @@ fi fi - BASIC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump]) - if test "x$OBJDUMP" != x; then - # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE - # bails if argument is missing. - BASIC_FIXUP_EXECUTABLE(OBJDUMP) - fi + case $TOOLCHAIN_TYPE in + gcc|clang|solstudio) + BASIC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump]) + if test "x$OBJDUMP" != x; then + # Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE + # bails if argument is missing. + BASIC_FIXUP_EXECUTABLE(OBJDUMP) + fi + BASIC_CHECK_TOOLS(CXXFILT, [c++filt]) + BASIC_CHECK_NONEMPTY(CXXFILT) + BASIC_FIXUP_EXECUTABLE(CXXFILT) + ;; + esac ]) # Setup the build tools (i.e, the compiler and linker used to build programs --- old/make/conf/jib-profiles.js 2018-03-05 17:41:04.000000000 +0100 +++ new/make/conf/jib-profiles.js 2018-03-05 17:41:04.000000000 +0100 @@ -765,7 +765,7 @@ var getJibProfilesDependencies = function (input, common) { var devkit_platform_revisions = { - linux_x64: "gcc4.9.2-OEL6.4+1.2", + linux_x64: "gcc4.9.2-OEL6.4+1.3", macosx_x64: "Xcode6.3-MacOSX10.9+1.0", solaris_x64: "SS12u4-Solaris11u1+1.0", solaris_sparcv9: "SS12u4-Solaris11u1+1.1", --- old/make/devkit/Tools.gmk 2018-03-05 17:41:05.000000000 +0100 +++ new/make/devkit/Tools.gmk 2018-03-05 17:41:05.000000000 +0100 @@ -562,8 +562,8 @@ ln -s $(TARGET)-$* $@ missing-links := $(addprefix $(PREFIX)/bin/, \ - addr2line ar as c++ c++filt elfedit g++ gcc gprof ld nm objcopy ranlib readelf \ - size strings strip ld.bfd ld.gold dtrace) + addr2line ar as c++ c++filt dwp elfedit g++ gcc gcc-$(GCC_VER) gprof ld ld.bfd \ + ld.gold nm objcopy objdump ranlib readelf size strings strip) endif ########################################################################################## --- old/make/hotspot/lib/CompileJvm.gmk 2018-03-05 17:41:06.000000000 +0100 +++ new/make/hotspot/lib/CompileJvm.gmk 2018-03-05 17:41:05.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -270,3 +270,62 @@ include lib/JvmMapfile.gmk TARGETS += $(BUILD_LIBJVM) + +################################################################################ +# Hotspot disallows the use of global operators 'new' and 'delete'. This build +# time check helps enforce this requirement. If you trigger this check and the +# reference is not obvious from the source, GNU objdump can be used to help find +# the reference if compiled with GCC: +# +# objdump -lrdSC +# +# -C demangle +# -d disassemble +# -r print relocation entries, interspersed with the disassembly +# -S print source code, intermixed with disassembly +# -l include filenames and line numbers +# +# Search the output for the operator(s) of interest, to see where they are +# referenced. + +ifneq ($(filter $(TOOLCHAIN_TYPE), gcc clang solstudio), ) + + DEMANGLED_REGEXP := [^:]operator (new|delete) + + # Running c++filt to find offending symbols in all files is too expensive, + # especially on Solaris, so use mangled names when looking for symbols. + # Save the demangling for when something is actually found. + ifeq ($(TOOLCHAIN_TYPE), solstudio) + MANGLED_SYMS := \ + __1c2n6FL_pv_ \ + __1c2N6FL_pv_ \ + __1c2k6Fpv_v_ \ + __1c2K6Fpv_v_ \ + # + UNDEF_PATTERN := UNDEF + else + MANGLED_SYMS := \ + _ZdaPv \ + _ZdlPv \ + _Znam \ + _Znwm \ + # + UNDEF_PATTERN := ' U ' + endif + + define SetupOperatorNewDeleteCheck + $1.op_check: $1 + if [ -n "`$(NM) $$< | $(GREP) $(addprefix -e , $(MANGLED_SYMS)) \ + | $(GREP) $(UNDEF_PATTERN)`" ]; then \ + $(ECHO) "$$<: Error: Use of global operators new and delete is not allowed in Hotspot:"; \ + $(NM) $$< | $(CXXFILT) | $(EGREP) '$(DEMANGLED_REGEXP)' | $(GREP) $(UNDEF_PATTERN); \ + $(ECHO) "See: $(TOPDIR)/make/hotspot/lib/CompileJvm.gmk"; \ + exit 1; \ + fi + $(TOUCH) $$@ + + TARGETS += $1.op_check + endef + + $(foreach o, $(BUILD_LIBJVM_ALL_OBJS), $(eval $(call SetupOperatorNewDeleteCheck,$o))) +endif