From b23aba1469de8bb7a115751f9cd294ad3aaa6680 Mon Sep 17 00:00:00 2001
From: Ali Abdel-Qader <abdelqaderali@protonmail.com>
Date: Tue, 31 May 2022 11:53:32 -0400
Subject: [PATCH] Remove deprecated --add-needed linker flag

Resolves #204
Signed-off-by: Ali Abdel-Qader <abdelqaderali@protonmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
Upstream-Status: Backport [https://github.com/rhboot/efivar/pull/218/commits/b23aba1469de8bb7a115751f9cd294ad3aaa6680]

 src/include/defaults.mk | 2 --
 src/include/gcc.specs   | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/include/defaults.mk b/src/include/defaults.mk
index b8cc590..42bd3d6 100644
--- a/src/include/defaults.mk
+++ b/src/include/defaults.mk
@@ -51,7 +51,6 @@ LDFLAGS ?=
 override _CCLDFLAGS := $(CCLDFLAGS)
 override _LDFLAGS := $(LDFLAGS)
 override LDFLAGS = $(CFLAGS) -L. $(_LDFLAGS) $(_CCLDFLAGS) \
-		   -Wl,--add-needed \
 		   -Wl,--build-id \
 		   -Wl,--no-allow-shlib-undefined \
 		   -Wl,--no-undefined-version \
@@ -98,7 +97,6 @@ override _HOST_LDFLAGS := $(HOST_LDFLAGS)
 override _HOST_CCLDFLAGS := $(HOST_CCLDFLAGS)
 override HOST_LDFLAGS = $(HOST_CFLAGS) -L. \
 			$(_HOST_LDFLAGS) $(_HOST_CCLDFLAGS) \
-			-Wl,--add-needed \
 			-Wl,--build-id \
 			-Wl,--no-allow-shlib-undefined \
 			-Wl,-z,now \
diff --git a/src/include/gcc.specs b/src/include/gcc.specs
index ef28e2b..d85e865 100644
--- a/src/include/gcc.specs
+++ b/src/include/gcc.specs
@@ -5,4 +5,4 @@
 + %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches
 
 *link:
-+ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
++ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
