Skip to contentSkip to conversation

kexec/zstd: fix static zstd build

PATCH Applied Nicholas Sielicki 2 participants 2 messages Jun 22, 2025 – Jun 23, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kexec/zstd: fix static zstd build

60ce9bdf introduced a local reimplementation of ZSTD_isFrame to this tree, as the definition in libzstd is only available for static linking. When a static build of libzstd is in-fact available to kexec-tools, this was previously causing multiple-definition errors at link time.

prefer the ZSTD_isFrame from libzstd, if it's available, by adding __attribute__((weak)) on the local definition.

---
 kexec/zstd.c | 1 +
 1 file changed, 1 insertion(+)
kexec/zstd.c +1 -0
index 79d5bf3..eaa76b9 100644
@@ -21,6 +21,7 @@
  * Reimplementation of private function available if zstd is
  * statically linked. Remove when it becomes public.
  */
+__attribute__((weak))
 unsigned ZSTD_isFrame(const void* buffer, size_t size)
 {
 	uint8_t *buf = (uint8_t *)buffer;
Signature · 1 line
2.48.1
Applied
#1 lore raw
Quoted 9 lines · Nicholas Sielicki

60ce9bdf introduced a local reimplementation of ZSTD_isFrame to this tree, as the definition in libzstd is only available for static linking. When a static build of libzstd is in-fact available to kexec-tools, this was previously causing multiple-definition errors at link time.

prefer the ZSTD_isFrame from libzstd, if it's available, by adding __attribute__((weak)) on the local definition.

Thanks, applied.