xref: /freebsd/contrib/elftoolchain/libdwarf/zlib_stub.c (revision d4eeb02986980bf33dd56c41ceb9fc5f180c0d47)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2021 The FreeBSD Foundation
5  *
6  * This software was developed by Mark Johnston under sponsorship from
7  * the FreeBSD Foundation.
8  */
9 
10 #include <sys/cdefs.h>
11 
12 /*
13  * A hack to allow libdwarf.a to be statically linked without zlib.  This is
14  * unfortunately required for FreeBSD <= 13.0 to bootstrap build tools
15  * such as nm(1), as they use metadata from the source tree to generate the
16  * dependency list but then link with the build host's libraries.
17  */
18 
19 extern int uncompress(void *, unsigned long *, const void *,
20     unsigned long);
21 
22 int __weak_symbol
23 uncompress(void *dst __unused, unsigned long *dstsz __unused,
24     const void *src __unused, unsigned long srcsz __unused)
25 {
26 	return (-6); /* Z_VERSION_ERROR */
27 }
28