]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
testsuite: libsframest: use as, ld, collect-ld from build dir
authorIndu Bhagat <indu.bhagat@oracle.com>
Tue, 23 Apr 2024 23:00:49 +0000 (16:00 -0700)
committerIndu Bhagat <indu.bhagat@oracle.com>
Thu, 25 Apr 2024 22:03:50 +0000 (15:03 -0700)
instead of host's as and ld.  Also disable libsframest build if cross
compiling.  The testsuite will consequently also be skipped.

Override the check-am make target and first execute setup.sh to bring in
the as-new / ld-new and use -B<path> to ensure these are picked up for
building:
  - libsframest
  - libsframe.stacktrace testsuite

Remove the configure time variable HAVE_SFRAME_AS as it is now
unnecessary.

TBD:
  - Get review on whether the whole setup.sh way of doing this is OK.
    But it seems there is no other way ?
  - Check the portability of the setup.sh script.

ChangeLog:
* libsframe/Makefile.am: Override check-am to first run setup.sh
before invoking make.  This ensures libsframest is built with
the newly setup tmpdir/libsframe.
* libsframe/Makefile.in: Regenerate.
* libsframe/acinclude.m4: Delete.
* libsframe/aclocal.m4: Remove include for acinclude.m4.
* libsframe/configure: Regenerate.
* libsframe/configure.ac: Remove HAVE_SFRAME_AS.  Add a new
AM_CONDITIONAL for CROSS_COMPILE.
* libsframe/setup.sh: New file.
* libsframe/testsuite/config/default.exp: Remove the creation
and setup of tmpdir/lisframe.
* libsframe/testsuite/lib/sframe-lib.exp: Use -B<path> to use
the as/ld from build tree.
* libsframe/testsuite/libsframe.stacktrace/libsframest/local.mk:
Use -B<path> and use the as/ld from build tree.
* libsframe/testsuite/libsframe.stacktrace/stacktrace.exp: Skip
testing if cross build.

libsframe/Makefile.am
libsframe/Makefile.in
libsframe/acinclude.m4 [deleted file]
libsframe/aclocal.m4
libsframe/configure
libsframe/configure.ac
libsframe/setup.sh [new file with mode: 0755]
libsframe/testsuite/config/default.exp
libsframe/testsuite/lib/sframe-lib.exp
libsframe/testsuite/libsframe.stacktrace/libsframest/local.mk
libsframe/testsuite/libsframe.stacktrace/stacktrace.exp

index c31eec9320f844915869a4dabc3d1372f0ddf2db..cdd57bdf1e9d1835248134bc246834d72319cd21 100644 (file)
@@ -55,6 +55,10 @@ libsframe_la_LDFLAGS = $(libsframe_version_info) $(libsframe_version_script)
 
 EXTRA_DIST = libtool-version libsframe.ver
 diststuff: $(EXTRA_DIST) info
+check-am: all-am setup.sh
+       $(SHELL) $(srcdir)/setup.sh
+       $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
+       $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
 
 include doc/local.mk
 
index d2c5ad1e1f4a9b6b6b134ef98de46d552df2d3f2..2b378681080d2e79b7e8ebe0d594cf1ce0d79cf6 100644 (file)
@@ -119,7 +119,9 @@ check_PROGRAMS = $(am__EXEEXT_1)
 @HAVE_COMPAT_DEJAGNU_TRUE@     testsuite/libsframe.find/findfre-1 \
 @HAVE_COMPAT_DEJAGNU_TRUE@     testsuite/libsframe.find/findfunc-1 \
 @HAVE_COMPAT_DEJAGNU_TRUE@     testsuite/libsframe.find/plt-findfre-1
-@HAVE_DL_ITERATE_PHDR_TRUE@@HAVE_SFRAME_AS_TRUE@am__append_5 = testsuite/libsframe.stacktrace/libsframest/libsframest.la
+
+# Build libsframest only when not cross-building
+@CROSS_COMPILE_FALSE@@HAVE_DL_ITERATE_PHDR_TRUE@am__append_5 = testsuite/libsframe.stacktrace/libsframest/libsframest.la
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
@@ -133,8 +135,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
        $(top_srcdir)/../config/warnings.m4 \
        $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
        $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
