[edk2-devel] [Patch 11/12] OvmfPkg: Enable CLANG9 tool chain

Laszlo Ersek lersek at redhat.com
Tue Oct 8 22:29:12 UTC 2019


On 10/08/19 17:02, Gao, Liming wrote:
> Laszlo:
> 
>> -----Original Message-----
>> From: Laszlo Ersek <lersek at redhat.com>
>> Sent: Tuesday, October 1, 2019 4:42 AM
>> To: devel at edk2.groups.io; Gao, Liming <liming.gao at intel.com>
>> 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

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48610): https://edk2.groups.io/g/devel/message/48610
Mute This Topic: https://groups.io/mt/34309064/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list