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.web11.30403.1654884569093452261 for ; Fri, 10 Jun 2022 11:09:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@canonical.com header.s=20210705 header.b=gxN4CXnr; spf=pass (domain: canonical.com, ip: 185.125.188.122, mailfrom: dann.frazier@canonical.com) Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) (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 E3AAA3F220 for ; Fri, 10 Jun 2022 18:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1654884566; bh=b5OmeSLlunBv3lldurmAUCewN1zKS7abJJV4cM3a898=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gxN4CXnrlX/ZlGeJjiOk8ychfviLkCAm1KbAtrnon1LRztgKGiYm0PMlHK2LnPLOU Xa/BDl0hD3KxLOugc05ny9Cn/HA+17nSomOdcD8uVoSjH4eThYnfj/r/jbSgpf0/bc mSkLXSZFYeuK4DCGfP3sj6NLSPbHpIGHxkXYif5Bfnv6qoWW7tQYrcGisa4WH5iAmy /eNMp3vrZcQSaLlB0yJzHsuwVH/gEm1IMiLIYO7Ty9gzYLU/CFLizIdSJW+lSYwKQB sYaUmxailoM45LgiRINy5rR8LKxZMyvY+ONmSM0V2JjY9iJOz5XdbNKiIVBr4V6nB8 QJMoPTxB5WG0Q== Received: by mail-io1-f70.google.com with SMTP id l3-20020a05660227c300b0065a8c141580so13652077ios.19 for ; Fri, 10 Jun 2022 11:09:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=b5OmeSLlunBv3lldurmAUCewN1zKS7abJJV4cM3a898=; b=EKGJ/OXvHeuYhIn1DM1sq6137EibfnfGWIIh7+2GdCy1fW74NVG49IdhXkzttOrXd/ t2xEXiXFch5s0VzUR5j3rfOV0ZxcDWaxpHtmCjF8no9XeR/KvKLsdzTApIdK60/jroL4 5/XFwvM+TrH2Vgel1aWPHTW7/Etx5BeFQlIMXVvtUA3d6gCRYYp44FoQzjQ/De5G+0UD 4Pf2h8WzHLdcG7kPF4fu3JgFFiUS5W0DfGe1EqUMlvDxSrE/81JZ5ZKlAB0hiRzbru/o U1CelEAzUjbob1EVenzhaI3At7EaGwNFUwU2UFKyIcgR36cbDcQZ1R+e4c0C1SRhD7a1 yGzw== X-Gm-Message-State: AOAM533nXQTZMZf+i+kxJZJ+IxkNy3Irz72QqWB1RuAf1BWKicMgEDjX cmWlL65HMtrP48yhIuQXxDm3cc9g/cpnwq65PbKDUG7OfWTGvfoyEv/PBxkO0WfgDRxAjeUV6Ku 5JyfDJaMPUq0DKBRz0xBoPHwjL/Sh/4A= X-Received: by 2002:a5d:8d92:0:b0:669:550a:8eb with SMTP id b18-20020a5d8d92000000b00669550a08ebmr13462169ioj.202.1654884564898; Fri, 10 Jun 2022 11:09:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEZ1NqMA51tB3rPOTW7pR7/rwc9da5sASodJ7ETAuJJqTSbRV/lA/5jfT7dKwMY2UCadH6MA== X-Received: by 2002:a5d:8d92:0:b0:669:550a:8eb with SMTP id b18-20020a5d8d92000000b00669550a08ebmr13462156ioj.202.1654884564604; Fri, 10 Jun 2022 11:09:24 -0700 (PDT) Received: from localhost (c-73-14-97-161.hsd1.co.comcast.net. [73.14.97.161]) by smtp.gmail.com with ESMTPSA id d24-20020a5d9bd8000000b0065a47e16f44sm11139404ion.22.2022.06.10.11.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 11:09:23 -0700 (PDT) From: "dann frazier" X-Google-Original-From: dann frazier To: Bob Feng , Liming Gao , Yuwei Chen Cc: devel@edk2.groups.io Subject: [PATCH] BaseTools/tools_def.txt: Add -march=x86-64 for X64 CLANG and GCC targets Date: Fri, 10 Jun 2022 12:09:18 -0600 Message-Id: <20220610180918.673822-1-dannf@debian.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=3Di586 for IA32, -march=3Darmv7-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.t= emplate index adcd23f727..569d16fb3e 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -1885,7 +1885,7 @@ DEFINE GCC_DEPS_FLAGS =3D -MMD -MF $@.de= ps DEFINE GCC48_ALL_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -ffunction-= sections -fdata-sections -DSTRING_ARRAY_NAME=3D$(BASE_NAME)Strings=0D DEFINE GCC48_IA32_X64_DLINK_COMMON =3D -nostdlib -Wl,-n,-q,--gc-sections= -z common-page-size=3D0x20=0D DEFINE GCC48_IA32_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) -m32 -mar= ch=3Di586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-un= wind-tables -Wno-address=0D -DEFINE GCC48_X64_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) -m64 -fno= -stack-protector "-DEFIAPI=3D__attribute__((ms_abi))" -maccumulate-outgoing= -args -mno-red-zone -Wno-address -mcmodel=3Dsmall -fpie -fno-asynchronous-u= nwind-tables -Wno-address=0D +DEFINE GCC48_X64_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) -m64 -mar= ch=3Dx86-64 -fno-stack-protector "-DEFIAPI=3D__attribute__((ms_abi))" -macc= umulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=3Dsmall -fpie -fn= o-asynchronous-unwind-tables -Wno-address=0D DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS =3D DEF(GCC48_IA32_X64_DLINK_COMMON) = -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable=0D DEFINE GCC48_IA32_X64_DLINK_FLAGS =3D DEF(GCC48_IA32_X64_DLINK_COMMON) = -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DI= R_DEBUG)/$(BASE_NAME).map,--whole-archive=0D DEFINE GCC48_IA32_DLINK2_FLAGS =3D -Wl,--defsym=3DPECOFF_HEADER_SIZE= =3D0x220 DEF(GCC_DLINK2_FLAGS_COMMON)=0D @@ -2613,15 +2613,15 @@ NOOPT_CLANG38_IA32_DLINK2_FLAGS =3D DEF(GCC5_IA= 32_DLINK2_FLAGS) -O0 *_CLANG38_X64_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_X6= 4_TARGET)=0D *_CLANG38_X64_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_X6= 4_TARGET)=0D =0D -DEBUG_CLANG38_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DE= FIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie -Oz -= flto DEF(CLANG38_X64_TARGET) -g=0D +DEBUG_CLANG38_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 -mar= ch=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Ds= mall -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g=0D DEBUG_CLANG38_X64_DLINK_FLAGS =3D DEF(GCC5_IA32_X64_DLINK_FLAGS) -flt= o -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=3Delf64-x86-64 -Wl,-pie -mcmodel= =3Dsmall=0D DEBUG_CLANG38_X64_DLINK2_FLAGS =3D DEF(GCC5_X64_DLINK2_FLAGS) -O3=0D =0D -RELEASE_CLANG38_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DE= FIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie -Oz -= flto DEF(CLANG38_X64_TARGET)=0D +RELEASE_CLANG38_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 -mar= ch=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Ds= mall -fpie -Oz -flto DEF(CLANG38_X64_TARGET)=0D RELEASE_CLANG38_X64_DLINK_FLAGS =3D DEF(GCC5_IA32_X64_DLINK_FLAGS) -flt= o -Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=3Delf64-x86-64 -Wl,-pie -mcmodel= =3Dsmall=0D RELEASE_CLANG38_X64_DLINK2_FLAGS =3D DEF(GCC5_X64_DLINK2_FLAGS) -O3=0D =0D -NOOPT_CLANG38_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DE= FIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie -O0 D= EF(CLANG38_X64_TARGET) -g=0D +NOOPT_CLANG38_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 -mar= ch=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Ds= mall -fpie -O0 DEF(CLANG38_X64_TARGET) -g=0D NOOPT_CLANG38_X64_DLINK_FLAGS =3D DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,= -O0 -Wl,-melf_x86_64 -Wl,--oformat=3Delf64-x86-64 -Wl,-pie -mcmodel=3Dsmall= =0D NOOPT_CLANG38_X64_DLINK2_FLAGS =3D DEF(GCC5_X64_DLINK2_FLAGS) -O0=0D =0D @@ -2798,17 +2798,17 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS =3D *_CLANGPDB_X64_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) DEF(CLANGPDB_= X64_TARGET)=0D *_CLANGPDB_X64_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) DEF(CLANGPDB_= X64_TARGET)=0D =0D -DEBUG_CLANGPDB_X64_CC_FLAGS =3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-= DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -Oz -flto= DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables=0D +DEBUG_CLANGPDB_X64_CC_FLAGS =3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64 -m= arch=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel= =3Dsmall -Oz -flto DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables=0D DEBUG_CLANGPDB_X64_DLINK_FLAGS =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_DRIVER /SAFESEH:NO /BASE:0 /= DEBUG:GHASH /MLLVM:-exception-model=3Dwineh /lldmap=0D DEBUG_CLANGPDB_X64_DLINK2_FLAGS =3D=0D DEBUG_CLANGPDB_X64_GENFW_FLAGS =3D --keepexceptiontable=0D =0D -RELEASE_CLANGPDB_X64_CC_FLAGS =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=0D +RELEASE_CLANGPDB_X64_CC_FLAGS =3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64 -m= arch=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel= =3Dsmall -Oz -flto DEF(CLANGPDB_X64_TARGET) -fno-unwind-tables=0D RELEASE_CLANGPDB_X64_DLINK_FLAGS =3D /NOLOGO /NODEFAULTLIB /IGNORE:4001= /IGNORE:4254 /OPT:REF /OPT:ICF=3D10 /ALIGN:32 /FILEALIGN:32 /SECTION:.xdat= a,D /SECTION:.pdata,D /Machine:X64 /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYS= TEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /MERGE:.rdata=3D.data /MLLV= M:-exception-model=3Dwineh /lldmap=0D RELEASE_CLANGPDB_X64_DLINK2_FLAGS =3D=0D RELEASE_CLANGPDB_X64_GENFW_FLAGS =3D=0D =0D -NOOPT_CLANGPDB_X64_CC_FLAGS =3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64 "-= DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -O0 DEF(C= LANGPDB_X64_TARGET) -gcodeview -funwind-tables=0D +NOOPT_CLANGPDB_X64_CC_FLAGS =3D DEF(CLANGPDB_ALL_CC_FLAGS) -m64 -m= arch=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel= =3Dsmall -O0 DEF(CLANGPDB_X64_TARGET) -gcodeview -funwind-tables=0D NOOPT_CLANGPDB_X64_DLINK_FLAGS =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_DRIVER /SAFESEH:NO /BASE:0 /= DEBUG:GHASH /MLLVM:-exception-model=3Dwineh /lldmap=0D NOOPT_CLANGPDB_X64_DLINK2_FLAGS =3D=0D NOOPT_CLANGPDB_X64_GENFW_FLAGS =3D --keepexceptiontable=0D @@ -2901,15 +2901,15 @@ NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =3D DEF(CLAN= GDWARF_IA32_DLINK2_FLAGS) -O0 - *_CLANGDWARF_X64_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) DEF(CLANG38= _X64_TARGET)=0D *_CLANGDWARF_X64_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) DEF(CLANG38= _X64_TARGET)=0D =0D -DEBUG_CLANGDWARF_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 "= -DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie -O= z -flto DEF(CLANG38_X64_TARGET) -g=0D +DEBUG_CLANGDWARF_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 -= march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel= =3Dsmall -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g=0D DEBUG_CLANGDWARF_X64_DLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLINK_FL= AGS) -flto -Wl,-O3 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mc= model=3Dsmall -Wl,--apply-dynamic-relocs=0D DEBUG_CLANGDWARF_X64_DLINK2_FLAGS =3D DEF(CLANGDWARF_X64_DLINK2_FLAGS)= -O3 -fuse-ld=3Dlld=0D =0D -RELEASE_CLANGDWARF_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 "= -DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie -O= z -flto DEF(CLANG38_X64_TARGET)=0D +RELEASE_CLANGDWARF_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 -= march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel= =3Dsmall -fpie -Oz -flto DEF(CLANG38_X64_TARGET)=0D RELEASE_CLANGDWARF_X64_DLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLINK_FL= AGS) -flto -Wl,-O3 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mc= model=3Dsmall -Wl,--apply-dynamic-relocs=0D RELEASE_CLANGDWARF_X64_DLINK2_FLAGS =3D DEF(CLANGDWARF_X64_DLINK2_FLAGS)= -O3 -fuse-ld=3Dlld=0D =0D -NOOPT_CLANGDWARF_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 "= -DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie -O= 0 DEF(CLANG38_X64_TARGET) -g=0D +NOOPT_CLANGDWARF_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 -= march=3Dx86-64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel= =3Dsmall -fpie -O0 DEF(CLANG38_X64_TARGET) -g=0D NOOPT_CLANGDWARF_X64_DLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLINK_FL= AGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel= =3Dsmall -Wl,--apply-dynamic-relocs=0D NOOPT_CLANGDWARF_X64_DLINK2_FLAGS =3D DEF(CLANGDWARF_X64_DLINK2_FLAGS)= -O0 -fuse-ld=3Dlld=0D =0D --=20 2.36.1