-       $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
-       $(top_srcdir)/configure.ac
+       $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@@ -200,8 +201,10 @@ testsuite_libsframe_stacktrace_libsframest_libsframest_la_LINK =  \
        $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) \
        $(testsuite_libsframe_stacktrace_libsframest_libsframest_la_CFLAGS) \
-       $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-@HAVE_DL_ITERATE_PHDR_TRUE@@HAVE_SFRAME_AS_TRUE@am_testsuite_libsframe_stacktrace_libsframest_libsframest_la_rpath =
+       $(CFLAGS) \
+       $(testsuite_libsframe_stacktrace_libsframest_libsframest_la_LDFLAGS) \
+       $(LDFLAGS) -o $@
+@CROSS_COMPILE_FALSE@@HAVE_DL_ITERATE_PHDR_TRUE@am_testsuite_libsframe_stacktrace_libsframest_libsframest_la_rpath =
 @HAVE_COMPAT_DEJAGNU_TRUE@am__EXEEXT_1 = testsuite/libsframe.decode/be-flipping$(EXEEXT) \
 @HAVE_COMPAT_DEJAGNU_TRUE@     testsuite/libsframe.decode/frecnt-1$(EXEEXT) \
 @HAVE_COMPAT_DEJAGNU_TRUE@     testsuite/libsframe.decode/frecnt-2$(EXEEXT) \
@@ -596,9 +599,13 @@ testsuite_libsframe_stacktrace_libsframest_libsframest_la_SOURCES = testsuite/li
 testsuite_libsframe_stacktrace_libsframest_libsframest_la_LIBADD = ${top_builddir}/libsframe.la
 testsuite_libsframe_stacktrace_libsframest_libsframest_la_CPPFLAGS = -I${top_srcdir}/../include \
                              -I${top_srcdir}/testsuite/libsframe.stacktrace/libsframest/include \
+                             -B${top_builddir}/tmpdir/libsframe \
                              -Wall -Wno-unused-but-set-variable
 
-testsuite_libsframe_stacktrace_libsframest_libsframest_la_CFLAGS = -Wa,--gsframe
+testsuite_libsframe_stacktrace_libsframest_libsframest_la_CFLAGS = -B${top_builddir}/tmpdir/libsframe \
+                           -Wa,--gsframe
+
+testsuite_libsframe_stacktrace_libsframest_libsframest_la_LDFLAGS = -B${top_builddir}/tmpdir/libsframe
 all: config.h
        $(MAKE) $(AM_MAKEFLAGS) all-am
 
@@ -1677,6 +1684,10 @@ uninstall-am: uninstall-dvi-am uninstall-html-am \
 .PRECIOUS: Makefile
 
 diststuff: $(EXTRA_DIST) info
+check-am: all-am setup.sh
+       $(SHELL) $(srcdir)/setup.sh
+       $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES) $(check_PROGRAMS)
+       $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
 
 @BUILD_INFO_TRUE@html-local: doc/sframe-spec/index.html
 @BUILD_INFO_TRUE@doc/sframe-spec/index.html: doc/sframe-spec.texi doc/$(am__dirstamp)
diff --git a/libsframe/acinclude.m4 b/libsframe/acinclude.m4
deleted file mode 100644 (file)
index a019ed8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-dnl SFRAME_CHECK_HAVE_SFRAME_AS
-dnl ----------------------
-dnl Defines:
-dnl sframe_cv_have_sframe_as
-dnl
-
-# Check whether the assembler supports generation of SFrame
-# unwind information.
-AC_DEFUN([SFRAME_CHECK_HAVE_SFRAME_AS],
-[
-  AC_CACHE_CHECK([if as supports --gsframe], sframe_cv_have_sframe_as,
-  [
-    ac_save_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -Wa,--gsframe"
-    AC_MSG_CHECKING([for as that supports --gsframe])
-    AC_TRY_COMPILE([], [return 0;], [sframe_cv_have_sframe_as=yes], [sframe_cv_have_sframe_as=no])
-  ])
-  AC_MSG_RESULT($sframe_cv_have_sframe_as)
-  CFLAGS="$ac_save_CFLAGS"
-])
index 6cf58259abc0b5ffbb6016620c525aeded0d186b..8804d9fb42b8d9b3342ca34071a80e0f08949f63 100644 (file)
@@ -1241,4 +1241,3 @@ m4_include([../ltoptions.m4])
 m4_include([../ltsugar.m4])
 m4_include([../ltversion.m4])
 m4_include([../lt~obsolete.m4])
