mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-20 02:36:16 +02:00
maint: rearrange cksum modules so main is in cksum.c
* src/cksum.c: -> src/cksum_crc.c * src/cksum.h: -> src/cksum_crc.h * src/digest.c: -> src/cksum.c * src/local.mk: Adjust accordingly. * cfg.mk: Likewise. * po/POTFILES.in: Likewise. * src/cksum_avx2.c: Likewise. * src/cksum_avx512.c: Likewise. * src/cksum_pclmul.c: Likewise. * src/cksum_vmull.c: Likewise.
This commit is contained in:
2
cfg.mk
2
cfg.mk
@@ -895,7 +895,7 @@ update-copyright-env = \
|
||||
exclude_file_name_regexp--sc_space_tab = \
|
||||
^(tests/pr/|tests/misc/nl\.sh$$|gl/.*\.diff$$|man/help2man$$)
|
||||
exclude_file_name_regexp--sc_bindtextdomain = \
|
||||
^(gl/.*|lib/euidaccess-stat|src/make-prime-list|src/cksum)\.c$$
|
||||
^(gl/.*|lib/euidaccess-stat|src/make-prime-list|src/cksum_crc)\.c$$
|
||||
exclude_file_name_regexp--sc_trailing_blank = \
|
||||
^(tests/pr/|gl/.*\.diff$$|man/help2man)
|
||||
_x_system_h := (system|copy|chown-core|find-mount-point)\.h
|
||||
|
||||
@@ -43,6 +43,7 @@ src/chown-core.c
|
||||
src/chown.c
|
||||
src/chroot.c
|
||||
src/cksum.c
|
||||
src/cksum_crc.c
|
||||
src/comm.c
|
||||
src/copy.c
|
||||
src/copy-file-data.c
|
||||
@@ -81,7 +82,6 @@ src/link.c
|
||||
src/ln.c
|
||||
src/logname.c
|
||||
src/ls.c
|
||||
src/digest.c
|
||||
src/mkdir.c
|
||||
src/mkfifo.c
|
||||
src/mknod.c
|
||||
|
||||
2084
src/cksum.c
2084
src/cksum.c
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* cksum -- calculate and print POSIX checksums and sizes of files
|
||||
/* cksum_crc -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 2024-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cksum.h"
|
||||
#include "cksum_crc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* cksum -- calculate and print POSIX checksums and sizes of files
|
||||
/* cksum_crc -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 2024-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cksum.h"
|
||||
#include "cksum_crc.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <x86intrin.h>
|
||||
|
||||
377
src/cksum_crc.c
Normal file
377
src/cksum_crc.c
Normal file
@@ -0,0 +1,377 @@
|
||||
/* cksum_crc -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 1992-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Q. Frank Xia, qx@math.columbia.edu.
|
||||
Cosmetic changes and reorganization by David MacKenzie, djm@gnu.ai.mit.edu.
|
||||
|
||||
The code segment between "#ifdef CRCTAB" and "#else" is the code
|
||||
which generates crctab.c
|
||||
|
||||
This software is compatible with neither the System V nor the BSD
|
||||
'sum' program. It is supposed to conform to POSIX, except perhaps
|
||||
for foreign language support. Any inconsistency with the standard
|
||||
(other than foreign language support) is a bug. */
|
||||
|
||||
/* This include must be at the top of the file to satisfy
|
||||
sc_require_config_h_first. */
|
||||
#ifndef CRCTAB
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef CRCTAB
|
||||
|
||||
# include <stdio.h>
|
||||
|
||||
# define BIT(x) (1u << (x))
|
||||
# define SBIT BIT (31)
|
||||
|
||||
/* The generating polynomial is
|
||||
|
||||
32 26 23 22 16 12 11 10 8 7 5 4 2 1
|
||||
G(X)=X + X + X + X + X + X + X + X + X + X + X + X + X + X + 1
|
||||
|
||||
The i bit in GEN is set if X^i is a summand of G(X) except X^32. */
|
||||
|
||||
# define GEN (BIT (26) | BIT (23) | BIT (22) | BIT (16) | BIT (12) \
|
||||
| BIT (11) | BIT (10) | BIT (8) | BIT (7) | BIT (5) \
|
||||
| BIT (4) | BIT (2) | BIT (1) | BIT (0))
|
||||
|
||||
static unsigned int r[8];
|
||||
|
||||
static void
|
||||
fill_r (void)
|
||||
{
|
||||
r[0] = GEN;
|
||||
for (int i = 1; i < 8; i++)
|
||||
r[i] = (r[i - 1] << 1) ^ ((r[i - 1] & SBIT) ? GEN : 0);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
crc_remainder (int m)
|
||||
{
|
||||
unsigned int rem = 0;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
if (BIT (i) & m)
|
||||
rem ^= r[i];
|
||||
|
||||
return rem & 0xFFFFFFFF; /* Make it run on 64-bit machine. */
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
static unsigned int crctab[8][256];
|
||||
|
||||
fill_r ();
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
crctab[0][i] = crc_remainder (i);
|
||||
|
||||
/* CRC(0x11 0x22 0x33 0x44)
|
||||
is equal to
|
||||
CRC(0x11 0x00 0x00 0x00) XOR CRC(0x22 0x00 0x00) XOR
|
||||
CRC(0x33 0x00) XOR CRC(0x44)
|
||||
We precompute the CRC values for the offset values into
|
||||
separate CRC tables. We can then use them to speed up
|
||||
CRC calculation by processing multiple bytes at the time. */
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
unsigned int crc = 0;
|
||||
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ i) & 0xFF];
|
||||
for (int offset = 1; offset < 8; offset++)
|
||||
{
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ 0) & 0xFF];
|
||||
crctab[offset][i] = crc & 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
printf ("#include <config.h>\n");
|
||||
printf ("#include \"cksum_crc.h\"\n");
|
||||
printf ("\n");
|
||||
printf ("uint_fast32_t const crctab[8][256] = {\n");
|
||||
for (int y = 0; y < 8; y++)
|
||||
{
|
||||
printf ("{\n 0x%08x", crctab[y][0]);
|
||||
for (int i = 0; i < 51; i++)
|
||||
{
|
||||
printf (",\n 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x",
|
||||
crctab[y][i * 5 + 1], crctab[y][i * 5 + 2],
|
||||
crctab[y][i * 5 + 3], crctab[y][i * 5 + 4],
|
||||
crctab[y][i * 5 + 5]);
|
||||
}
|
||||
printf ("\n},\n");
|
||||
}
|
||||
printf ("};\n");
|
||||
}
|
||||
|
||||
#else /* !CRCTAB */
|
||||
|
||||
# include "cksum_crc.h"
|
||||
# include <sys/types.h>
|
||||
# include <endian.h>
|
||||
# include "system.h"
|
||||
|
||||
# ifdef USE_VMULL_CRC32
|
||||
# include <sys/auxv.h>
|
||||
# include <asm/hwcap.h>
|
||||
# endif
|
||||
|
||||
# include "crc.h"
|
||||
# include "cpu-supports.h"
|
||||
|
||||
/* Number of bytes to read at once. */
|
||||
# define BUFLEN (1 << 16)
|
||||
|
||||
typedef bool (*cksum_fp_t) (FILE *, uint_fast32_t *, uintmax_t *);
|
||||
|
||||
static cksum_fp_t
|
||||
pclmul_supported (void)
|
||||
{
|
||||
# if USE_PCLMUL_CRC32 || GL_CRC_X86_64_PCLMUL
|
||||
bool pclmul_enabled = (cpu_supports ("avx")
|
||||
&& cpu_supports ("pclmul"));
|
||||
if (cksum_debug)
|
||||
error (0, 0, "%s",
|
||||
(pclmul_enabled
|
||||
? _("using pclmul hardware support")
|
||||
: _("pclmul support not detected")));
|
||||
# if USE_PCLMUL_CRC32
|
||||
if (pclmul_enabled)
|
||||
return cksum_pclmul;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static cksum_fp_t
|
||||
avx2_supported (void)
|
||||
{
|
||||
/* AVX512 processors will not set vpclmulqdq unless they support
|
||||
the avx512 version, but it implies that the avx2 version
|
||||
is supported */
|
||||
# if USE_AVX2_CRC32
|
||||
bool avx2_enabled = (cpu_supports ("avx2")
|
||||
&& cpu_supports ("vpclmulqdq"));
|
||||
if (cksum_debug)
|
||||
error (0, 0, "%s",
|
||||
(avx2_enabled
|
||||
? _("using avx2 hardware support")
|
||||
: _("avx2 support not detected")));
|
||||
if (avx2_enabled)
|
||||
return cksum_avx2;
|
||||
# endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static cksum_fp_t
|
||||
avx512_supported (void)
|
||||
{
|
||||
/* vpclmulqdq for multiplication
|
||||
mavx512f for most of the avx512 functions we're using
|
||||
mavx512bw for byte swapping */
|
||||
# if USE_AVX512_CRC32
|
||||
bool avx512_enabled = (cpu_supports ("avx512f")
|
||||
&& cpu_supports ("avx512bw")
|
||||
&& cpu_supports ("vpclmulqdq"));
|
||||
|
||||
if (cksum_debug)
|
||||
error (0, 0, "%s",
|
||||
(avx512_enabled
|
||||
? _("using avx512 hardware support")
|
||||
: _("avx512 support not detected")));
|
||||
if (avx512_enabled)
|
||||
return cksum_avx512;
|
||||
# endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static cksum_fp_t
|
||||
vmull_supported (void)
|
||||
{
|
||||
/* vmull for multiplication */
|
||||
# if USE_VMULL_CRC32
|
||||
bool vmull_enabled = (cpu_may_support ("pmull")
|
||||
&& (getauxval (AT_HWCAP) & HWCAP_PMULL) > 0);
|
||||
if (cksum_debug)
|
||||
error (0, 0, "%s",
|
||||
(vmull_enabled
|
||||
? _("using vmull hardware support")
|
||||
: _("vmull support not detected")));
|
||||
if (vmull_enabled)
|
||||
return cksum_vmull;
|
||||
# endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool
|
||||
cksum_slice8 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
|
||||
{
|
||||
uint32_t buf[BUFLEN / sizeof (uint32_t)];
|
||||
uint_fast32_t crc = 0;
|
||||
uintmax_t length = 0;
|
||||
size_t bytes_read;
|
||||
|
||||
if (!fp || !crc_out || !length_out)
|
||||
return false;
|
||||
|
||||
while ((bytes_read = fread (buf, 1, BUFLEN, fp)) > 0)
|
||||
{
|
||||
uint32_t *datap;
|
||||
|
||||
if (ckd_add (&length, length, bytes_read))
|
||||
{
|
||||
errno = EOVERFLOW;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Process multiples of 8 bytes */
|
||||
datap = (uint32_t *)buf;
|
||||
while (bytes_read >= 8)
|
||||
{
|
||||
uint32_t first = *datap++, second = *datap++;
|
||||
crc ^= htobe32 (first);
|
||||
second = htobe32 (second);
|
||||
crc = (crctab[7][(crc >> 24) & 0xFF]
|
||||
^ crctab[6][(crc >> 16) & 0xFF]
|
||||
^ crctab[5][(crc >> 8) & 0xFF]
|
||||
^ crctab[4][(crc) & 0xFF]
|
||||
^ crctab[3][(second >> 24) & 0xFF]
|
||||
^ crctab[2][(second >> 16) & 0xFF]
|
||||
^ crctab[1][(second >> 8) & 0xFF]
|
||||
^ crctab[0][(second) & 0xFF]);
|
||||
bytes_read -= 8;
|
||||
}
|
||||
|
||||
/* And finish up last 0-7 bytes in a byte by byte fashion */
|
||||
unsigned char *cp = (unsigned char *)datap;
|
||||
while (bytes_read--)
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ *cp++) & 0xFF];
|
||||
if (feof (fp))
|
||||
break;
|
||||
}
|
||||
|
||||
*crc_out = crc;
|
||||
*length_out = length;
|
||||
|
||||
return !ferror (fp);
|
||||
}
|
||||
|
||||
/* Calculate the checksum and length in bytes of stream STREAM.
|
||||
Return -1 on error, 0 on success. */
|
||||
|
||||
int
|
||||
crc_sum_stream (FILE *stream, void *resstream, uintmax_t *length)
|
||||
{
|
||||
uintmax_t total_bytes = 0;
|
||||
uint_fast32_t crc = 0;
|
||||
|
||||
static cksum_fp_t cksum_fp;
|
||||
if (! cksum_fp)
|
||||
cksum_fp = avx512_supported ();
|
||||
if (! cksum_fp)
|
||||
cksum_fp = avx2_supported ();
|
||||
if (! cksum_fp)
|
||||
cksum_fp = pclmul_supported ();
|
||||
if (! cksum_fp)
|
||||
cksum_fp = vmull_supported ();
|
||||
if (! cksum_fp)
|
||||
cksum_fp = cksum_slice8;
|
||||
|
||||
if (! cksum_fp (stream, &crc, &total_bytes))
|
||||
return -1;
|
||||
|
||||
*length = total_bytes;
|
||||
|
||||
for (; total_bytes; total_bytes >>= 8)
|
||||
crc = (crc << 8) ^ crctab[0][((crc >> 24) ^ total_bytes) & 0xFF];
|
||||
crc = ~crc & 0xFFFFFFFF;
|
||||
|
||||
unsigned int crc_out = crc;
|
||||
memcpy (resstream, &crc_out, sizeof crc_out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Calculate the crc32b checksum and length in bytes of stream STREAM.
|
||||
Return -1 on error, 0 on success. */
|
||||
|
||||
int
|
||||
crc32b_sum_stream (FILE *stream, void *resstream, uintmax_t *reslen)
|
||||
{
|
||||
uint32_t buf[BUFLEN / sizeof (uint32_t)];
|
||||
uint32_t crc = 0;
|
||||
uintmax_t len = 0;
|
||||
size_t bytes_read;
|
||||
|
||||
if (!stream || !resstream || !reslen)
|
||||
return -1;
|
||||
|
||||
# if GL_CRC_X86_64_PCLMUL
|
||||
if (cksum_debug)
|
||||
(void) pclmul_supported ();
|
||||
# endif
|
||||
|
||||
while ((bytes_read = fread (buf, 1, BUFLEN, stream)) > 0)
|
||||
{
|
||||
if (ckd_add (&len, len, bytes_read))
|
||||
{
|
||||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
}
|
||||
|
||||
crc = crc32_update (crc, (char const *)buf, bytes_read);
|
||||
|
||||
if (feof (stream))
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned int crc_out = crc;
|
||||
memcpy (resstream, &crc_out, sizeof crc_out);
|
||||
|
||||
*reslen = len;
|
||||
|
||||
return ferror (stream) ? -1 : 0;
|
||||
}
|
||||
|
||||
/* Print the checksum and size to stdout.
|
||||
If ARGS is true, also print the FILE name. */
|
||||
|
||||
void
|
||||
output_crc (char const *file, MAYBE_UNUSED int binary_file,
|
||||
void const *digest, bool raw, MAYBE_UNUSED bool tagged,
|
||||
unsigned char delim, bool args, uintmax_t length)
|
||||
{
|
||||
if (raw)
|
||||
{
|
||||
/* Output in network byte order (big endian). */
|
||||
uint32_t out_int = htobe32 (*(uint32_t *)digest);
|
||||
fwrite (&out_int, 1, 32/8, stdout);
|
||||
return;
|
||||
}
|
||||
|
||||
printf ("%u %ju", *(unsigned int *)digest, length);
|
||||
if (args)
|
||||
printf (" %s", file);
|
||||
putchar (delim);
|
||||
}
|
||||
|
||||
#endif /* !CRCTAB */
|
||||
@@ -1,4 +1,4 @@
|
||||
/* cksum -- calculate and print POSIX checksums and sizes of files
|
||||
/* cksum_crc -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 2021-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cksum.h"
|
||||
#include "cksum_crc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* cksum -- calculate and print POSIX checksums and sizes of files
|
||||
/* cksum_crc -- calculate and print POSIX checksums and sizes of files
|
||||
Copyright (C) 2024-2025 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "cksum.h"
|
||||
#include "cksum_crc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
1805
src/digest.c
1805
src/digest.c
File diff suppressed because it is too large
Load Diff
30
src/local.mk
30
src/local.mk
@@ -429,55 +429,55 @@ src_tac_SOURCES = src/tac.c src/temp-stream.c
|
||||
src_tail_SOURCES = src/tail.c src/iopoll.c
|
||||
src_tee_SOURCES = src/tee.c src/iopoll.c
|
||||
|
||||
src_sum_SOURCES = src/sum.c src/sum.h src/digest.c
|
||||
src_sum_SOURCES = src/sum.c src/sum.h src/cksum.c
|
||||
src_sum_CPPFLAGS = -DHASH_ALGO_SUM=1 $(AM_CPPFLAGS)
|
||||
|
||||
src_md5sum_SOURCES = src/digest.c
|
||||
src_md5sum_SOURCES = src/cksum.c
|
||||
src_md5sum_CPPFLAGS = -DHASH_ALGO_MD5=1 $(AM_CPPFLAGS)
|
||||
src_sha1sum_SOURCES = src/digest.c
|
||||
src_sha1sum_SOURCES = src/cksum.c
|
||||
src_sha1sum_CPPFLAGS = -DHASH_ALGO_SHA1=1 $(AM_CPPFLAGS)
|
||||
src_sha224sum_SOURCES = src/digest.c
|
||||
src_sha224sum_SOURCES = src/cksum.c
|
||||
src_sha224sum_CPPFLAGS = -DHASH_ALGO_SHA224=1 $(AM_CPPFLAGS)
|
||||
src_sha256sum_SOURCES = src/digest.c
|
||||
src_sha256sum_SOURCES = src/cksum.c
|
||||
src_sha256sum_CPPFLAGS = -DHASH_ALGO_SHA256=1 $(AM_CPPFLAGS)
|
||||
src_sha384sum_SOURCES = src/digest.c
|
||||
src_sha384sum_SOURCES = src/cksum.c
|
||||
src_sha384sum_CPPFLAGS = -DHASH_ALGO_SHA384=1 $(AM_CPPFLAGS)
|
||||
src_sha512sum_SOURCES = src/digest.c
|
||||
src_sha512sum_SOURCES = src/cksum.c
|
||||
src_sha512sum_CPPFLAGS = -DHASH_ALGO_SHA512=1 $(AM_CPPFLAGS)
|
||||
src_b2sum_CPPFLAGS = -DHASH_ALGO_BLAKE2=1 -DHAVE_CONFIG_H $(AM_CPPFLAGS)
|
||||
src_b2sum_SOURCES = src/digest.c \
|
||||
src_b2sum_SOURCES = src/cksum.c \
|
||||
src/blake2/blake2.h src/blake2/blake2-impl.h \
|
||||
src/blake2/blake2b-ref.c \
|
||||
src/blake2/b2sum.c src/blake2/b2sum.h
|
||||
|
||||
src_cksum_SOURCES = $(src_b2sum_SOURCES) src/sum.c src/sum.h \
|
||||
src/cksum.c src/cksum.h src/crctab.c
|
||||
src/cksum_crc.c src/crc.h src/crctab.c
|
||||
src_cksum_CPPFLAGS = -DHASH_ALGO_CKSUM=1 -DHAVE_CONFIG_H $(AM_CPPFLAGS)
|
||||
|
||||
if USE_AVX512_CRC32
|
||||
noinst_LIBRARIES += src/libcksum_avx512.a
|
||||
src_libcksum_avx512_a_SOURCES = src/cksum_avx512.c src/cksum.h
|
||||
src_libcksum_avx512_a_SOURCES = src/cksum_avx512.c src/cksum_crc.h
|
||||
cksum_avx512_ldadd = src/libcksum_avx512.a
|
||||
src_cksum_LDADD += $(cksum_avx512_ldadd)
|
||||
src_libcksum_avx512_a_CFLAGS = -mavx512bw -mavx512f -mvpclmulqdq $(AM_CFLAGS)
|
||||
endif
|
||||
if USE_AVX2_CRC32
|
||||
noinst_LIBRARIES += src/libcksum_avx2.a
|
||||
src_libcksum_avx2_a_SOURCES = src/cksum_avx2.c src/cksum.h
|
||||
src_libcksum_avx2_a_SOURCES = src/cksum_avx2.c src/cksum_crc.h
|
||||
cksum_avx2_ldadd = src/libcksum_avx2.a
|
||||
src_cksum_LDADD += $(cksum_avx2_ldadd)
|
||||
src_libcksum_avx2_a_CFLAGS = -mpclmul -mavx -mavx2 -mvpclmulqdq $(AM_CFLAGS)
|
||||
endif
|
||||
if USE_PCLMUL_CRC32
|
||||
noinst_LIBRARIES += src/libcksum_pclmul.a
|
||||
src_libcksum_pclmul_a_SOURCES = src/cksum_pclmul.c src/cksum.h
|
||||
src_libcksum_pclmul_a_SOURCES = src/cksum_pclmul.c src/cksum_crc.h
|
||||
cksum_pclmul_ldadd = src/libcksum_pclmul.a
|
||||
src_cksum_LDADD += $(cksum_pclmul_ldadd)
|
||||
src_libcksum_pclmul_a_CFLAGS = -mavx -mpclmul $(AM_CFLAGS)
|
||||
endif
|
||||
if USE_VMULL_CRC32
|
||||
noinst_LIBRARIES += src/libcksum_vmull.a
|
||||
src_libcksum_vmull_a_SOURCES = src/cksum_vmull.c src/cksum.h
|
||||
src_libcksum_vmull_a_SOURCES = src/cksum_vmull.c src/cksum_crc.h
|
||||
cksum_vmull_ldadd = src/libcksum_vmull.a
|
||||
src_cksum_LDADD += $(cksum_vmull_ldadd)
|
||||
src_libcksum_vmull_a_CFLAGS = -march=armv8-a+crypto $(AM_CFLAGS)
|
||||
@@ -598,13 +598,13 @@ $(top_srcdir)/src/primes.h: $(top_srcdir)/src/make-prime-list.c
|
||||
|
||||
# We build crctab in a similar manner to primes.h.
|
||||
BUILT_SOURCES += $(top_srcdir)/src/crctab.c
|
||||
$(top_srcdir)/src/crctab.c: $(top_srcdir)/src/cksum.c
|
||||
$(top_srcdir)/src/crctab.c: $(top_srcdir)/src/cksum_crc.c
|
||||
$(AM_V_GEN)if test -n '$(BUILD_CC)'; then \
|
||||
$(MKDIR_P) $(top_srcdir)/src/crctab-tmp \
|
||||
&& (cd $(top_srcdir)/src/crctab-tmp \
|
||||
&& $(BUILD_CC) $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) \
|
||||
$(BUILD_LDFLAGS) -DCRCTAB -o crctab$(EXEEXT) \
|
||||
$(abs_top_srcdir)/src/cksum.c) \
|
||||
$(abs_top_srcdir)/src/cksum_crc.c) \
|
||||
&& rm -f $@ $@-t \
|
||||
&& $(top_srcdir)/src/crctab-tmp/crctab$(EXEEXT) > $@-t \
|
||||
&& chmod a-w $@-t \
|
||||
|
||||
Reference in New Issue
Block a user