From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 47BF21A1E3E for ; Thu, 29 Sep 2016 11:29:34 -0700 (PDT) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B20F6335F9E; Thu, 29 Sep 2016 18:29:33 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-12.phx2.redhat.com [10.3.116.12]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8TITV3c005784; Thu, 29 Sep 2016 14:29:32 -0400 To: Liming Gao References: <1475158367-13120-1-git-send-email-liming.gao@intel.com> <1475158367-13120-5-git-send-email-liming.gao@intel.com> Cc: edk2-devel@ml01.01.org, Ard Biesheuvel , "Jordan Justen (Intel address)" From: Laszlo Ersek Message-ID: Date: Thu, 29 Sep 2016 20:29:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1475158367-13120-5-git-send-email-liming.gao@intel.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 29 Sep 2016 18:29:33 +0000 (UTC) Subject: Re: [Patch 4/4] BaseTools Makefile: Enable Ofast option for GCC tool chain 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: Thu, 29 Sep 2016 18:29:35 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Hi Liming, On 09/29/16 16:12, Liming Gao wrote: > Enable Ofast option to generate fast code for performance improvement. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Liming Gao > --- > BaseTools/Source/C/Makefiles/header.makefile | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile > index f2041f8..ca2dc2e 100644 > --- a/BaseTools/Source/C/Makefiles/header.makefile > +++ b/BaseTools/Source/C/Makefiles/header.makefile > @@ -44,12 +44,12 @@ ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/ > endif > > INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) > -BUILD_CPPFLAGS = $(INCLUDE) > +BUILD_CPPFLAGS = $(INCLUDE) -Ofast > ifeq ($(DARWIN),Darwin) > # assume clang or clang compatible flags on OS X > -BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -nostdlib -c -g > +BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c -g > else > -BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -nostdlib -c -g > +BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g > endif > BUILD_LFLAGS = > BUILD_CXXFLAGS = > are you sure -Ofast is a good idea? The gcc manual says, -Ofast Disregard strict standards compliance. -Ofast enables all -O3 optimizations. It also enables optimizations that are not valid for all standard-compliant programs. It turns on -ffast-math and the Fortran-specific -fno-protect-parens and -fstack-arrays. To me this sounds quite scary -- I'm worried it might break the base utilities in various obscure ways, which in turn could break the firmware built with these tools in obscure ways. Most upstream projects and GNU/Linux distributions use -O2 for performance-optimized builds. Can you try that please and see if the performance improvements (relative to the current status) are still acceptable? If so, I would strongly prefer -O2 over -Ofast. Also, while building BaseTools with your series applied (using gcc-4.8), I saw one warning issued: > g++ -c -I Pccts/h -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ -Ofast VfrFormPkg.cpp -o VfrFormPkg.o > VfrFormPkg.cpp: In member function 'void CIfrRecordInfoDB::IfrUpdateRecordInfoForDynamicOpcode(BOOLEAN)': > VfrFormPkg.cpp:1360:91: warning: deprecated conversion from string constant to 'CHAR8* {aka char*}' [-Wwrite-strings] > gCVfrErrorHandle.PrintMsg (0, "Error", "Can not find the adjust offset in the record."); ^ Thanks! Laszlo