-m4_include([acinclude.m4])
index 03b1b4735c979002cc1c421b58ac179b8c5e5179..b23debde88867ee79a25c5991915bcdc6c46750a 100755 (executable)
@@ -645,8 +645,8 @@ INSTALL_LIBBFD_TRUE
 MAINT
 MAINTAINER_MODE_FALSE
 MAINTAINER_MODE_TRUE
-HAVE_SFRAME_AS_FALSE
-HAVE_SFRAME_AS_TRUE
+CROSS_COMPILE_FALSE
+CROSS_COMPILE_TRUE
 CROSS_COMPILE
 HAVE_LD_VERSION_SCRIPT_FALSE
 HAVE_LD_VERSION_SCRIPT_TRUE
@@ -12476,50 +12476,12 @@ else
 fi
 CROSS_COMPILE=$is_cross_compiler
 
-
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if as supports --gsframe" >&5
-$as_echo_n "checking if as supports --gsframe... " >&6; }
-if ${sframe_cv_have_sframe_as+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-    ac_save_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -Wa,--gsframe"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for as that supports --gsframe" >&5
-$as_echo_n "checking for as that supports --gsframe... " >&6; }
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  sframe_cv_have_sframe_as=yes
-else
-  sframe_cv_have_sframe_as=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sframe_cv_have_sframe_as" >&5
-$as_echo "$sframe_cv_have_sframe_as" >&6; }
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sframe_cv_have_sframe_as" >&5
-$as_echo "$sframe_cv_have_sframe_as" >&6; }
-  CFLAGS="$ac_save_CFLAGS"
-
- if test "x$sframe_cv_have_sframe_as" = "xyes"; then
-  HAVE_SFRAME_AS_TRUE=
-  HAVE_SFRAME_AS_FALSE='#'
+ if test "is_cross_compiler" = "yes"; then
+  CROSS_COMPILE_TRUE=
+  CROSS_COMPILE_FALSE='#'
 else
-  HAVE_SFRAME_AS_TRUE='#'
-  HAVE_SFRAME_AS_FALSE=
+  CROSS_COMPILE_TRUE='#'
+  CROSS_COMPILE_FALSE=
 fi
 
 
@@ -13072,8 +13034,8 @@ if test -z "${HAVE_LD_VERSION_SCRIPT_TRUE}" && test -z "${HAVE_LD_VERSION_SCRIPT
   as_fn_error $? "conditional \"HAVE_LD_VERSION_SCRIPT\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${HAVE_SFRAME_AS_TRUE}" && test -z "${HAVE_SFRAME_AS_FALSE}"; then
-  as_fn_error $? "conditional \"HAVE_SFRAME_AS\" was never defined.
+if test -z "${CROSS_COMPILE_TRUE}" && test -z "${CROSS_COMPILE_FALSE}"; then
+  as_fn_error $? "conditional \"CROSS_COMPILE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
index fdd4a6dddd0eb673ea632325ad2decf74601b12c..a164542bd55bb56ee2979b9f082784260eacc81f 100644 (file)
@@ -121,13 +121,7 @@ else
 fi
 CROSS_COMPILE=$is_cross_compiler
 AC_SUBST([CROSS_COMPILE])
-
-dnl The libsframebt library needs to be built with SFrame info.
-dnl If the build assembler is not capable of generate SFrame then
-dnl the library is not built.
-
-SFRAME_CHECK_HAVE_SFRAME_AS
-AM_CONDITIONAL([HAVE_SFRAME_AS], [test "x$sframe_cv_have_sframe_as" = "xyes"])
+AM_CONDITIONAL(CROSS_COMPILE, test "is_cross_compiler" = "yes")
 
 AM_MAINTAINER_MODE
 AM_INSTALL_LIBBFD
