mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-15 18:03:30 +00:00
toolchain: add llvm-bpf
This commit is contained in:
parent
6cb6036c50
commit
89e39d8809
83
include/bpf.mk
Normal file
83
include/bpf.mk
Normal file
@ -0,0 +1,83 @@
|
||||
BPF_DEPENDS := @HAS_BPF_TOOLCHAIN
|
||||
LLVM_VER:=
|
||||
|
||||
CLANG_MIN_VER:=12
|
||||
|
||||
ifneq ($(CONFIG_USE_LLVM_HOST),)
|
||||
BPF_TOOLCHAIN_HOST_PATH:=$(call qstrip,$(CONFIG_BPF_TOOLCHAIN_HOST_PATH))
|
||||
ifneq ($(BPF_TOOLCHAIN_HOST_PATH),)
|
||||
BPF_PATH:=$(BPF_TOOLCHAIN_HOST_PATH)/bin:$(PATH)
|
||||
else
|
||||
BPF_PATH:=$(PATH)
|
||||
endif
|
||||
CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' command -v clang clang-13 clang-12 clang-11))
|
||||
LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
|
||||
endif
|
||||
ifneq ($(CONFIG_USE_LLVM_PREBUILT),)
|
||||
CLANG:=$(TOPDIR)/llvm-bpf/bin/clang
|
||||
endif
|
||||
ifneq ($(CONFIG_USE_LLVM_BUILD),)
|
||||
CLANG:=$(STAGING_DIR_HOST)/llvm-bpf/bin/clang
|
||||
endif
|
||||
|
||||
LLVM_PATH:=$(dir $(CLANG))
|
||||
LLVM_LLC:=$(LLVM_PATH)/llc$(LLVM_VER)
|
||||
LLVM_DIS:=$(LLVM_PATH)/llvm-dis$(LLVM_VER)
|
||||
LLVM_OPT:=$(LLVM_PATH)/opt$(LLVM_VER)
|
||||
LLVM_STRIP:=$(LLVM_PATH)/llvm-strip$(LLVM_VER)
|
||||
|
||||
BPF_KARCH:=mips
|
||||
BPF_ARCH:=mips$(if $(CONFIG_ARCH_64BIT),64)$(if $(CONFIG_BIG_ENDIAN),,el)
|
||||
BPF_TARGET:=bpf$(if $(CONFIG_BIG_ENDIAN),eb,el)
|
||||
|
||||
BPF_HEADERS_DIR:=$(STAGING_DIR)/bpf-headers
|
||||
|
||||
BPF_KERNEL_INCLUDE := \
|
||||
-nostdinc -isystem $(TOOLCHAIN_DIR)/include \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/asm/mach-generic \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/generated \
|
||||
-I$(BPF_HEADERS_DIR)/include \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/uapi \
|
||||
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/generated/uapi \
|
||||
-I$(BPF_HEADERS_DIR)/include/uapi \
|
||||
-I$(BPF_HEADERS_DIR)/include/generated/uapi \
|
||||
-I$(BPF_HEADERS_DIR)/tools/lib \
|
||||
-I$(BPF_HEADERS_DIR)/tools/testing/selftests \
|
||||
-I$(BPF_HEADERS_DIR)/samples/bpf \
|
||||
-include linux/kconfig.h -include asm_goto_workaround.h
|
||||
|
||||
BPF_CFLAGS := \
|
||||
$(BPF_KERNEL_INCLUDE) -I$(PKG_BUILD_DIR) \
|
||||
-D__KERNEL__ -D__BPF_TRACING__ -DCONFIG_GENERIC_CSUM \
|
||||
-D__TARGET_ARCH_${BPF_KARCH} \
|
||||
-m$(if $(CONFIG_BIG_ENDIAN),big,little)-endian \
|
||||
-fno-stack-protector -Wall \
|
||||
-Wno-unused-value -Wno-pointer-sign \
|
||||
-Wno-compare-distinct-pointer-types \
|
||||
-Wno-gnu-variable-sized-type-not-at-end \
|
||||
-Wno-address-of-packed-member -Wno-tautological-compare \
|
||||
-Wno-unknown-warning-option \
|
||||
-fno-asynchronous-unwind-tables \
|
||||
-Wno-uninitialized -Wno-unused-variable \
|
||||
-Wno-unused-label \
|
||||
-O2 -emit-llvm -Xclang -disable-llvm-passes
|
||||
|
||||
ifeq ($(DUMP),)
|
||||
CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3)
|
||||
CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 )
|
||||
ifeq ($(CLANG_VER_VALID),)
|
||||
$(error ERROR: LLVM/clang version too old. Minimum required: $(CLANG_MIN_VER), found: $(CLANG_VER))
|
||||
endif
|
||||
endif
|
||||
|
||||
define CompileBPF
|
||||
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \
|
||||
-c $(1) -o $(patsubst %.c,%.bc,$(1))
|
||||
$(LLVM_OPT) -O2 -mtriple=$(BPF_TARGET) < $(patsubst %.c,%.bc,$(1)) > $(patsubst %.c,%.opt,$(1))
|
||||
$(LLVM_DIS) < $(patsubst %.c,%.opt,$(1)) > $(patsubst %.c,%.S,$(1))
|
||||
$(LLVM_LLC) -march=$(BPF_TARGET) -mcpu=v3 -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
|
||||
$(CP) $(patsubst %.c,%.o,$(1)) $(patsubst %.c,%.debug.o,$(1))
|
||||
$(LLVM_STRIP) --strip-debug $(patsubst %.c,%.o,$(1))
|
||||
endef
|
||||
|
114
package/kernel/bpf-headers/Makefile
Normal file
114
package/kernel/bpf-headers/Makefile
Normal file
@ -0,0 +1,114 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
override QUILT:=
|
||||
override HOST_QUILT:=
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
|
||||
PKG_NAME:=linux
|
||||
PKG_PATCHVER:=5.15
|
||||
# Manually include kernel version and hash from kernel details file
|
||||
include $(INCLUDE_DIR)/kernel-$(PKG_PATCHVER)
|
||||
|
||||
PKG_VERSION:=$(PKG_PATCHVER)$(strip $(LINUX_VERSION-$(PKG_PATCHVER)))
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=$(LINUX_SITE)
|
||||
PKG_HASH:=$(LINUX_KERNEL_HASH-$(strip $(PKG_VERSION)))
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/bpf-headers/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
GENERIC_PLATFORM_DIR := $(CURDIR)/../../../target/linux/generic
|
||||
GENERIC_BACKPORT_DIR := $(GENERIC_PLATFORM_DIR)/backport$(if $(wildcard $(GENERIC_PLATFORM_DIR)/backport-$(PKG_PATCHVER)),-$(PKG_PATCHVER))
|
||||
GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/pending$(if $(wildcard $(GENERIC_PLATFORM_DIR)/pending-$(PKG_PATCHVER)),-$(PKG_PATCHVER))
|
||||
GENERIC_HACK_DIR := $(GENERIC_PLATFORM_DIR)/hack$(if $(wildcard $(GENERIC_PLATFORM_DIR)/hack-$(PKG_PATCHVER)),-$(PKG_PATCHVER))
|
||||
GENERIC_FILES_DIR := $(foreach dir,$(wildcard $(GENERIC_PLATFORM_DIR)/files $(GENERIC_PLATFORM_DIR)/files-$(PKG_PATCHVER)),"$(dir)")
|
||||
PATCH_DIR := $(CURDIR)/patches
|
||||
FILES_DIR :=
|
||||
|
||||
REAL_LINUX_DIR := $(LINUX_DIR)
|
||||
LINUX_DIR := $(PKG_BUILD_DIR)
|
||||
|
||||
include $(INCLUDE_DIR)/bpf.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/bpf-headers
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel
|
||||
TITLE:=eBPF kernel headers
|
||||
BUILDONLY:=1
|
||||
HIDDEN:=1
|
||||
endef
|
||||
|
||||
PKG_CONFIG_PATH:=
|
||||
|
||||
export HOST_EXTRACFLAGS=-I$(STAGING_DIR_HOST)/include
|
||||
|
||||
KERNEL_MAKE := \
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
ARCH=$(BPF_KARCH) \
|
||||
CROSS_COMPILE=$(BPF_ARCH)-linux- \
|
||||
LLVM=1 CC="$(CLANG)" LD="$(TARGET_CROSS)ld" \
|
||||
HOSTCC="$(HOSTCC)" \
|
||||
HOSTCXX="$(HOSTCXX)" \
|
||||
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
|
||||
KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \
|
||||
CONFIG_SHELL="$(BASH)" \
|
||||
INSTALL_HDR_PATH="$(PKG_BUILD_DIR)/user_headers"
|
||||
|
||||
define Build/Patch
|
||||
$(Kernel/Patch/Default)
|
||||
endef
|
||||
|
||||
BPF_DOC = $(PKG_BUILD_DIR)/scripts/bpf_doc.py
|
||||
|
||||
define Build/Configure/64
|
||||
echo 'CONFIG_CPU_MIPS64_R2=y' >> $(PKG_BUILD_DIR)/.config
|
||||
echo 'CONFIG_64BIT=y' >> $(PKG_BUILD_DIR)/.config
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
grep -vE 'CONFIG_(CPU_.*ENDIAN|HZ)' $(PKG_BUILD_DIR)/arch/mips/configs/generic_defconfig > $(PKG_BUILD_DIR)/.config
|
||||
echo 'CONFIG_CPU_$(if $(CONFIG_BIG_ENDIAN),BIG,LITTLE)_ENDIAN=y' >> $(PKG_BUILD_DIR)/.config
|
||||
$(if $(CONFIG_ARCH_64BIT),$(Build/Configure/64))
|
||||
grep CONFIG_HZ $(REAL_LINUX_DIR)/.config >> $(PKG_BUILD_DIR)/.config
|
||||
yes '' | $(KERNEL_MAKE) oldconfig
|
||||
grep 'CONFIG_HZ=' $(REAL_LINUX_DIR)/.config | \
|
||||
cut -d= -f2 | \
|
||||
bc -q $(LINUX_DIR)/kernel/time/timeconst.bc \
|
||||
> $(LINUX_DIR)/include/generated/timeconst.h
|
||||
$(BPF_DOC) --header \
|
||||
--file $(LINUX_DIR)/tools/include/uapi/linux/bpf.h \
|
||||
> $(PKG_BUILD_DIR)/tools/lib/bpf/bpf_helper_defs.h
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(KERNEL_MAKE) archprepare headers_install
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
mkdir -p $(1)/bpf-headers/arch $(1)/bpf-headers/tools
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/arch/$(BPF_KARCH) \
|
||||
$(1)/bpf-headers/arch/
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/tools/lib \
|
||||
$(PKG_BUILD_DIR)/tools/testing \
|
||||
$(1)/bpf-headers/tools/
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/include \
|
||||
$(PKG_BUILD_DIR)/samples \
|
||||
$(PKG_BUILD_DIR)/scripts \
|
||||
$(PKG_BUILD_DIR)/user_headers \
|
||||
$(1)/bpf-headers
|
||||
$(CP) \
|
||||
$(CURDIR)/files/stdarg.h \
|
||||
$(1)/bpf-headers/include
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bpf-headers))
|
19
package/kernel/bpf-headers/files/stdarg.h
Normal file
19
package/kernel/bpf-headers/files/stdarg.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef _STDARG_H
|
||||
#define _STDARG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef __builtin_va_list va_list;
|
||||
|
||||
#define va_start(v,l) __builtin_va_start(v,l)
|
||||
#define va_end(v) __builtin_va_end(v)
|
||||
#define va_arg(v,l) __builtin_va_arg(v,l)
|
||||
#define va_copy(d,s) __builtin_va_copy(d,s)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
20
package/kernel/bpf-headers/patches/100-support_hz_300.patch
Normal file
20
package/kernel/bpf-headers/patches/100-support_hz_300.patch
Normal file
@ -0,0 +1,20 @@
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -2988,6 +2988,9 @@ choice
|
||||
config HZ_256
|
||||
bool "256 HZ" if SYS_SUPPORTS_256HZ || SYS_SUPPORTS_ARBIT_HZ
|
||||
|
||||
+ config HZ_300
|
||||
+ bool "300 HZ" if SYS_SUPPORTS_ARBIT_HZ
|
||||
+
|
||||
config HZ_1000
|
||||
bool "1000 HZ" if SYS_SUPPORTS_1000HZ || SYS_SUPPORTS_ARBIT_HZ
|
||||
|
||||
@@ -3039,6 +3042,7 @@ config HZ
|
||||
default 128 if HZ_128
|
||||
default 250 if HZ_250
|
||||
default 256 if HZ_256
|
||||
+ default 300 if HZ_300
|
||||
default 1000 if HZ_1000
|
||||
default 1024 if HZ_1024
|
||||
|
14
package/kernel/bpf-headers/src/include/generated/bounds.h
Normal file
14
package/kernel/bpf-headers/src/include/generated/bounds.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef __LINUX_BOUNDS_H__
|
||||
#define __LINUX_BOUNDS_H__
|
||||
/*
|
||||
* DO NOT MODIFY.
|
||||
*
|
||||
* This file was generated by Kbuild
|
||||
*/
|
||||
|
||||
#define NR_PAGEFLAGS 23 /* __NR_PAGEFLAGS */
|
||||
#define MAX_NR_ZONES 4 /* __MAX_NR_ZONES */
|
||||
#define NR_CPUS_BITS 1 /* ilog2(CONFIG_NR_CPUS) */
|
||||
#define SPINLOCK_SIZE 64 /* sizeof(spinlock_t) */
|
||||
|
||||
#endif
|
30
target/llvm-bpf/Makefile
Normal file
30
target/llvm-bpf/Makefile
Normal file
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Copyright (C) 2021 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
override MAKEFLAGS=
|
||||
|
||||
LLVM_VERSION := $(shell cat $(STAGING_DIR_HOST)/llvm-bpf/.llvm-version)
|
||||
|
||||
LLVM_BPF_PREFIX := llvm-bpf-$(LLVM_VERSION).$(HOST_OS)-$(HOST_ARCH)
|
||||
LLVM_TAR := $(BIN_DIR)/$(LLVM_BPF_PREFIX).tar.xz
|
||||
|
||||
$(LLVM_TAR): $(STAGING_DIR_HOST)/llvm-bpf/.llvm-version
|
||||
tar -C $(STAGING_DIR_HOST) \
|
||||
-I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' \
|
||||
$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
|
||||
-cf $@.tmp llvm-bpf $(LLVM_BPF_PREFIX)
|
||||
mv $@.tmp $@
|
||||
|
||||
download:
|
||||
prepare:
|
||||
compile: $(LLVM_TAR)
|
||||
install: compile
|
||||
|
||||
clean:
|
||||
rm -f $(LLVM_TAR)
|
@ -37,6 +37,39 @@ menuconfig TARGET_OPTIONS
|
||||
|
||||
Most people will answer N.
|
||||
|
||||
choice BPF_TOOLCHAIN
|
||||
prompt "BPF toolchain" if DEVEL
|
||||
default BPF_TOOLCHAIN_BUILD_LLVM if BUILDBOT
|
||||
default BPF_TOOLCHAIN_PREBUILT if HAS_PREBUILT_LLVM_TOOLCHAIN
|
||||
default BPF_TOOLCHAIN_NONE
|
||||
|
||||
config BPF_TOOLCHAIN_NONE
|
||||
bool "None"
|
||||
|
||||
config BPF_TOOLCHAIN_PREBUILT
|
||||
bool "Use prebuilt LLVM toolchain"
|
||||
depends on HAS_PREBUILT_LLVM_TOOLCHAIN
|
||||
select USE_LLVM_PREBUILT
|
||||
|
||||
config BPF_TOOLCHAIN_HOST
|
||||
select USE_LLVM_HOST
|
||||
bool "Use host LLVM toolchain"
|
||||
|
||||
config BPF_TOOLCHAIN_BUILD_LLVM
|
||||
select USE_LLVM_BUILD
|
||||
bool "Build LLVM toolchain for eBPF"
|
||||
help
|
||||
If enabled, a LLVM toolchain for building eBPF binaries will be built.
|
||||
If this is not enabled, eBPF packages can only be built if the host
|
||||
has a suitable toolchain
|
||||
endchoice
|
||||
|
||||
config BPF_TOOLCHAIN_HOST_PATH
|
||||
string
|
||||
depends on BPF_TOOLCHAIN_HOST
|
||||
prompt "Host LLVM toolchain path (prefix)" if DEVEL
|
||||
default "/usr/local/opt/llvm" if HOST_OS_MACOS
|
||||
default ""
|
||||
|
||||
menuconfig EXTERNAL_TOOLCHAIN
|
||||
bool
|
||||
@ -266,6 +299,26 @@ config GDB_PYTHON
|
||||
|
||||
help
|
||||
Enable the python bindings for GDB to allow using python in the gdb shell.
|
||||
|
||||
config HAS_BPF_TOOLCHAIN
|
||||
bool
|
||||
|
||||
config HAS_PREBUILT_LLVM_TOOLCHAIN
|
||||
def_bool $(shell, [ -f llvm-bpf/.llvm-version ] && echo y || echo n)
|
||||
|
||||
config USE_LLVM_HOST
|
||||
select HAS_BPF_TOOLCHAIN
|
||||
bool
|
||||
|
||||
config USE_LLVM_PREBUILT
|
||||
select HAS_BPF_TOOLCHAIN
|
||||
default y if !DEVEL && !BUILDBOT && HAS_PREBUILT_LLVM_TOOLCHAIN
|
||||
bool
|
||||
|
||||
config USE_LLVM_BUILD
|
||||
default y if !DEVEL && BUILDBOT
|
||||
select HAS_BPF_TOOLCHAIN
|
||||
bool
|
||||
|
||||
config USE_GLIBC
|
||||
default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (arc)
|
||||
|
@ -35,6 +35,7 @@ tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
|
||||
tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs
|
||||
tools-$(CONFIG_USES_MINOR) += kernel2minor
|
||||
tools-$(CONFIG_USE_SPARSE) += sparse
|
||||
tools-$(CONFIG_USE_LLVM_BUILD) += llvm-bpf
|
||||
|
||||
# builddir dependencies
|
||||
$(curdir)/autoconf/compile := $(curdir)/m4/compile
|
||||
@ -57,6 +58,7 @@ $(curdir)/isl/compile := $(curdir)/gmp/compile
|
||||
$(curdir)/libressl/compile := $(curdir)/pkgconf/compile
|
||||
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
|
||||
$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
|
||||
$(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile
|
||||
$(curdir)/meson/compile := $(curdir)/ninja/compile
|
||||
$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
|
||||
$(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
|
||||
|
56
tools/llvm-bpf/Makefile
Normal file
56
tools/llvm-bpf/Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=llvm-project
|
||||
PKG_VERSION:=13.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
|
||||
PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
|
||||
PKG_HASH:=6075ad30f1ac0e15f07c1bf062c1e1268c241d674f11bd32cdf0e040c71f2bf3
|
||||
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
CMAKE_BINARY_SUBDIR := build
|
||||
CMAKE_SOURCE_SUBDIR := llvm
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
LLVM_BPF_PREFIX = llvm-bpf-$(PKG_VERSION).$(HOST_OS)-$(HOST_ARCH)
|
||||
|
||||
CMAKE_HOST_INSTALL_PREFIX = $(STAGING_DIR_HOST)/$(LLVM_BPF_PREFIX)
|
||||
|
||||
CMAKE_HOST_OPTIONS += \
|
||||
-DLLVM_ENABLE_BINDINGS=OFF \
|
||||
-DLLVM_INCLUDE_DOCS=OFF \
|
||||
-DLLVM_INCLUDE_EXAMPLES=OFF \
|
||||
-DLLVM_INCLUDE_TESTS=OFF \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;lld" \
|
||||
-DLLVM_TARGETS_TO_BUILD=BPF \
|
||||
-DCLANG_BUILD_EXAMPLES=OFF \
|
||||
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
|
||||
-DLLVM_LINK_LLVM_DYLIB=ON \
|
||||
-DLLVM_TOOLCHAIN_TOOLS="llvm-objcopy;llvm-objdump;llvm-readelf;llvm-strip;llvm-ar;llvm-as;llvm-dis;llvm-link;llvm-nm;llvm-ranlib;llc;opt" \
|
||||
-DCMAKE_SKIP_RPATH=OFF
|
||||
|
||||
define Host/Install
|
||||
rm -rf $(STAGING_DIR_HOST)/llvm-bpf*
|
||||
$(Host/Install/Default)
|
||||
ln -s $(LLVM_BPF_PREFIX) $(STAGING_DIR_HOST)/llvm-bpf
|
||||
STRIP_KMOD= PATCHELF= STRIP=strip $(SCRIPT_DIR)/rstrip.sh $(STAGING_DIR_HOST)/llvm-bpf
|
||||
echo "$(PKG_VERSION)" > $(CMAKE_HOST_INSTALL_PREFIX)/.llvm-version
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
rm -rf $(STAGING_DIR_HOST)/llvm-bpf*
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
Loading…
Reference in New Issue
Block a user