From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mx.groups.io with SMTP id smtpd.web12.19304.1656549749835792115 for ; Wed, 29 Jun 2022 17:42:30 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@canonical.com header.s=20210705 header.b=RyCmK1QM; spf=pass (domain: canonical.com, ip: 185.125.188.122, mailfrom: dann.frazier@canonical.com) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C68C83F839 for ; Thu, 30 Jun 2022 00:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1656549747; bh=kizQXrXKXfuBWy6fQ6pTIjZ1nmHgHwLoAFCnfW2d5zA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=RyCmK1QMb+qNqonCBfKyVurYUy/MU9UplfoqRmiiLFPR/K2LaEpvQBHBGdTNlSqiI F36+sSqQz3Wne8sFx7Q+86kuRLQBHefeBdGlR8LBfrauNfhyjsH+TZYHewIz2y6Xc5 FOer7dhCV5k+cwpGZcmy78j2ABO38jJAyVikaaA4rIMtFZeoe7wUuOEphjYi31XnQS ydnvkJoHgW+2//nr2ohuYYlHUroNRe14WVH8QnsHd9Qeg2gBcVbi7Vt+Jl6cRxwAWm gRyYKhFXEvo4Hkcwpkk2OdK0B2gUbHmPb8DchU3q24CLhfSlXPsJEDmxR56N29XDjR QwPiWfROFF5Uw== Received: by mail-wm1-f71.google.com with SMTP id v125-20020a1cac83000000b0039c832fbd02so550048wme.4 for ; Wed, 29 Jun 2022 17:42:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kizQXrXKXfuBWy6fQ6pTIjZ1nmHgHwLoAFCnfW2d5zA=; b=A9zKSFXhQUsEu0WYhi7SWOLwUKOJw1DNvrw4qy4YJ5DMN7hbHFR8yYIYB+2Vu+P34K hC61u8pInwrjxnP41NCB5G+ni/wJ5p1XJ6z0JnLhJ1IFwC9PaMhpd+dCe2sXdbZQYwxs jgeyi8TXHkhQRSB5XC9zuIUl5RUO9B42qifZnLkgqHjAX7CLZ7Vo0tVSPU3v+U9sMXZM LTXgR4LVFAhVMNJkBd7ZPBMlQn9gsbUi5vZae7DvrwpWkoWxX3Acl5vVQLyz+vZIt+XQ UqsWdT3NcZc7aRFK/otRLA78EEolPCKkKrPmev5QKJbrX3B3c8Ecu79Gb3pWA8o1oo8f W5ew== X-Gm-Message-State: AJIora/uo3H6PLFpKrln+vFQVZYgBihmxLBEs9cvhFV9b4E1NijUcC1j EbZPNUoTd/AvvWPdsw6tqziniZKcEAtDRFhsBlVD8QTvmuyEcXglj6OMX0DX7WTkY+BRKwRODuY hZKoRTFgLIWTEM9rAVyyTga2t7eo7fecWt4L1P/COP2kelVA= X-Received: by 2002:a05:6000:144d:b0:21b:b3cc:162e with SMTP id v13-20020a056000144d00b0021bb3cc162emr5731211wrx.433.1656549744630; Wed, 29 Jun 2022 17:42:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vOcYoIiZGkTxd0I4M7rD2ZbihWw8zwb0EKyQxd96agYzPlgjW5ZWe8SOeiX29AjVUZbuZghtBroi+GOd9l+M4= X-Received: by 2002:a05:6000:144d:b0:21b:b3cc:162e with SMTP id v13-20020a056000144d00b0021bb3cc162emr5731194wrx.433.1656549744311; Wed, 29 Jun 2022 17:42:24 -0700 (PDT) MIME-Version: 1.0 References: <20220610180918.673822-1-dannf@debian.org> In-Reply-To: From: "dann frazier" Date: Wed, 29 Jun 2022 18:42:13 -0600 Message-ID: Subject: Re: [edk2-devel] [PATCH] BaseTools/tools_def.txt: Add -march=x86-64 for X64 CLANG and GCC targets To: "Kinney, Michael D" Cc: edk2-devel-groups-io , Pedro Falcato , "Feng, Bob C" , "Gao, Liming" , "Chen, Christine" Content-Type: multipart/alternative; boundary="00000000000010209b05e29f8b50" --00000000000010209b05e29f8b50 Content-Type: text/plain; charset="UTF-8" On Wed, Jun 29, 2022, 18:10 Kinney, Michael D wrote: > What is the default when -march is not specified? > Whatever your compiler was built to target by default. Today that's x86-64 pretty much everywhere. But it's possible some distros may change that, and I don't think we want edk2 builds changing if they happen to be built on one of them. -dann Mike > > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of dann > frazier > > Sent: Wednesday, June 29, 2022 4:25 PM > > To: Pedro Falcato > > Cc: edk2-devel-groups-io ; Feng, Bob C < > bob.c.feng@intel.com>; Gao, Liming ; > > Chen, Christine > > Subject: Re: [edk2-devel] [PATCH] BaseTools/tools_def.txt: Add > -march=x86-64 for X64 CLANG and GCC targets > > > > On Wed, Jun 29, 2022 at 11:06:01PM +0100, Pedro Falcato wrote: > > > This may be a strong opinion but I would consider toolchains that > > > explicitly change the default -march from the well understood x86-64 > (which > > > all 64-bit processors support) to be totally broken. If a distro wants > to > > > switch the -march for the packages, override CFLAGS :) > > > > Opinion noted. But is there a downside to edk2 being explicit about > > its target CPU level on x86-64, given it already does so for IA32 and > > ARM? > > > > -dann > > > > > On Wed, Jun 29, 2022 at 10:57 PM dann frazier < > dann.frazier@canonical.com> > > > wrote: > > > > > > > Ping on this. Would it be more palatable if I limited the change only > > > > to tested toolchains (gcc/clang)? Alternatively, is there a way to > > > > submit this code to CI to verify the !(gcc|clang) variants? > > > > > > > > -dann > > > > > > > > On Fri, Jun 10, 2022 at 12:09:18PM -0600, dann frazier wrote: > > > > > From: dann frazier > > > > > > > > > > Some Linux distributions are experimenting with builds that target > a > > > > > higher x86-64 psABI, such as x86-64-v3. To avoid inheriting these > > > > > compiler defaults in edk2 builds, and therefore breaking > compatibility > > > > > with machines using older CPUs, explicitly target the generic > x86-64 > > > > > psABI. This is similar to how we explicitly specify the cpu type > for > > > > > some other architectures (-march=i586 for IA32, -march=armv7-a for > ARM). > > > > > > > > > > Spot tested with OVMF builds using GCC5 and CLANG38. > > > > > > > > > > Signed-off-by: dann frazier > > > > > --- > > > > > BaseTools/Conf/tools_def.template | 20 ++++++++++---------- > > > > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > > > > > > > diff --git a/BaseTools/Conf/tools_def.template > > > > b/BaseTools/Conf/tools_def.template > > > > > index adcd23f727..569d16fb3e 100755 > > > > > --- a/BaseTools/Conf/tools_def.template > > > > > +++ b/BaseTools/Conf/tools_def.template > > > > > @@ -1885,7 +1885,7 @@ DEFINE GCC_DEPS_FLAGS = -MMD -MF > > > > $@.deps > > > > > DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) > > > > -ffunction-sections -fdata-sections > -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings > > > > > DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib > > > > -Wl,-n,-q,--gc-sections -z common-page-size=0x20 > > > > > DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) > -m32 > > > > -march=i586 -malign-double -fno-stack-protector -D EFI32 > > > > -fno-asynchronous-unwind-tables -Wno-address > > > > > -DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) > -m64 > > > > -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" > > > > -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small > -fpie > > > > -fno-asynchronous-unwind-tables -Wno-address > > > > > +DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" > > > > -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small > -fpie > > > > -fno-asynchronous-unwind-tables -Wno-address > > > > > DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = > DEF(GCC48_IA32_X64_DLINK_COMMON) > > > > -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable > > > > > DEFINE GCC48_IA32_X64_DLINK_FLAGS = > DEF(GCC48_IA32_X64_DLINK_COMMON) > > > > -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) > > > > -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive > > > > > DEFINE GCC48_IA32_DLINK2_FLAGS = > > > > -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON) > > > > > @@ -2613,15 +2613,15 @@ NOOPT_CLANG38_IA32_DLINK2_FLAGS = > > > > DEF(GCC5_IA32_DLINK2_FLAGS) -O0 > > > > > *_CLANG38_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) > > > > DEF(CLANG38_X64_TARGET) > > > > > *_CLANG38_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) > > > > DEF(CLANG38_X64_TARGET) > > > > > > > > > > -DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small > -fpie -Oz > > > > -flto DEF(CLANG38_X64_TARGET) -g > > > > > +DEBUG_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone > > > > -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g > > > > > DEBUG_CLANG38_X64_DLINK_FLAGS = > DEF(GCC5_IA32_X64_DLINK_FLAGS) > > > > -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie > > > > -mcmodel=small > > > > > DEBUG_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) > -O3 > > > > > > > > > > -RELEASE_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small > -fpie -Oz > > > > -flto DEF(CLANG38_X64_TARGET) > > > > > +RELEASE_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone > > > > -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) > > > > > RELEASE_CLANG38_X64_DLINK_FLAGS = > DEF(GCC5_IA32_X64_DLINK_FLAGS) > > > > -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie > > > > -mcmodel=small > > > > > RELEASE_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) > -O3 > > > > > > > > > > -NOOPT_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small > -fpie -O0 > > > > DEF(CLANG38_X64_TARGET) -g > > > > > +NOOPT_CLANG38_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone > > > > -mcmodel=small -fpie -O0 DEF(CLANG38_X64_TARGET) -g > > > > > NOOPT_CLANG38_X64_DLINK_FLAGS = > DEF(GCC5_IA32_X64_DLINK_FLAGS) > > > > -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie > -mcmodel=small > > > > > NOOPT_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) > -O0 > > > > > > > > > > @@ -2798,17 +2798,17 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS = > > > > > *_CLANGPDB_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) > > > > DEF(CLANGPDB_X64_TARGET) > > > > > *_CLANGPDB_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) > > > > DEF(CLANGPDB_X64_TARGET) > > > > > > > > > > -DEBUG_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m64 > > > > "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -Oz > -flto > > > > DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables > > > > > +DEBUG_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone > > > > -mcmodel=small -Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodeview > > > > -funwind-tables > > > > > DEBUG_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > /Machine:X64 /DLL > > > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO > > > > /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap > > > > > DEBUG_CLANGPDB_X64_DLINK2_FLAGS = > > > > > DEBUG_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable > > > > > > > > > > -RELEASE_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m64 > > > > "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -Oz > -flto > > > > DEF(CLANGPDB_X64_TARGET) -fno-unwind-tables > > > > > +RELEASE_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone > > > > -mcmodel=small -Oz -flto DEF(CLANGPDB_X64_TARGET) -fno-unwind-tables > > > > > RELEASE_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > > > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /ALIGN:32 > /FILEALIGN:32 > > > > /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL > > > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO > > > > /BASE:0 /MERGE:.rdata=.data /MLLVM:-exception-model=wineh /lldmap > > > > > RELEASE_CLANGPDB_X64_DLINK2_FLAGS = > > > > > RELEASE_CLANGPDB_X64_GENFW_FLAGS = > > > > > > > > > > -NOOPT_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m64 > > > > "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -O0 > > > > DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables > > > > > +NOOPT_CLANGPDB_X64_CC_FLAGS = DEF(CLANGPDB_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone > > > > -mcmodel=small -O0 DEF(CLANGPDB_X64_TARGET) -gcodeview > -funwind-tables > > > > > NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > > > > /IGNORE:4001 /OPT:REF /OPT:ICF=10 /ALIGN:32 /FILEALIGN:32 > /Machine:X64 /DLL > > > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER > /SAFESEH:NO > > > > /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=wineh /lldmap > > > > > NOOPT_CLANGPDB_X64_DLINK2_FLAGS = > > > > > NOOPT_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable > > > > > @@ -2901,15 +2901,15 @@ NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = > > > > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 - > > > > > *_CLANGDWARF_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) > > > > DEF(CLANG38_X64_TARGET) > > > > > *_CLANGDWARF_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) > > > > DEF(CLANG38_X64_TARGET) > > > > > > > > > > -DEBUG_CLANGDWARF_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small > -fpie -Oz > > > > -flto DEF(CLANG38_X64_TARGET) -g > > > > > +DEBUG_CLANGDWARF_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone > > > > -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g > > > > > DEBUG_CLANGDWARF_X64_DLINK_FLAGS = > > > > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_x86_64 > > > > -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=small > > > > -Wl,--apply-dynamic-relocs > > > > > DEBUG_CLANGDWARF_X64_DLINK2_FLAGS = > > > > DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O3 -fuse-ld=lld > > > > > > > > > > -RELEASE_CLANGDWARF_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small > -fpie -Oz > > > > -flto DEF(CLANG38_X64_TARGET) > > > > > +RELEASE_CLANGDWARF_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone > > > > -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) > > > > > RELEASE_CLANGDWARF_X64_DLINK_FLAGS = > > > > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_x86_64 > > > > -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=small > > > > -Wl,--apply-dynamic-relocs > > > > > RELEASE_CLANGDWARF_X64_DLINK2_FLAGS = > > > > DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O3 -fuse-ld=lld > > > > > > > > > > -NOOPT_CLANGDWARF_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small > -fpie -O0 > > > > DEF(CLANG38_X64_TARGET) -g > > > > > +NOOPT_CLANGDWARF_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) > -m64 > > > > -march=x86-64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone > > > > -mcmodel=small -fpie -O0 DEF(CLANG38_X64_TARGET) -g > > > > > NOOPT_CLANGDWARF_X64_DLINK_FLAGS = > > > > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 > > > > -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=small > > > > -Wl,--apply-dynamic-relocs > > > > > NOOPT_CLANGDWARF_X64_DLINK2_FLAGS = > > > > DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O0 -fuse-ld=lld > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --00000000000010209b05e29f8b50 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, Jun 29, 2022, 18:10 Kinney, Michael D <michael.d.kinney@intel.com>= ; wrote:
What is the default when -= march is not specified?

