diff options
Diffstat (limited to 'src/liblzma')
-rw-r--r-- | src/liblzma/check/crc32_small.c | 7 | ||||
-rw-r--r-- | src/liblzma/check/crc64_small.c | 5 | ||||
-rw-r--r-- | src/liblzma/lz/lz_encoder.c | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/liblzma/check/crc32_small.c b/src/liblzma/check/crc32_small.c index 5f8a3286..186966e9 100644 --- a/src/liblzma/check/crc32_small.c +++ b/src/liblzma/check/crc32_small.c @@ -16,6 +16,9 @@ uint32_t lzma_crc32_table[1][256]; +#ifdef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR +__attribute__((__constructor__)) +#endif static void crc32_init(void) { @@ -37,18 +40,22 @@ crc32_init(void) } +#ifndef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR extern void lzma_crc32_init(void) { mythread_once(crc32_init); return; } +#endif extern LZMA_API(uint32_t) lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) { +#ifndef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR lzma_crc32_init(); +#endif crc = ~crc; diff --git a/src/liblzma/check/crc64_small.c b/src/liblzma/check/crc64_small.c index 55d72316..420f7cfb 100644 --- a/src/liblzma/check/crc64_small.c +++ b/src/liblzma/check/crc64_small.c @@ -16,6 +16,9 @@ static uint64_t crc64_table[256]; +#ifdef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR +__attribute__((__constructor__)) +#endif static void crc64_init(void) { @@ -40,7 +43,9 @@ crc64_init(void) extern LZMA_API(uint64_t) lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) { +#ifndef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR mythread_once(crc64_init); +#endif crc = ~crc; diff --git a/src/liblzma/lz/lz_encoder.c b/src/liblzma/lz/lz_encoder.c index 890d1bc4..2dad7e5f 100644 --- a/src/liblzma/lz/lz_encoder.c +++ b/src/liblzma/lz/lz_encoder.c @@ -543,7 +543,7 @@ lzma_lz_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)) { -#ifdef HAVE_SMALL +#if defined(HAVE_SMALL) && !defined(HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR) // We need that the CRC32 table has been initialized. lzma_crc32_init(); #endif |