public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gprofng: Skip jsynprog with a broken javac
@ 2022-03-16 13:59 H.J. Lu
  2022-03-17 17:11 ` Vladimir Mezentsev
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2022-03-16 13:59 UTC (permalink / raw)
  To: binutils

On CET enabled Linux/x86-64 machines, one can get

$ javac simple.java
Error: dl failure on line 894
Error: failed /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-6.fc35.x86_64/jre/lib/amd64/server/libjvm.so, because /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-6.fc35.x86_64/jre/lib/amd64/server/libjvm.so: rebuild shared object with SHSTK support enabled

Set GPROFNG_BROKEN_JAVAC to "yes" only with a broken javac and skip the
jsynprog test with a broken javac.

	PR gprofng/28965
	* Makefile.am (GPROFNG_BROKEN_JAVAC): New.
	(check-DEJAGNU): Pass GPROFNG_BROKEN_JAVAC to runtest.
	* configure.ac (GPROFNG_BROKEN_JAVAC): New AC_SUBST.  Set to yes
	with a broken javac.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* testsuite/gprofng.display/display.exp: Skip jsynprog with a
	broken javac.
---
 gprofng/Makefile.am                           |  2 ++
 gprofng/Makefile.in                           |  2 ++
 gprofng/configure                             | 27 +++++++++++++++++--
 gprofng/configure.ac                          | 17 ++++++++++++
 gprofng/testsuite/gprofng.display/display.exp |  8 +++++-
 5 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/gprofng/Makefile.am b/gprofng/Makefile.am
index 3bf707412ca..e06769cbf90 100644
--- a/gprofng/Makefile.am
+++ b/gprofng/Makefile.am
@@ -41,6 +41,7 @@ LD_NO_AS_NEEDED = @LD_NO_AS_NEEDED@
 GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
 GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
 GPROFNG_LIBDIR = @GPROFNG_LIBDIR@
+GPROFNG_BROKEN_JAVAC = @GPROFNG_BROKEN_JAVAC@
 
 AM_MAKEFLAGS = \
 	jdk_inc="$(jdk_inc)" \
@@ -59,6 +60,7 @@ check-DEJAGNU: site.exp development.exp
 	runtest=$(RUNTEST); \
 	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
 	  $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
+		GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \
 		MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS) $(PTHREAD_CFLAGS)" \
 		LDFLAGS="$(LDFLAGS)" LIBS="$(PTHREAD_LIBS) $(LIBS)" \
 		BUILDDIR="$(abs_top_builddir)" $(RUNTESTFLAGS); \
diff --git a/gprofng/Makefile.in b/gprofng/Makefile.in
index 62005dc2b46..43df524f60a 100644
--- a/gprofng/Makefile.in
+++ b/gprofng/Makefile.in
@@ -261,6 +261,7 @@ EXEEXT = @EXEEXT@
 # Setup the testing framework, if you have one
 EXPECT = expect
 FGREP = @FGREP@
+GPROFNG_BROKEN_JAVAC = @GPROFNG_BROKEN_JAVAC@
 GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
 GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
 GPROFNG_LIBADD = @GPROFNG_LIBADD@
@@ -927,6 +928,7 @@ uninstall-am:
 @TCL_TRY_TRUE@	runtest=$(RUNTEST); \
 @TCL_TRY_TRUE@	if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
 @TCL_TRY_TRUE@	  $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
+@TCL_TRY_TRUE@		GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \
 @TCL_TRY_TRUE@		MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS) $(PTHREAD_CFLAGS)" \
 @TCL_TRY_TRUE@		LDFLAGS="$(LDFLAGS)" LIBS="$(PTHREAD_LIBS) $(LIBS)" \
 @TCL_TRY_TRUE@		BUILDDIR="$(abs_top_builddir)" $(RUNTESTFLAGS); \
diff --git a/gprofng/configure b/gprofng/configure
index 1371caa45d6..4623a342dfc 100755
--- a/gprofng/configure
+++ b/gprofng/configure
@@ -645,6 +645,7 @@ TCL_TRY_FALSE
 TCL_TRY_TRUE
 EXPECT
 jdk_inc
+GPROFNG_BROKEN_JAVAC
 JAVA
 JAVAC
 PTHREAD_CFLAGS
@@ -12091,7 +12092,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12094 "configure"
+#line 12095 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12197,7 +12198,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12200 "configure"
+#line 12201 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16484,6 +16485,7 @@ fi
 
 
 fi
+GPROFNG_BROKEN_JAVAC=no
 if test "x$enable_gprofng_jp" = x; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:  Cannot find the JDK include directory.
       gprofng will be build without support for profiling Java applications.
@@ -16495,9 +16497,30 @@ else
 
 $as_echo "#define GPROFNG_JAVA_PROFILING 1" >>confdefs.h
 
+    if test "x$JAVAC" != x; then
+      cat > configtest.java << EOF
+class Simple{
+  public static void main(String args){
+    System.out.println("Hello Java");
+  }
+}
+EOF
+      if { ac_try='$JAVAC conftest.java &5 2>&1'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+	GPROFNG_BROKEN_JAVAC=no
+      else
+	GPROFNG_BROKEN_JAVAC=yes
+      fi
+      rm -f configtest.*
+    fi
 fi
 
 
+
 DEBUG=
  # Check whether --enable-gprofng-debug was given.
 if test "${enable_gprofng_debug+set}" = set; then :
diff --git a/gprofng/configure.ac b/gprofng/configure.ac
index 23fee8705ac..a038b05b81e 100644
--- a/gprofng/configure.ac
+++ b/gprofng/configure.ac
@@ -127,13 +127,30 @@ fi
 if test "x$enable_gprofng_jp" = x; then
   AC_CHECK_HEADER([jni.h], [ enable_gprofng_jp=yes ], [], [] )
 fi
+GPROFNG_BROKEN_JAVAC=no
 if test "x$enable_gprofng_jp" = x; then
     AC_MSG_WARN([ Cannot find the JDK include directory.
       gprofng will be build without support for profiling Java applications.
       Use --with-jdk=PATH to specify directory for the installed JDK])
 else
     AC_DEFINE(GPROFNG_JAVA_PROFILING, 1, [Enable java profiling])
+    if test "x$JAVAC" != x; then
+      cat > configtest.java << EOF
+class Simple{
+  public static void main(String args[]){
+    System.out.println("Hello Java");
+  }
+}
+EOF
+      if AC_TRY_COMMAND($JAVAC conftest.java &AS_MESSAGE_LOG_FD 2>&1); then
+	GPROFNG_BROKEN_JAVAC=no
+      else
+	GPROFNG_BROKEN_JAVAC=yes
+      fi
+      rm -f configtest.*
+    fi
 fi
+AC_SUBST(GPROFNG_BROKEN_JAVAC)
 AC_SUBST(jdk_inc)
 
 DEBUG=
diff --git a/gprofng/testsuite/gprofng.display/display.exp b/gprofng/testsuite/gprofng.display/display.exp
index 108144c069a..dfb383e9fc6 100644
--- a/gprofng/testsuite/gprofng.display/display.exp
+++ b/gprofng/testsuite/gprofng.display/display.exp
@@ -68,6 +68,8 @@ switch $pltf {
   }
 }
 
+global GPROFNG_BROKEN_JAVAC
+
 foreach line $table {
   set dir [lindex $line 0]
   set cflags [lindex $line 1]
@@ -75,7 +77,11 @@ foreach line $table {
 
   verbose [file rootname $line]
   verbose running display test $line
-  run_display_test $dir $cflags $gprofflags
+  if { $GPROFNG_BROKEN_JAVAC == "yes" && $dir == "jsynprog" } {
+    unsupported $dir
+  } else {
+    run_display_test $dir $cflags $gprofflags
+  }
 }
     
 
-- 
2.35.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] gprofng: Skip jsynprog with a broken javac
  2022-03-16 13:59 [PATCH] gprofng: Skip jsynprog with a broken javac H.J. Lu
@ 2022-03-17 17:11 ` Vladimir Mezentsev
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Mezentsev @ 2022-03-17 17:11 UTC (permalink / raw)
  To: H.J. Lu, binutils

  Hi HJ,

