uti: Don't compile syscall_intercept related stuff when not specified with configure option

Change-Id: I9be8cb9b3fcae78d33a33b057c43caee23a81fc1
This commit is contained in:
Masamichi Takagi
2018-09-05 13:14:36 +09:00
parent 22c6c5c736
commit b51886421e
6 changed files with 136 additions and 2 deletions

View File

@ -86,3 +86,6 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* whether or not syscall_intercept library is linked */
#undef WITH_SYSCALL_INTERCEPT

89
configure vendored
View File

@ -628,6 +628,7 @@ IHK_RELEASE_DATE
DCFA_VERSION
MCKERNEL_VERSION
IHK_VERSION
WITH_SYSCALL_INTERCEPT
ENABLE_QLMPI
ENABLE_RUSAGE
ENABLE_MCOVERLAYFS
@ -3529,6 +3530,7 @@ fi
# Check whether --with-syscall_intercept was given.
if test "${with_syscall_intercept+set}" = set; then :
withval=$with_syscall_intercept; case "$withval" in #(
@ -3640,6 +3642,81 @@ fi
fi
if test -n "${with_syscall_intercept}" || test -n "${with_syscall_intercept_include}" || test -n "${with_syscall_intercept_lib}"; then :
WITH_SYSCALL_INTERCEPT=yes
else
WITH_SYSCALL_INTERCEPT=no
fi
if test "x$WITH_SYSCALL_INTERCEPT" == "xno" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for syscall_no_intercept in -lsyscall_intercept" >&5
$as_echo_n "checking for syscall_no_intercept in -lsyscall_intercept... " >&6; }
if ${ac_cv_lib_syscall_intercept_syscall_no_intercept+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsyscall_intercept -lcapstone -ldl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char syscall_no_intercept ();
int
main ()
{
return syscall_no_intercept ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_syscall_intercept_syscall_no_intercept=yes
else
ac_cv_lib_syscall_intercept_syscall_no_intercept=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_syscall_intercept_syscall_no_intercept" >&5
$as_echo "$ac_cv_lib_syscall_intercept_syscall_no_intercept" >&6; }
if test "x$ac_cv_lib_syscall_intercept_syscall_no_intercept" = xyes; then :
syscall_intercept_lib_found=yes
else
syscall_intercept_lib_found=no
fi
if test "x$syscall_intercept_lib_found" != "xyes"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: libsyscall_intercept.so not found" >&5
$as_echo "$as_me: libsyscall_intercept.so not found" >&6;}
fi
ac_fn_c_check_header_mongrel "$LINENO" "libsyscall_intercept_hook_point.h" "ac_cv_header_libsyscall_intercept_hook_point_h" "$ac_includes_default"
if test "x$ac_cv_header_libsyscall_intercept_hook_point_h" = xyes; then :
syscall_intercept_header_found=yes
else
syscall_intercept_header_found=no
fi
if test "x$syscall_intercept_header_found" != "xyes"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: libsyscall_intercept_hook_point.h not found" >&5
$as_echo "$as_me: libsyscall_intercept_hook_point.h not found" >&6;}
fi
if test "x$syscall_intercept_lib_found" == "xyes" && test "x$syscall_intercept_header_found" == "xyes"; then :
WITH_SYSCALL_INTERCEPT=yes
else
WITH_SYSCALL_INTERCEPT=no
fi
fi
# Check whether --with-kernelsrc was given.
@ -4722,6 +4799,17 @@ else
$as_echo "$as_me: perf is disabled" >&6;}
fi
if test "x$WITH_SYSCALL_INTERCEPT" = "xyes" ; then
$as_echo "#define WITH_SYSCALL_INTERCEPT 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: syscall_intercept library is linked" >&5
$as_echo "$as_me: syscall_intercept library is linked" >&6;}
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: syscall_intercept library isn't linked" >&5
$as_echo "$as_me: syscall_intercept library isn't linked" >&6;}
fi
if test "x$MCKERNEL_INCDIR" != "x" ; then
cat >>confdefs.h <<_ACEOF
@ -4792,6 +4880,7 @@ fi
ac_config_headers="$ac_config_headers config.h"

View File

