From 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 2 Aug 2021 14:36:03 +0100 Subject: Allow bootstrapping llvm-tblgen on macOS and Linux This is needed in order to build various LLVM binutils (e.g. addr2line) as well as clang/lld/lldb. Co-authored-by: Jessica Clarke Test Plan: Compiles on ubuntu 18.04 and macOS 11.4 Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D31057 --- tools/build/cross-build/include/common/sys/sysctl.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools/build/cross-build/include') diff --git a/tools/build/cross-build/include/common/sys/sysctl.h b/tools/build/cross-build/include/common/sys/sysctl.h index 856f6be23421..6d6f5438c557 100644 --- a/tools/build/cross-build/include/common/sys/sysctl.h +++ b/tools/build/cross-build/include/common/sys/sysctl.h @@ -37,6 +37,11 @@ */ #pragma once +#ifdef BOOTSTRAPPING_WANT_NATIVE_SYSCTL +/* We need the real sysctl.h e.g. when bootstrapping the LLVM tools. */ +#include_next +#else +/* Otherwise, avoid sysctls since they might not be supported on the host. */ #include #define sysctlbyname __freebsd_sysctlbyname @@ -44,3 +49,4 @@ int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); int sysctlbyname(const char *, void *, size_t *, const void *, size_t); +#endif -- cgit v1.2.3