Please check in your patch.

Thank you,
-Vladimir


On 3/16/22 06:59, H.J. Lu wrote:
> On CET enabled Linux/x86-64 machines, one can get
>
> $ javac simple.java
> Error: dl failure on line 894
> Error: failed /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-6.fc35.x86_64/jre/lib/amd64/server/libjvm.so, because /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-6.fc35.x86_64/jre/lib/amd64/server/libjvm.so: rebuild shared object with SHSTK support enabled
>
> Set GPROFNG_BROKEN_JAVAC to "yes" only with a broken javac and skip the
> jsynprog test with a broken javac.
>
> 	PR gprofng/28965
> 	* Makefile.am (GPROFNG_BROKEN_JAVAC): New.
> 	(check-DEJAGNU): Pass GPROFNG_BROKEN_JAVAC to runtest.
> 	* configure.ac (GPROFNG_BROKEN_JAVAC): New AC_SUBST.  Set to yes
> 	with a broken javac.
> 	* Makefile.in: Regenerate.
> 	* configure: Likewise.
> 	* testsuite/gprofng.display/display.exp: Skip jsynprog with a
> 	broken javac.
> ---
>   gprofng/Makefile.am                           |  2 ++
>   gprofng/Makefile.in                           |  2 ++
>   gprofng/configure                             | 27 +++++++++++++++++--
>   gprofng/configure.ac                          | 17 ++++++++++++
>   gprofng/testsuite/gprofng.display/display.exp |  8 +++++-
>   5 files changed, 53 insertions(+), 3 deletions(-)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-17 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 13:59 [PATCH] gprofng: Skip jsynprog with a broken javac H.J. Lu
2022-03-17 17:11 ` Vladimir Mezentsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).