Module Name: src Committed By: mrg Date: Fri Jun 24 03:50:23 UTC 2011
Modified Files: src/external/lgpl3/gmp/lib/libgmp: Makefile src/external/lgpl3/gmp/lib/libgmp/arch/x86_64: Makefile.inc Added Files: src/external/lgpl3/gmp: README build-gmp-Makefile.inc.awk Log Message: add a README to describe how to port GMP build framework, and a script to parse the GMP ./configure output and generate part of a makefile. move all the mpn build stuff into the MD part of the framework, and update the amd64 port to build all the parts it should. XXX: amd64 build fails to preprocess redc_1.asm gcd_1.asm mod_1_4.asm, XXX: so we're using the generic C versions for now. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/external/lgpl3/gmp/README \ src/external/lgpl3/gmp/build-gmp-Makefile.inc.awk cvs rdiff -u -r1.2 -r1.3 src/external/lgpl3/gmp/lib/libgmp/Makefile cvs rdiff -u -r1.1 -r1.2 \ src/external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/lgpl3/gmp/lib/libgmp/Makefile diff -u src/external/lgpl3/gmp/lib/libgmp/Makefile:1.2 src/external/lgpl3/gmp/lib/libgmp/Makefile:1.3 --- src/external/lgpl3/gmp/lib/libgmp/Makefile:1.2 Thu Jun 23 12:09:30 2011 +++ src/external/lgpl3/gmp/lib/libgmp/Makefile Fri Jun 24 03:50:23 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2011/06/23 12:09:30 mrg Exp $ +# $NetBSD: Makefile,v 1.3 2011/06/24 03:50:23 mrg Exp $ .include <bsd.init.mk> @@ -91,138 +91,6 @@ equal.c set_z.c set_d.c \ set_f.c swap.c -# addmul_2.c \ -# addmul_3.c \ -# addmul_4.c \ -# addmul_5.c \ -# addmul_6.c \ -# addmul_7.c \ -# addmul_8.c \ -# and_n.c \ -# andn_n.c \ -# ior_n.c \ -# iorn_n.c \ -# mul_2.c \ -# mul_3.c \ -# mul_4.c \ -# nand_n.c \ -# nior_n.c \ -# udiv_qrnnd.c \ -# xor_n.c -# xnor_n.c -# many asm -# sqr_diagonal.c \ - -MPN_SRCS = \ - add.c \ - add_1.c \ - add_n.c \ - addmul_1.c \ - cmp.c \ - com.c \ - copyd.c \ - copyi.c \ - dive_1.c \ - diveby3.c \ - divexact.c \ - divis.c \ - divrem.c \ - divrem_1.c \ - divrem_2.c \ - sbpi1_bdiv_qr.c \ - sbpi1_bdiv_q.c \ - sbpi1_div_qr.c \ - sbpi1_div_q.c \ - sbpi1_divappr_q.c \ - dcpi1_bdiv_qr.c \ - dcpi1_bdiv_q.c \ - dcpi1_div_qr.c \ - dcpi1_div_q.c \ - dcpi1_divappr_q.c \ - dump.c \ - fib2_ui.c \ - gcd.c \ - gcd_1.c \ - gcdext.c \ - get_d.c \ - get_str.c \ - hgcd2.c \ - hgcd.c \ - jacbase.c \ - lshift.c \ - matrix22_mul.c \ - mod_1.c \ - mod_34lsub1.c \ - mode1o.c \ - mod_1_1.c \ - mod_1_2.c \ - mod_1_3.c \ - mod_1_4.c \ - mul.c \ - mul_1.c \ - mul_fft.c \ - mul_n.c \ - mul_basecase.c \ - nussbaumer_mul.c \ - toom22_mul.c \ - toom32_mul.c \ - toom42_mul.c \ - toom52_mul.c \ - toom62_mul.c \ - toom33_mul.c \ - toom43_mul.c \ - toom53_mul.c \ - toom63_mul.c \ - toom44_mul.c \ - toom6h_mul.c \ - toom6_sqr.c \ - toom8h_mul.c \ - toom8_sqr.c \ - toom_couple_handling.c \ - toom2_sqr.c \ - toom3_sqr.c \ - toom4_sqr.c \ - toom_eval_dgr3_pm1.c \ - toom_eval_dgr3_pm2.c \ - toom_eval_pm1.c \ - toom_eval_pm1.c \ - toom_eval_pm2exp.c \ - toom_eval_pm2rexp.c \ - toom_interpolate_5pts.c \ - toom_interpolate_6pts.c \ - toom_interpolate_7pts.c \ - toom_interpolate_8pts.c \ - toom_interpolate_12pts.c \ - toom_interpolate_16pts.c \ - invertappr.c \ - invert.c \ - binvert.c \ - mulmod_bnm1.c \ - sqrmod_bnm1.c \ - mullo_n.c \ - mullo_basecase.c \ - neg.c \ - perfsqr.c \ - pre_divrem_1.c \ - pre_mod_1.c \ - pow_1.c \ - random.c \ - random2.c \ - rshift.c \ - rootrem.c \ - scan0.c \ - scan1.c \ - set_str.c \ - sqr_basecase.c \ - sqrtrem.c \ - sub.c \ - sub_1.c \ - sub_n.c \ - submul_1.c \ - tdiv_qr.c \ - -# udiv_w_sdiv.c - MPN_GENERIC_SRCS = \ popcount.c \ hamdist.c @@ -251,11 +119,6 @@ randlc2x.c randmt.c randmts.c rands.c randsd.c randsdui.c \ randbui.c randmui.c version.c nextprime.c -.for _src in ${MPN_SRCS} -COPTS.${_src}+= -DOPERATION_${_src:R} -.endfor -SRCS+= ${MPN_SRCS} - SRCS+= tal-reent.c # these are generated @@ -279,6 +142,7 @@ .endfor +.if 0 # Build the generic popcount/hamdist for now .for _srcfile in \ ${MPN_GENERIC_SRCS} @@ -290,6 +154,7 @@ SRCS+= mpn_${_srcfile} CLEANFILES+= mpn_${_srcfile} .endfor +.endif INCS= gmp.h INCSDIR= /usr/include Index: src/external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc diff -u src/external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc:1.1 src/external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc:1.2 --- src/external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc:1.1 Thu Jun 23 12:09:30 2011 +++ src/external/lgpl3/gmp/lib/libgmp/arch/x86_64/Makefile.inc Fri Jun 24 03:50:23 2011 @@ -1,63 +1,168 @@ -# $NetBSD: Makefile.inc,v 1.1 2011/06/23 12:09:30 mrg Exp $ +# $NetBSD: Makefile.inc,v 1.2 2011/06/24 03:50:23 mrg Exp $ SRCS+= \ + random.c \ + toom_interpolate_7pts.c \ + sbpi1_divappr_q.c \ + random2.c \ + mu_bdiv_q.c \ + toom32_mul.c \ + toom44_mul.c \ + toom8h_mul.c \ + toom2_sqr.c \ + zero.c \ + gcdext.c \ + binvert.c \ + mu_div_q.c \ + invertappr.c \ + dump.c \ + dcpi1_div_qr.c \ + mu_divappr_q.c \ + redc_1_sec.c \ + toom6_sqr.c \ + mod_1.c \ + divexact.c \ + powlo.c \ + mul.c \ + set_str.c \ + toom42_mul.c \ + toom_interpolate_6pts.c \ + dcpi1_divappr_q.c \ + toom_eval_dgr3_pm2.c \ + mod_1_3.c \ + toom_couple_handling.c \ + add.c \ + toom_interpolate_12pts.c \ + perfsqr.c \ + toom53_mul.c \ + toom_eval_pm2exp.c \ + toom_interpolate_16pts.c \ + mu_div_qr.c \ bdiv_q.c \ - bdiv_qr.c \ + toom22_mul.c \ + toom4_sqr.c \ div_q.c \ - pow_1.c \ - powm.c \ - powm_sec.c \ - powlo.c \ + jacbase.c \ + gcdext_subdiv_step.c \ + mullo_n.c \ + toom33_mul.c \ + toom_eval_dgr3_pm1.c \ + mod_1_2.c \ + sub_1.c \ + trialdiv.c \ + add_1.c \ + toom_interpolate_5pts.c \ + sbpi1_bdiv_q.c \ + pre_mod_1.c \ + hgcd.c \ + sqrtrem.c \ + gcdext_1.c \ + toom63_mul.c \ + toom8_sqr.c \ + neg.c \ + gcdext_lehmer.c \ + divis.c \ + dcpi1_div_q.c \ + subcnd_n.c \ toom_eval_pm2.c \ - toom_eval_pm2exp.c \ + hgcd2.c \ + toom62_mul.c \ + sbpi1_bdiv_qr.c \ + scan1.c \ + perfpow.c \ + get_str.c \ + mullo_basecase.c \ + mulmod_bnm1.c \ + tdiv_qr.c \ + toom43_mul.c \ + mod_1_1.c \ + matrix22_mul.c \ + powm_sec.c \ + divrem.c \ + mul_n.c \ + dcpi1_bdiv_qr.c \ + redc_2.c \ + toom6h_mul.c \ + mul_fft.c \ + sqrmod_bnm1.c \ + powm.c \ + rootrem.c \ + toom_interpolate_8pts.c \ + remove.c \ + cmp.c \ + toom_eval_pm1.c \ + scan0.c \ + gcd_subdiv_step.c \ + sbpi1_div_qr.c \ + invert.c \ + sub.c \ toom_eval_pm2rexp.c \ - mu_bdiv_qr.c \ - mu_div_qr.c \ + dcpi1_bdiv_q.c \ sqr.c \ + nussbaumer_mul.c \ + pow_1.c \ gcd_lehmer.c \ - gcd_subdiv_step.c \ - gcdext_lehmer.c \ - gcdext_subdiv_step.c \ - perfpow.c \ - gcdext_1.c \ - mu_bdiv_q.c \ mu_bdiv_qr.c \ - mu_div_q.c \ - mu_div_qr.c \ - mu_divappr_q.c \ - redc_1_sec.c \ - redc_2.c \ + get_d.c \ + toom52_mul.c \ + sbpi1_div_q.c \ + diveby3.c \ + fib2_ui.c \ + bdiv_qr.c \ + toom3_sqr.c \ + gcd.c \ redc_n.c \ - subcnd_n.c \ - trialdiv.c ASM_SRCS_LIST= \ - add_n mpn/x86_64/aors_n.asm \ - addaddmul_1msb0 mpn/x86_64/addaddmul_1msb0.asm \ - addlsh1_n mpn/x86_64/aorrlsh1_n.asm \ - addlsh2_n mpn/x86_64/aorrlsh2_n.asm \ - addlsh_n mpn/x86_64/aorrlsh_n.asm \ - addmul_2 mpn/x86_64/addmul_2.asm \ - bdiv_q_1 mpn/x86_64/bdiv_q_1.asm \ - bdiv_dbm1c mpn/x86_64/bdiv_dbm1c.asm \ - lshiftc mpn/x86_64/lshiftc.asm \ - mul_1 mpn/x86_64/mul_1.asm \ - mul_2 mpn/x86_64/mul_2.asm \ - rsblsh1_n mpn/x86_64/aorrlsh1_n.asm \ - rsblsh2_n mpn/x86_64/aorrlsh2_n.asm \ - rsblsh_n mpn/x86_64/aorrlsh_n.asm \ - rsh1add_n mpn/x86_64/rsh1aors_n.asm \ - rsh1sub_n mpn/x86_64/rsh1aors_n.asm \ - rshift mpn/x86_64/rshift.asm \ - sub_n mpn/x86_64/aors_n.asm \ - sublsh1_n mpn/x86_64/sublsh1_n.asm \ - invert_limb mpn/x86_64/invert_limb.asm \ - mode1o mpn/x86_64/mode1o.asm \ - and_n mpn/x86_64/logops_n.asm \ - -# XXX using redc_1.c -# redc_1 mpn/x86_64/redc_1.asm -SRCS+= redc_1.c + nand_n.asm mpn/x86_64/logops_n.asm \ + rsh1sub_n.asm mpn/x86_64/rsh1aors_n.asm \ + add_n.asm mpn/x86_64/aors_n.asm \ + rsh1add_n.asm mpn/x86_64/rsh1aors_n.asm \ + sqr_basecase.asm mpn/x86_64/sqr_basecase.asm \ + rsblsh2_n.asm mpn/x86_64/aorrlsh2_n.asm \ + sublsh1_n.asm mpn/x86_64/sublsh1_n.asm \ + bdiv_q_1.asm mpn/x86_64/bdiv_q_1.asm \ + addaddmul_1msb0.asm mpn/x86_64/addaddmul_1msb0.asm \ + xor_n.asm mpn/x86_64/logops_n.asm \ + rsblsh_n.asm mpn/x86_64/aorrlsh_n.asm \ + addmul_2.asm mpn/x86_64/addmul_2.asm \ + submul_1.asm mpn/x86_64/aorsmul_1.asm \ + nior_n.asm mpn/x86_64/logops_n.asm \ + mul_basecase.asm mpn/x86_64/mul_basecase.asm \ + lshift.asm mpn/x86_64/lshift.asm \ + and_n.asm mpn/x86_64/logops_n.asm \ + hamdist.asm mpn/x86_64/popham.asm \ + mul_1.asm mpn/x86_64/mul_1.asm \ + addlsh2_n.asm mpn/x86_64/aorrlsh2_n.asm \ + divrem_1.asm mpn/x86_64/divrem_1.asm \ + copyd.asm mpn/x86_64/copyd.asm \ + bdiv_dbm1c.asm mpn/x86_64/bdiv_dbm1c.asm \ + rsblsh1_n.asm mpn/x86_64/aorrlsh1_n.asm \ + dive_1.asm mpn/x86_64/dive_1.asm \ + andn_n.asm mpn/x86_64/logops_n.asm \ + com.asm mpn/x86_64/com.asm \ + copyi.asm mpn/x86_64/copyi.asm \ + rshift.asm mpn/x86_64/rshift.asm \ + addlsh_n.asm mpn/x86_64/aorrlsh_n.asm \ + iorn_n.asm mpn/x86_64/logops_n.asm \ + ior_n.asm mpn/x86_64/logops_n.asm \ + mod_34lsub1.asm mpn/x86_64/mod_34lsub1.asm \ + popcount.asm mpn/x86_64/popham.asm \ + xnor_n.asm mpn/x86_64/logops_n.asm \ + lshiftc.asm mpn/x86_64/lshiftc.asm \ + mode1o.asm mpn/x86_64/mode1o.asm \ + addlsh1_n.asm mpn/x86_64/aorrlsh1_n.asm \ + mul_2.asm mpn/x86_64/mul_2.asm \ + invert_limb.asm mpn/x86_64/invert_limb.asm \ + addmul_1.asm mpn/x86_64/aorsmul_1.asm \ + divrem_2.asm mpn/x86_64/divrem_2.asm \ + sub_n.asm mpn/x86_64/aors_n.asm \ + +# XXX using C versions +# redc_1.asm mpn/x86_64/redc_1.asm +# gcd_1.asm mpn/x86_64/gcd_1.asm +# mod_1_4.asm mpn/x86_64/mod_1_4.asm +SRCS+= redc_1.c gcd_1.c mod_1_4.c gen-trialdivtab: gen-trialdivtab.c ${HOST_CC} -o ${.OBJDIR}/gen-trialdivtab ${.ALLSRC} -lm @@ -78,9 +183,9 @@ cp ${.CURDIR}/arch/${MACHINE_ARCH}/config.m4 ${.TARGET} .for _build _src in ${ASM_SRCS_LIST} -${_build}.s: Makefile dummy ${.OBJDIR}/config.m4 +${_build:R}.s: Makefile dummy ${.OBJDIR}/config.m4 ${TOOL_M4} -DCONFIG_TOP_SRCDIR=${DIST} -I${.CURDIR} -I${.OBJDIR}/dummy -I${DIST}/ -I${DIST}/mpn -DOPERATION_${.TARGET:R} ${DIST}/${_src} > ${.TARGET} -SRCS+= ${_build}.s +SRCS+= ${_build:R}.s .endfor Added files: Index: src/external/lgpl3/gmp/README diff -u /dev/null src/external/lgpl3/gmp/README:1.1 --- /dev/null Fri Jun 24 03:50:23 2011 +++ src/external/lgpl3/gmp/README Fri Jun 24 03:50:23 2011 @@ -0,0 +1,46 @@ +$NetBSD: README,v 1.1 2011/06/24 03:50:23 mrg Exp $ + +GMP in NetBSD. We need GMP for GCC >= 4.2. + + +Building GMP without configure - how to port GMP build to a new platform. + +The GMP build doesn't map very well to normal make. The ./configure phase +creates a bunch of symlinks and weeds out the sources lists, and there are +files with the same name in different subdirectories linked into the same +final product. All of these issues need to be dealt with. + +There are a few steps to this: + + - run ./configure, save the output + + - create src/external/gpl3/gmp/lib/libgmp/arch/${MACHINE_ARCH} dir, + and copy these files into it: + config.h + config.m4 + gmp-mparam.h + gmp.h + mp.h + + - parse the ./configure output and note all created symlinks + for mpn. these need to be converted into a new Makefile.inc. + there is a script in this subdir build-gmp-Makefile.inc.awk + that can be used to do this. it should just work to generate + the first section of Makefile.inc if fed the entire configure + output. + + assembler files generally want -DOPERATION_${foo} defined for + each way they are compiled or pre-processed. the pre-processor + used is m4 to parse, and we and create .s files from the .asm + files that we then we feed into $CC. + +The amd64 port is a good reference to compare. The trialdivtab.h +generation may need to be moved the into libgmp/Makefile itself. + + +This is still a work in progress and methods used to build may be +changed at any time. + + +m...@netbsd.org +- 2001/06/22 Index: src/external/lgpl3/gmp/build-gmp-Makefile.inc.awk diff -u /dev/null src/external/lgpl3/gmp/build-gmp-Makefile.inc.awk:1.1 --- /dev/null Fri Jun 24 03:50:23 2011 +++ src/external/lgpl3/gmp/build-gmp-Makefile.inc.awk Fri Jun 24 03:50:23 2011 @@ -0,0 +1,26 @@ +#! /usr/bin/awk -f + +/^config.status: linking/ { + # $3 = src + # $5 = dst + + sub(/mpn\//, "", $5) + if (match($3, /\.c$/)) { + c_list[$5] = $3 + } else if (match($3, /\.asm$/)) { + asm_list[$5] = $3 + } +} + +END { + printf("SRCS+= \\\n"); + # XXX check that the basenames are the same? + # XXX yeah - logops_n.c and popham.c may need this + for (c in c_list) { + printf("\t%s \\\n", c) + } + printf("\nASM_SRCS_LIST= \\\n"); + for (asm in asm_list) { + printf("\t%s\t\t%s \\\n", asm, asm_list[asm]) + } +}