1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include "json.h"
5 
6 #if HAVE_ELFUTILS
7 int dlopen_dw(void);
8 int dlopen_elf(void);
9 
10 /* Parse an ELF object in a forked process, so that errors while iterating over
11  * untrusted and potentially malicious data do not propagate to the main caller's process.
12  * If fork_disable_dump, the child process will not dump core if it crashes. */
13 int parse_elf_object(int fd, const char *executable, bool fork_disable_dump, char **ret, JsonVariant **ret_package_metadata);
14 #else
parse_elf_object(int fd,const char * executable,bool fork_disable_dump,char ** ret,JsonVariant ** ret_package_metadata)15 static inline int parse_elf_object(int fd, const char *executable, bool fork_disable_dump, char **ret, JsonVariant **ret_package_metadata) {
16         return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "elfutils disabled, parsing ELF objects not supported");
17 }
18 #endif
19