Blame SOURCES/0027-BaseTools-tools_def-add-fno-unwind-tables-to-GCC_AAR.patch

cc9195
From 7ef29963526aa451b1101e4b92e47d3028c9035a Mon Sep 17 00:00:00 2001
cc9195
From: Laszlo Ersek <lersek@redhat.com>
cc9195
Date: Fri, 18 May 2018 19:20:32 +0200
cc9195
Subject: BaseTools/tools_def: add "-fno-unwind-tables" to GCC_AARCH64_CC_FLAGS
cc9195
cc9195
Notes about the RHEL-7.6/ovmf-20180508-2.gitee3198e672e2.el7 ->
cc9195
RHEL-8.0/20180508-ee3198e672e2 rebase:
cc9195
cc9195
- reorder the rebase changelog in the commit message so that it reads like
cc9195
  a blog: place more recent entries near the top
cc9195
cc9195
- in RHEL-8.0 Alpha, this patch was applied downstream-only, for fixing
cc9195
  RHBZ#1579525. Since then, the patch has been upstreamed, and now it is
cc9195
  cherry-picked from upstream.
cc9195
cc9195
The ElfConvert routines in GenFw don't handle the ".eh_frame" ELF section
cc9195
emitted by gcc. For this reason, Leif disabled the generation of that
cc9195
section for AARCH64 with "-fno-asynchronous-unwind-tables" in commit
cc9195
28e80befa4fe [1], and Ard did the same for IA32 and X64 in commit
cc9195
26ecc55c027d [2]. (The CLANG38 toolchain received the same flag at its
cc9195
inception, in commit 6f756db5ea05 [3].)
cc9195
cc9195
However, ".eh_frame" is back now; in upstream gcc commit 9cbee213b579 [4]
cc9195
(part of tag "gcc-8_1_0-release"), both "-fasynchronous-unwind-tables" and
cc9195
"-funwind-tables" were made the default for AARCH64. (The patch author
cc9195
described the effects on the gcc mailing list [5].) We have to counter the
cc9195
latter flag with "-fno-unwind-tables", otherwise GenFw chokes on
cc9195
".eh_frame" again (triggered for example on Fedora 28).
cc9195
cc9195
"-f[no-]unwind-tables" goes back to at least gcc-4.4 [6], so it's safe to
cc9195
add to GCC_AARCH64_CC_FLAGS.
cc9195
cc9195
[1] https://github.com/tianocore/edk2/commit/28e80befa4fe
cc9195
[2] https://github.com/tianocore/edk2/commit/26ecc55c027d
cc9195
[3] https://github.com/tianocore/edk2/commit/6f756db5ea05
cc9195
[4] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9cbee213b579
cc9195
[5] http://mid.mail-archive.com/7b28c03a-c032-6cec-c127-1c12cbe98eeb@foss.arm.com
cc9195
[6] https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Code-Gen-Options.html
cc9195
cc9195
Cc: "Danilo C. L. de Paula" <ddepaula@redhat.com>
cc9195
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
cc9195
Cc: Cole Robinson <crobinso@redhat.com>
cc9195
Cc: Gerd Hoffmann <kraxel@redhat.com>
cc9195
Cc: Leif Lindholm <leif.lindholm@linaro.org>
cc9195
Cc: Liming Gao <liming.gao@intel.com>
cc9195
Cc: Paolo Bonzini <pbonzini@redhat.com>
cc9195
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
cc9195
Reported-by: "Danilo C. L. de Paula" <ddepaula@redhat.com>
cc9195
Contributed-under: TianoCore Contribution Agreement 1.1
cc9195
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
cc9195
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
cc9195
Reviewed-by: Liming Gao <liming.gao@intel.com>
cc9195
(cherry picked from commit cbf00651eda6818ca3c76115b8a18e3f6b23eef4)
cc9195
---
cc9195
 BaseTools/Conf/tools_def.template | 2 +-
cc9195
 1 file changed, 1 insertion(+), 1 deletion(-)
cc9195
cc9195
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
cc9195
index 03d7000..9429033 100755
cc9195
--- a/BaseTools/Conf/tools_def.template
cc9195
+++ b/BaseTools/Conf/tools_def.template
cc9195
@@ -4537,7 +4537,7 @@ DEFINE GCC_X64_CC_FLAGS            = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-ad
cc9195
 DEFINE GCC_IPF_CC_FLAGS            = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency
cc9195
 DEFINE GCC_ARM_CC_FLAGS            = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie
cc9195
 DEFINE GCC_ARM_CC_XIPFLAGS         = -mno-unaligned-access
cc9195
-DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-pic -fno-pie -ffixed-x18
cc9195
+DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18
cc9195
 DEFINE GCC_AARCH64_CC_XIPFLAGS     = -mstrict-align -mgeneral-regs-only
cc9195
 DEFINE GCC_DLINK_FLAGS_COMMON      = -nostdlib --pie
cc9195
 DEFINE GCC_DLINK2_FLAGS_COMMON     = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
cc9195
-- 
cc9195
1.8.3.1
cc9195