From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (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 D801D1A1DF4 for ; Tue, 2 Aug 2016 08:02:00 -0700 (PDT) Received: by mail-wm0-x232.google.com with SMTP id q128so413147793wma.1 for ; Tue, 02 Aug 2016 08:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lLz1vbQ5SiAJ9GwBkQL/Djx3LFqhblO8whHUdF8WnoU=; b=A5QbDulUgSn4lyG10/ZSOG35KUmfU4pbgyMARpm87kon1ihOSUt6R2qoXG27mQBRkF SSmOoQrVS6MgLSfwOOAMBfvGf/aPKpeqnziwbLOLdoNMvIBk9rjyQxe2W5a3jImU/TWY xkrq39SuX+s9wfJp5JxdGzKUjs/ovG/+86OVQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lLz1vbQ5SiAJ9GwBkQL/Djx3LFqhblO8whHUdF8WnoU=; b=Kpgv2A6aQX98B0h2YvP+Znhkt1qzZVK9Y5Lk+y6wIoYs6McriD/OtmVtMxkDYG+C8l L1zM0NZeRtrt/yzP6uJJI5YOBcghW3x/vXPGqbUT9MIZuF8jpLErlabKSVO8hdolAaKJ kVLl/iqE7nvVnRNodD62OzTYuO0q5N34YaxFDzy/b7EEj6dLQ9e9J2dLpierFAd2cM0T GI72xbyfie0DQmm68FjN+sw/45VOliZcDj/BXmD2BVSjAR0/3gdpeyedcazWxhqP+IZj c0Wl9278cha9MkXo4KxuR/JxYpdjZIvMzJ9MXdwaT4PUbnrxvOsYIgtN8UZrnRzE0pG2 gAyA== X-Gm-Message-State: AEkoouv42yEwH5OmucjxkUaUF8Y9LMStIjqN2bslRp6+c6hBGpg9FwtwJMaC+8+48td/P1+Q X-Received: by 10.194.144.114 with SMTP id sl18mr56479102wjb.123.1470150119294; Tue, 02 Aug 2016 08:01:59 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id x133sm3449126wmf.16.2016.08.02.08.01.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Aug 2016 08:01:58 -0700 (PDT) Date: Tue, 2 Aug 2016 16:01:56 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: yonghong.zhu@intel.com, liming.gao@intel.com, jordan.l.justen@intel.com, edk2-devel@lists.01.org, sigmaepsilon92@gmail.com Message-ID: <20160802150156.GW31760@bivouac.eciton.net> References: <1470148772-15712-1-git-send-email-ard.biesheuvel@linaro.org> <1470148772-15712-2-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <1470148772-15712-2-git-send-email-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [PATCH 1/3] BaseTools GCC: move -c compiler flag to build rules 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: Tue, 02 Aug 2016 15:02:01 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Aug 02, 2016 at 04:39:30PM +0200, Ard Biesheuvel wrote: > In order to be able to share the compiler flags with the linker (which > is required for LTO since it involves the linker doing code generation > based on the LTO bytecode), move the -c GCC argument to the build rules, > and drop it from the GCC CC_FLAGS definitions in tools_def. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > --- > BaseTools/Conf/build_rule.template | 16 +++++++++------- > BaseTools/Conf/tools_def.template | 10 +++++----- > 2 files changed, 14 insertions(+), 12 deletions(-) > > diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template > index 9adf3918e42e..7d9f8ca075c2 100644 > --- a/BaseTools/Conf/build_rule.template > +++ b/BaseTools/Conf/build_rule.template > @@ -130,7 +130,10 @@ > > "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src} > > - > + > + "$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src} > + > + Apart from the slightly larger patch set, is there any reason not to split out the RVCT handling here and fix up tools_def.template for it too? / Leif > # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues > "$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src} > > @@ -156,9 +159,8 @@ > > "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src} > > - > - # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues > - "$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src} > + > + "$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src} > "$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst} > > [C-Code-File.BASE.AARCH64,C-Code-File.SEC.AARCH64,C-Code-File.PEI_CORE.AARCH64,C-Code-File.PEIM.AARCH64] > @@ -172,7 +174,7 @@ > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj > > > - "$(CC)" $(CC_FLAGS) $(CC_XIPFLAGS) -o ${dst} $(INC) ${src} > + "$(CC)" $(CC_FLAGS) $(CC_XIPFLAGS) -c -o ${dst} $(INC) ${src} > > [C-Header-File] > > @@ -446,7 +448,7 @@ > "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS) > > > - "$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src} > + "$(ASLCC)" -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src} > "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj > "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS) > > @@ -466,7 +468,7 @@ > "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS) > > > - "$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src} > + "$(ASLCC)" -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src} > "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj > "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS) > > diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template > index fd9eccb9b92a..289e75cc3be6 100644 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -4330,7 +4330,7 @@ NOOPT_DDK3790xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF > DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug > RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG = > > -DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -c -include AutoGen.h -fno-common > +DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common > DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe > DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe > DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency > @@ -4362,7 +4362,7 @@ DEFINE GCC_IPF_RC_FLAGS = -I binary -O elf64-ia64-little -B ia64 > DEFINE GCC_ARM_RC_FLAGS = -I binary -O elf32-littlearm -B arm --rename-section .data=.hii > DEFINE GCC_AARCH64_RC_FLAGS = -I binary -O elf64-littleaarch64 -B aarch64 --rename-section .data=.hii > > -DEFINE GCC44_ALL_CC_FLAGS = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -c -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings > +DEFINE GCC44_ALL_CC_FLAGS = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings > DEFINE GCC44_IA32_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables > DEFINE GCC44_X64_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -Os -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables > DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20 > @@ -5677,7 +5677,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) > *_ELFGCC_IA32_ASLDLINK_PATH = DEF(ELFGCC_BIN)/ld > *_ELFGCC_IA32_RC_PATH = DEF(ELFGCC_BIN)/objcopy > > -*_ELFGCC_IA32_CC_FLAGS = -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings > +*_ELFGCC_IA32_CC_FLAGS = -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings > *_ELFGCC_IA32_SLINK_FLAGS = > *_ELFGCC_IA32_DLINK_FLAGS = -melf_i386 -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map > #*_ELFGCC_IA32_DLINK_FLAGS = -melf_i386 -nostdlib -n -q -Ttext 0x220 --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) > @@ -5702,7 +5702,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) > *_ELFGCC_X64_VFRPP_PATH = DEF(ELFGCC_BIN)/gcc > *_ELFGCC_X64_RC_PATH = DEF(ELFGCC_BIN)/objcopy > > -*_ELFGCC_X64_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-address -Wno-array-bounds -c -include AutoGen.h -D_EFI_P64 > +*_ELFGCC_X64_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-address -Wno-array-bounds -include AutoGen.h -D_EFI_P64 > *_ELFGCC_X64_DLINK_FLAGS = -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map > *_ELFGCC_X64_SLINK_FLAGS = > *_ELFGCC_X64_ASM_FLAGS = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h > @@ -5725,7 +5725,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) > *_ELFGCC_IPF_VFRPP_PATH = DEF(ELFGCC_BIN)/gcc > *_ELFGCC_IPF_RC_PATH = DEF(ELFGCC_BIN)/objcopy > > -*_ELFGCC_IPF_CC_FLAGS = -Os -fshort-wchar -Wall -Werror -c -include AutoGen.h -D_EFI_P64 > +*_ELFGCC_IPF_CC_FLAGS = -Os -fshort-wchar -Wall -Werror -include AutoGen.h -D_EFI_P64 > *_ELFGCC_IPF_DLINK_FLAGS = -nostdlib --shared --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map > *_ELFGCC_IPF_SLINK_FLAGS = > *_ELFGCC_IPF_ASM_FLAGS = -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h > -- > 2.7.4 >