eu-readelfs on libraries improved, added gdb call
This commit is contained in:
parent
dc4e79abbb
commit
ea155293bf
77
dont-add-unnecessary-debug-links.patch
Normal file
77
dont-add-unnecessary-debug-links.patch
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
--- openjdk/make/common/NativeCompilation.gmk
|
||||||
|
+++ openjdk/make/common/NativeCompilation.gmk
|
||||||
|
@@ -437,29 +437,6 @@
|
||||||
|
|
||||||
|
ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
|
||||||
|
ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
|
||||||
|
- ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||||
|
- # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
|
||||||
|
- # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
|
||||||
|
- # empty section headers until a fixed $(OBJCOPY) is available.
|
||||||
|
- # An empty section header has sh_addr == 0 and sh_size == 0.
|
||||||
|
- # This problem has only been seen on Solaris X64, but we call this tool
|
||||||
|
- # on all Solaris builds just in case.
|
||||||
|
- #
|
||||||
|
- # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
|
||||||
|
- # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
|
||||||
|
- $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
|
||||||
|
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
|
||||||
|
- $(RM) $$@
|
||||||
|
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
|
||||||
|
- $(OBJCOPY) --only-keep-debug $$< $$@
|
||||||
|
- $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
|
||||||
|
- else # not solaris
|
||||||
|
- $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
|
||||||
|
- $(RM) $$@
|
||||||
|
- $(OBJCOPY) --only-keep-debug $$< $$@
|
||||||
|
- $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
|
||||||
|
- endif # Touch to not retrigger rule on rebuild
|
||||||
|
- $(TOUCH) $$@
|
||||||
|
endif # !windows
|
||||||
|
endif # !macosx
|
||||||
|
|
||||||
|
@@ -483,7 +460,6 @@
|
||||||
|
$1 += $$($1_OUTPUT_DIR)/$$($1_LIBRARY).map \
|
||||||
|
$$($1_OUTPUT_DIR)/$$($1_LIBRARY).pdb
|
||||||
|
else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
|
||||||
|
- $1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
@@ -522,28 +498,8 @@
|
||||||
|
ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
|
||||||
|
ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
|
||||||
|
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||||
|
- # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
|
||||||
|
- # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
|
||||||
|
- # empty section headers until a fixed $(OBJCOPY) is available.
|
||||||
|
- # An empty section header has sh_addr == 0 and sh_size == 0.
|
||||||
|
- # This problem has only been seen on Solaris X64, but we call this tool
|
||||||
|
- # on all Solaris builds just in case.
|
||||||
|
- #
|
||||||
|
- # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
|
||||||
|
- # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
|
||||||
|
- $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
|
||||||
|
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
|
||||||
|
- $(RM) $$@
|
||||||
|
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
|
||||||
|
- $(OBJCOPY) --only-keep-debug $$< $$@
|
||||||
|
- $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
|
||||||
|
else # not solaris
|
||||||
|
- $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
|
||||||
|
- $(RM) $$@
|
||||||
|
- $(OBJCOPY) --only-keep-debug $$< $$@
|
||||||
|
- $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
|
||||||
|
endif
|
||||||
|
- $(TOUCH) $$@
|
||||||
|
endif # !windows
|
||||||
|
endif # !macosx
|
||||||
|
|
||||||
|
@@ -567,7 +523,6 @@
|
||||||
|
$1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).map \
|
||||||
|
$$($1_OUTPUT_DIR)/$$($1_PROGRAM).pdb
|
||||||
|
else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
|
||||||
|
- $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).debuginfo
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
27
hotspot-assembler-debuginfo.patch
Normal file
27
hotspot-assembler-debuginfo.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
Make the assembler generate whatever debuginfo it can
|
||||||
|
--- openjdk/hotspot/make/linux/makefiles/rules.make
|
||||||
|
+++ openjdk/hotspot/make/linux/makefiles/rules.make
|
||||||
|
@@ -34,7 +34,7 @@
|
||||||
|
CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS)
|
||||||
|
CXX_COMPILE = $(CXX) $(CXXFLAGS) $(CFLAGS)
|
||||||
|
|
||||||
|
-AS.S = $(AS) $(ASFLAGS)
|
||||||
|
+AS.S = $(AS) -g $(ASFLAGS)
|
||||||
|
|
||||||
|
COMPILE.CC = $(CC_COMPILE) -c
|
||||||
|
GENASM.CC = $(CC_COMPILE) -S
|
||||||
|
@@ -161,12 +161,12 @@
|
||||||
|
%.o: %.s
|
||||||
|
@echo Assembling $<
|
||||||
|
$(QUIETLY) $(REMOVE_TARGET)
|
||||||
|
- $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
|
||||||
|
+ $(QUIETLY) $(AS.S) -g $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)
|
||||||
|
|
||||||
|
%.o: %.S
|
||||||
|
@echo Assembling $<
|
||||||
|
$(QUIETLY) $(REMOVE_TARGET)
|
||||||
|
- $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
|
||||||
|
+ $(COMPILE.CC) -g -o $@ $< $(COMPILE_DONE)
|
||||||
|
|
||||||
|
%.s: %.cpp
|
||||||
|
@echo Generating assembly for $<
|
@ -795,7 +795,7 @@ Obsoletes: java-1.7.0-openjdk-accessibility%1
|
|||||||
|
|
||||||
Name: java-%{javaver}-%{origin}
|
Name: java-%{javaver}-%{origin}
|
||||||
Version: %{javaver}.%{updatever}
|
Version: %{javaver}.%{updatever}
|
||||||
Release: 1.%{buildver}%{?dist}
|
Release: 2.%{buildver}%{?dist}
|
||||||
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons,
|
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons,
|
||||||
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
|
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
|
||||||
# also included the epoch in their virtual provides. This created a
|
# also included the epoch in their virtual provides. This created a
|
||||||
@ -940,6 +940,10 @@ Patch524: 8158260-pr2991-rh1341258.patch
|
|||||||
# Patches ineligible for 8u
|
# Patches ineligible for 8u
|
||||||
# 8043805: Allow using a system-installed libjpeg
|
# 8043805: Allow using a system-installed libjpeg
|
||||||
Patch201: system-libjpeg.patch
|
Patch201: system-libjpeg.patch
|
||||||
|
# Pathces 204-206 are serving for better check of debug symbols in native liraries
|
||||||
|
Patch204: hotspot-remove-debuglink.patch
|
||||||
|
Patch205: dont-add-unnecessary-debug-links.patch
|
||||||
|
Patch206: hotspot-assembler-debuginfo.patch
|
||||||
|
|
||||||
# Local fixes
|
# Local fixes
|
||||||
# PR1834, RH1022017: Reduce curves reported by SSL to those in NSS
|
# PR1834, RH1022017: Reduce curves reported by SSL to those in NSS
|
||||||
@ -957,10 +961,12 @@ BuildRequires: alsa-lib-devel
|
|||||||
BuildRequires: binutils
|
BuildRequires: binutils
|
||||||
BuildRequires: cups-devel
|
BuildRequires: cups-devel
|
||||||
BuildRequires: desktop-file-utils
|
BuildRequires: desktop-file-utils
|
||||||
|
BuildRequires: elfutils
|
||||||
BuildRequires: fontconfig
|
BuildRequires: fontconfig
|
||||||
BuildRequires: freetype-devel
|
BuildRequires: freetype-devel
|
||||||
BuildRequires: giflib-devel
|
BuildRequires: giflib-devel
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
|
BuildRequires: gdb
|
||||||
BuildRequires: gtk2-devel
|
BuildRequires: gtk2-devel
|
||||||
BuildRequires: lcms2-devel
|
BuildRequires: lcms2-devel
|
||||||
BuildRequires: libjpeg-devel
|
BuildRequires: libjpeg-devel
|
||||||
@ -1235,6 +1241,9 @@ sh %{SOURCE12}
|
|||||||
%patch201
|
%patch201
|
||||||
%patch202
|
%patch202
|
||||||
%patch203
|
%patch203
|
||||||
|
%patch204
|
||||||
|
%patch205
|
||||||
|
%patch206
|
||||||
|
|
||||||
%patch1
|
%patch1
|
||||||
%patch3
|
%patch3
|
||||||
@ -1459,18 +1468,61 @@ $JAVA_HOME/bin/javac -d . %{SOURCE14}
|
|||||||
$JAVA_HOME/bin/java $(echo $(basename %{SOURCE14})|sed "s|\.java||")
|
$JAVA_HOME/bin/java $(echo $(basename %{SOURCE14})|sed "s|\.java||")
|
||||||
|
|
||||||
# Check debug symbols are present and can identify code
|
# Check debug symbols are present and can identify code
|
||||||
SERVER_JVM="$JAVA_HOME/jre/lib/%{archinstall}/server/libjvm.so"
|
find "$JAVA_HOME" -iname '*.so' -print0 | while read -d $'\0' lib
|
||||||
if [ -f "$SERVER_JVM" ] ; then
|
do
|
||||||
nm -aCl "$SERVER_JVM" | grep javaCalls.cpp
|
if [ -f "$lib" ] ; then
|
||||||
fi
|
echo "Testing $lib for debug symbols"
|
||||||
CLIENT_JVM="$JAVA_HOME/jre/lib/%{archinstall}/client/libjvm.so"
|
# All these tests rely on RPM failing the build if the exit code of any set
|
||||||
if [ -f "$CLIENT_JVM" ] ; then
|
# of piped commands is non-zero.
|
||||||
nm -aCl "$CLIENT_JVM" | grep javaCalls.cpp
|
|
||||||
fi
|
# Test for .debug_* sections in the shared object. This is the main test.
|
||||||
ZERO_JVM="$JAVA_HOME/jre/lib/%{archinstall}/zero/libjvm.so"
|
# Stripped objects will not contain these.
|
||||||
if [ -f "$ZERO_JVM" ] ; then
|
eu-readelf -S "$lib" | grep "] .debug_"
|
||||||
nm -aCl "$ZERO_JVM" | grep javaCalls.cpp
|
test $(eu-readelf -S "$lib" | egrep "\]\ .debug_(info|abbrev)" | wc --lines) == 2
|
||||||
fi
|
|
||||||
|
# Test FILE symbols. These will most likely be removed by anyting that
|
||||||
|
# manipulates symbol tables because it's generally useless. So a nice test
|
||||||
|
# that nothing has messed with symbols.
|
||||||
|
old_IFS="$IFS"
|
||||||
|
IFS=$'\n'
|
||||||
|
for line in $(eu-readelf -s "$lib" | grep "00000000 0 FILE LOCAL DEFAULT")
|
||||||
|
do
|
||||||
|
# We expect to see .cpp files, except for architectures like aarch64 and
|
||||||
|
# s390 where we expect .o and .oS files
|
||||||
|
echo "$line" | egrep "ABS ((.*/)?[-_a-zA-Z0-9]+\.(c|cc|cpp|cxx|o|oS))?$"
|
||||||
|
done
|
||||||
|
IFS="$old_IFS"
|
||||||
|
|
||||||
|
# If this is the JVM, look for javaCalls.(cpp|o) in FILEs, for extra sanity checking.
|
||||||
|
if [ "`basename $lib`" = "libjvm.so" ]; then
|
||||||
|
eu-readelf -s "$lib" | \
|
||||||
|
egrep "00000000 0 FILE LOCAL DEFAULT ABS javaCalls.(cpp|o)$"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Test that there are no .gnu_debuglink sections pointing to another
|
||||||
|
# debuginfo file. There shouldn't be any debuginfo files, so the link makes
|
||||||
|
# no sense either.
|
||||||
|
eu-readelf -S "$lib" | grep 'gnu'
|
||||||
|
if eu-readelf -S "$lib" | grep '] .gnu_debuglink' | grep PROGBITS; then
|
||||||
|
echo "bad .gnu_debuglink section."
|
||||||
|
eu-readelf -x .gnu_debuglink "$lib"
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Make sure gdb can do a backtrace based on line numbers on libjvm.so
|
||||||
|
gdb -q "$JAVA_HOME/bin/java" <<EOF | tee gdb.out
|
||||||
|
handle SIGSEGV pass nostop noprint
|
||||||
|
set breakpoint pending on
|
||||||
|
break javaCalls.cpp:1
|
||||||
|
commands 1
|
||||||
|
backtrace
|
||||||
|
quit
|
||||||
|
end
|
||||||
|
run -version
|
||||||
|
EOF
|
||||||
|
grep 'JavaCallWrapper::JavaCallWrapper' gdb.out
|
||||||
|
|
||||||
# Check src.zip has all sources. See RHBZ#1130490
|
# Check src.zip has all sources. See RHBZ#1130490
|
||||||
jar -tf $JAVA_HOME/src.zip | grep 'sun.misc.Unsafe'
|
jar -tf $JAVA_HOME/src.zip | grep 'sun.misc.Unsafe'
|
||||||
@ -1880,6 +1932,12 @@ require "copy_jdk_configs.lua"
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Oct 21 2016 Omair Majid <omajid@redhat.com> - 1:1.8.0.111-2.b16
|
||||||
|
- added dont-add-unnecessary-debug-links.patch
|
||||||
|
- added hotspot-assembler-debuginfo.patch
|
||||||
|
- returned accidentally removed hotspot-remove-debuglink.patch
|
||||||
|
- eu-readelfs on libraries improved, added gdb call
|
||||||
|
|
||||||
* Wed Oct 19 2016 jvanek <jvanek@redhat.com> - 1:1.8.0.111-1.b16
|
* Wed Oct 19 2016 jvanek <jvanek@redhat.com> - 1:1.8.0.111-1.b16
|
||||||
- updated to aarch64-jdk8u111-b16 (from aarch64-port/jdk8u)
|
- updated to aarch64-jdk8u111-b16 (from aarch64-port/jdk8u)
|
||||||
- updated to aarch64-shenandoah-jdk8u111-b16 (from aarch64-port/jdk8u-shenandoah) of hotspot
|
- updated to aarch64-shenandoah-jdk8u111-b16 (from aarch64-port/jdk8u-shenandoah) of hotspot
|
||||||
|
Loading…
Reference in New Issue
Block a user