* [gentoo-commits] proj/sandbox:master commit in: libsandbox/trace/linux/, libsandbox/, /
@ 2015-09-27 6:13 Mike Frysinger
0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2015-09-27 6:13 UTC (permalink / raw
To: gentoo-commits
commit: 46fe624223cfe62fb6c2fbb609be42f2f1d1734b
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 20 08:51:41 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 08:51:41 2015 +0000
URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=46fe6242
libsandbox: rework abi syscall header generation
Probe the availability of multilib headers at configure time so that we
can show the status more cleanly. This allows the header generation to
be done in parallel and not output confusing warning messages to users.
URL: https://bugs.gentoo.org/536582
Reported-by: cmue81 <AT> gmx.de
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
configure.ac | 44 ++++++++++++++++++++++++++++++++---------
libsandbox/Makefile.am | 19 +++++++++++-------
libsandbox/trace/linux/x86_64.c | 6 ++++++
3 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac
index dec9686..b57263e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,19 +50,45 @@ dnl multiple personality support (x86 & x86_64: multilib)
AC_MSG_CHECKING([for multiple personalities])
AC_ARG_ENABLE([schizo],
[AS_HELP_STRING([--enable-schizo],[Support multiple personalities])],
- [],[enable_schizo="yes"])
-SB_SCHIZO_SETTINGS="no"
-if test "x$enable_schizo" = "xyes" ; then
- case $host_alias in
- x86_64*linux*) SB_SCHIZO_SETTINGS="x86_64:-m64 x86:-m32 x32:-mx32";;
+ [],[enable_schizo="auto"])
+AC_MSG_RESULT([$enable_schizo])
+SB_SCHIZO_SETTINGS=
+AC_DEFUN([SB_CHECK_SCHIZO],[dnl
+ AC_MSG_CHECKING([checking for $1/$2 compiler support])
+ ac_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $2"
+ AC_TRY_COMPILE([
+ #include <stdio.h>
+ ], [
+ return 0
+ ], [
+ enable_schizo=yes
+ AS_VAR_APPEND([SB_SCHIZO_SETTINGS], " $1:$2")
+ AS_VAR_APPEND([SB_SCHIZO_HEADERS], " trace_syscalls_$1.h")
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED([SB_SCHIZO_$1], 1, [Support for $1/$2 is available])
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+ CFLAGS=$ac_save_CFLAGS
+])
+if test "x$enable_schizo" != "xno" ; then
+ enable_schizo=no
+ case $host in
+ i686*linux|x86_64*linux*)
+ SB_CHECK_SCHIZO([x86_64], [-m64])
+ SB_CHECK_SCHIZO([x86], [-m32])
+ SB_CHECK_SCHIZO([x32], [-mx32])
+ ;;
esac
-fi
-if test "$SB_SCHIZO_SETTINGS" != "no" ; then
- AC_DEFINE_UNQUOTED([SB_SCHIZO], ["$SB_SCHIZO_SETTINGS"], [Enable multiple personalities support])
+ SB_SCHIZO_SETTINGS=${SB_SCHIZO_SETTINGS# }
+ if test "x$enable_schizo" != "xno" ; then
+ AC_DEFINE_UNQUOTED([SB_SCHIZO], ["$SB_SCHIZO_SETTINGS"], [Enable multiple personalities support])
+ fi
fi
AC_SUBST(SB_SCHIZO_SETTINGS)
+AC_SUBST(SB_SCHIZO_HEADERS)
AM_CONDITIONAL([SB_SCHIZO], test "$SB_SCHIZO_SETTINGS" != "no")
-AC_MSG_RESULT($SB_SCHIZO_SETTINGS)
dnl this test fills up the stack and then triggers a segfault ...
dnl but it's hard to wrap things without a stack, so let's ignore
diff --git a/libsandbox/Makefile.am b/libsandbox/Makefile.am
index 529d835..cbc73ba 100644
--- a/libsandbox/Makefile.am
+++ b/libsandbox/Makefile.am
@@ -70,18 +70,23 @@ TRACE_MAKE_HEADER = \
$(SB_AWK) $(GEN_TRACE_SCRIPT) -v MODE=gen | \
$(COMPILE) -E -P -include $(top_srcdir)/headers.h - $$f | \
$(SB_AWK) $(GEN_TRACE_SCRIPT) -v syscall_prefix=$$t > $$header
-trace_syscalls.h: $(GEN_TRACE_SCRIPT) Makefile
+trace_syscalls.h: $(GEN_TRACE_SCRIPT) $(SB_SCHIZO_HEADERS)
if SB_SCHIZO
+ $(AM_V_GEN)touch $@
+else
+ $(AM_V_GEN)t= f= header=$@; $(TRACE_MAKE_HEADER)
+endif
+
+$(SB_SCHIZO_HEADERS): $(GEN_TRACE_SCRIPT)
$(AM_V_GEN)for pers in $(SB_SCHIZO_SETTINGS) ; do \
t=_$${pers%:*}; \
f=$${pers#*:}; \
- header=trace_syscalls$${t}.h; \
- $(TRACE_MAKE_HEADER) || exit $$?; \
+ header="trace_syscalls$${t}.h"; \
+ if [ "$$header" = "$@" ]; then \
+ $(TRACE_MAKE_HEADER) || exit $$?; \
+ break; \
+ fi; \
done
- @touch $@
-else
- $(AM_V_GEN)t= f= header=$@; $(TRACE_MAKE_HEADER)
-endif
EXTRA_DIST = $(SYMBOLS_FILE) $(SYMBOLS_WRAPPERS) $(SB_NR_FILE) $(TRACE_FILES) headers.h
diff --git a/libsandbox/trace/linux/x86_64.c b/libsandbox/trace/linux/x86_64.c
index 5bd1361..82c492d 100644
--- a/libsandbox/trace/linux/x86_64.c
+++ b/libsandbox/trace/linux/x86_64.c
@@ -4,21 +4,27 @@
#ifdef SB_SCHIZO
static const struct syscall_entry syscall_table_32[] = {
+#ifdef SB_SCHIZO_x86
#define S(s) { SB_SYS_x86_##s, SB_NR_##s, #s },
#include "trace_syscalls_x86.h"
#undef S
+#endif
{ SB_NR_UNDEF, SB_NR_UNDEF, NULL },
};
static const struct syscall_entry syscall_table_64[] = {
+#ifdef SB_SCHIZO_x86_64
#define S(s) { SB_SYS_x86_64_##s, SB_NR_##s, #s },
#include "trace_syscalls_x86_64.h"
#undef S
+#endif
{ SB_NR_UNDEF, SB_NR_UNDEF, NULL },
};
static const struct syscall_entry syscall_table_x32[] = {
+#ifdef SB_SCHIZO_x32
#define S(s) { SB_SYS_x32_##s, SB_NR_##s, #s },
#include "trace_syscalls_x32.h"
#undef S
+#endif
{ SB_NR_UNDEF, SB_NR_UNDEF, NULL },
};
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-27 6:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-27 6:13 [gentoo-commits] proj/sandbox:master commit in: libsandbox/trace/linux/, libsandbox/, / Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox