1 |
commit: 46fe624223cfe62fb6c2fbb609be42f2f1d1734b |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 20 08:51:41 2015 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 20 08:51:41 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=46fe6242 |
7 |
|
8 |
libsandbox: rework abi syscall header generation |
9 |
|
10 |
Probe the availability of multilib headers at configure time so that we |
11 |
can show the status more cleanly. This allows the header generation to |
12 |
be done in parallel and not output confusing warning messages to users. |
13 |
|
14 |
URL: https://bugs.gentoo.org/536582 |
15 |
Reported-by: cmue81 <AT> gmx.de |
16 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
17 |
|
18 |
configure.ac | 44 ++++++++++++++++++++++++++++++++--------- |
19 |
libsandbox/Makefile.am | 19 +++++++++++------- |
20 |
libsandbox/trace/linux/x86_64.c | 6 ++++++ |
21 |
3 files changed, 53 insertions(+), 16 deletions(-) |
22 |
|
23 |
diff --git a/configure.ac b/configure.ac |
24 |
index dec9686..b57263e 100644 |
25 |
--- a/configure.ac |
26 |
+++ b/configure.ac |
27 |
@@ -50,19 +50,45 @@ dnl multiple personality support (x86 & x86_64: multilib) |
28 |
AC_MSG_CHECKING([for multiple personalities]) |
29 |
AC_ARG_ENABLE([schizo], |
30 |
[AS_HELP_STRING([--enable-schizo],[Support multiple personalities])], |
31 |
- [],[enable_schizo="yes"]) |
32 |
-SB_SCHIZO_SETTINGS="no" |
33 |
-if test "x$enable_schizo" = "xyes" ; then |
34 |
- case $host_alias in |
35 |
- x86_64*linux*) SB_SCHIZO_SETTINGS="x86_64:-m64 x86:-m32 x32:-mx32";; |
36 |
+ [],[enable_schizo="auto"]) |
37 |
+AC_MSG_RESULT([$enable_schizo]) |
38 |
+SB_SCHIZO_SETTINGS= |
39 |
+AC_DEFUN([SB_CHECK_SCHIZO],[dnl |
40 |
+ AC_MSG_CHECKING([checking for $1/$2 compiler support]) |
41 |
+ ac_save_CFLAGS=$CFLAGS |
42 |
+ CFLAGS="$CFLAGS $2" |
43 |
+ AC_TRY_COMPILE([ |
44 |
+ #include <stdio.h> |
45 |
+ ], [ |
46 |
+ return 0 |
47 |
+ ], [ |
48 |
+ enable_schizo=yes |
49 |
+ AS_VAR_APPEND([SB_SCHIZO_SETTINGS], " $1:$2") |
50 |
+ AS_VAR_APPEND([SB_SCHIZO_HEADERS], " trace_syscalls_$1.h") |
51 |
+ AC_MSG_RESULT([yes]) |
52 |
+ AC_DEFINE_UNQUOTED([SB_SCHIZO_$1], 1, [Support for $1/$2 is available]) |
53 |
+ ], [ |
54 |
+ AC_MSG_RESULT([no]) |
55 |
+ ]) |
56 |
+ CFLAGS=$ac_save_CFLAGS |
57 |
+]) |
58 |
+if test "x$enable_schizo" != "xno" ; then |
59 |
+ enable_schizo=no |
60 |
+ case $host in |
61 |
+ i686*linux|x86_64*linux*) |
62 |
+ SB_CHECK_SCHIZO([x86_64], [-m64]) |
63 |
+ SB_CHECK_SCHIZO([x86], [-m32]) |
64 |
+ SB_CHECK_SCHIZO([x32], [-mx32]) |
65 |
+ ;; |
66 |
esac |
67 |
-fi |
68 |
-if test "$SB_SCHIZO_SETTINGS" != "no" ; then |
69 |
- AC_DEFINE_UNQUOTED([SB_SCHIZO], ["$SB_SCHIZO_SETTINGS"], [Enable multiple personalities support]) |
70 |
+ SB_SCHIZO_SETTINGS=${SB_SCHIZO_SETTINGS# } |
71 |
+ if test "x$enable_schizo" != "xno" ; then |
72 |
+ AC_DEFINE_UNQUOTED([SB_SCHIZO], ["$SB_SCHIZO_SETTINGS"], [Enable multiple personalities support]) |
73 |
+ fi |
74 |
fi |
75 |
AC_SUBST(SB_SCHIZO_SETTINGS) |
76 |
+AC_SUBST(SB_SCHIZO_HEADERS) |
77 |
AM_CONDITIONAL([SB_SCHIZO], test "$SB_SCHIZO_SETTINGS" != "no") |
78 |
-AC_MSG_RESULT($SB_SCHIZO_SETTINGS) |
79 |
|
80 |
dnl this test fills up the stack and then triggers a segfault ... |
81 |
dnl but it's hard to wrap things without a stack, so let's ignore |
82 |
|
83 |
diff --git a/libsandbox/Makefile.am b/libsandbox/Makefile.am |
84 |
index 529d835..cbc73ba 100644 |
85 |
--- a/libsandbox/Makefile.am |
86 |
+++ b/libsandbox/Makefile.am |
87 |
@@ -70,18 +70,23 @@ TRACE_MAKE_HEADER = \ |
88 |
$(SB_AWK) $(GEN_TRACE_SCRIPT) -v MODE=gen | \ |
89 |
$(COMPILE) -E -P -include $(top_srcdir)/headers.h - $$f | \ |
90 |
$(SB_AWK) $(GEN_TRACE_SCRIPT) -v syscall_prefix=$$t > $$header |
91 |
-trace_syscalls.h: $(GEN_TRACE_SCRIPT) Makefile |
92 |
+trace_syscalls.h: $(GEN_TRACE_SCRIPT) $(SB_SCHIZO_HEADERS) |
93 |
if SB_SCHIZO |
94 |
+ $(AM_V_GEN)touch $@ |
95 |
+else |
96 |
+ $(AM_V_GEN)t= f= header=$@; $(TRACE_MAKE_HEADER) |
97 |
+endif |
98 |
+ |
99 |
+$(SB_SCHIZO_HEADERS): $(GEN_TRACE_SCRIPT) |
100 |
$(AM_V_GEN)for pers in $(SB_SCHIZO_SETTINGS) ; do \ |
101 |
t=_$${pers%:*}; \ |
102 |
f=$${pers#*:}; \ |
103 |
- header=trace_syscalls$${t}.h; \ |
104 |
- $(TRACE_MAKE_HEADER) || exit $$?; \ |
105 |
+ header="trace_syscalls$${t}.h"; \ |
106 |
+ if [ "$$header" = "$@" ]; then \ |
107 |
+ $(TRACE_MAKE_HEADER) || exit $$?; \ |
108 |
+ break; \ |
109 |
+ fi; \ |
110 |
done |
111 |
- @touch $@ |
112 |
-else |
113 |
- $(AM_V_GEN)t= f= header=$@; $(TRACE_MAKE_HEADER) |
114 |
-endif |
115 |
|
116 |
EXTRA_DIST = $(SYMBOLS_FILE) $(SYMBOLS_WRAPPERS) $(SB_NR_FILE) $(TRACE_FILES) headers.h |
117 |
|
118 |
|
119 |
diff --git a/libsandbox/trace/linux/x86_64.c b/libsandbox/trace/linux/x86_64.c |
120 |
index 5bd1361..82c492d 100644 |
121 |
--- a/libsandbox/trace/linux/x86_64.c |
122 |
+++ b/libsandbox/trace/linux/x86_64.c |
123 |
@@ -4,21 +4,27 @@ |
124 |
#ifdef SB_SCHIZO |
125 |
|
126 |
static const struct syscall_entry syscall_table_32[] = { |
127 |
+#ifdef SB_SCHIZO_x86 |
128 |
#define S(s) { SB_SYS_x86_##s, SB_NR_##s, #s }, |
129 |
#include "trace_syscalls_x86.h" |
130 |
#undef S |
131 |
+#endif |
132 |
{ SB_NR_UNDEF, SB_NR_UNDEF, NULL }, |
133 |
}; |
134 |
static const struct syscall_entry syscall_table_64[] = { |
135 |
+#ifdef SB_SCHIZO_x86_64 |
136 |
#define S(s) { SB_SYS_x86_64_##s, SB_NR_##s, #s }, |
137 |
#include "trace_syscalls_x86_64.h" |
138 |
#undef S |
139 |
+#endif |
140 |
{ SB_NR_UNDEF, SB_NR_UNDEF, NULL }, |
141 |
}; |
142 |
static const struct syscall_entry syscall_table_x32[] = { |
143 |
+#ifdef SB_SCHIZO_x32 |
144 |
#define S(s) { SB_SYS_x32_##s, SB_NR_##s, #s }, |
145 |
#include "trace_syscalls_x32.h" |
146 |
#undef S |
147 |
+#endif |
148 |
{ SB_NR_UNDEF, SB_NR_UNDEF, NULL }, |
149 |
}; |