+2020-07-22 Nick Alcock <nick.alcock@oracle.com>
+
+ * configure.ac (enable_libctf): Substitute it.
+ * Makefile.am (enablings.exp): New.
+ (EXTRA_DEJAGNU_SITE_CONFIG): Add it.
+ (DISTCLEANFILES): Likewise.
+ * Makefile.in: Regenerate.
+ * configure: Likewise.
+ * testsuite/lib/ld-lib.exp (compile_one_cc): New.
+ (check_ctf_available): Likewise.
+ (skip_ctf_tests): Likewise.
+ * testsuite/ld-ctf/ctf.exp: Call skip_ctf_tests.
+
2020-07-22 Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com>
* testsuite/ld-ctf/ctf.exp: New file.
development.exp: $(BFDDIR)/development.sh
$(EGREP) "[development|experimental]=" $(BFDDIR)/development.sh \
| $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+
+enablings.exp:
+ echo "set enable_libctf ${enable_libctf}" >> $@
#
#
# Build a dummy plugin using libtool.
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host $(srcdir)/configure.tgt \
$(BFDDIR)/development.sh
-EXTRA_DEJAGNU_SITE_CONFIG = development.exp
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp enablings.exp
MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
ldemul-list.h crtbegin.@OBJEXT@ crtend.@OBJEXT@ ld.log ld.sum
# ld.1 to support parallel build.
info-recursive: ld.1
-DISTCLEANFILES = site.exp development.exp site.bak stringify.sed
+DISTCLEANFILES = site.exp development.exp enablings.exp site.bak stringify.sed
distclean-local:
rm -rf ldscripts
elf_plt_unwind_list_options = @elf_plt_unwind_list_options@
elf_shlib_list_options = @elf_shlib_list_options@
enable_initfini_array = @enable_initfini_array@
+enable_libctf = @enable_libctf@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host $(srcdir)/configure.tgt \
$(BFDDIR)/development.sh
-EXTRA_DEJAGNU_SITE_CONFIG = development.exp
+EXTRA_DEJAGNU_SITE_CONFIG = development.exp enablings.exp
MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
ldemul-list.h crtbegin.@OBJEXT@ crtend.@OBJEXT@ ld.log ld.sum
EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.@OBJEXT@_c \
emultempl/spu_icache.@OBJEXT@_c deffilep.c deffilep.h $(man_MANS)
-DISTCLEANFILES = site.exp development.exp site.bak stringify.sed
+DISTCLEANFILES = site.exp development.exp enablings.exp site.bak stringify.sed
all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
$(EGREP) "[development|experimental]=" $(BFDDIR)/development.sh \
| $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
+enablings.exp:
+ echo "set enable_libctf ${enable_libctf}" >> $@
+
# DOCUMENTATION TARGETS
# Manual configuration file; not usually attached to normal configuration,
# because almost all configs use "gen" version of manual.
NO_WERROR
WARN_CFLAGS_FOR_BUILD
WARN_CFLAGS
+enable_libctf
ENABLE_LIBCTF_FALSE
ENABLE_LIBCTF_TRUE
installed_linker
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12040 "configure"
+#line 12041 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12146 "configure"
+#line 12147 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
+
# Set the 'development' global.
. $srcdir/../bfd/development.sh
AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
fi
AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
+AC_SUBST(enable_libctf)
AM_BINUTILS_WARNINGS
# MA 02110-1301, USA.
#
+if [skip_ctf_tests] {
+ unsupported "no CTF format support in the compiler, or CTF disabled"
+ return 0
+}
+
set ctf_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach ctf_test $ctf_test_list {
+ if [string equal -length [string length "diag-"] "diag-" [file tail $ctf_test]] {
+ if ![is_elf_format] {
+ continue
+ }
+ }
verbose [file rootname $ctf_test]
run_dump_test [file rootname $ctf_test] { { cc "-gt -fPIC" } }
}
}
return $gnu2_tls_available_saved
}
+
+# Compile a C source file, with the specified additional_flags.
+proc compile_one_cc { src output additional_flags } {
+ global CC
+ global CFLAGS
+
+ set flags ""
+ if [board_info [target_info name] exists cflags] {
+ append flags " [board_info [target_info name] cflags]"
+ }
+ if [board_info [target_info name] exists ldflags] {
+ append flags " [board_info [target_info name] ldflags]"
+ }
+
+ if [is_remote host] {
+ set src [remote_download host $src]
+ }
+ return [run_host_cmd_yesno "$CC" "$flags $CFLAGS $additional_flags $src -o $output"]
+}
+
+# Returns true if the target compiler supports -gt
+proc check_ctf_available { } {
+ global ctf_available_saved
+
+ if {![info exists ctf_available_saved]} {
+ set basename "tmpdir/ctf_available[pid]"
+ set src ${basename}.c
+ set output ${basename}.o
+ set f [open $src "w"]
+ puts $f "int main() { return 0; }"
+ close $f
+ set ctf_available_saved [compile_one_cc $src $output "-gt -c"]
+ remote_file host delete $src
+ remote_file host delete $output
+ file delete $src
+ }
+ return $ctf_available_saved
+}
+
+proc skip_ctf_tests { } {
+ global enable_libctf
+
+ if {$enable_libctf eq "no"} {
+ return 1
+ }
+
+ if [check_ctf_available] {
+ return 0
+ }
+
+ return 1
+}