aboutsummaryrefslogtreecommitdiff
path: root/libsframe
diff options
context:
space:
mode:
Diffstat (limited to 'libsframe')
-rw-r--r--libsframe/Makefile.am2
-rw-r--r--libsframe/Makefile.in60
-rw-r--r--libsframe/aclocal.m42
-rwxr-xr-xlibsframe/configure405
-rw-r--r--libsframe/doc/sframe-spec.texi4
-rw-r--r--libsframe/sframe.c10
-rw-r--r--libsframe/testsuite/libsframe.decode/be-flipping.c16
-rw-r--r--libsframe/testsuite/libsframe.decode/frecnt-1.c16
-rw-r--r--libsframe/testsuite/libsframe.decode/frecnt-2.c17
-rw-r--r--libsframe/testsuite/libsframe.decode/local.mk12
-rw-r--r--libsframe/testsuite/libsframe.encode/encode-1.c70
-rw-r--r--libsframe/testsuite/libsframe.encode/local.mk4
-rw-r--r--libsframe/testsuite/libsframe.find/findfre-1.c22
-rw-r--r--libsframe/testsuite/libsframe.find/findfunc-1.c27
-rw-r--r--libsframe/testsuite/libsframe.find/local.mk16
-rw-r--r--libsframe/testsuite/libsframe.find/plt-findfre-1.c12
-rw-r--r--libsframe/testsuite/libsframe.find/plt-findfre-2.c12
-rw-r--r--libsframe/testsuite/local.mk3
-rw-r--r--libsframe/testsuite/sframe-test.h43
19 files changed, 571 insertions, 182 deletions
diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am
index 89e471f..864e497 100644
--- a/libsframe/Makefile.am
+++ b/libsframe/Makefile.am
@@ -27,7 +27,7 @@ MAINTAINERCLEANFILES =
INCDIR = $(srcdir)/../include
# include libctf for swap.h
-AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf
+AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../libctf
AM_CFLAGS = @ac_libsframe_warn_cflags@
libsframe_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
# libsframe does not restrict the set of exported symbols. So, if linker does
diff --git a/libsframe/Makefile.in b/libsframe/Makefile.in
index fa705dd..c313506 100644
--- a/libsframe/Makefile.in
+++ b/libsframe/Makefile.in
@@ -124,8 +124,10 @@ subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/clang-plugin.m4 \
$(top_srcdir)/../config/dejagnu.m4 \
$(top_srcdir)/../config/depstand.m4 \
+ $(top_srcdir)/../config/gcc-plugin.m4 \
$(top_srcdir)/../config/jobserver.m4 \
$(top_srcdir)/../config/lead-dot.m4 \
$(top_srcdir)/../config/mmap.m4 \
@@ -201,42 +203,37 @@ am_testsuite_libsframe_decode_be_flipping_OBJECTS = testsuite/libsframe.decode/t
testsuite_libsframe_decode_be_flipping_OBJECTS = \
$(am_testsuite_libsframe_decode_be_flipping_OBJECTS)
testsuite_libsframe_decode_be_flipping_DEPENDENCIES = \
- ${top_builddir}/libsframe.la
+ $(testsuite_LDADD)
am_testsuite_libsframe_decode_frecnt_1_OBJECTS = testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.$(OBJEXT)
testsuite_libsframe_decode_frecnt_1_OBJECTS = \
$(am_testsuite_libsframe_decode_frecnt_1_OBJECTS)
-testsuite_libsframe_decode_frecnt_1_DEPENDENCIES = \
- ${top_builddir}/libsframe.la
+testsuite_libsframe_decode_frecnt_1_DEPENDENCIES = $(testsuite_LDADD)
am_testsuite_libsframe_decode_frecnt_2_OBJECTS = testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.$(OBJEXT)
testsuite_libsframe_decode_frecnt_2_OBJECTS = \
$(am_testsuite_libsframe_decode_frecnt_2_OBJECTS)
-testsuite_libsframe_decode_frecnt_2_DEPENDENCIES = \
- ${top_builddir}/libsframe.la
+testsuite_libsframe_decode_frecnt_2_DEPENDENCIES = $(testsuite_LDADD)
am_testsuite_libsframe_encode_encode_1_OBJECTS = testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.$(OBJEXT)
testsuite_libsframe_encode_encode_1_OBJECTS = \
$(am_testsuite_libsframe_encode_encode_1_OBJECTS)
-testsuite_libsframe_encode_encode_1_DEPENDENCIES = \
- ${top_builddir}/libsframe.la
+testsuite_libsframe_encode_encode_1_DEPENDENCIES = $(testsuite_LDADD)
am_testsuite_libsframe_find_findfre_1_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_findfre_1-findfre-1.$(OBJEXT)
testsuite_libsframe_find_findfre_1_OBJECTS = \
$(am_testsuite_libsframe_find_findfre_1_OBJECTS)
-testsuite_libsframe_find_findfre_1_DEPENDENCIES = \
- ${top_builddir}/libsframe.la
+testsuite_libsframe_find_findfre_1_DEPENDENCIES = $(testsuite_LDADD)
am_testsuite_libsframe_find_findfunc_1_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_findfunc_1-findfunc-1.$(OBJEXT)
testsuite_libsframe_find_findfunc_1_OBJECTS = \
$(am_testsuite_libsframe_find_findfunc_1_OBJECTS)
-testsuite_libsframe_find_findfunc_1_DEPENDENCIES = \
- ${top_builddir}/libsframe.la
+testsuite_libsframe_find_findfunc_1_DEPENDENCIES = $(testsuite_LDADD)
am_testsuite_libsframe_find_plt_findfre_1_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_plt_findfre_1-plt-findfre-1.$(OBJEXT)
testsuite_libsframe_find_plt_findfre_1_OBJECTS = \
$(am_testsuite_libsframe_find_plt_findfre_1_OBJECTS)
testsuite_libsframe_find_plt_findfre_1_DEPENDENCIES = \
- ${top_builddir}/libsframe.la
+ $(testsuite_LDADD)
am_testsuite_libsframe_find_plt_findfre_2_OBJECTS = testsuite/libsframe.find/testsuite_libsframe_find_plt_findfre_2-plt-findfre-2.$(OBJEXT)
testsuite_libsframe_find_plt_findfre_2_OBJECTS = \
$(am_testsuite_libsframe_find_plt_findfre_2_OBJECTS)
testsuite_libsframe_find_plt_findfre_2_DEPENDENCIES = \
- ${top_builddir}/libsframe.la
+ $(testsuite_LDADD)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -424,6 +421,7 @@ LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
+LLVM_CONFIG = @LLVM_CONFIG@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
@@ -535,7 +533,7 @@ DISTCLEANFILES = $(am__append_2)
MAINTAINERCLEANFILES = $(am__append_3)
INCDIR = $(srcdir)/../include
# include libctf for swap.h
-AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf
+AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir)/../libctf
AM_CFLAGS = @ac_libsframe_warn_cflags@
libsframe_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_FALSE@libsframe_version_script = -Wl,--version-script=$(srcdir)/libsframe.ver
@@ -557,30 +555,32 @@ EXTRA_DIST = libtool-version libsframe.ver
EXPECT = expect
RUNTEST = runtest
RUNTESTFLAGS =
+testsuite_LDADD = $(top_builddir)/libsframe.la
+testsuite_CPPFLAGS = -I$(srcdir)/testsuite -I$(srcdir)/../include
testsuite_libsframe_decode_be_flipping_SOURCES = testsuite/libsframe.decode/be-flipping.c
-testsuite_libsframe_decode_be_flipping_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_decode_be_flipping_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_decode_be_flipping_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_decode_be_flipping_CPPFLAGS = $(testsuite_CPPFLAGS)
testsuite_libsframe_decode_frecnt_1_SOURCES = testsuite/libsframe.decode/frecnt-1.c
-testsuite_libsframe_decode_frecnt_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_decode_frecnt_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_decode_frecnt_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_decode_frecnt_1_CPPFLAGS = $(testsuite_CPPFLAGS)
testsuite_libsframe_decode_frecnt_2_SOURCES = testsuite/libsframe.decode/frecnt-2.c
-testsuite_libsframe_decode_frecnt_2_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_decode_frecnt_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_decode_frecnt_2_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_decode_frecnt_2_CPPFLAGS = $(testsuite_CPPFLAGS)
testsuite_libsframe_encode_encode_1_SOURCES = testsuite/libsframe.encode/encode-1.c
-testsuite_libsframe_encode_encode_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_encode_encode_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_encode_encode_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_encode_encode_1_CPPFLAGS = $(testsuite_CPPFLAGS)
testsuite_libsframe_find_findfre_1_SOURCES = testsuite/libsframe.find/findfre-1.c
-testsuite_libsframe_find_findfre_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_find_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_find_findfre_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_find_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
testsuite_libsframe_find_findfunc_1_SOURCES = testsuite/libsframe.find/findfunc-1.c
-testsuite_libsframe_find_findfunc_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_find_findfunc_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_find_findfunc_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_find_findfunc_1_CPPFLAGS = $(testsuite_CPPFLAGS)
testsuite_libsframe_find_plt_findfre_1_SOURCES = testsuite/libsframe.find/plt-findfre-1.c
-testsuite_libsframe_find_plt_findfre_1_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_find_plt_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_find_plt_findfre_1_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_find_plt_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
testsuite_libsframe_find_plt_findfre_2_SOURCES = testsuite/libsframe.find/plt-findfre-2.c
-testsuite_libsframe_find_plt_findfre_2_LDADD = ${top_builddir}/libsframe.la
-testsuite_libsframe_find_plt_findfre_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
+testsuite_libsframe_find_plt_findfre_2_LDADD = $(testsuite_LDADD)
+testsuite_libsframe_find_plt_findfre_2_CPPFLAGS = $(testsuite_CPPFLAGS)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/libsframe/aclocal.m4 b/libsframe/aclocal.m4
index 8804d9f..c47bb61 100644
--- a/libsframe/aclocal.m4
+++ b/libsframe/aclocal.m4
@@ -1229,8 +1229,10 @@ AC_SUBST([am__untar])
m4_include([../bfd/acinclude.m4])
m4_include([../config/acx.m4])
+m4_include([../config/clang-plugin.m4])
m4_include([../config/dejagnu.m4])
m4_include([../config/depstand.m4])
+m4_include([../config/gcc-plugin.m4])
m4_include([../config/jobserver.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/mmap.m4])
diff --git a/libsframe/configure b/libsframe/configure
index 4727eff..715ce58 100755
--- a/libsframe/configure
+++ b/libsframe/configure
@@ -658,6 +658,7 @@ OTOOL
LIPO
NMEDIT
DSYMUTIL
+LLVM_CONFIG
OBJDUMP
LN_S
NM
@@ -6610,8 +6611,266 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
-plugin_option=
+
+# Try CLANG_PLUGIN_FILE first since GCC_PLUGIN_OPTION may return the
+# wrong plugin_option with clang.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang" >&5
+$as_echo_n "checking for clang... " >&6; }
+if ${clang_cv_is_clang+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifdef __clang__
+ yes
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "yes" >/dev/null 2>&1; then :
+ clang_cv_is_clang=yes
+else
+ clang_cv_is_clang=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $clang_cv_is_clang" >&5
+$as_echo "$clang_cv_is_clang" >&6; }
+ plugin_file=
+ if test $clang_cv_is_clang = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang plugin file" >&5
+$as_echo_n "checking for clang plugin file... " >&6; }
+ plugin_names="LLVMgold.so"
+ for plugin in $plugin_names; do
+ plugin_file=`${CC} ${CFLAGS} --print-file-name $plugin`
+ if test x$plugin_file = x$plugin; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}llvm-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}llvm-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LLVM_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LLVM_CONFIG"; then
+ ac_cv_prog_LLVM_CONFIG="$LLVM_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_LLVM_CONFIG="${ac_tool_prefix}llvm-config"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LLVM_CONFIG=$ac_cv_prog_LLVM_CONFIG
+if test -n "$LLVM_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_CONFIG" >&5
+$as_echo "$LLVM_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LLVM_CONFIG"; then
+ ac_ct_LLVM_CONFIG=$LLVM_CONFIG
+ # Extract the first word of "llvm-config", so it can be a program name with args.
+set dummy llvm-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LLVM_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LLVM_CONFIG"; then
+ ac_cv_prog_ac_ct_LLVM_CONFIG="$ac_ct_LLVM_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_LLVM_CONFIG="llvm-config"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LLVM_CONFIG=$ac_cv_prog_ac_ct_LLVM_CONFIG
+if test -n "$ac_ct_LLVM_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LLVM_CONFIG" >&5
+$as_echo "$ac_ct_LLVM_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LLVM_CONFIG" = x; then
+ LLVM_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LLVM_CONFIG=$ac_ct_LLVM_CONFIG
+ fi
+else
+ LLVM_CONFIG="$ac_cv_prog_LLVM_CONFIG"
+fi
+
+ if test "$?" != 0; then
+ as_fn_error $? "Required tool 'llvm-config' not found on PATH." "$LINENO" 5
+ fi
+ clang_lib_dir=`$LLVM_CONFIG --libdir`
+ if test -f $clang_lib_dir/$plugin; then
+ plugin_file=$clang_lib_dir/$plugin
+ fi
+ if test x$plugin_file != x$plugin; then
+ break;
+ fi
+ fi
+ done
+ if test -z $plugin_file; then
+ as_fn_error $? "Couldn't find clang plugin file for $CC." "$LINENO" 5
+ fi
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+ if test "${AR}" = "" ; then
+ as_fn_error $? "Required archive tool 'ar' not found on PATH." "$LINENO" 5
+ fi
+ plugin_option="--plugin $plugin_file"
+ touch conftest.c
+ ${AR} $plugin_option rc conftest.a conftest.c
+ if test "$?" != 0; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5
+$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;}
+ plugin_file=
+ fi
+ rm -f conftest.*
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_file" >&5
+$as_echo "$plugin_file" >&6; }
+ fi
+ plugin_file="$plugin_file"
+
+if test -n "$plugin_file"; then
+ plugin_option="--plugin $plugin_file"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
+$as_echo_n "checking for -plugin option... " >&6; }
+
plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+plugin_option=
for plugin in $plugin_names; do
plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
if test x$plugin_so = x$plugin; then
@@ -6622,7 +6881,119 @@ for plugin in $plugin_names; do
break
fi
done
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test "${AR}" = "" ; then
+ as_fn_error $? "Required archive tool 'ar' not found on PATH." "$LINENO" 5
+fi
+touch conftest.c
+${AR} $plugin_option rc conftest.a conftest.c
+if test "$?" != 0; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5
+$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;}
+ plugin_option=
+fi
+rm -f conftest.*
+if test -n "$plugin_option"; then
+ plugin_option="$plugin_option"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_option" >&5
+$as_echo "$plugin_option" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
@@ -6717,17 +7088,15 @@ fi
test -z "$AR" && AR=ar
if test -n "$plugin_option"; then
- if $AR --help 2>&1 | grep -q "\--plugin"; then
- touch conftest.c
- $AR $plugin_option rc conftest.a conftest.c
- if test "$?" != 0; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5
-$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;}
- else
+ case "$AR" in
+ *"$plugin_option"*)
+ ;;
+ *)
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
AR="$AR $plugin_option"
fi
- rm -f conftest.*
- fi
+ ;;
+ esac
fi
test -z "$AR_FLAGS" && AR_FLAGS=cru
@@ -6934,9 +7303,15 @@ fi
test -z "$RANLIB" && RANLIB=:
if test -n "$plugin_option" && test "$RANLIB" != ":"; then
- if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
- RANLIB="$RANLIB $plugin_option"
- fi
+ case "$RANLIB" in
+ *"$plugin_option"*)
+ ;;
+ *)
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB="$RANLIB $plugin_option"
+ fi
+ ;;
+ esac
fi
@@ -11563,7 +11938,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11566 "configure"
+#line 11941 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11669,7 +12044,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11672 "configure"
+#line 12047 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libsframe/doc/sframe-spec.texi b/libsframe/doc/sframe-spec.texi
index f25791e..73060ff 100644
--- a/libsframe/doc/sframe-spec.texi
+++ b/libsframe/doc/sframe-spec.texi
@@ -22,6 +22,7 @@ License''.
@title The SFrame Format
@subtitle Version 2 (Errata 1)
@sp 15
+@center @strong{*** DRAFT - NOT FOR DISTRIBUTION ***}
@center @today{}
@author Indu Bhagat
@@ -35,6 +36,9 @@ License''.
@node Top
@top The SFrame format
+@center @strong{*** DRAFT - NOT FOR DISTRIBUTION ***}
+@center @today{}
+
This manual describes version 2 (errata 1) of the SFrame file format. SFrame
stands for Simple Frame. The SFrame format keeps track of the minimal
necessary information needed for generating stack traces:
diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index 824d1fd..8550079 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -969,12 +969,11 @@ sframe_decode (const char *sf_buf, size_t sf_size, int *errp)
sframe_ret_set_errno (errp, SFRAME_ERR_NOMEM);
goto decode_fail_free;
}
- memcpy (dctx->sfd_funcdesc, frame_buf, fidx_size);
+ /* SFrame FDEs are at an offset of sfh_fdeoff from SFrame header end. */
+ memcpy (dctx->sfd_funcdesc, frame_buf + sfheaderp->sfh_fdeoff, fidx_size);
debug_printf ("%u total fidx size\n", fidx_size);
- frame_buf += (fidx_size);
-
/* Handle the SFrame Frame Row Entry section. */
dctx->sfd_fres = (char *) malloc (sfheaderp->sfh_fre_len);
if (dctx->sfd_fres == NULL)
@@ -982,7 +981,10 @@ sframe_decode (const char *sf_buf, size_t sf_size, int *errp)
sframe_ret_set_errno (errp, SFRAME_ERR_NOMEM);
goto decode_fail_free;
}
- memcpy (dctx->sfd_fres, frame_buf, sfheaderp->sfh_fre_len);
+ /* SFrame FREs are at an offset of sfh_freoff from SFrame header end. */
+ memcpy (dctx->sfd_fres,
+ frame_buf + sfheaderp->sfh_freoff,
+ sfheaderp->sfh_fre_len);
fre_bytes = sfheaderp->sfh_fre_len;
dctx->sfd_fre_nbytes = fre_bytes;
diff --git a/libsframe/testsuite/libsframe.decode/be-flipping.c b/libsframe/testsuite/libsframe.decode/be-flipping.c
index 5002524..c8b627b 100644
--- a/libsframe/testsuite/libsframe.decode/be-flipping.c
+++ b/libsframe/testsuite/libsframe.decode/be-flipping.c
@@ -15,17 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here. */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
/* SFrame info from the following source (1 fde 5 fres):
static int cnt;
@@ -55,6 +45,7 @@ main (void)
struct stat st;
char *sf_buf;
size_t sf_size;
+ uint8_t rep_block_size;
#define TEST(name, cond) \
do \
@@ -101,7 +92,8 @@ main (void)
unsigned int fde_cnt = sframe_decoder_get_num_fidx (dctx);
TEST ("be-flipping: Decoder FDE count", fde_cnt == 1);
- err = sframe_decoder_get_funcdesc (dctx, 0, &nfres, &fsize, &fstart, &finfo);
+ err = sframe_decoder_get_funcdesc_v2 (dctx, 0, &nfres, &fsize, &fstart,
+ &finfo, &rep_block_size);
TEST ("be-flipping: Decoder get FDE", err == 0);
TEST ("be-flipping: Decoder FRE count", nfres == 5);
diff --git a/libsframe/testsuite/libsframe.decode/frecnt-1.c b/libsframe/testsuite/libsframe.decode/frecnt-1.c
index 77b0440..9cf55ef 100644
--- a/libsframe/testsuite/libsframe.decode/frecnt-1.c
+++ b/libsframe/testsuite/libsframe.decode/frecnt-1.c
@@ -15,17 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here. */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
/*
* SFrame info from the following source (1 fde 4 fres):
@@ -46,6 +36,7 @@ main (void)
struct stat st;
char *sf_buf;
size_t sf_size;
+ uint8_t rep_block_size;
#define TEST(name, cond) \
do \
@@ -85,7 +76,8 @@ main (void)
unsigned int fde_cnt = sframe_decoder_get_num_fidx (dctx);
TEST ("frecnt-1: Decoder FDE count", fde_cnt == 1);
- err = sframe_decoder_get_funcdesc (dctx, 0, &nfres, &fsize, &fstart, &finfo);
+ err = sframe_decoder_get_funcdesc_v2 (dctx, 0, &nfres, &fsize, &fstart,
+ &finfo, &rep_block_size);
TEST ("frecnt-1: Decoder get FDE", err == 0);
TEST ("frecnt-1: Decoder FRE count", nfres == 4);
diff --git a/libsframe/testsuite/libsframe.decode/frecnt-2.c b/libsframe/testsuite/libsframe.decode/frecnt-2.c
index 912fdbd..9136e9a 100644
--- a/libsframe/testsuite/libsframe.decode/frecnt-2.c
+++ b/libsframe/testsuite/libsframe.decode/frecnt-2.c
@@ -15,17 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here. */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
/*
* SFrame info from the following source (2 fde 8 fres):
@@ -48,6 +38,7 @@ main (void)
struct stat st;
char *sf_buf;
size_t sf_size;
+ uint8_t rep_block_size;
#define TEST(name, cond) \
do \
@@ -88,8 +79,8 @@ main (void)
for (i = 0; i < fde_cnt; ++i)
{
- err = sframe_decoder_get_funcdesc (dctx, i, &nfres, &fsize, &fstart,
- &finfo);
+ err = sframe_decoder_get_funcdesc_v2 (dctx, i, &nfres, &fsize, &fstart,
+ &finfo, &rep_block_size);
TEST ("frecnt-2: Decode get FDE", err == 0);
TEST ("frecnt-2: Decode get FRE", nfres == 4);
}
diff --git a/libsframe/testsuite/libsframe.decode/local.mk b/libsframe/testsuite/libsframe.decode/local.mk
index 0e4279b..de34bbc 100644
--- a/libsframe/testsuite/libsframe.decode/local.mk
+++ b/libsframe/testsuite/libsframe.decode/local.mk
@@ -4,13 +4,13 @@ if HAVE_COMPAT_DEJAGNU
endif
%C%_be_flipping_SOURCES = %D%/be-flipping.c
-%C%_be_flipping_LDADD = ${top_builddir}/libsframe.la
-%C%_be_flipping_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_be_flipping_LDADD = $(testsuite_LDADD)
+%C%_be_flipping_CPPFLAGS = $(testsuite_CPPFLAGS)
%C%_frecnt_1_SOURCES = %D%/frecnt-1.c
-%C%_frecnt_1_LDADD = ${top_builddir}/libsframe.la
-%C%_frecnt_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_frecnt_1_LDADD = $(testsuite_LDADD)
+%C%_frecnt_1_CPPFLAGS = $(testsuite_CPPFLAGS)
%C%_frecnt_2_SOURCES = %D%/frecnt-2.c
-%C%_frecnt_2_LDADD = ${top_builddir}/libsframe.la
-%C%_frecnt_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_frecnt_2_LDADD = $(testsuite_LDADD)
+%C%_frecnt_2_CPPFLAGS = $(testsuite_CPPFLAGS)
diff --git a/libsframe/testsuite/libsframe.encode/encode-1.c b/libsframe/testsuite/libsframe.encode/encode-1.c
index 1ba75d7..da477e5 100644
--- a/libsframe/testsuite/libsframe.encode/encode-1.c
+++ b/libsframe/testsuite/libsframe.encode/encode-1.c
@@ -15,22 +15,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here. */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
static int
-add_fde1 (sframe_encoder_ctx *encode, int idx)
+add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
+ uint32_t sframe_vaddr, int idx, uint32_t *func_size)
{
- int i, err;
+#define FDE1_NUM_FRES 4
/* A contiguous block containing 4 FREs. */
sframe_frame_row_entry fres[]
= { {0x0, {0x8, 0, 0}, 0x3},
@@ -38,40 +29,60 @@ add_fde1 (sframe_encoder_ctx *encode, int idx)
{0x4, {0x10, 0xf0, 0}, 0x4},
{0x1a, {0x8, 0xf0, 0}, 0x5}
};
-
+ /* Function size in bytes. P.S. Must be a value greater than the
+ fre_start_addr of the last FRE above (0x1a). */
+ *func_size = 0x1b;
+
+ uint32_t offsetof_fde_in_sec
+ = sframe_encoder_get_offsetof_fde_start_addr (encode, idx, NULL);
+ int32_t func1_start_addr = (start_pc_vaddr
+ - (sframe_vaddr + offsetof_fde_in_sec));
unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
SFRAME_FDE_TYPE_PCINC);
- err = sframe_encoder_add_funcdesc (encode, 0xfffff022, 0x1b, finfo, 4);
+ int err = sframe_encoder_add_funcdesc_v2 (encode, func1_start_addr,
+ *func_size, finfo, 0,
+ FDE1_NUM_FRES);
if (err == -1)
return err;
- for (i = 0; i < 4; i++)
- if (sframe_encoder_add_fre (encode, idx,fres+i) == SFRAME_ERR)
+ for (unsigned int i = 0; i < FDE1_NUM_FRES; i++)
+ if (sframe_encoder_add_fre (encode, idx, fres + i) == SFRAME_ERR)
return -1;
return 0;
}
static int
-add_fde2 (sframe_encoder_ctx *encode, int idx)
+add_fde2 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
+ uint32_t sframe_vaddr, int idx, uint32_t *func_size)
+
{
- int i, err;
/* A contiguous block containing 4 FREs. */
+#define FDE2_NUM_FRES 4
sframe_frame_row_entry fres[]
= { {0x0, {0x8, 0, 0}, 0x3},
{0x1, {0x10, 0xf0, 0}, 0x5},
{0x4, {0x10, 0xf0, 0}, 0x4},
{0xf, {0x8, 0xf0, 0}, 0x5}
};
-
+ /* Function size in bytes. P.S. Must be a value greater than the
+ fre_start_addr of the last FRE above (0xf). */
+ *func_size = 0x10;
+
+ uint32_t offsetof_fde_in_sec
+ = sframe_encoder_get_offsetof_fde_start_addr (encode, idx, NULL);
+ int32_t func1_start_addr = (start_pc_vaddr
+ - (sframe_vaddr + offsetof_fde_in_sec));
unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
SFRAME_FDE_TYPE_PCINC);
- err = sframe_encoder_add_funcdesc (encode, 0xfffff029, 0x10, finfo, 4);
+ int err = sframe_encoder_add_funcdesc_v2 (encode, func1_start_addr,
+ *func_size, finfo, 0,
+ FDE1_NUM_FRES);
if (err == -1)
return err;
- for (i = 0; i < 4; i++)
- if (sframe_encoder_add_fre (encode, idx, fres+i) == SFRAME_ERR)
+ for (unsigned int i = 0; i < FDE1_NUM_FRES; i++)
+ if (sframe_encoder_add_fre (encode, idx, fres + i) == SFRAME_ERR)
return -1;
return 0;
@@ -129,6 +140,11 @@ int main (void)
{
sframe_encoder_ctx *encode;
sframe_frame_row_entry frep;
+ uint32_t sframe_vaddr;
+ uint32_t func1_start_vaddr;
+ uint32_t func2_start_vaddr;
+ uint32_t func1_size = 0;
+ uint32_t func2_size = 0;
char *sframe_buf;
size_t sf_size;
int err = 0;
@@ -145,6 +161,7 @@ int main (void)
} \
while (0)
+ sframe_vaddr = 0x4020c8;
encode = sframe_encode (SFRAME_VERSION,
SFRAME_F_FDE_FUNC_START_PCREL,
SFRAME_ABI_AMD64_ENDIAN_LITTLE,
@@ -158,10 +175,13 @@ int main (void)
err = sframe_encoder_add_fre (encode, 1, &frep);
TEST ("encode-1: Encoder update workflow", err == SFRAME_ERR);
- err = add_fde1 (encode, 0);
+ func1_start_vaddr = 0x401106;
+ err = add_fde1 (encode, func1_start_vaddr, sframe_vaddr, 0, &func1_size);
TEST ("encode-1: Encoder adding FDE1", err == 0);
- err = add_fde2 (encode, 1);
+ /* Function 2 is placed after 0x0 bytes from the end of Function 1. */
+ func2_start_vaddr = func1_start_vaddr + func1_size + 0x0;
+ err = add_fde2 (encode, func2_start_vaddr, sframe_vaddr, 1, &func2_size);
TEST ("encode-1: Encoder adding FDE2", err == 0);
fde_cnt = sframe_encoder_get_num_fidx (encode);
diff --git a/libsframe/testsuite/libsframe.encode/local.mk b/libsframe/testsuite/libsframe.encode/local.mk
index 477d4b6..6b09651 100644
--- a/libsframe/testsuite/libsframe.encode/local.mk
+++ b/libsframe/testsuite/libsframe.encode/local.mk
@@ -3,5 +3,5 @@ if HAVE_COMPAT_DEJAGNU
endif
%C%_encode_1_SOURCES = %D%/encode-1.c
-%C%_encode_1_LDADD = ${top_builddir}/libsframe.la
-%C%_encode_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_encode_1_LDADD = $(testsuite_LDADD)
+%C%_encode_1_CPPFLAGS = $(testsuite_CPPFLAGS)
diff --git a/libsframe/testsuite/libsframe.find/findfre-1.c b/libsframe/testsuite/libsframe.find/findfre-1.c
index 7c7c947..cbd7ab3 100644
--- a/libsframe/testsuite/libsframe.find/findfre-1.c
+++ b/libsframe/testsuite/libsframe.find/findfre-1.c
@@ -15,17 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here. */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
static int
add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
@@ -49,8 +39,9 @@ add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
- (sframe_vaddr + offsetof_fde_in_sec));
unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
SFRAME_FDE_TYPE_PCINC);
- int err = sframe_encoder_add_funcdesc (encode, func1_start_addr, *func_size,
- finfo, FDE1_NUM_FRES);
+ int err = sframe_encoder_add_funcdesc_v2 (encode, func1_start_addr,
+ *func_size, finfo, 0,
+ FDE1_NUM_FRES);
if (err == -1)
return err;
@@ -83,8 +74,9 @@ add_fde2 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
- (sframe_vaddr + offsetof_fde_in_sec));
unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
SFRAME_FDE_TYPE_PCINC);
- int err = sframe_encoder_add_funcdesc (encode, func2_start_addr, *func_size,
- finfo, FDE2_NUM_FRES);
+ int err = sframe_encoder_add_funcdesc_v2 (encode, func2_start_addr,
+ *func_size, finfo, 0,
+ FDE2_NUM_FRES);
if (err == -1)
return err;
diff --git a/libsframe/testsuite/libsframe.find/findfunc-1.c b/libsframe/testsuite/libsframe.find/findfunc-1.c
index 00b9e8d..1dcd870 100644
--- a/libsframe/testsuite/libsframe.find/findfunc-1.c
+++ b/libsframe/testsuite/libsframe.find/findfunc-1.c
@@ -22,17 +22,7 @@
The tests in here stress the sframe_get_funcdesc_with_addr API via calls to
the sframe_find_fre (). */
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here. */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
static int
add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
@@ -56,8 +46,9 @@ add_fde1 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
- (sframe_vaddr + offsetof_fde_in_sec));
unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
SFRAME_FDE_TYPE_PCINC);
- int err = sframe_encoder_add_funcdesc (encode, func1_start_addr, *func_size,
- finfo, FDE1_NUM_FRES);
+ int err = sframe_encoder_add_funcdesc_v2 (encode, func1_start_addr,
+ *func_size, finfo, 0,
+ FDE1_NUM_FRES);
if (err == -1)
return err;
@@ -90,8 +81,9 @@ add_fde2 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
- (sframe_vaddr + offsetof_fde_in_sec));
unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
SFRAME_FDE_TYPE_PCINC);
- int err = sframe_encoder_add_funcdesc (encode, func2_start_addr, *func_size,
- finfo, FDE2_NUM_FRES);
+ int err = sframe_encoder_add_funcdesc_v2 (encode, func2_start_addr,
+ *func_size, finfo, 0,
+ FDE2_NUM_FRES);
if (err == -1)
return err;
@@ -124,8 +116,9 @@ add_fde3 (sframe_encoder_ctx *encode, uint32_t start_pc_vaddr,
- (sframe_vaddr + offsetof_fde_in_sec));
unsigned char finfo = sframe_fde_create_func_info (SFRAME_FRE_TYPE_ADDR1,
SFRAME_FDE_TYPE_PCINC);
- int err = sframe_encoder_add_funcdesc (encode, func3_start_addr, *func_size,
- finfo, FDE3_NUM_FRES);
+ int err = sframe_encoder_add_funcdesc_v2 (encode, func3_start_addr,
+ *func_size, finfo, 0,
+ FDE3_NUM_FRES);
if (err == -1)
return err;
diff --git a/libsframe/testsuite/libsframe.find/local.mk b/libsframe/testsuite/libsframe.find/local.mk
index 52741e8..05c7a10 100644
--- a/libsframe/testsuite/libsframe.find/local.mk
+++ b/libsframe/testsuite/libsframe.find/local.mk
@@ -4,17 +4,17 @@ if HAVE_COMPAT_DEJAGNU
endif
%C%_findfre_1_SOURCES = %D%/findfre-1.c
-%C%_findfre_1_LDADD = ${top_builddir}/libsframe.la
-%C%_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_findfre_1_LDADD = $(testsuite_LDADD)
+%C%_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
%C%_findfunc_1_SOURCES = %D%/findfunc-1.c
-%C%_findfunc_1_LDADD = ${top_builddir}/libsframe.la
-%C%_findfunc_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_findfunc_1_LDADD = $(testsuite_LDADD)
+%C%_findfunc_1_CPPFLAGS = $(testsuite_CPPFLAGS)
%C%_plt_findfre_1_SOURCES = %D%/plt-findfre-1.c
-%C%_plt_findfre_1_LDADD = ${top_builddir}/libsframe.la
-%C%_plt_findfre_1_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_plt_findfre_1_LDADD = $(testsuite_LDADD)
+%C%_plt_findfre_1_CPPFLAGS = $(testsuite_CPPFLAGS)
%C%_plt_findfre_2_SOURCES = %D%/plt-findfre-2.c
-%C%_plt_findfre_2_LDADD = ${top_builddir}/libsframe.la
-%C%_plt_findfre_2_CPPFLAGS = -I${top_srcdir}/../include -Wall
+%C%_plt_findfre_2_LDADD = $(testsuite_LDADD)
+%C%_plt_findfre_2_CPPFLAGS = $(testsuite_CPPFLAGS)
diff --git a/libsframe/testsuite/libsframe.find/plt-findfre-1.c b/libsframe/testsuite/libsframe.find/plt-findfre-1.c
index 91da4bc..b41588a 100644
--- a/libsframe/testsuite/libsframe.find/plt-findfre-1.c
+++ b/libsframe/testsuite/libsframe.find/plt-findfre-1.c
@@ -15,17 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here. */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
static int
add_plt_fde1 (sframe_encoder_ctx *ectx, uint32_t plt_vaddr,
diff --git a/libsframe/testsuite/libsframe.find/plt-findfre-2.c b/libsframe/testsuite/libsframe.find/plt-findfre-2.c
index 00a5b2a..61f04f0 100644
--- a/libsframe/testsuite/libsframe.find/plt-findfre-2.c
+++ b/libsframe/testsuite/libsframe.find/plt-findfre-2.c
@@ -16,17 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "sframe-api.h"
-
-/* DejaGnu should not use gnulib's vsnprintf replacement here. */
-#undef vsnprintf
-#include <dejagnu.h>
+#include "sframe-test.h"
/* s390x-specific size in bytes of plt0 and pltN. */
#define PLT_SIZE 32
diff --git a/libsframe/testsuite/local.mk b/libsframe/testsuite/local.mk
index 5e5ba92..4f2ea9b 100644
--- a/libsframe/testsuite/local.mk
+++ b/libsframe/testsuite/local.mk
@@ -19,6 +19,9 @@ check-DEJAGNU: site.exp
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi
+testsuite_LDADD = $(top_builddir)/libsframe.la
+testsuite_CPPFLAGS = -I$(srcdir)/testsuite -I$(srcdir)/../include
+
# libsframe encoder/decoder/find testsuite
include %D%/libsframe.decode/local.mk
include %D%/libsframe.encode/local.mk
diff --git a/libsframe/testsuite/sframe-test.h b/libsframe/testsuite/sframe-test.h
new file mode 100644
index 0000000..d5db96b
--- /dev/null
+++ b/libsframe/testsuite/sframe-test.h
@@ -0,0 +1,43 @@
+/* sframe-test.h -- Common libsframe testsuite header.
+
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _SFRAME_TEST_H
+#define _SFRAME_TEST_H
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "sframe-api.h"
+
+/* DejaGnu should not use gnulib's vsnprintf replacement here. */
+#undef vsnprintf
+
+/* PR 33168: Solaris <sys/wait.h> with __EXTENSIONS__ defined gets a
+ declaration of wait(). This conflicts with <dejagnu.h>'s wait
+ definition that is only removed after DejaGnu 1.6.3. */
+
+#define wait dg_wait
+/* Add prototype to avoid warning. */
+void wait (void);
+#include <dejagnu.h>
+#undef wait
+
+#endif /* _SFRAME_TEST_H */