From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0C5A41A1E46 for ; Mon, 1 Aug 2016 01:02:08 -0700 (PDT) Received: by mail-wm0-x22c.google.com with SMTP id i5so231425439wmg.0 for ; Mon, 01 Aug 2016 01:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WV0Uts5hUZ0Vb9MLFTn6E3A/Jni9ItOaOHWPBaj2Rbo=; b=iQTBdSiClvzkKYLFl7jY7+9qJ5uTimNlvRPb1tymN32llKWuYxrwssZX/n9USOhwKk 2JGzT/gu53+6yqfgIGnGb+vckepCUHaWrqww+idu8UanxM3qjx1pu0XM1U1TZyvz2aeP V3TRmj/1i2KptbFP/SHo5jcjnE/f2uSuovtzU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WV0Uts5hUZ0Vb9MLFTn6E3A/Jni9ItOaOHWPBaj2Rbo=; b=mvxp3w3+2Y3OcWnn3gkWL9UUsTZhqLLssEzmkDCNN0RccUwGWhg7tug+FlsYj5u8eL T+DbmnTJaSBsJjPLuAwb4XikADKUJprDP+LXU81hXmfJZlHu0sE7j4XUnp4Lhjc6GTbt m26rL2QMphKsXr6eyYiGAaFQPDD5hjlyKAOA2hrlO/3d2hTkyzRJ9Bse/Zo2mcWC1mTz 4eDl9yVC4SFuvsaazky8dPrnpjxBKB0i/zIS6/GDaGpFQrm68rWwfZR7B9nJHoo4rGuw j37aTsL2tZoz2Yf8PlWvG+6cDGNm2JVMKiy3sn25b4gFVZNB1NuNozYvmtKH5odZ2iBO 7xlw== X-Gm-Message-State: AEkoouvKO8TX+XIC/9k6Cmm5aJjloBp6qp2Xwjllv8VxlxB0qh4R0nXbjZU3LQFG+bbfITRW X-Received: by 10.28.113.135 with SMTP id d7mr53733253wmi.43.1470038526527; Mon, 01 Aug 2016 01:02:06 -0700 (PDT) Received: from localhost.localdomain (3.red-81-34-118.dynamicip.rima-tde.net. [81.34.118.3]) by smtp.gmail.com with ESMTPSA id m62sm15671943wmm.24.2016.08.01.01.02.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Aug 2016 01:02:05 -0700 (PDT) From: Ard Biesheuvel To: steven.shi@intel.com, yonghong.zhu@intel.com, liming.gao@intel.com, jordan.l.justen@intel.com, edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, lersek@redhat.com, Ard Biesheuvel Date: Mon, 1 Aug 2016 10:01:37 +0200 Message-Id: <1470038497-2536-9-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470038497-2536-1-git-send-email-ard.biesheuvel@linaro.org> References: <1470038497-2536-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH v5 8/8] BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO mode X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2016 08:02:08 -0000 This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and AARCH64. Due to the fact that the GCC project switched to a new numbering scheme where the first digit is now incremented for every major release, the new toolchain is simply called 'GCC5', and is intended to support all GCC v5.x releases. Since IA32 and X64 enable compiler optimizations (-Os) for both DEBUG and RELEASE builds, LTO support is equally enabled for both targets. On ARM and AARCH64, DEBUG builds are not optimized, and so the LTO optimizations are only enabled for RELEASE. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Jordan Justen --- BaseTools/Conf/tools_def.template | 164 ++++++++++++++++++++ 1 file changed, 164 insertions(+) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 10ac21e42c8f..314adaf6bfa8 100644 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -197,6 +197,9 @@ DEFINE GCC48_X64_PREFIX = ENV(GCC48_BIN) DEFINE GCC49_IA32_PREFIX = ENV(GCC49_BIN) DEFINE GCC49_X64_PREFIX = ENV(GCC49_BIN) +DEFINE GCC5_IA32_PREFIX = ENV(GCC5_BIN) +DEFINE GCC5_X64_PREFIX = ENV(GCC5_BIN) + DEFINE UNIX_IASL_BIN = ENV(IASL_PREFIX)iasl DEFINE WIN_ASL_BIN_DIR = C:\ASL DEFINE WIN_IASL_BIN = DEF(WIN_ASL_BIN_DIR)\iasl.exe @@ -366,6 +369,12 @@ DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G # Required to build platforms or ACPI tables: # Intel(r) ACPI Compiler from # https://acpica.org/downloads +# GCC5 -Linux,Windows- Requires: +# GCC 5 with LTO support, targeting x86_64-linux-gnu, aarch64-linux-gnu, or arm-linux-gnueabi +# Optional: +# Required to build platforms or ACPI tables: +# Intel(r) ACPI Compiler from +# https://acpica.org/downloads # CLANG35 -Linux,Windows- Requires: # Clang v3.5 or later, and GNU binutils targeting aarch64-linux-gnu or arm-linux-gnueabi # Optional: @@ -4452,6 +4461,27 @@ DEFINE GCC49_AARCH64_DLINK2_FLAGS = DEF(GCC48_AARCH64_DLINK2_FLAGS) DEFINE GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS) DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS) +DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -flto -fno-builtin +DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto -fno-builtin +DEFINE GCC5_IA32_X64_DLINK_COMMON = DEF(GCC49_IA32_X64_DLINK_COMMON) +DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) +DEFINE GCC5_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -flto +DEFINE GCC5_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS) +DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) -flto +DEFINE GCC5_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS) +DEFINE GCC5_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) +DEFINE GCC5_ARM_ASM_FLAGS = DEF(GCC49_ARM_ASM_FLAGS) +DEFINE GCC5_AARCH64_ASM_FLAGS = DEF(GCC49_AARCH64_ASM_FLAGS) +DEFINE GCC5_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) +DEFINE GCC5_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS) +DEFINE GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC49_AARCH64_CC_XIPFLAGS) +DEFINE GCC5_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS) -flto +DEFINE GCC5_ARM_DLINK2_FLAGS = DEF(GCC49_ARM_DLINK2_FLAGS) +DEFINE GCC5_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) -flto +DEFINE GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC49_AARCH64_DLINK2_FLAGS) +DEFINE GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC49_ARM_ASLDLINK_FLAGS) +DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS) + #################################################################################### # # Unix GCC And Intel Linux ACPI Compiler @@ -5186,6 +5216,140 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) #################################################################################### # +# GCC 5 - This configuration is used to compile under Linux to produce +# PE/COFF binaries using GCC 5 +# +#################################################################################### +*_GCC5_*_*_FAMILY = GCC + +*_GCC5_*_MAKE_PATH = DEF(GCC5_IA32_PREFIX)make +*_GCC5_*_*_DLL = ENV(GCC5_DLL) +*_GCC5_*_ASL_PATH = DEF(UNIX_IASL_BIN) + +*_GCC5_*_PP_FLAGS = DEF(GCC_PP_FLAGS) +*_GCC5_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) +*_GCC5_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) +*_GCC5_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) +*_GCC5_*_APP_FLAGS = +*_GCC5_*_ASL_FLAGS = DEF(IASL_FLAGS) +*_GCC5_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS) + +################## +# GCC5 IA32 definitions +################## +*_GCC5_IA32_OBJCOPY_PATH = DEF(GCC5_IA32_PREFIX)objcopy +*_GCC5_IA32_CC_PATH = DEF(GCC5_IA32_PREFIX)gcc +*_GCC5_IA32_SLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc-ar +*_GCC5_IA32_DLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc +*_GCC5_IA32_ASLDLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc +*_GCC5_IA32_ASM_PATH = DEF(GCC5_IA32_PREFIX)gcc +*_GCC5_IA32_PP_PATH = DEF(GCC5_IA32_PREFIX)gcc +*_GCC5_IA32_VFRPP_PATH = DEF(GCC5_IA32_PREFIX)gcc +*_GCC5_IA32_ASLCC_PATH = DEF(GCC5_IA32_PREFIX)gcc +*_GCC5_IA32_ASLPP_PATH = DEF(GCC5_IA32_PREFIX)gcc +*_GCC5_IA32_RC_PATH = DEF(GCC5_IA32_PREFIX)objcopy + +*_GCC5_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto +*_GCC5_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 +*_GCC5_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 +*_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os -Wl,-m,elf_i386,--oformat=elf32-i386 +*_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) +*_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) +*_GCC5_IA32_OBJCOPY_FLAGS = +*_GCC5_IA32_NASM_FLAGS = -f elf32 + + DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os +RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable + +################## +# GCC5 X64 definitions +################## +*_GCC5_X64_OBJCOPY_PATH = DEF(GCC5_X64_PREFIX)objcopy +*_GCC5_X64_CC_PATH = DEF(GCC5_X64_PREFIX)gcc +*_GCC5_X64_SLINK_PATH = DEF(GCC5_X64_PREFIX)gcc-ar +*_GCC5_X64_DLINK_PATH = DEF(GCC5_X64_PREFIX)gcc +*_GCC5_X64_ASLDLINK_PATH = DEF(GCC5_X64_PREFIX)gcc +*_GCC5_X64_ASM_PATH = DEF(GCC5_X64_PREFIX)gcc +*_GCC5_X64_PP_PATH = DEF(GCC5_X64_PREFIX)gcc +*_GCC5_X64_VFRPP_PATH = DEF(GCC5_X64_PREFIX)gcc +*_GCC5_X64_ASLCC_PATH = DEF(GCC5_X64_PREFIX)gcc +*_GCC5_X64_ASLPP_PATH = DEF(GCC5_X64_PREFIX)gcc +*_GCC5_X64_RC_PATH = DEF(GCC5_X64_PREFIX)objcopy + +*_GCC5_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto +*_GCC5_X64_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64 +*_GCC5_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 +*_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os +*_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) +*_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) +*_GCC5_X64_OBJCOPY_FLAGS = +*_GCC5_X64_NASM_FLAGS = -f elf64 + + DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) +RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -Wno-unused-but-set-variable + +################## +# GCC5 ARM definitions +################## +*_GCC5_ARM_CC_PATH = ENV(GCC5_ARM_PREFIX)gcc +*_GCC5_ARM_SLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc-ar +*_GCC5_ARM_DLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc +*_GCC5_ARM_ASLDLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc +*_GCC5_ARM_ASM_PATH = ENV(GCC5_ARM_PREFIX)gcc +*_GCC5_ARM_PP_PATH = ENV(GCC5_ARM_PREFIX)gcc +*_GCC5_ARM_VFRPP_PATH = ENV(GCC5_ARM_PREFIX)gcc +*_GCC5_ARM_ASLCC_PATH = ENV(GCC5_ARM_PREFIX)gcc +*_GCC5_ARM_ASLPP_PATH = ENV(GCC5_ARM_PREFIX)gcc +*_GCC5_ARM_RC_PATH = ENV(GCC5_ARM_PREFIX)objcopy + +*_GCC5_ARM_ARCHCC_FLAGS = -mthumb +*_GCC5_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto +*_GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC5_ARM_ASLDLINK_FLAGS) +*_GCC5_ARM_ASM_FLAGS = DEF(GCC5_ARM_ASM_FLAGS) +*_GCC5_ARM_DLINK2_FLAGS = DEF(GCC5_ARM_DLINK2_FLAGS) +*_GCC5_ARM_PLATFORM_FLAGS = -march=armv7-a +*_GCC5_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) +*_GCC5_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS) +*_GCC5_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) + + DEBUG_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0 +RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable + + DEBUG_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) +RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm + +################## +# GCC5 AARCH64 definitions +################## +*_GCC5_AARCH64_CC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc +*_GCC5_AARCH64_SLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc-ar +*_GCC5_AARCH64_DLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc +*_GCC5_AARCH64_ASLDLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc +*_GCC5_AARCH64_ASM_PATH = ENV(GCC5_AARCH64_PREFIX)gcc +*_GCC5_AARCH64_PP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc +*_GCC5_AARCH64_VFRPP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc +*_GCC5_AARCH64_ASLCC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc +*_GCC5_AARCH64_ASLPP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc +*_GCC5_AARCH64_RC_PATH = ENV(GCC5_AARCH64_PREFIX)objcopy + +*_GCC5_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto +*_GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC5_AARCH64_ASLDLINK_FLAGS) +*_GCC5_AARCH64_ASM_FLAGS = DEF(GCC5_AARCH64_ASM_FLAGS) +*_GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC5_AARCH64_DLINK2_FLAGS) +*_GCC5_AARCH64_PLATFORM_FLAGS = +*_GCC5_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS) +*_GCC5_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS) +*_GCC5_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) +*_GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC5_AARCH64_CC_XIPFLAGS) + + DEBUG_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -O0 -mcmodel=small + DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 + +RELEASE_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -mcmodel=tiny +RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 + +#################################################################################### +# # CLANG35 - This configuration is used to compile under Linux to produce # PE/COFF binaries using the clang compiler and assembler (v3.5 and up) # and GNU linker -- 2.7.4