<= /div>
Whatever your compiler was built to target by defaul= t. Today that's x86-64 pretty much everywhere. But it's possible so= me distros may change that, and I don't think we want edk2 builds chang= ing if they happen to be built on one of them.

<= /div>
=C2=A0 -dann

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On= Behalf Of dann frazier
> Sent: Wednesday, June 29, 2022 4:25 PM
> To: Pedro Falcato <pedro.falcato@gmail.com>
> Cc: edk2-devel-groups-io <devel@edk2.groups.io>; Feng, Bob= C <bob.c.feng@intel.com>; Gao, Liming <gaoliming@byos= oft.com.cn>;
> Chen, Christine <yuwei.chen@intel.com>
> Subject: Re: [edk2-devel] [PATCH] BaseTools/tools_def.txt: Add -march= =3Dx86-64 for X64 CLANG and GCC targets
>
> On Wed, Jun 29, 2022 at 11:06:01PM +0100, Pedro Falcato wrote:
> > This may be a strong opinion but I would consider toolchains that=
> > explicitly change the default -march from the well understood x86= -64 (which
> > all 64-bit processors support) to be totally broken. If a distro = wants to
> > switch the -march for the packages, override CFLAGS :)
>
> Opinion noted. But is there a downside to edk2 being explicit about > its target CPU level on x86-64, given it already does so for IA32 and<= br> > ARM?
>
>=C2=A0 =C2=A0-dann
>
> > On Wed, Jun 29, 2022 at 10:57 PM dann frazier <dann.fr= azier@canonical.com>
> > wrote:
> >
> > > Ping on this. Would it be more palatable if I limited the ch= ange only
> > > to tested toolchains (gcc/clang)? Alternatively, is there a = way to
> > > submit this code to CI to verify the !(gcc|clang) variants?<= br> > > >
> > >=C2=A0 =C2=A0-dann
> > >
> > > On Fri, Jun 10, 2022 at 12:09:18PM -0600, dann frazier wrote= :
> > > > From: dann frazier <dann.frazier@canonical.c= om>
> > > >
> > > > Some Linux distributions are experimenting with builds = that target a
> > > > higher x86-64 psABI, such as x86-64-v3. To avoid inheri= ting these
> > > > compiler defaults in edk2 builds, and therefore breakin= g compatibility
> > > > with machines using older CPUs, explicitly target the g= eneric x86-64
> > > > psABI. This is similar to how we explicitly specify the= cpu type for
> > > > some other architectures (-march=3Di586 for IA32, -marc= h=3Darmv7-a for ARM).
> > > >
> > > > Spot tested with OVMF builds using GCC5 and CLANG38. > > > >
> > > > Signed-off-by: dann frazier <dann.frazier@ca= nonical.com>
> > > > ---
> > > >=C2=A0 BaseTools/Conf/tools_def.template | 20 ++++++++++= ----------
> > > >=C2=A0 1 file changed, 10 insertions(+), 10 deletions(-)=
> > > >
> > > > diff --git a/BaseTools/Conf/tools_def.template
> > > b/BaseTools/Conf/tools_def.template
> > > > index adcd23f727..569d16fb3e 100755
> > > > --- a/BaseTools/Conf/tools_def.template
> > > > +++ b/BaseTools/Conf/tools_def.template
> > > > @@ -1885,7 +1885,7 @@ DEFINE GCC_DEPS_FLAGS=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D -MMD -MF
> > > $@.deps
> > > >=C2=A0 DEFINE GCC48_ALL_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =3D DEF(GCC_ALL_CC_FLAGS)
> > > -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=3D$(= BASE_NAME)Strings
> > > >=C2=A0 DEFINE GCC48_IA32_X64_DLINK_COMMON=C2=A0 =C2=A0= =3D -nostdlib
> > > -Wl,-n,-q,--gc-sections -z common-page-size=3D0x20
> > > >=C2=A0 DEFINE GCC48_IA32_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0=3D DEF(GCC48_ALL_CC_FLAGS) -m32
> > > -march=3Di586 -malign-double -fno-stack-protector -D EFI32 > > > -fno-asynchronous-unwind-tables -Wno-address
> > > > -DEFINE GCC48_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D DEF(GCC48_ALL_CC_FLAGS) -m64
> > > -fno-stack-protector "-DEFIAPI=3D__attribute__((ms_abi)= )"
> > > -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmod= el=3Dsmall -fpie
> > > -fno-asynchronous-unwind-tables -Wno-address
> > > > +DEFINE GCC48_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D DEF(GCC48_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 -fno-stack-protector "-DEFIAPI=3D__attr= ibute__((ms_abi))"
> > > -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmod= el=3Dsmall -fpie
> > > -fno-asynchronous-unwind-tables -Wno-address
> > > >=C2=A0 DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS =3D DEF(GCC4= 8_IA32_X64_DLINK_COMMON)
> > > -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
> > > >=C2=A0 DEFINE GCC48_IA32_X64_DLINK_FLAGS=C2=A0 =C2=A0 = =3D DEF(GCC48_IA32_X64_DLINK_COMMON)
> > > -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
> > > -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive<= br> > > > >=C2=A0 DEFINE GCC48_IA32_DLINK2_FLAGS=C2=A0 =C2=A0 =C2= =A0 =C2=A0=3D
> > > -Wl,--defsym=3DPECOFF_HEADER_SIZE=3D0x220 DEF(GCC_DLINK2_FLA= GS_COMMON)
> > > > @@ -2613,15 +2613,15 @@ NOOPT_CLANG38_IA32_DLINK2_FLAGS= =C2=A0 =C2=A0 =C2=A0=3D
> > > DEF(GCC5_IA32_DLINK2_FLAGS) -O0
> > > >=C2=A0 *_CLANG38_X64_ASLPP_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D DEF(GCC_ASLPP_FLAGS)
> > > DEF(CLANG38_X64_TARGET)
> > > >=C2=A0 *_CLANG38_X64_VFRPP_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D DEF(GCC_VFRPP_FLAGS)
> > > DEF(CLANG38_X64_TARGET)
> > > >
> > > > -DEBUG_CLANG38_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone= -mcmodel=3Dsmall -fpie -Oz
> > > -flto DEF(CLANG38_X64_TARGET) -g
> > > > +DEBUG_CLANG38_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))&quo= t; -mno-red-zone
> > > -mcmodel=3Dsmall -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g<= br> > > > >=C2=A0 DEBUG_CLANG38_X64_DLINK_FLAGS=C2=A0 =C2=A0 =C2=A0= =3D DEF(GCC5_IA32_X64_DLINK_FLAGS)
> > > -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=3Delf64-x86-64 = -Wl,-pie
> > > -mcmodel=3Dsmall
> > > >=C2=A0 DEBUG_CLANG38_X64_DLINK2_FLAGS=C2=A0 =C2=A0 =C2= =A0=3D DEF(GCC5_X64_DLINK2_FLAGS) -O3
> > > >
> > > > -RELEASE_CLANG38_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone= -mcmodel=3Dsmall -fpie -Oz
> > > -flto DEF(CLANG38_X64_TARGET)
> > > > +RELEASE_CLANG38_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))&quo= t; -mno-red-zone
> > > -mcmodel=3Dsmall -fpie -Oz -flto DEF(CLANG38_X64_TARGET)
> > > >=C2=A0 RELEASE_CLANG38_X64_DLINK_FLAGS=C2=A0 =C2=A0 =3D = DEF(GCC5_IA32_X64_DLINK_FLAGS)
> > > -flto -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=3Delf64-x86-64 = -Wl,-pie
> > > -mcmodel=3Dsmall
> > > >=C2=A0 RELEASE_CLANG38_X64_DLINK2_FLAGS=C2=A0 =C2=A0=3D = DEF(GCC5_X64_DLINK2_FLAGS) -O3
> > > >
> > > > -NOOPT_CLANG38_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone= -mcmodel=3Dsmall -fpie -O0
> > > DEF(CLANG38_X64_TARGET) -g
> > > > +NOOPT_CLANG38_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))&quo= t; -mno-red-zone
> > > -mcmodel=3Dsmall -fpie -O0 DEF(CLANG38_X64_TARGET) -g
> > > >=C2=A0 NOOPT_CLANG38_X64_DLINK_FLAGS=C2=A0 =C2=A0 =C2=A0= =3D DEF(GCC5_IA32_X64_DLINK_FLAGS)
> > > -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=3Delf64-x86-64 -Wl,-p= ie -mcmodel=3Dsmall
> > > >=C2=A0 NOOPT_CLANG38_X64_DLINK2_FLAGS=C2=A0 =C2=A0 =C2= =A0=3D DEF(GCC5_X64_DLINK2_FLAGS) -O0
> > > >
> > > > @@ -2798,17 +2798,17 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAG= S=C2=A0 =C2=A0 =C2=A0=3D
> > > >=C2=A0 *_CLANGPDB_X64_ASLPP_FLAGS=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D DEF(GCC_ASLPP_FLAGS)
> > > DEF(CLANGPDB_X64_TARGET)
> > > >=C2=A0 *_CLANGPDB_X64_VFRPP_FLAGS=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D DEF(GCC_VFRPP_FLAGS)
> > > DEF(CLANGPDB_X64_TARGET)
> > > >
> > > > -DEBUG_CLANGPDB_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0=3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64
> > > "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone= -mcmodel=3Dsmall -Oz -flto
> > > DEF(CLANGPDB_X64_TARGET) -gcodeview=C2=A0 -funwind-tables > > > > +DEBUG_CLANGPDB_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0=3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))&quo= t; -mno-red-zone
> > > -mcmodel=3Dsmall -Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodevi= ew
> > > -funwind-tables
> > > >=C2=A0 DEBUG_CLANGPDB_X64_DLINK_FLAGS=C2=A0 =C2=A0 =C2= =A0 =3D /NOLOGO /NODEFAULTLIB
> > > /IGNORE:4001 /OPT:REF /OPT:ICF=3D10 /ALIGN:32 /FILEALIGN:32 = /Machine:X64 /DLL
> > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIV= ER /SAFESEH:NO
> > > /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=3Dwineh /lldmap=
> > > >=C2=A0 DEBUG_CLANGPDB_X64_DLINK2_FLAGS=C2=A0 =C2=A0 =C2= =A0=3D
> > > >=C2=A0 DEBUG_CLANGPDB_X64_GENFW_FLAGS=C2=A0 =C2=A0 =C2= =A0 =3D --keepexceptiontable
> > > >
> > > > -RELEASE_CLANGPDB_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0=3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64
> > > "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone= -mcmodel=3Dsmall -Oz -flto
> > > DEF(CLANGPDB_X64_TARGET) -fno-unwind-tables
> > > > +RELEASE_CLANGPDB_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0=3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))&quo= t; -mno-red-zone
> > > -mcmodel=3Dsmall -Oz -flto DEF(CLANGPDB_X64_TARGET) -fno-unw= ind-tables
> > > >=C2=A0 RELEASE_CLANGPDB_X64_DLINK_FLAGS=C2=A0 =C2=A0 =3D= /NOLOGO /NODEFAULTLIB
> > > /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=3D10 /ALIGN:32 /= FILEALIGN:32
> > > /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /DLL
> > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIV= ER /SAFESEH:NO
> > > /BASE:0 /MERGE:.rdata=3D.data /MLLVM:-exception-model=3Dwine= h /lldmap
> > > >=C2=A0 RELEASE_CLANGPDB_X64_DLINK2_FLAGS=C2=A0 =C2=A0=3D=
> > > >=C2=A0 RELEASE_CLANGPDB_X64_GENFW_FLAGS=C2=A0 =C2=A0 =3D=
> > > >
> > > > -NOOPT_CLANGPDB_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0=3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64
> > > "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone= -mcmodel=3Dsmall -O0
> > > DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables
> > > > +NOOPT_CLANGPDB_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0=3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))&quo= t; -mno-red-zone
> > > -mcmodel=3Dsmall -O0 DEF(CLANGPDB_X64_TARGET) -gcodeview -fu= nwind-tables
> > > >=C2=A0 NOOPT_CLANGPDB_X64_DLINK_FLAGS=C2=A0 =C2=A0 =C2= =A0 =3D /NOLOGO /NODEFAULTLIB
> > > /IGNORE:4001 /OPT:REF /OPT:ICF=3D10 /ALIGN:32 /FILEALIGN:32 = /Machine:X64 /DLL
> > > /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIV= ER /SAFESEH:NO
> > > /BASE:0 /DEBUG:GHASH /MLLVM:-exception-model=3Dwineh /lldmap=
> > > >=C2=A0 NOOPT_CLANGPDB_X64_DLINK2_FLAGS=C2=A0 =C2=A0 =C2= =A0=3D
> > > >=C2=A0 NOOPT_CLANGPDB_X64_GENFW_FLAGS=C2=A0 =C2=A0 =C2= =A0 =3D --keepexceptiontable
> > > > @@ -2901,15 +2901,15 @@ NOOPT_CLANGDWARF_IA32_DLINK2_FL= AGS=C2=A0 =C2=A0 =C2=A0=3D
> > > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -
> > > >=C2=A0 *_CLANGDWARF_X64_ASLPP_FLAGS=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D DEF(GCC_ASLPP_FLAGS)
> > > DEF(CLANG38_X64_TARGET)
> > > >=C2=A0 *_CLANGDWARF_X64_VFRPP_FLAGS=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =3D DEF(GCC_VFRPP_FLAGS)
> > > DEF(CLANG38_X64_TARGET)
> > > >
> > > > -DEBUG_CLANGDWARF_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone= -mcmodel=3Dsmall -fpie -Oz
> > > -flto DEF(CLANG38_X64_TARGET) -g
> > > > +DEBUG_CLANGDWARF_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))&quo= t; -mno-red-zone
> > > -mcmodel=3Dsmall -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g<= br> > > > >=C2=A0 DEBUG_CLANGDWARF_X64_DLINK_FLAGS=C2=A0 =C2=A0 =C2= =A0 =3D
> > > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf= _x86_64
> > > -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=3Dsmall
> > > -Wl,--apply-dynamic-relocs
> > > >=C2=A0 DEBUG_CLANGDWARF_X64_DLINK2_FLAGS=C2=A0 =C2=A0 = =C2=A0=3D
> > > DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O3 -fuse-ld=3Dlld
> > > >
> > > > -RELEASE_CLANGDWARF_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 = =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone= -mcmodel=3Dsmall -fpie -Oz
> > > -flto DEF(CLANG38_X64_TARGET)
> > > > +RELEASE_CLANGDWARF_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 = =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))&quo= t; -mno-red-zone
> > > -mcmodel=3Dsmall -fpie -Oz -flto DEF(CLANG38_X64_TARGET)
> > > >=C2=A0 RELEASE_CLANGDWARF_X64_DLINK_FLAGS=C2=A0 =C2=A0 = =3D
> > > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf= _x86_64
> > > -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=3Dsmall
> > > -Wl,--apply-dynamic-relocs
> > > >=C2=A0 RELEASE_CLANGDWARF_X64_DLINK2_FLAGS=C2=A0 =C2=A0= =3D
> > > DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O3 -fuse-ld=3Dlld
> > > >
> > > > -NOOPT_CLANGDWARF_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone= -mcmodel=3Dsmall -fpie -O0
> > > DEF(CLANG38_X64_TARGET) -g
> > > > +NOOPT_CLANGDWARF_X64_CC_FLAGS=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0=3D DEF(CLANG38_ALL_CC_FLAGS) -m64
> > > -march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))&quo= t; -mno-red-zone
> > > -mcmodel=3Dsmall -fpie -O0 DEF(CLANG38_X64_TARGET) -g
> > > >=C2=A0 NOOPT_CLANGDWARF_X64_DLINK_FLAGS=C2=A0 =C2=A0 =C2= =A0 =3D
> > > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_6= 4
> > > -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=3Dsmall
> > > -Wl,--apply-dynamic-relocs
> > > >=C2=A0 NOOPT_CLANGDWARF_X64_DLINK2_FLAGS=C2=A0 =C2=A0 = =C2=A0=3D
> > > DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O0 -fuse-ld=3Dlld
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
>
>
>

--00000000000010209b05e29f8b50--