render / rpms / edk2

Forked from rpms/edk2 2 months ago
Clone

Blame SOURCES/edk2-BaseTools-VfrCompile-honor-EXTRA_LDFLAGS.patch

cc9195
From 5825a1b2507e195c40a8655e18c5485c00513445 Mon Sep 17 00:00:00 2001
cc9195
From: Laszlo Ersek <lersek@redhat.com>
cc9195
Date: Wed, 29 Aug 2018 17:12:03 +0200
cc9195
Subject: [PATCH 6/7] BaseTools/VfrCompile: honor EXTRA_LDFLAGS
cc9195
cc9195
Message-id: <20180829151204.26958-7-lersek@redhat.com>
cc9195
Patchwork-id: 81963
cc9195
O-Subject:  [RHEL8/virt212 edk2 PATCH 6/7] BaseTools/VfrCompile: honor
cc9195
	EXTRA_LDFLAGS
cc9195
Bugzilla: 1607906
cc9195
Acked-by: Thomas Huth <thuth@redhat.com>
cc9195
Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
cc9195
cc9195
In commit 81502cee20ac ("BaseTools/Source/C: take EXTRA_LDFLAGS from the
cc9195
caller", 2018-08-16), I missed that "VfrCompile/GNUmakefile" does not use
cc9195
BUILD_LFLAGS in the APPLICATION linking rule, unlike "app.makefile" does.
cc9195
Instead, "VfrCompile/GNUmakefile" uses the (undefined) LFLAGS macro.
cc9195
Therefore commit 81502cee20ac did not cover the linking step of
cc9195
VfrCompile.
cc9195
cc9195
Thankfully, the structure of the linking rules is the same, between
cc9195
"app.makefile" and "VfrCompile/GNUmakefile". Rename the undefined LFLAGS
cc9195
macro in "VfrCompile/GNUmakefile" to VFR_LFLAGS (for consistency with
cc9195
VFR_CXXFLAGS), and set it to EXTRA_LDFLAGS.
cc9195
cc9195
As a result, we have:
cc9195
cc9195
             | compilation                    | linking
cc9195
  -----------+--------------------------------+----------------------
cc9195
  VfrCompile | VFR_CXXFLAGS =                 | VFR_LFLAGS =
cc9195
             | BUILD_OPTFLAGS =               | EXTRA_LDFLAGS
cc9195
             | '-O2' + EXTRA_OPTFLAGS         |
cc9195
  -----------+--------------------------------+----------------------
cc9195
  other apps | BUILD_CFLAGS/BUILD_CXXFLAGS =  | BUILD_LFLAGS =
cc9195
             | [...] + BUILD_OPTFLAGS =       | [...] + EXTRA_LDFLAGS
cc9195
             | [...] + '-O2' + EXTRA_OPTFLAGS |
cc9195
cc9195
This table shows
cc9195
- that the VfrCompile compilation and linking flags are always a subset of
cc9195
  the corresponding flags used by the other apps,
cc9195
- and that the EXTRA flags are always at the end.
cc9195
cc9195
Cc: Liming Gao <liming.gao@intel.com>
cc9195
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
cc9195
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1540244
cc9195
Fixes: 81502cee20ac4046f08bb4aec754c7091c8808dc
cc9195
Contributed-under: TianoCore Contribution Agreement 1.1
cc9195
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
cc9195
Reviewed-by: Liming Gao <liming.gao@intel.com>
cc9195
(cherry picked from commit aa4e0df1f0c7ffdff07d7e382c9da89cbe207cdb)
cc9195
---
cc9195
 BaseTools/Source/C/VfrCompile/GNUmakefile | 5 ++++-
cc9195
 1 file changed, 4 insertions(+), 1 deletion(-)
cc9195
cc9195
diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C/VfrCompile/GNUmakefile
cc9195
index bbe562c..9273589 100644
cc9195
--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
cc9195
+++ b/BaseTools/Source/C/VfrCompile/GNUmakefile
cc9195
@@ -28,6 +28,9 @@ VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
cc9195
 # keep BUILD_OPTFLAGS last
cc9195
 VFR_CXXFLAGS = $(BUILD_OPTFLAGS)
cc9195
 
cc9195
+# keep EXTRA_LDFLAGS last
cc9195
+VFR_LFLAGS = $(EXTRA_LDFLAGS)
cc9195
+
cc9195
 LINKER = $(BUILD_CXX)
cc9195
 
cc9195
 EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
cc9195
@@ -42,7 +45,7 @@ APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
cc9195
 all: $(MAKEROOT)/bin $(APPLICATION) 
cc9195
 
cc9195
 $(APPLICATION): $(OBJECTS) 
cc9195
-	$(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
cc9195
+	$(LINKER) -o $(APPLICATION) $(VFR_LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
cc9195
 
cc9195
 VfrCompiler.o: ../Include/Common/BuildVersion.h
cc9195
 
cc9195
-- 
cc9195
1.8.3.1
cc9195