diff options
author | Indu Bhagat <indu.bhagat@oracle.com> | 2024-04-23 16:00:49 -0700 |
---|---|---|
committer | Indu Bhagat <indu.bhagat@oracle.com> | 2024-04-25 15:03:50 -0700 |
commit | 28a782672178b21d287f5b5952daf34a4de0c031 (patch) | |
tree | 5ff538a42b95efd6e79a792fe29b7764b8147b2a | |
parent | bb5f22a1a3db024ed8068e87a9df4ee2ee516252 (diff) | |
download | gdb-28a782672178b21d287f5b5952daf34a4de0c031.zip gdb-28a782672178b21d287f5b5952daf34a4de0c031.tar.gz gdb-28a782672178b21d287f5b5952daf34a4de0c031.tar.bz2 |
testsuite: libsframest: use as, ld, collect-ld from build dir
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.
-rw-r--r-- | libsframe/Makefile.am | 4 | ||||
-rw-r--r-- | libsframe/Makefile.in | 23 | ||||
-rw-r--r-- | libsframe/acinclude.m4 | 20 | ||||
-rw-r--r-- | libsframe/aclocal.m4 | 1 | ||||
-rwxr-xr-x | libsframe/configure | 56 | ||||
-rw-r--r-- | libsframe/configure.ac | 8 | ||||
-rwxr-xr-x | libsframe/setup.sh | 23 | ||||
-rw-r--r-- | libsframe/testsuite/config/default.exp | 9 | ||||
-rw-r--r-- | libsframe/testsuite/lib/sframe-lib.exp | 2 | ||||
-rw-r--r-- | libsframe/testsuite/libsframe.stacktrace/libsframest/local.mk | 10 | ||||
-rw-r--r-- | libsframe/testsuite/libsframe.stacktrace/stacktrace.exp | 6 |
11 files changed, 68 insertions, 94 deletions
diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am index c31eec9..cdd57bd 100644 --- a/libsframe/Makefile.am +++ b/libsframe/Makefile.am @@ -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 diff --git a/libsframe/Makefile.in b/libsframe/Makefile.in index d2c5ad1..2b37868 100644 --- a/libsframe/Makefile.in +++ b/libsframe/Makefile.in @@ -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 index a019ed8..0000000 --- a/libsframe/acinclude.m4 +++ /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" -]) diff --git a/libsframe/aclocal.m4 b/libsframe/aclocal.m4 index 6cf5825..8804d9f 100644 --- a/libsframe/aclocal.m4 +++ b/libsframe/aclocal.m4 @@ -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]) diff --git a/libsframe/configure b/libsframe/configure index 03b1b47..b23debd 100755 --- a/libsframe/configure +++ b/libsframe/configure @@ -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 diff --git a/libsframe/configure.ac b/libsframe/configure.ac index fdd4a6d..a164542 100644 --- a/libsframe/configure.ac +++ b/libsframe/configure.ac @@ -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 index 0000000..9fb7afa --- /dev/null +++ b/libsframe/setup.sh @@ -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 diff --git a/libsframe/testsuite/config/default.exp b/libsframe/testsuite/config/default.exp index b3cc58d..77f0ea4 100644 --- a/libsframe/testsuite/config/default.exp +++ b/libsframe/testsuite/config/default.exp @@ -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 "" diff --git a/libsframe/testsuite/lib/sframe-lib.exp b/libsframe/testsuite/lib/sframe-lib.exp index d686d27..bc466f1 100644 --- a/libsframe/testsuite/lib/sframe-lib.exp +++ b/libsframe/testsuite/lib/sframe-lib.exp @@ -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 } { diff --git a/libsframe/testsuite/libsframe.stacktrace/libsframest/local.mk b/libsframe/testsuite/libsframe.stacktrace/libsframest/local.mk index 60673ba..918b6ef 100644 --- a/libsframe/testsuite/libsframe.stacktrace/libsframest/local.mk +++ b/libsframe/testsuite/libsframe.stacktrace/libsframest/local.mk @@ -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 diff --git a/libsframe/testsuite/libsframe.stacktrace/stacktrace.exp b/libsframe/testsuite/libsframe.stacktrace/stacktrace.exp index bc1e847..f804651 100644 --- a/libsframe/testsuite/libsframe.stacktrace/stacktrace.exp +++ b/libsframe/testsuite/libsframe.stacktrace/stacktrace.exp @@ -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 { |