Testcase by Chantry Xavier (shiningxc@gmail.com).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12715
AM_CONDITIONAL(BUILD_AVX_TESTS, test x$ac_have_as_avx = xyes)
+# Does the C compiler support the "ifunc" attribute
+# Note, this doesn't generate a C-level symbol. It generates a
+# automake-level symbol (BUILD_IFUNC_TESTS), used in test Makefile.am's
+AC_MSG_CHECKING([if gcc supports the ifunc attribute])
+
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]], [[
+ void bar(void) {}
+ void foo(void) __attribute__((ifunc("bar")));
+]])], [
+ac_have_ifunc_attr=yes
+AC_MSG_RESULT([yes])
+], [
+ac_have_ifunc_attr=no
+AC_MSG_RESULT([no])
+])
+
+AM_CONDITIONAL(BUILD_IFUNC_TESTS, test x$ac_have_ifunc_attr = xyes)
+
+
# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
# when building the tool executables. I think we should get rid of it.
#
fork.stderr.exp fork.stdout.exp fork.vgtest \
fucomip.stderr.exp fucomip.vgtest \
gxx304.stderr.exp gxx304.vgtest \
+ ifunc.stderr.exp ifunc.stdout.exp ifunc.vgtest \
manythreads.stdout.exp manythreads.stderr.exp manythreads.vgtest \
map_unaligned.stderr.exp map_unaligned.vgtest \
map_unmap.stderr.exp map_unmap.stdout.exp map_unmap.vgtest \
check_PROGRAMS += rlimit64_nofile
endif
+if BUILD_IFUNC_TESTS
+ check_PROGRAMS += ifunc
+endif
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
--- /dev/null
+/* This test made valgrind run in an infinite loop. See bugzilla #301204 */
+#include <stdio.h>
+
+static void mytest(int d)
+{
+ printf("%d\n", d);
+}
+
+static void (*resolve_test(void))(void)
+{
+ return (void (*)(void))&mytest;
+}
+
+void test(int d)
+ __attribute__((ifunc("resolve_test")));
+
+int main()
+{
+ test(5);
+ return 0;
+}
--- /dev/null
+prog: ifunc