Files
Centos-kernel-stream-9/lib/zstd/Makefile
T
Vladislav Dronov eae3282c6c zstd: Fixing mixed module-builtin objects
JIRA: https://redhat.atlassian.net/browse/RHEL-115837
Upstream Status: merged into the upstream linux.git

commit 637a642f5ca5e850186bb64ac75ebb0f124b458d
Author: Alexey Kardashevskiy <aik@ozlabs.ru>
Date:   Thu Sep 29 12:08:23 2022 +1000

    zstd: Fixing mixed module-builtin objects

    With CONFIG_ZSTD_COMPRESS=m and CONFIG_ZSTD_DECOMPRESS=y we end up in
    a situation when files from lib/zstd/common/ are compiled once to be
    linked later for ZSTD_DECOMPRESS (build-in) and ZSTD_COMPRESS (module)
    even though CFLAGS are different for builtins and modules.
    So far somehow this was not a problem but enabling LLVM LTO exposes
    the problem as:

    ld.lld: error: linking module flags 'Code Model': IDs have conflicting values in 'lib/built-in.a(zstd_common.o at 5868)' and 'ld-temp.o'

    This particular conflict is caused by KBUILD_CFLAGS=-mcmodel=medium vs.
    KBUILD_CFLAGS_MODULE=-mcmodel=large , modules use the large model on
    POWERPC as explained at
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/Makefile?h=v5.18-rc4#n127
    but the current use of common files is wrong anyway.

    This works around the issue by introducing a zstd_common module with
    shared code.

    Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Signed-off-by: Vladislav Dronov <vdronov@redhat.com>
2026-06-25 16:53:47 +02:00

43 lines
1.4 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
# ################################################################
# Copyright (c) Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under both the BSD-style license (found in the
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
# in the COPYING file in the root directory of this source tree).
# You may select, at your option, one of the above-listed licenses.
# ################################################################
obj-$(CONFIG_ZSTD_COMPRESS) += zstd_compress.o
obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd_decompress.o
obj-$(CONFIG_ZSTD_COMMON) += zstd_common.o
zstd_compress-y := \
zstd_compress_module.o \
compress/fse_compress.o \
compress/hist.o \
compress/huf_compress.o \
compress/zstd_compress.o \
compress/zstd_compress_literals.o \
compress/zstd_compress_sequences.o \
compress/zstd_compress_superblock.o \
compress/zstd_double_fast.o \
compress/zstd_fast.o \
compress/zstd_lazy.o \
compress/zstd_ldm.o \
compress/zstd_opt.o \
zstd_decompress-y := \
zstd_decompress_module.o \
decompress/huf_decompress.o \
decompress/zstd_ddict.o \
decompress/zstd_decompress.o \
decompress/zstd_decompress_block.o \
zstd_common-y := \
common/debug.o \
common/entropy_common.o \
common/error_private.o \
common/fse_decompress.o \
common/zstd_common.o \