@ -123,6 +123,10 @@ AC_DEFUN([PAC_SET_HEADER_LIB_PATH_SYSCALL_INTERCEPT],[
[PAC_APPEND_FLAG([-L${with_$1}/lib64 -Wl,-rpath,${with_$1}/lib64],[LDFLAGS_SYSCALL_INTERCEPT])])
])
])
AS_IF([test -n "${with_$1}" || test -n "${with_$1_include}" || test -n "${with_$1_lib}"],
[WITH_SYSCALL_INTERCEPT=yes],
[WITH_SYSCALL_INTERCEPT=no])
])
IHK_VERSION=IHK_VERSION_m4
@ -142,8 +146,24 @@ AS_IF([test "x$numa_lib_found" != "xyes"],
[AC_MSG_ERROR([Unable to find NUMA library, missing numactl-devel?])])
PAC_SET_HEADER_LIB_PATH([mpi])
PAC_SET_HEADER_LIB_PATH_SYSCALL_INTERCEPT([syscall_intercept])
if test "x$WITH_SYSCALL_INTERCEPT" == "xno" ; then
AC_CHECK_LIB([syscall_intercept],[syscall_no_intercept],[syscall_intercept_lib_found=yes],[syscall_intercept_lib_found=no],[-lcapstone -ldl])
AS_IF([test "x$syscall_intercept_lib_found" != "xyes"],
[AC_MSG_NOTICE([libsyscall_intercept.so not found])])
AC_CHECK_HEADER([libsyscall_intercept_hook_point.h],[syscall_intercept_header_found=yes],[syscall_intercept_header_found=no])
AS_IF([test "x$syscall_intercept_header_found" != "xyes"],
[AC_MSG_NOTICE([libsyscall_intercept_hook_point.h not found])])
AS_IF([test "x$syscall_intercept_lib_found" == "xyes" && test "x$syscall_intercept_header_found" == "xyes"],
[WITH_SYSCALL_INTERCEPT=yes],
[WITH_SYSCALL_INTERCEPT=no])
fi
AC_ARG_WITH([kernelsrc],
AC_HELP_STRING(
[--with-kernelsrc=path],[Path to 'kernel src', default is /lib/modules/uname_r/build]),
@ -466,6 +486,13 @@ else
AC_MSG_NOTICE([perf is disabled])
fi
if test "x$WITH_SYSCALL_INTERCEPT" = "xyes" ; then
AC_DEFINE([WITH_SYSCALL_INTERCEPT],[1],[whether or not syscall_intercept library is linked])
AC_MSG_NOTICE([syscall_intercept library is linked])
else
AC_MSG_NOTICE([syscall_intercept library isn't linked])
fi
if test "x$MCKERNEL_INCDIR" != "x" ; then
AC_DEFINE_UNQUOTED(MCKERNEL_INCDIR,"$MCKERNEL_INCDIR",[McKernel specific headers])
fi
@ -508,6 +535,7 @@ AC_SUBST(LDFLAGS_SYSCALL_INTERCEPT)
AC_SUBST(ENABLE_MCOVERLAYFS)
AC_SUBST(ENABLE_RUSAGE)
AC_SUBST(ENABLE_QLMPI)
AC_SUBST(WITH_SYSCALL_INTERCEPT)
AC_SUBST(IHK_VERSION)
AC_SUBST(MCKERNEL_VERSION)

View File

@ -17,18 +17,23 @@ CPPFLAGS_SYSCALL_INTERCEPT=@CPPFLAGS_SYSCALL_INTERCEPT@
LDFLAGS_SYSCALL_INTERCEPT=@LDFLAGS_SYSCALL_INTERCEPT@
RPATH=$(shell echo $(LDFLAGS)|awk '{for(i=1;i<=NF;i++){if($$i~/^-L/){w=$$i;sub(/^-L/,"-Wl,-rpath,",w);print w}}}')
VPATH=@abs_srcdir@
TARGET=mcexec libsched_yield ldump2mcdump.so syscall_intercept.so
TARGET=mcexec libsched_yield ldump2mcdump.so
@uncomment_if_ENABLE_MEMDUMP@TARGET+=eclair
LIBS=@LIBS@
IHKDIR ?= $(VPATH)/../../../ihk/linux/include/
MCEXEC_LIBS=-lmcexec -lrt -lnuma -pthread -L@abs_builddir@/../../../ihk/linux/user -lihk -Wl,-rpath,$(MCKERNEL_LIBDIR)
ENABLE_QLMPI=@ENABLE_QLMPI@
WITH_SYSCALL_INTERCEPT=@WITH_SYSCALL_INTERCEPT@
ifeq ($(ENABLE_QLMPI),yes)
MCEXEC_LIBS += -lmpi
TARGET+= libqlmpi.so ql_server ql_mpiexec_start ql_mpiexec_finalize ql_talker libqlfort.so
endif
ifeq ($(WITH_SYSCALL_INTERCEPT),yes)
TARGET += syscall_intercept.so
endif
ifeq ($(ARCH), arm64)
CFLAGS += $(foreach i, $(shell seq 1 100), $(addprefix -DPOSTK_DEBUG_ARCH_DEP_, $(i)))
CFLAGS += $(foreach i, $(shell seq 1 100), $(addprefix -DPOSTK_DEBUG_TEMP_FIX_, $(i)))
@ -108,7 +113,9 @@ ifeq ($(ENABLE_QLMPI),yes)
install -m 755 ql_mpiexec_finalize $(BINDIR)
install -m 755 ql_talker $(SBINDIR)
endif
ifeq ($(WITH_SYSCALL_INTERCEPT),yes)
install -m 755 syscall_intercept.so $(MCKERNEL_LIBDIR)
endif
@uncomment_if_ENABLE_MEMDUMP@install -m 755 eclair $(BINDIR)
@uncomment_if_ENABLE_MEMDUMP@install -m 755 vmcore2mckdump $(BINDIR)

View File

@ -2178,6 +2178,13 @@ int main(int argc, char **argv)
if (opendev() == -1)
exit(EXIT_FAILURE);
#ifndef WITH_SYSCALL_INTERCEPT
if (enable_uti) {
__eprintf("ERROR: uti is not available when not configured with --with-syscall_intercept=<path>\n");
exit(EXIT_FAILURE);
}
#endif
ld_preload_init();
#ifdef ADD_ENVS_OPTION

2
ihk

Submodule ihk updated: e88b7d011e...00634a823f