aboutsummaryrefslogtreecommitdiff
path: root/tools/build
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2021-08-02 13:36:03 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2021-08-02 13:36:03 +0000
commit31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3 (patch)
treeb9895127e861448a23a51c15aba851acf5a216dc /tools/build
parent2de949cf85d0e0b9ff71e1ffd74153814de96175 (diff)
downloadsrc-31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3.tar.gz
src-31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3.zip
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 <jrtc27@FreeBSD.org> Test Plan: Compiles on ubuntu 18.04 and macOS 11.4 Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D31057
Diffstat (limited to 'tools/build')
-rw-r--r--tools/build/cross-build/include/common/sys/sysctl.h6
-rwxr-xr-xtools/build/make.py4
2 files changed, 10 insertions, 0 deletions
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 <sys/sysctl.h>
+#else
+/* Otherwise, avoid sysctls since they might not be supported on the host. */
#include <sys/types.h>
#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
diff --git a/tools/build/make.py b/tools/build/make.py
index 0cf831a3c966..799ea89b74b3 100755
--- a/tools/build/make.py
+++ b/tools/build/make.py
@@ -166,6 +166,9 @@ if __name__ == "__main__":
"needed if CC/CPP/CXX are not set). ")
parser.add_argument("--debug", action="store_true",
help="Print information on inferred env vars")
+ parser.add_argument("--bootstrap-toolchain", action="store_true",
+ help="Bootstrap the toolchain instead of using an "
+ "external one (experimental and not recommended)")
parser.add_argument("--clean", action="store_true",
help="Do a clean rebuild instead of building with "
"-DWITHOUT_CLEAN")
@@ -195,6 +198,7 @@ if __name__ == "__main__":
if "universe" not in sys.argv and "tinderbox" not in sys.argv:
sys.exit("TARGET= and TARGET_ARCH= must be set explicitly "
"when building on non-FreeBSD")
+ if not parsed_args.bootstrap_toolchain:
# infer values for CC/CXX/CPP
if parsed_args.host_compiler_type == "gcc":
default_cc, default_cxx, default_cpp = ("gcc", "g++", "cpp")