diff --git a/libsframe/setup.sh b/libsframe/setup.sh
new file mode 100755 (executable)
index 0000000..9fb7afa
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Make symlinks from tmpdir/libsframe to the linker and assembler in the
+# build tree, so that we can use a -B option to gcc to force it to use
+# the newly built linker and assembler.
+#
+# The libsframest library (used in the testsuite) needs to be built with
+# SFrame info.
+DIRECTORY="tmpdir/libsframe"
+if [ ! -d "$DIRECTORY" ]; then
+  mkdir -p $DIRECTORY
+fi
+
+if [ ! -L "$DIRECTORY/ld" ]; then
+  ln -s ../../../ld/ld-new $DIRECTORY/ld
+fi
+
+if [ ! -L "$DIRECTORY/collect-ld" ]; then
+  ln -s ld $DIRECTORY/collect-ld
+fi
+
+if [ ! -L "$DIRECTORY/as" ]; then
+  ln -s ../../../gas/as-new $DIRECTORY/as
+fi
index b3cc58dcb88c48d4dc3a7707765c9651ce39f27c..77f0ea46733060ae2ddba31c2ada57fd302482a0 100644 (file)
@@ -31,15 +31,6 @@ if ![info exists as] then {
 
 remote_exec host "mkdir -p tmpdir"
 
-# Make symlinks from tmpdir/libsframe to the linker and assembler in the
-# build tree, so that we can use a -B option to gcc to force it to use
-# the newly built linker and assembler.
-if {![file isdirectory tmpdir/libsframe]} then {
-    catch "exec mkdir tmpdir/libsframe" status
-    catch "exec ln -s ../../../ld/ld-new tmpdir/libsframe/ld" status
-    catch "exec ln -s ld tmpdir/libsframe/collect-ld" status
-    catch "exec ln -s ../../../gas/as-new tmpdir/libsframe/as" status
-}
 set gcc_B_opt "-B[pwd]/tmpdir/libsframe/"
 set ld_L_opt ""
 
index d686d27f371509e7059993cb954aa66a6625c537..bc466f15e650527302e12315f30878b1da502a26 100644 (file)
@@ -53,7 +53,7 @@ proc compile_link_one_host_cc { src output additional_args } {
     global CC
     global CFLAGS
 
-    return [run_native_host_cmd "./libtool --quiet --tag=CC --mode=link $CC $CFLAGS $src -o $output $additional_args" ]
+    return [run_native_host_cmd "./libtool --quiet --tag=CC --mode=link $CC -B./tmpdir/libsframe $CFLAGS $src -o $output $additional_args" ]
 }
 
 proc make_unwind_parallel_path { args } {
index 60673ba734a2efae087c4c663fafb2da8df0b8b3..918b6efd24a449b0172183f742649bb29ddb8f14 100644 (file)
@@ -1,8 +1,9 @@
 check_LTLIBRARIES =
 
-if HAVE_SFRAME_AS
 if HAVE_DL_ITERATE_PHDR
-  check_LTLIBRARIES += %D%/libsframest.la
+# Build libsframest only when not cross-building
+if !CROSS_COMPILE
+check_LTLIBRARIES += %D%/libsframest.la
 endif
 endif
 
@@ -12,5 +13,8 @@ endif
 %C%_libsframest_la_LIBADD = ${top_builddir}/libsframe.la
 %C%_libsframest_la_CPPFLAGS = -I${top_srcdir}/../include \
                              -I${top_srcdir}/%D%/include \
+                             -B${top_builddir}/tmpdir/libsframe \
                              -Wall -Wno-unused-but-set-variable
-%C%_libsframest_la_CFLAGS = -Wa,--gsframe
+%C%_libsframest_la_CFLAGS = -B${top_builddir}/tmpdir/libsframe \
+                           -Wa,--gsframe
+%C%_libsframest_la_LDFLAGS = -B${top_builddir}/tmpdir/libsframe
index bc1e84766a6518e2719c2f99ff26a7c4dbae29f0..f8046511cc68d418b5e378f19a4c2020a10f7a25 100644 (file)
@@ -30,6 +30,7 @@ if [catch "exec ls $objdir/testsuite/libsframe.stacktrace/libsframest/.libs/libs
 proc run_unwind_test { name } {
     global CC
     global CFLAGS
+    global CROSS_COMPILE
     global copyfile env runtests srcdir subdir verbose
 
     # Append additional flags for unwinder to work properly
@@ -79,6 +80,11 @@ proc run_unwind_test { name } {
        set opts($opt_name) [concat $opts($opt_name) $opt_val]
     }
 
+    if { "$CROSS_COMPILE" eq "yes" } {
+       untested "$subdir/$name not tested when cross-compiling"
+       return
+    }
+
     if { [llength $opts(unwind)] == 0 } {
        set opts(unwind) "$file.c"
     } else {