mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-17 01:11:29 +00:00
llvm/clang: add support to build llvm/clang
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
parent
cc0576886a
commit
975aae507b
@ -1,7 +1,8 @@
|
||||
From 705ea724f1dc4083665746a1cf4c9b0f317667ec Mon Sep 17 00:00:00 2001
|
||||
From 3937223beab0c3e4284fd916c0c3b6548c287e03 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Tue, 26 Oct 2021 20:41:22 +0200
|
||||
Subject: [PATCH] bpf-headers: add a package with kernel headers for ebpf
|
||||
Subject: [PATCH 050/102] bpf-headers: add a package with kernel headers for
|
||||
ebpf
|
||||
|
||||
In order to genererate suitable kernel headers, a 5.10 kernel tree is
|
||||
prepared with a default config for mips. The arch is forced to mips in
|
||||
@ -11,27 +12,32 @@ It also has the advantage of supporting both endian types
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/bpf.mk | 60 +++++++++++
|
||||
include/bpf.mk | 65 ++++++++++++
|
||||
package/kernel/bpf-headers/Makefile | 99 +++++++++++++++++++
|
||||
.../src/include/generated/bounds.h | 14 +++
|
||||
3 files changed, 173 insertions(+)
|
||||
3 files changed, 178 insertions(+)
|
||||
create mode 100644 include/bpf.mk
|
||||
create mode 100644 package/kernel/bpf-headers/Makefile
|
||||
create mode 100644 package/kernel/bpf-headers/src/include/generated/bounds.h
|
||||
|
||||
diff --git a/include/bpf.mk b/include/bpf.mk
|
||||
new file mode 100644
|
||||
index 0000000000..4e227a11d0
|
||||
index 0000000000..3dc65c7685
|
||||
--- /dev/null
|
||||
+++ b/include/bpf.mk
|
||||
@@ -0,0 +1,60 @@
|
||||
+ifeq ($(CONFIG_BUILD_LLVM_BPF),)
|
||||
+export PATH:=/usr/local/opt/llvm/bin:$(PATH)
|
||||
+CLANG:=$(firstword $(shell PATH='$(PATH)' which clang clang-13 clang-12 clang-11 clang-10 clang-9))
|
||||
+LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
|
||||
@@ -0,0 +1,65 @@
|
||||
+ifneq ($(CONFIG_BPF_TOOLCHAIN_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:=$(BPF_PATH)
|
||||
+ endif
|
||||
+ CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' which clang clang-13 clang-12 clang-11))
|
||||
+ LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
|
||||
+else
|
||||
+CLANG:=$(STAGING_DIR_HOST)/bin/clang
|
||||
+LLVM_VER:=
|
||||
+ CLANG:=$(STAGING_DIR_HOST)/bin/clang
|
||||
+ LLVM_VER:=
|
||||
+endif
|
||||
+
|
||||
+LLVM_PATH:=$(dir $(CLANG))
|
||||
29
backports/0051-bpf-headers-unset-PKG_CONFIG_PATH.patch
Normal file
29
backports/0051-bpf-headers-unset-PKG_CONFIG_PATH.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 32243b2148fd0dacd0630affaea59345c64df79a Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Tue, 2 Nov 2021 10:36:14 +0100
|
||||
Subject: [PATCH 051/102] bpf-headers: unset PKG_CONFIG_PATH
|
||||
|
||||
This fixes an issue where the kernel would pick up an incompatible target
|
||||
libyaml for building host tools
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
package/kernel/bpf-headers/Makefile | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/package/kernel/bpf-headers/Makefile b/package/kernel/bpf-headers/Makefile
|
||||
index 5f5b89370d..df24bfa13f 100644
|
||||
--- a/package/kernel/bpf-headers/Makefile
|
||||
+++ b/package/kernel/bpf-headers/Makefile
|
||||
@@ -41,6 +41,8 @@ define Package/bpf-headers
|
||||
HIDDEN:=1
|
||||
endef
|
||||
|
||||
+PKG_CONFIG_PATH:=
|
||||
+
|
||||
export HOST_EXTRACFLAGS=-I$(STAGING_DIR_HOST)/include
|
||||
|
||||
KERNEL_MAKE := \
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,99 @@
|
||||
From 1eb36bc2be4b54e4e4e4ceffc01be78d996205f0 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sun, 17 Oct 2021 17:50:53 +0200
|
||||
Subject: [PATCH 052/102] tools/llvm-bpf: add llvm+clang build suitable for
|
||||
compiling code to eBPF
|
||||
|
||||
Preparation for building packages that ship eBPF code
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
toolchain/Config.in | 7 +++++++
|
||||
tools/Makefile | 2 ++
|
||||
tools/llvm-bpf/Makefile | 36 ++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 45 insertions(+)
|
||||
create mode 100644 tools/llvm-bpf/Makefile
|
||||
|
||||
diff --git a/toolchain/Config.in b/toolchain/Config.in
|
||||
index 6dda9af92d..9062d6f65e 100644
|
||||
--- a/toolchain/Config.in
|
||||
+++ b/toolchain/Config.in
|
||||
@@ -37,6 +37,13 @@ menuconfig TARGET_OPTIONS
|
||||
|
||||
Most people will answer N.
|
||||
|
||||
+config BUILD_LLVM_BPF
|
||||
+ bool "Build LLVM toolchain for eBPF" if DEVEL
|
||||
+ 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
|
||||
+
|
||||
|
||||
menuconfig EXTERNAL_TOOLCHAIN
|
||||
bool
|
||||
diff --git a/tools/Makefile b/tools/Makefile
|
||||
index a2665dbc9a..83147014c6 100644
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -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_BUILD_LLVM_BPF) += llvm-bpf
|
||||
|
||||
# builddir dependencies
|
||||
$(curdir)/autoconf/compile := $(curdir)/m4/compile
|
||||
@@ -57,6 +58,7 @@ $(curdir)/libelf/compile := $(curdir)/libtool/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)/make-ext4fs/compile := $(curdir)/zlib/compile
|
||||
$(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
|
||||
$(curdir)/mkimage/compile += $(curdir)/libressl/compile
|
||||
diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile
|
||||
new file mode 100644
|
||||
index 0000000000..a5ba2a4cb7
|
||||
--- /dev/null
|
||||
+++ b/tools/llvm-bpf/Makefile
|
||||
@@ -0,0 +1,36 @@
|
||||
+#
|
||||
+# 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
|
||||
+
|
||||
+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
|
||||
+
|
||||
+$(eval $(call HostBuild))
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
From 103a743e7ca4a2e98969d0f60d8aeb6cc7641f67 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Tue, 2 Nov 2021 19:38:12 +0100
|
||||
Subject: [PATCH 053/102] llvm-bpf: move to staging_dir/host/llvm-bpf
|
||||
|
||||
This makes it easier to package it up for the download server
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
tools/llvm-bpf/Makefile | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile
|
||||
index a5ba2a4cb7..ae279d26d2 100644
|
||||
--- a/tools/llvm-bpf/Makefile
|
||||
+++ b/tools/llvm-bpf/Makefile
|
||||
@@ -24,6 +24,8 @@ CMAKE_SOURCE_SUBDIR := llvm
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
+CMAKE_HOST_INSTALL_PREFIX = $(STAGING_DIR_HOST)/llvm-bpf
|
||||
+
|
||||
CMAKE_HOST_OPTIONS += \
|
||||
-DLLVM_ENABLE_BINDINGS=OFF \
|
||||
-DLLVM_INCLUDE_DOCS=OFF \
|
||||
@@ -31,6 +33,10 @@ CMAKE_HOST_OPTIONS += \
|
||||
-DLLVM_INCLUDE_TESTS=OFF \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;lld" \
|
||||
-DLLVM_TARGETS_TO_BUILD=BPF \
|
||||
- -DCLANG_BUILD_EXAMPLES=OFF
|
||||
+ -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
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,103 @@
|
||||
From a368d456ba1e9198fd8f473b7e82c0e066e4eb82 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Mon, 1 Nov 2021 18:40:03 +0100
|
||||
Subject: [PATCH 054/102] build: fix bpf toolchain dependency for qosify
|
||||
|
||||
Add hidden symbols to fix defaults with CONFIG_DEVEL unset
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/bpf.mk | 2 ++
|
||||
toolchain/Config.in | 45 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
tools/Makefile | 2 +-
|
||||
3 files changed, 48 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/bpf.mk b/include/bpf.mk
|
||||
index 3dc65c7685..5211ec4434 100644
|
||||
--- a/include/bpf.mk
|
||||
+++ b/include/bpf.mk
|
||||
@@ -1,3 +1,5 @@
|
||||
+BPF_DEPENDS := @HAS_BPF_TOOLCHAIN
|
||||
+
|
||||
ifneq ($(CONFIG_BPF_TOOLCHAIN_HOST),)
|
||||
BPF_TOOLCHAIN_HOST_PATH:=$(call qstrip,$(CONFIG_BPF_TOOLCHAIN_HOST_PATH))
|
||||
ifneq ($(BPF_TOOLCHAIN_HOST_PATH),)
|
||||
diff --git a/toolchain/Config.in b/toolchain/Config.in
|
||||
index 9062d6f65e..997cff59e4 100644
|
||||
--- a/toolchain/Config.in
|
||||
+++ b/toolchain/Config.in
|
||||
@@ -44,6 +44,32 @@ config BUILD_LLVM_BPF
|
||||
If this is not enabled, eBPF packages can only be built if the host
|
||||
has a suitable toolchain
|
||||
|
||||
+ choice BPF_TOOLCHAIN
|
||||
+ prompt "BPF toolchain" if DEVEL
|
||||
+ default BPF_TOOLCHAIN_NONE
|
||||
+
|
||||
+ config BPF_TOOLCHAIN_NONE
|
||||
+ bool "None"
|
||||
+
|
||||
+ 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 +292,25 @@ config GDB
|
||||
help
|
||||
Enable if you want to build the gdb.
|
||||
|
||||
+config GDB_PYTHON
|
||||
+ bool
|
||||
+ depends on GDB
|
||||
+ prompt "Build gdb with python binding"
|
||||
+
|
||||
+ help
|
||||
+ Enable the python bindings for GDB to allow using python in the gdb shell.
|
||||
+
|
||||
+config HAS_BPF_TOOLCHAIN
|
||||
+ bool
|
||||
+
|
||||
+config USE_LLVM_HOST
|
||||
+ select HAS_BPF_TOOLCHAIN
|
||||
+ bool
|
||||
+
|
||||
+config USE_LLVM_BUILD
|
||||
+ select HAS_BPF_TOOLCHAIN
|
||||
+ bool
|
||||
+
|
||||
config USE_GLIBC
|
||||
default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (arc)
|
||||
bool
|
||||
diff --git a/tools/Makefile b/tools/Makefile
|
||||
index 83147014c6..ae3cc5dfd6 100644
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -35,7 +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_BUILD_LLVM_BPF) += llvm-bpf
|
||||
+tools-$(CONFIG_USE_LLVM_BUILD) += llvm-bpf
|
||||
|
||||
# builddir dependencies
|
||||
$(curdir)/autoconf/compile := $(curdir)/m4/compile
|
||||
--
|
||||
2.25.1
|
||||
|
||||
26
backports/0055-include-bpf.mk-fix-typo.patch
Normal file
26
backports/0055-include-bpf.mk-fix-typo.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 2ae5b19a52da190ea342ec4210523407837c58ea Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Tue, 2 Nov 2021 09:56:10 +0100
|
||||
Subject: [PATCH 055/102] include/bpf.mk: fix typo
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/bpf.mk | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/bpf.mk b/include/bpf.mk
|
||||
index 5211ec4434..6223648c5d 100644
|
||||
--- a/include/bpf.mk
|
||||
+++ b/include/bpf.mk
|
||||
@@ -5,7 +5,7 @@ ifneq ($(CONFIG_BPF_TOOLCHAIN_HOST),)
|
||||
ifneq ($(BPF_TOOLCHAIN_HOST_PATH),)
|
||||
BPF_PATH:=$(BPF_TOOLCHAIN_HOST_PATH)/bin:$(PATH)
|
||||
else
|
||||
- BPF_PATH:=$(BPF_PATH)
|
||||
+ BPF_PATH:=$(PATH)
|
||||
endif
|
||||
CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' which clang clang-13 clang-12 clang-11))
|
||||
LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
From aff796bf3e60d7f09e5ca500cbf59221211dd218 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Tue, 2 Nov 2021 10:39:35 +0100
|
||||
Subject: [PATCH 056/102] include/bpf.mk: fix compile for big-endian targets
|
||||
|
||||
llvm-opt and llc need endian flags in the target as well
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/bpf.mk | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/bpf.mk b/include/bpf.mk
|
||||
index 6223648c5d..9636ad5165 100644
|
||||
--- a/include/bpf.mk
|
||||
+++ b/include/bpf.mk
|
||||
@@ -22,6 +22,7 @@ LLVM_STRIP:=$(LLVM_PATH)/llvm-strip$(LLVM_VER)
|
||||
|
||||
BPF_KARCH:=mips
|
||||
BPF_ARCH:=mips$(if $(CONFIG_BIG_ENDIAN),,el)
|
||||
+BPF_TARGET:=bpf$(if $(CONFIG_BIG_ENDIAN),eb,el)
|
||||
|
||||
BPF_HEADERS_DIR:=$(STAGING_DIR)/bpf-headers
|
||||
|
||||
@@ -59,9 +60,9 @@ BPF_CFLAGS := \
|
||||
define CompileBPF
|
||||
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \
|
||||
-c $(1) -o $(patsubst %.c,%.bc,$(1))
|
||||
- $(LLVM_OPT) -O2 -mtriple=bpf-pc-linux < $(patsubst %.c,%.bc,$(1)) > $(patsubst %.c,%.opt,$(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 -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
|
||||
+ $(LLVM_LLC) -march=$(BPF_TARGET) -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
|
||||
$(LLVM_STRIP) --strip-debug $(patsubst %.c,%.o,$(1))
|
||||
endef
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
34
backports/0057-include-bpf.mk-add-LD_LIBRARY_PATH.patch
Normal file
34
backports/0057-include-bpf.mk-add-LD_LIBRARY_PATH.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From d05fae42794c5fe76509935b1e8f900e1d17d9f0 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Fri, 5 Nov 2021 10:46:00 +0100
|
||||
Subject: [PATCH] include/bpf.mk: add LD_LIBRARY_PATH
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
include/bpf.mk | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/include/bpf.mk b/include/bpf.mk
|
||||
index 9636ad5165..2f797625b6 100644
|
||||
--- a/include/bpf.mk
|
||||
+++ b/include/bpf.mk
|
||||
@@ -58,11 +58,16 @@ BPF_CFLAGS := \
|
||||
-O2 -emit-llvm -Xclang -disable-llvm-passes
|
||||
|
||||
define CompileBPF
|
||||
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
|
||||
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \
|
||||
-c $(1) -o $(patsubst %.c,%.bc,$(1))
|
||||
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
|
||||
$(LLVM_OPT) -O2 -mtriple=$(BPF_TARGET) < $(patsubst %.c,%.bc,$(1)) > $(patsubst %.c,%.opt,$(1))
|
||||
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
|
||||
$(LLVM_DIS) < $(patsubst %.c,%.opt,$(1)) > $(patsubst %.c,%.S,$(1))
|
||||
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
|
||||
$(LLVM_LLC) -march=$(BPF_TARGET) -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
|
||||
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
|
||||
$(LLVM_STRIP) --strip-debug $(patsubst %.c,%.o,$(1))
|
||||
endef
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user