render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

Blame 0022-BaseTools-VfrCompile-honor-EXTRA_LDFLAGS.patch

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