From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mx.groups.io with SMTP id smtpd.web10.18391.1656545115182305575 for ; Wed, 29 Jun 2022 16:25:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@canonical.com header.s=20210705 header.b=JUdslQ1k; spf=pass (domain: canonical.com, ip: 185.125.188.123, mailfrom: dann.frazier@canonical.com) Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) (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-1.canonical.com (Postfix) with ESMTPS id D853A3FD82 for ; Wed, 29 Jun 2022 23:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1656545112; bh=hiaBa0S1VKo3yEIk6LPHhWmO/SRnwIZBSUtq2Hu9a0A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=JUdslQ1ka6XmuG0m8bmVgic4QIjmZKUeSrjhZX5YowhrdbVWgSWSW5SkhMW9bON8P eZRpWIV92wtFzQlgiClwOwV1a39w11L7xxuaSbcVZ+KQj+R6tLnH0N5sM8RC8Di7mO /6kczmu9eQwwsOn/0LbfTD21qgmkckKCOthdLEq+GCS/vRamDmKtG+aaH/B+C8KEXX 5iqkr8Osh+rA3z2+zdwtIraNJ0serummzlSHEgGHLeaDZWyogzgk/qq/Ua7msun8Tn WJYs5185Jk2E/QMt/KsKhEygDZMQhribc4ilkP7tgqRSw4IJViYwwk82xLhAbbd/sT 0WYUI6m1m2u6A== Received: by mail-io1-f69.google.com with SMTP id f18-20020a5d8592000000b0067289239d1dso9448482ioj.22 for ; Wed, 29 Jun 2022 16:25:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hiaBa0S1VKo3yEIk6LPHhWmO/SRnwIZBSUtq2Hu9a0A=; b=BxQ91X/8vtK+a36f4z3edxtgkHv2t8JJfTlyg5KixWITyVyGvukqn237vCouofMxPF pYnUAdjYOIqhv+yajAiKwCjfyD08jXu7SasDPr5sp55nsgbz67zQJXklDKcjyM1sV0F3 vLSzeVeyS+EgK0OREGjPmoOpamW3B5jpDI38qHQ1SXuUR1iltkpd/oV5/lx28+hhU2OA myU0K25WHtGjxasoi4Ww7EJIkskXE4Edr3j7ygfuuVQ9uSUdN0fIv61y8y/YHa/1+2S2 Qpa+RfMof3wdIASAkSY+8thq5EJLtVZiFwVJs8ZEo7ub/s41i3grtWcAS7wKcaa3R5Jx 7qLQ== X-Gm-Message-State: AJIora86blasnAi0yyHccaOAOt8XQoQ4Flo3WrM3hQXqUDFj33Xjp5cG EFN8nwiFj8qfNYA8dw7KNgn7qbNWvmWAOBGQisXVOV4UU9A8XR0oSQUr8RON+AOCgYXffcKbVh3 adcIE7BbyFjrVsmXwcqrrKOb/23qXJBk= X-Received: by 2002:a05:6602:1409:b0:5e7:487:133c with SMTP id t9-20020a056602140900b005e70487133cmr3065255iov.196.1656545110081; Wed, 29 Jun 2022 16:25:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s1fbklRxSkho/N/6VcZMrg0jYrxbPrGgM6a+h5KBjNfvCoFpFea4wG8YCetuviky8aTStzjw== X-Received: by 2002:a05:6602:1409:b0:5e7:487:133c with SMTP id t9-20020a056602140900b005e70487133cmr3065241iov.196.1656545109762; Wed, 29 Jun 2022 16:25:09 -0700 (PDT) Received: from xps13.dannf (c-73-14-97-161.hsd1.co.comcast.net. [73.14.97.161]) by smtp.gmail.com with ESMTPSA id z18-20020a05663822b200b00335c0e07abdsm7782349jas.14.2022.06.29.16.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 16:25:08 -0700 (PDT) Date: Wed, 29 Jun 2022 17:25:05 -0600 From: "dann frazier" To: Pedro Falcato Cc: edk2-devel-groups-io , Bob Feng , Liming Gao , Yuwei Chen Subject: Re: [edk2-devel] [PATCH] BaseTools/tools_def.txt: Add -march=x86-64 for X64 CLANG and GCC targets Message-ID: References: <20220610180918.673822-1-dannf@debian.org> MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > 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 > > > > > > > > > > > > > > > >