From c4b392a179048f936c062f5ffccc2bc25627e500 Mon Sep 17 00:00:00 2001 From: polwex Date: Mon, 6 Oct 2025 01:01:41 +0700 Subject: working --- vere/ext/gmp/gen/README.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 vere/ext/gmp/gen/README.md (limited to 'vere/ext/gmp/gen/README.md') diff --git a/vere/ext/gmp/gen/README.md b/vere/ext/gmp/gen/README.md new file mode 100644 index 0000000..52bdd96 --- /dev/null +++ b/vere/ext/gmp/gen/README.md @@ -0,0 +1,68 @@ +# Generated architecture specific `.c`, `.s`, and `.h` files + +To generate these, first run the `./configure` script under the unpacked GMP dependency directory with the following options: + +macOS: +```terminal +./configure --with-pic --disable-shared +``` + +linux-x86_64: +```terminal +./configure --with-pic --disable-shared --host=x86_64-linux-musl +``` + +linux-aarch64: +```terminal +./configure --with-pic --disable-shared --host=aarch64-linux-musl +``` + +Next, navigate under `mpn/` and run the following to generate the assembly files: + +```bash +for file in $(find . -maxdepth 1 -print | grep "\.asm$"); do + filename_no_path="${file#"./"}"; + filename="${filename_no_path%.*}"; + echo "m4 -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_${filename} -DPIC $file > ${filename}.s"; + m4 -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_${filename} -DPIC $file > ${filename}.s; +done +``` + +Next, copy the generated `mpn/*.s` files under the appropriate path, e.g., +`aarch64-macos/mpn/.` + +Now, under the GMP root dir run `make` and copy these files as well: + +- `mp_bases.h` +- `fac_table.h` +- `fib_table.h` +- `trialdivtab.h` +- `sieve_table.h` +- `mpn/fib_table.c` +- `mpn/jacobitab.h` +- `mpn/mp_bases.c` +- `mpn/perfsqr.h` + +e.g. +```bash +cp {mp_bases.h,fac_table.h,fib_table.h,trialdivtab.h} aarch64-macos/. +cp {mpn/fib_table.c,mpn/jacobitab.h,mpn/mp_bases.c,mpn/perfsqr.h} aarch64-macos/mpn/. +``` + +## Some additional snippets + +### Write the generated assembly file paths into a file `ssources` + +```bash +for file in $(find ./mpn -maxdepth 1 -print | grep "\.s" | sort); do + echo $(realpath $file) >> ssources; +done +``` + +### Write the relevant C source file paths into a file `csources` + +```bash +for file in $(find ./mpn -maxdepth 1 -print | grep "\.c" | sort); do + echo $(realpath $file) >> csources; +done +``` -- cgit v1.2.3