summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in5
-rw-r--r--configure.ac35
-rw-r--r--lib/md5.c4
3 files changed, 40 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in
index 2d769846..f52976e9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -33,6 +33,7 @@ VERSION=@RSYNC_VERSION@
.SUFFIXES: .c .o
SIMD_x86_64=simd-checksum-x86_64.o
+ASM_x86_64=lib/md5-asm-x86_64.o
GENFILES=configure.sh aclocal.m4 config.h.in proto.h proto.h-tstamp rsync.1 rsync.1.html \
rsync-ssl.1 rsync-ssl.1.html rsyncd.conf.5 rsyncd.conf.5.html
@@ -46,7 +47,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
util.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
-OBJS3=progress.o pipe.o lib/md5-asm-x86_64.o
+OBJS3=progress.o pipe.o @ASM@
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
popt/popthelp.o popt/poptparse.o
@@ -136,7 +137,7 @@ simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
$(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp
lib/md5-asm-x86_64.o: lib/md5-asm-x86_64.S config.h lib/md-defines.h
- $(CC) -I. -Wa,--noexecstack -c -o $@ $(srcdir)/lib/md5-asm-x86_64.S
+ $(CC) -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/lib/md5-asm-x86_64.S
tls$(EXEEXT): $(TLS_OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
diff --git a/configure.ac b/configure.ac
index 208d4de7..c99fe076 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,6 +253,41 @@ fi
AC_SUBST(SIMD)
+AC_MSG_CHECKING([if assembler accepts noexecstack])
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wa,--noexecstack"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[return 0;]])],
+[ NOEXECSTACK='-Wa,--noexecstack' ; AC_MSG_RESULT(yes) ],
+[ NOEXECSTACK='' ; AC_MSG_RESULT(no) ])
+CFLAGS="$OLD_CFLAGS"
+AC_SUBST(NOEXECSTACK)
+
+ASM=
+
+AC_MSG_CHECKING([whether to enable ASM optimizations])
+AC_ARG_ENABLE(asm,
+ AS_HELP_STRING([--disable-asm],[disable ASM optimizations]))
+
+if test x"$enable_asm" != x"no"; then
+ if test x"$build_cpu" = x"x86_64"; then
+ ASM="$build_cpu"
+ elif test x"$enable_asm" = x"yes"; then
+ AC_MSG_RESULT(unavailable)
+ AC_MSG_ERROR(The ASM optimizations are currently x86_64 only.
+Omit --enable-asm to continue without it.)
+ fi
+fi
+
+if test x"$ASM" != x""; then
+ AC_MSG_RESULT([yes ($ASM)])
+ AC_DEFINE(HAVE_ASM, 1, [Define to 1 to enable ASM optimizations])
+ ASM='$(ASM_'"$ASM)"
+else
+ AC_MSG_RESULT(no)
+fi
+
+AC_SUBST(ASM)
+
# arrgh. libc in some old debian version screwed up the largefile
# stuff, getting byte range locking wrong
AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[
diff --git a/lib/md5.c b/lib/md5.c
index a2eebdb0..41f158b8 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -148,7 +148,7 @@ static void md5_process(md_context *ctx, const uchar data[CSUM_CHUNK])
ctx->D += D;
}
-#if defined(HAVE_SIMD) && (CSUM_CHUNK == 64)
+#if defined HAVE_ASM && CSUM_CHUNK == 64
extern void md5_process_asm(md_context *ctx, const void *data, size_t num);
#endif
@@ -176,7 +176,7 @@ void md5_update(md_context *ctx, const uchar *input, uint32 length)
left = 0;
}
-#if defined(HAVE_SIMD) && (CSUM_CHUNK == 64)
+#if defined HAVE_ASM && CSUM_CHUNK == 64
if (length >= CSUM_CHUNK) {
uint32 chunks = length / CSUM_CHUNK;
md5_process_asm(ctx, input, chunks);