diff options
author | Kåre Hampf | 2016-01-13 21:40:08 +0200 |
---|---|---|
committer | Kåre Hampf | 2016-01-13 21:40:08 +0200 |
commit | a4f74c5583a3f5b7754a72975a42a2bd5505f21d (patch) | |
tree | 703d6063e8d217398badf4c073db6c5ec2010b85 | |
download | aur-a4f74c5583a3f5b7754a72975a42a2bd5505f21d.tar.gz |
Initial upload. Execstack not done, only tested on one Core i7 system.
-rw-r--r-- | .SRCINFO | 32 | ||||
-rw-r--r-- | PKGBUILD | 93 | ||||
-rw-r--r-- | lasieve4_64-athlon64-i7.patch | 210 | ||||
-rw-r--r-- | makefile-lasieve4_64.patch | 12 |
4 files changed, 347 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..fe4b07e8011a --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,32 @@ +# Generated by mksrcinfo v8 +# Wed Jan 13 19:30:18 UTC 2016 +pkgbase = ggnfs-code + pkgdesc = GGNFS is an open source implementation of General Number Field Sieve algorithm for factoring integers. + pkgver = 441 + pkgrel = 1 + url = http://sourceforge.net/projects/ggnfs/ + arch = i686 + arch = x86_64 + license = GPL2 + makedepends = subversion + source = ggnfs-code::svn://svn.code.sf.net/p/ggnfs/code/trunk + source = makefile-lasieve4_64.patch + source = lasieve4_64-athlon64-i7.patch + sha256sums = SKIP + sha256sums = a0265a78f87eb9e2c4add9d125d803af1892659c59103a794ecfc4ba9a8b87a6 + sha256sums = 39018ea8dd0c65183038bdfb44eb58c87a5794f93982edb3866a5aab659939d7 + +pkgname = ggnfs-lasieve4e-x86_64-svn + pkgdesc = lasieve4e is a lattice siever for GGNFS by Jens Franke and T. Kleinjung. + arch = x86_64 + provides = ggnfs-lasieve4e + conflicts = ggnfs-lasieve4e + +pkgname = ggnfs-svn + arch = i686 + arch = x86_64 + depends = ggnfs-lasieve4e + optdepends = gnuplot + provides = ggnfs + conflicts = ggnfs + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..b942c85eb0a6 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,93 @@ +# This PKGBUILD is highly experimental and works on my Intel i7 setup +# It is not setup to produce any other targets and not yet tested on more than +# my own system. +# I have made small fixes to the AMD K8 assembly code not yet submitted upstream. +# No guarantees. +# Maintainer: K. Hampf <khampf@users.sourceforge.net> + +pkgbase=ggnfs-code +pkgname=('ggnfs-lasieve4e-x86_64-svn' 'ggnfs-svn') +pkgver=441 +pkgrel=1 +pkgdesc="GGNFS is an open source implementation of General Number Field Sieve algorithm for factoring integers." +arch=('i686' 'x86_64') +url="http://sourceforge.net/projects/ggnfs/" +license=('GPL2') +makedepends=('subversion') +source=("ggnfs-code::svn://svn.code.sf.net/p/ggnfs/code/trunk" + "makefile-lasieve4_64.patch" + "lasieve4_64-athlon64-i7.patch") +sha256sums=('SKIP' + 'a0265a78f87eb9e2c4add9d125d803af1892659c59103a794ecfc4ba9a8b87a6' + '39018ea8dd0c65183038bdfb44eb58c87a5794f93982edb3866a5aab659939d7') + +_ggnfstarget="nocona" # Works on Intel i7. YMMW +_lasieveL1bits="15" # default is 15 bits = 32 KB L1 data cache, 14 bits = 16 KB + +pkgver() { + cd "${srcdir}/${pkgbase}" + local ver="$(svnversion)" + printf "%s" "${ver//[[:alpha:]]}" +} + +prepare() { + cd "$srcdir/$pkgbase" + patch -p1 < "$srcdir/makefile-lasieve4_64.patch" + patch -p1 < "$srcdir/lasieve4_64-athlon64-i7.patch" + cd "$srcdir/$pkgbase/src/experimental/lasieve4_64" + if [ "$_lasieveL1bits" != "15" ]; then + echo "Patching asm code for ${_lasieveL1bits}-bit L1 data cache ..." + sed -i -e "s/#define L1_BITS 15/#define L1_BITS ${_lasieveL1bits}/" athlon64/siever-config.h + sed -i -e "s/define(l1_bits,15)dnl/define(l1_bits,${_lasieveL1bits})dnl/" athlon64/ls-defs.asm + fi + ln -s "athlon64" "asm" +} + +build() { + msg "Starting ggnfs-lasieve4e-${CARCH}-svn build..." + cd "$srcdir/$pkgbase/src/experimental/lasieve4_64" + make + msg "Starting ggnfs-svn build..." + cd "$srcdir/$pkgbase" + make "$_ggnfstarget" +} + +package_ggnfs-lasieve4e-x86_64-svn() { + pkgdesc="lasieve4e is a lattice siever for GGNFS by Jens Franke and T. Kleinjung." + arch=('x86_64') + provides=('ggnfs-lasieve4e') + conflicts=('ggnfs-lasieve4e') + + cd "$srcdir/$pkgbase" +# install -D -m755 src/experimental/lasieve4_64/gnfs-lasieve4I1?e "${pkgdir}/usr/bin" + install -d -m755 "${pkgdir}/usr/bin" + install -D -m755 bin/gnfs-lasieve4I1?e "${pkgdir}/usr/bin" +} + +package_ggnfs-svn() { + arch=('i686' 'x86_64') # select ggnfs target other than nocona + provides=('ggnfs') + conflicts=('ggnfs') + depends=('ggnfs-lasieve4e') + optdepends=('gnuplot') + + cd "$srcdir/$pkgbase" + install -d -m755 "${pkgdir}/usr/bin" + install -D -m755 bin/autogplot.sh "${pkgdir}/usr/bin" + install -D -m755 bin/makefb "${pkgdir}/usr/bin" + install -D -m755 bin/matbuild "${pkgdir}/usr/bin" + install -D -m755 bin/matprune "${pkgdir}/usr/bin" + install -D -m755 bin/matsolve "${pkgdir}/usr/bin" + install -D -m755 bin/pol51m0b "${pkgdir}/usr/bin" + install -D -m755 bin/pol51m0n "${pkgdir}/usr/bin" + install -D -m755 bin/pol51opt "${pkgdir}/usr/bin" + install -D -m755 bin/polyselect "${pkgdir}/usr/bin" + install -D -m755 bin/procrels "${pkgdir}/usr/bin" + install -D -m755 bin/sieve "${pkgdir}/usr/bin" + install -D -m755 bin/sqrt "${pkgdir}/usr/bin" + install -d -m755 "${pkgdir}/usr/share/${pkgname}" + install -D -m644 bin/def-nm-params.txt "${pkgdir}/usr/share/${pkgname}" + install -D -m644 bin/def-par.txt "${pkgdir}/usr/share/${pkgname}" +} + +# vim:set ts=2 sw=2 et: diff --git a/lasieve4_64-athlon64-i7.patch b/lasieve4_64-athlon64-i7.patch new file mode 100644 index 000000000000..67de8bf8ab10 --- /dev/null +++ b/lasieve4_64-athlon64-i7.patch @@ -0,0 +1,210 @@ +diff -aur ggnfs-code/src/experimental/lasieve4_64/athlon64/Makefile ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/Makefile +--- ggnfs-code/src/experimental/lasieve4_64/athlon64/Makefile 2016-01-10 22:14:26.958067416 +0200 ++++ ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/Makefile 2016-01-11 10:45:40.485257844 +0200 +@@ -7,7 +7,10 @@ + # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + # 02111-1307, USA. + +-CFLAGS= -O3 -march=k8 -mtune=k8 -I. ++#CFLAGS= -O3 -march=k8 -mtune=k8 -I. ++#CFLAGS= -O3 -march=native -mtune=native -I. -fPIC -fstack-protector-strong ++CFLAGS= -O3 -march=native -mtune=native -I. -fstack-protector-strong -static ++#LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro" # -call_shared" + #CFLAGS= -g + + CC=gcc +@@ -144,3 +147,6 @@ + + bup: + echo $(SRCFILES) ++ ++clean: ++ -rm -f *.o *.a +diff -aur ggnfs-code/src/experimental/lasieve4_64/athlon64/mpqs_td.asm ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/mpqs_td.asm +--- ggnfs-code/src/experimental/lasieve4_64/athlon64/mpqs_td.asm 2016-01-10 22:14:26.958067416 +0200 ++++ ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/mpqs_td.asm 2016-01-11 10:45:40.485257844 +0200 +@@ -290,7 +290,7 @@ + mull %ecx + testl %edx,%edx + jnz tdloop +- cmpw $27,nr ++ cmpw $27,nrw # KH + jnc gotonext + movl aux4d,%eax + movw aux5w,10(relptr,nr,2) +@@ -321,10 +321,10 @@ + mull %ecx + testl %edx,%edx + jnz tdloopk +- cmpw $27,nr ++ cmpw $27,nrw # KH + jnc gotonext + movl aux4d,%eax +- movw nr1,10(relptr,nr,2) ++ movw nr1w,10(relptr,nr,2) # KH + incq nr + movl aux4d,qxd + jmp divloopk +@@ -354,7 +354,7 @@ + testl %edx,%edx + jnz tdloopa + movl aux4d,%eax +- cmpw $27,nr ++ cmpw $27,nrw # KH + jnc gotonext + addw nr1w,aux5w + movw aux5w,10(relptr,nr,2) +diff -aur ggnfs-code/src/experimental/lasieve4_64/athlon64/tdslinie1.asm ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/tdslinie1.asm +--- ggnfs-code/src/experimental/lasieve4_64/athlon64/tdslinie1.asm 2016-01-10 22:14:26.958067416 +0200 ++++ ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/tdslinie1.asm 2016-01-11 10:45:40.485257844 +0200 +@@ -10,6 +10,7 @@ + define(sieve_ptr,%r8)dnl + define(sieve_ptr_ub,%r9)dnl + define(root,%r10)dnl ++define(rootw,%r10w)dnl + define(prime,%r11)dnl + define(prime32,%r11d)dnl + define(sv0,%al)dnl +@@ -58,7 +59,7 @@ + jnz tdslinie1_suche + tdslinie1_nextfbi: + cmpq aux_ptr,aux_ptr_ub +- movw root,root_src ++ movw rootw,root_src # KH + leaq 8(aux_ptr),aux_ptr + ja tdslinie1_fbi_loop + tdslinie1_ende: +diff -aur ggnfs-code/src/experimental/lasieve4_64/athlon64/tdslinie2.asm ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/tdslinie2.asm +--- ggnfs-code/src/experimental/lasieve4_64/athlon64/tdslinie2.asm 2016-01-10 22:14:26.958067416 +0200 ++++ ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/tdslinie2.asm 2016-01-11 10:45:40.485257844 +0200 +@@ -10,6 +10,7 @@ + define(sieve_ptr,%r8)dnl + define(sieve_ptr_ub,%r9)dnl + define(root,%r10)dnl ++define(rootw,%r10w)dnl + define(prime,%r11)dnl + define(prime32,%r11d)dnl + define(sv0,%al)dnl +@@ -57,7 +58,7 @@ + jnz tdslinie2_suche + tdslinie2_next_fbi: + cmpq aux_ptr,aux_ptr_ub +- movw root,root_src ++ movw rootw,root_src # KH + leaq 8(aux_ptr),aux_ptr + ja tdslinie2_fbi_loop + tdslinie2_ende: +diff -aur ggnfs-code/src/experimental/lasieve4_64/athlon64/tdslinie3.asm ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/tdslinie3.asm +--- ggnfs-code/src/experimental/lasieve4_64/athlon64/tdslinie3.asm 2016-01-10 22:14:26.958067416 +0200 ++++ ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/tdslinie3.asm 2016-01-11 10:45:40.485257844 +0200 +@@ -7,6 +7,7 @@ + define(sieve_ptr,%r8)dnl + define(sieve_ptr_ub,%r9)dnl + define(root,%r10)dnl ++define(rootw,%r10w)dnl + define(prime,%r11)dnl + define(prime32,%r11d)dnl + define(sv0,%al)dnl +@@ -73,7 +74,7 @@ + tdslinie3_next_j`'i: + ') + cmpq aux_ptr,aux_ptr_ub +- movw root,root_src ++ movw rootw,root_src # KH + leaq 8(aux_ptr),aux_ptr + ja tdslinie3_fbi_loop + tdslinie3_ende: +diff -aur ggnfs-code/src/experimental/lasieve4_64/athlon64/tdslinie.asm ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/tdslinie.asm +--- ggnfs-code/src/experimental/lasieve4_64/athlon64/tdslinie.asm 2016-01-10 22:14:26.958067416 +0200 ++++ ggnfs-code-hack/src/experimental/lasieve4_64/athlon64/tdslinie.asm 2016-01-11 10:45:40.485257844 +0200 +@@ -10,6 +10,7 @@ + define(sieve_ptr,%r8)dnl + define(sieve_ptr_ub,%r9)dnl + define(root,%r10)dnl ++define(rootw,%r10w)dnl + define(prime,%r11)dnl + define(prime32,%r11d)dnl + define(sv0,%al)dnl +@@ -115,7 +116,7 @@ + tdslinie_next_j`'i: + ') + cmpq aux_ptr,aux_ptr_ub +- movw root,root_src ++ movw rootw,root_src # KH + leaq 8(aux_ptr),aux_ptr + ja tdslinie_fbi_loop + tdslinie_ende: +diff -aur ggnfs-code/src/experimental/lasieve4_64/Makefile ggnfs-code-hack/src/experimental/lasieve4_64/Makefile +--- ggnfs-code/src/experimental/lasieve4_64/Makefile 2016-01-10 22:14:26.818069850 +0200 ++++ ggnfs-code-hack/src/experimental/lasieve4_64/Makefile 2016-01-11 10:45:40.485257844 +0200 +@@ -8,11 +8,16 @@ + # 02111-1307, USA. + # + # 6/13/04: Hacked up for use in GGNFS by Chris Monico. ++# 2016-01-11: Altered for native (static) binaries on i7. YMMW. K. Hampf <k.hampf@gmail.com> + + INC=-I. -I./asm +-LIBFLAGS=-L. ++LIBFLAGS=-L. + #CFLAGS=-Os -march=amdfam10 -mtune=amdfam10 -funroll-loops +-CFLAGS=-O3 -march=k8 -mtune=k8 -funroll-loops ++#CFLAGS=-O3 -march=k8 -mtune=k8 -funroll-loops ++#CFLAGS=-O3 -march=native -mtune=native -funroll-loops -fPIC -fstack-protector-strong ++CFLAGS=-O3 -march=native -mtune=native -funroll-loops -fstack-protector-strong -static ++LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro" ++BINDIR=../../../bin + + .SUFFIXES: + +@@ -29,10 +34,12 @@ + + LIBS=-lgmp-aux -lgmp -lm + ++all : $(BINDIR)/gnfs-lasieve4I11e $(BINDIR)/gnfs-lasieve4I12e \ ++ $(BINDIR)/gnfs-lasieve4I13e $(BINDIR)/gnfs-lasieve4I14e \ ++ $(BINDIR)/gnfs-lasieve4I15e $(BINDIR)/gnfs-lasieve4I16e + +-all : gnfs-lasieve4I11e gnfs-lasieve4I12e gnfs-lasieve4I13e \ +- gnfs-lasieve4I14e gnfs-lasieve4I15e gnfs-lasieve4I16e +- ++asm/%: ++ $(MAKE) -C asm $* + + %.o: %.c asm/siever-config.h + $(CC) $(CFLAGS) $(INC) -c -o $@ $< +@@ -46,23 +53,23 @@ + gnfs-lasieve4eI%.o: gnfs-lasieve4e.c + $(CC) $(CFLAGS) $(INC) -c -DI_bits=$* -o $@ $< + +-gnfs-lasieve4I11e: gnfs-lasieve4eI11.o $(OBJS) libgmp-aux.a \ +- liblasieve.a liblasieveI11.a ++$(BINDIR)/gnfs-lasieve4I11e: gnfs-lasieve4eI11.o $(OBJS) libgmp-aux.a \ ++ asm/liblasieve.a asm/liblasieveI11.a + $(CC) $(CFLAGS) $(INC) $(LIBFLAGS) -o $@ $^ $(LIBS) -static +-gnfs-lasieve4I12e: gnfs-lasieve4eI12.o $(OBJS) libgmp-aux.a \ +- liblasieve.a liblasieveI12.a ++$(BINDIR)/gnfs-lasieve4I12e: gnfs-lasieve4eI12.o $(OBJS) libgmp-aux.a \ ++ asm/liblasieve.a asm/liblasieveI12.a + $(CC) $(CFLAGS) $(INC) $(LIBFLAGS) -o $@ $^ $(LIBS) -static +-gnfs-lasieve4I13e: gnfs-lasieve4eI13.o $(OBJS) libgmp-aux.a \ +- liblasieve.a liblasieveI13.a ++$(BINDIR)/gnfs-lasieve4I13e: gnfs-lasieve4eI13.o $(OBJS) libgmp-aux.a \ ++ asm/liblasieve.a asm/liblasieveI13.a + $(CC) $(CFLAGS) $(INC) $(LIBFLAGS) -o $@ $^ $(LIBS) -static +-gnfs-lasieve4I14e: gnfs-lasieve4eI14.o $(OBJS) libgmp-aux.a \ +- liblasieve.a liblasieveI14.a ++$(BINDIR)/gnfs-lasieve4I14e: gnfs-lasieve4eI14.o $(OBJS) libgmp-aux.a \ ++ asm/liblasieve.a asm/liblasieveI14.a + $(CC) $(CFLAGS) $(INC) $(LIBFLAGS) -o $@ $^ $(LIBS) -static +-gnfs-lasieve4I15e: gnfs-lasieve4eI15.o $(OBJS) libgmp-aux.a \ +- liblasieve.a liblasieveI15.a ++$(BINDIR)/gnfs-lasieve4I15e: gnfs-lasieve4eI15.o $(OBJS) libgmp-aux.a \ ++ asm/liblasieve.a asm/liblasieveI15.a + $(CC) $(CFLAGS) $(INC) $(LIBFLAGS) -o $@ $^ $(LIBS) -static +-gnfs-lasieve4I16e: gnfs-lasieve4eI16.o $(OBJS) libgmp-aux.a \ +- liblasieve.a liblasieveI16.a ++$(BINDIR)/gnfs-lasieve4I16e: gnfs-lasieve4eI16.o $(OBJS) libgmp-aux.a \ ++ asm/liblasieve.a asm/liblasieveI16.a + $(CC) $(CFLAGS) $(INC) $(LIBFLAGS) -o $@ $^ $(LIBS) -static + + diff --git a/makefile-lasieve4_64.patch b/makefile-lasieve4_64.patch new file mode 100644 index 000000000000..043279c9db6e --- /dev/null +++ b/makefile-lasieve4_64.patch @@ -0,0 +1,12 @@ +diff -aur ggnfs-code/src/Makefile ggnfs-code-hack/src/Makefile +--- ggnfs-code/src/Makefile 2016-01-10 22:14:26.198080653 +0200 ++++ ggnfs-code-hack/src/Makefile 2016-01-11 10:49:12.901564767 +0200 +@@ -128,7 +128,7 @@ + $(CC) $(INC) $(CFLAGS) $(LIBFLAGS) -o $@ polyselect.c $(OBJS) $(LIBS) + + latsiever : +- $(MAKE) -C lasieve4 ++# $(MAKE) -C experimental/lasieve4_64 + + polsel : + $(MAKE) -C pol5 |