openvswitch: fix PIE build against 4.14 kernel
authorYousong Zhou <yszhou4tech@gmail.com>
Mon, 16 Mar 2020 07:25:51 +0000 (15:25 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Mon, 16 Mar 2020 07:32:11 +0000 (15:32 +0800)
Reported-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Ref: https://github.com/openwrt/packages/pull/11567
(cherry picked from commit e9d6414437d27803a16b5d96c48b45140e989e5e)

net/openvswitch/Makefile
net/openvswitch/patches/0007-datapath-unexport-LDFLAGS.patch [new file with mode: 0644]

index c629194dc34fdddc54a0d5ed26008b9613a33174..b4b313b5507df7c14cf15b310c04b8376e84c32c 100644 (file)
@@ -13,7 +13,7 @@ include $(INCLUDE_DIR)/kernel.mk
 PKG_NAME:=openvswitch
 
 PKG_VERSION:=2.8.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=Apache-2.0
 PKG_LICENSE_FILES:=COPYING
 PKG_USE_MIPS16:=0
diff --git a/net/openvswitch/patches/0007-datapath-unexport-LDFLAGS.patch b/net/openvswitch/patches/0007-datapath-unexport-LDFLAGS.patch
new file mode 100644 (file)
index 0000000..ebf8460
--- /dev/null
@@ -0,0 +1,31 @@
+From ddbe0a362cad22e7171524661fd3d3f83628dd7a Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Mon, 16 Mar 2020 15:18:16 +0800
+Subject: [PATCH] datapath: unexport LDFLAGS
+
+OpenWrt build system will put "-specs=.../hardened-pie-ld.specs" into
+LDFLAGS when building PIE binaries.  However the "-specs" argument is
+inteneded for "gcc" the driver while "ld" the linker when presented will
+complain it as unrecognized error.
+
+This can cause Kbuild error when building datapath kernel modules.  The
+issue should only happen when compiling against upstream kernel 4.14 and
+earlier.  Later ones should have been fixed with kernel upstream commit
+d503ac531a5 ("kbuild: rename LDFLAGS to KBUILD_LDFLAGS")
+
+Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
+---
+ datapath/linux/Makefile.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/datapath/linux/Makefile.in b/datapath/linux/Makefile.in
+index efc1663e4..61fcaa67e 100644
+--- a/datapath/linux/Makefile.in
++++ b/datapath/linux/Makefile.in
+@@ -1,5 +1,6 @@
+ ifeq ($(KERNELRELEASE),)
+ # We're being called directly by running make in this directory.
++unexport LDFLAGS
+ include Makefile.main
+ else
+ # We're being included by the Linux kernel build system