efivar: fix build for correct cpu

Message ID 20230228184515.14471-1-arne_f@ipfire.org
State Accepted
Commit 66a5ad1e88836fcfead7745eedbd8e0f753a22ee
Headers
Series efivar: fix build for correct cpu |

Commit Message

Arne Fitzenreiter Feb. 28, 2023, 6:45 p.m. UTC
  the makefile add --march=native which optimize the code to the
cpu of the buildhost which can result in unsupported instructions on
other machines.
---
 lfs/efivar                                     |  3 ++-
 .../efivar-38_remove_march=native.patch        | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 src/patches/efivar-38_remove_march=native.patch
  

Patch

diff --git a/lfs/efivar b/lfs/efivar
index 70ed90170..ee278c50c 100644
--- a/lfs/efivar
+++ b/lfs/efivar
@@ -1,7 +1,7 @@ 
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2018  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2023  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -73,6 +73,7 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
 
 	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/efivar-37-compile-fixes-3.patch
+	cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/efivar-38_remove_march=native.patch
 
 	# fix an issue in Makefile causing the package to be rebuilt during installation
 	# obtained from https://linuxfromscratch.org/blfs/view/11.1/postlfs/efivar.html
diff --git a/src/patches/efivar-38_remove_march=native.patch b/src/patches/efivar-38_remove_march=native.patch
new file mode 100644
index 000000000..7c22576e6
--- /dev/null
+++ b/src/patches/efivar-38_remove_march=native.patch
@@ -0,0 +1,18 @@ 
+diff -Naur efivar-38.org/src/include/defaults.mk efivar-38/src/include/defaults.mk
+--- efivar-38.org/src/include/defaults.mk	2022-01-14 20:29:35.000000000 +0100
++++ efivar-38/src/include/defaults.mk	2023-02-23 19:38:12.493736490 +0100
+@@ -71,12 +71,8 @@
+ 		   -Wl,--version-script=$(MAP) \
+ 		   $(call family,SOFLAGS)
+ 
+-HOST_ARCH=$(shell uname -m)
+-ifneq ($(HOST_ARCH),ia64)
+-	HOST_MARCH=-march=native
+-else
+-	HOST_MARCH=
+-endif
++HOST_MARCH=
++
+ HOST_CPPFLAGS ?= $(CPPFLAGS)
+ override _HOST_CPPFLAGS := $(HOST_CPPFLAGS)
+ override HOST_CPPFLAGS = $(_HOST_CPPFLAGS) \