From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.groups.io with SMTP id smtpd.web12.132.1570573754557550824 for ; Tue, 08 Oct 2019 15:29:14 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2EB1810C0949; Tue, 8 Oct 2019 22:29:14 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-109.rdu2.redhat.com [10.10.120.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57D4B5D71C; Tue, 8 Oct 2019 22:29:13 +0000 (UTC) Subject: Re: [edk2-devel] [Patch 11/12] OvmfPkg: Enable CLANG9 tool chain To: "Gao, Liming" References: <1569570395-11240-1-git-send-email-liming.gao@intel.com> <1569570395-11240-12-git-send-email-liming.gao@intel.com> <4c27bdc4-60b4-26bf-c416-c02b69ef8051@redhat.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E5124FA@SHSMSX104.ccr.corp.intel.com> From: "Laszlo Ersek" Cc: "devel@edk2.groups.io" Message-ID: <7fc791fe-9d08-9763-ecc9-529e88b621c6@redhat.com> Date: Wed, 9 Oct 2019 00:29:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E5124FA@SHSMSX104.ccr.corp.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Tue, 08 Oct 2019 22:29:14 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/08/19 17:02, Gao, Liming wrote: > Laszlo: > >> -----Original Message----- >> From: Laszlo Ersek >> Sent: Tuesday, October 1, 2019 4:42 AM >> To: devel@edk2.groups.io; Gao, Liming >> Subject: Re: [edk2-devel] [Patch 11/12] OvmfPkg: Enable CLANG9 tool chain >> >> Hi Liming, >> >> On 09/27/19 09:46, Liming Gao wrote: >>> 1. Apply CLANG9 Linker option. >> >> I'm confused by this, in two regards. >> >> - Why do we refer to CLANG9 first as being in the GCC toolchain family >> (see near mmx/sse), and then under a totally different family name >> (CLANGPE?) > > CLANGPE is used to override GCC option. GCC is used to append GCC options. > You can see XCODE5 take the same way. > CLANG9 tool chain doesn't recognize -z common-page-size=0x1000 option. > So, here CLANGPE is used to specify /ALIGN:4096 option. Wait, so the "GCC" toolchain *family* applies to: - actual GCC toolchains (such as GCC48, GCC49, GCC5) - XCODE toolchains (such as XCODE5) - CLANG toolchains (such as CLANG9) but the "XCODE" toolchain *family* only applies to XCODE toolchains (such as XCODE5), and similarly, the CLANGPE toolchain *family* only applies to CLANG toolchains (such as CLANG9)? Put differently, is XCODE in two toolchain families at the same time (GCC and XCODE)? Similarly, is CLANG9 in two toolchain families at the same time (GCC and CLANGPE)? Wait... from "BaseTools/Conf/tools_def.template": > # > # > # XCODE5 support > # > > *_XCODE5_*_*_FAMILY = GCC > *_XCODE5_*_*_BUILDRULEFAMILY = XCODE This makes me very unhappy. I don't know how anyone can follow this. What is the difference between "FAMILY" and "BUILDRULEFAMILY"? When I see GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 XCODE:*_*_*_DLINK_FLAGS = how can I know that the first line applies due to "FAMILY", but the second line also applies due to "BUILDRULEFAMILY" (and overrides the first line)? Hmmm.... https://edk2-docs.gitbooks.io/edk-ii-build-specification/5_meta-data_file_specifications/52_tools_def_txt.html """ FAMILY -- A flag to the build command that will be used to ensure the correct commands and flags are used in the generated Makefile or GNUMakefile, as well as to use the correct options for independent tools, such as the ACPI compiler. This is typically used to identify the type of Makefile that needs to be generated. BUILDRULEFAMILY -- This flag is used by some tool chain tags to set a special FAMILY value when processing the build_rule.txt file. Normally, the FAMILY attribute is used to identify the type of makefile the tools need to generate. Tools such as XCODE will use GCC as the FAMILY, but uses different (from GCC) processing rules. If present and if a build rule (in build_rules.txt) contains an attribute with the value specified in this entry, that rule will be processed and the rule with the FAMILY attribute will be ignored. """ Well, I can't say that it's entirely clear to me what applies when. :/ In particular because in this patch, we don't use BUILDRULEFAMILY for overrides in "build_rules.txt", we use BUILDRULEFAMILY for overrides in DSC files. Anyway, let's say that we use the following syntax for linker flag overrides: [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 XCODE:*_*_*_DLINK_FLAGS = CLANGPE: *_*_*_DLINK_FLAGS = /ALIGN:4096 Fine. But then, why don't we similarly use: [BuildOptions] GCC:*_*_*_CC_FLAGS = -mno-mmx -mno-sse XCODE:*_*_*_CC_FLAGS = CLANGPE:*_*_*_CC_FLAGS = for CC flag overrides? Because, the proposal is: !if $(TOOL_CHAIN_TAG) != "XCODE5" && $(TOOL_CHAIN_TAG) != "CLANG9" GCC:*_*_*_CC_FLAGS = -mno-mmx -mno-sse !endif I mean, in one case (for the linker flags), we rely on BUILDRULEFAMILY for specifying the override. But in the other case (for the C compilation flags), we do not rely on BUILDRULEFAMILY; instead we check $(TOOL_CHAIN_TAG). Is this difference justified? Why? The rest of your answers sounds good to me. Thanks! Laszlo