From e890bb0e75ed16cf4bbe2ea2458cda66ef593e6a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 22 Jul 2023 12:40:49 -0400 Subject: [PATCH] asahi: Don't depend on glibc to decode fopencookie is a glibc feature, so we can't use it on macOS (and probably other libc's?). It's only used for the hypervisor interface, though, so we can just make the hypervisor piece glibc-only while otherwise fixing the wrap.dylib build. Fixes: ee83453f69f ("asahi: Add a shared library interface for decode") Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/decode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/asahi/lib/decode.c b/src/asahi/lib/decode.c index c357610..bb43fc4 100644 --- a/src/asahi/lib/decode.c +++ b/src/asahi/lib/decode.c @@ -971,17 +971,24 @@ libagxdecode_writer(void *cookie, const char *buffer, size_t size) return lib_config.stream_write(buffer, size); } +#ifdef _GNU_SOURCE static cookie_io_functions_t funcs = {.write = libagxdecode_writer}; +#endif static decoder_params lib_params; void libagxdecode_init(struct libagxdecode_config *config) { +#ifdef _GNU_SOURCE lib_config = *config; agxdecode_dump_stream = fopencookie(NULL, "w", funcs); chip_id_to_params(&lib_params, config->chip_id); +#else + /* fopencookie is a glibc extension */ + unreachable("libagxdecode only available with glibc"); +#endif } void -- 2.7.4