[asm] Share portability macros and restrict ASM further

Move portability macros to `lib/common/portability_macros.h`. This file
only contains platform/feature detection (e.g. 0/1 macros). This file is
shared between C and ASM code, so it cannot include any C code.

Rename `HUF_` ASM macros to be `ZSTD_` prefixed, and move to the new
header.

Restrict `ZSTD_ASM_SUPPORTED` to `__GNUC__`, because we need the GAS
assembler.

Finally, only include the ASM code if we are actually going to use it.
This disables it on all Windows platforms, which should resolve the
problem brought up in Issue #2789.
This commit is contained in:
Nick Terrell
2021-12-02 16:58:04 -08:00
parent 647c1b6615
commit c284569457
8 changed files with 155 additions and 103 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ ZSTD_LEGACY_FILES :=
ZSTD_DECOMPRESS_AMD64_ASM_FILES := $(sort $(wildcard $(LIBZSTD)/decompress/*_amd64.S))
ifneq ($(ZSTD_NO_ASM), 0)
CPPFLAGS += -DHUF_DISABLE_ASM
CPPFLAGS += -DZSTD_DISABLE_ASM
else
# Unconditionally add the ASM files they are disabled by
# macros in the .S file.