[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
crc.c clashes with zlib
From: |
Gisle Vanem |
Subject: |
crc.c clashes with zlib |
Date: |
Fri, 10 Apr 2020 14:31:30 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
I have a situation with clang's 'lld-link' linker
in Wget2 where the symbol 'crc32()' in Gnulib is called
instead of the correct symbol 'crc32()' in Zlib.
In Zlib's inflate.c:
#ifdef GUNZIP
if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
state->check = crc32(0L, Z_NULL, 0);
The above in fact calls Gnulib's crc32() an crashes due to 'buf == NULL'.
Zlib's 'crc32(crc, buf, len)' on the other hand supports a 'buf == NULL'.
1st line in crc32.c:
if (buf == Z_NULL) return 0UL;
Wget2 is using only static libraries. When using MSVC linker,
this never happens.
I fail to understand how this happens. Experimenting
with '-wholearchive' etc. created other link errors
due to e.g. '_version_etc_copyright' defined in IDN2 too.
But would it be possible to give 'crc32' another name
like 'gl_crc32()'? Or handle 'buf == NULL' as Zlib does?
--
--gv
- crc.c clashes with zlib,
Gisle Vanem <=