From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.groups.io with SMTP id smtpd.web10.20235.1679061991395801999 for ; Fri, 17 Mar 2023 07:06:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@9elements.com header.s=google header.b=JCI2VdEl; spf=pass (domain: 9elements.com, ip: 209.85.221.50, mailfrom: patrick.rudolph@9elements.com) Received: by mail-wr1-f50.google.com with SMTP id r18so4552160wrx.1 for ; Fri, 17 Mar 2023 07:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1679061990; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8QkSQdXAQHtb7LTLLvp7nOPSqvKI/+cJ5azWwN/u1fU=; b=JCI2VdElyCgQMe1rNvuqYTnjMllnW0HeaxpKt06gLnVNkRojoo9xp/APF2mhicbMua KcDqcIAoFcE2/yEGJyxeycPdAbi05U/tOkRtS1LE6QunoLD8i0R061+jFYse2bPGzWRh EQQXALZSM3uJr5gIGDdHe1iyvys8MGar56+W3cls85DzwAsT1TAb22vGqKGpSnIpVlho kmNbX+crwGWyHlMFXeBAUlzoNmvHDGSL93t2KPL/UD3+8nJOlb1cBoN3Bek76du+OQpQ EMXLsnNH+p0LEBPnhnzi3P1bTZp6L4UDNsyiRPHFjxdOGg3DFucGfe87jNUWJ6dEdt8i lZnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679061990; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8QkSQdXAQHtb7LTLLvp7nOPSqvKI/+cJ5azWwN/u1fU=; b=rIvjCTFriKxlezH2W+/moOeUx/IXYp5DhIIQWTVxpS3OUz6DOBXKF+EqKJLHgDtHHq DlHFaVlYcceIjvtD/1a+XQZSrGj2vDGm9vceWjWI7ly1KBbM/H2D2oBSTC1O3TO5O488 3RYsjFwOfozSjCblxI053yifzAhpNCqW431Qy6ypqiTrpL+y7dKb/Lx4v691ItT6fbWN PFnKvqQ9R2JfZacm1Lg/hxXpm7L/KCynSDIujzo05iUoW34Io1Pm42yosiln3eFU4dtx I17j8EoGmXSDnGNLKedO5sTXgHnw5O1X1jKp9ZFgWEy4ecB+py07HxT1mVw4MOcJj8Kd YQKg== X-Gm-Message-State: AO0yUKXQuZYI5HM0Y2m0pHtvQjifmHIh4tXv0ONaEPTbcVqbALxAP6Ph 1MS54T36hxZ6IdmJp1yzKIQfNXXxRMcakIQ6MKU= X-Google-Smtp-Source: AK7set/2UFMAz9OHk/oSWEVCeUVp5VRIbjVRYGcLvOW4K2oh/+C9fqAHHYhILmbOfOg9jiSLkVwbZQ== X-Received: by 2002:adf:ea4f:0:b0:2ce:adda:f45a with SMTP id j15-20020adfea4f000000b002ceaddaf45amr7445637wrn.62.1679061989854; Fri, 17 Mar 2023 07:06:29 -0700 (PDT) Return-Path: Received: from fedora.sec.9e.network (ip-095-222-150-251.um34.pools.vodafone-ip.de. [95.222.150.251]) by smtp.gmail.com with ESMTPSA id w2-20020a5d6082000000b002c6d0462163sm2029834wrt.100.2023.03.17.07.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Mar 2023 07:06:29 -0700 (PDT) From: "Patrick Rudolph" To: Cc: devel@edk2.groups.io, guo.dong@intel.com, gua.guo@intel.com, james.lu@intel.com, ray.ni@intel.com, mhaeuser@posteo.de, ardb@kernel.org Subject: [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64 Date: Fri, 17 Mar 2023 15:06:27 +0100 Message-Id: <20230317140627.1033739-2-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230317140627.1033739-1-patrick.rudolph@9elements.com> References: <20230317140627.1033739-1-patrick.rudolph@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Drop the "-z max-page-size=3D0x40" option as it causes the ELF header to overflow into the .text section, causing undefined behaviour. With high optimization level it corrupts essential code and the binary would crash. It might work with low optimization level though. As the default is to use Oz and LTO, it always crashes. Test: The ELF generated by 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots. Signed-off-by: Patrick Rudolph Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4357 --- BaseTools/Conf/tools_def.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index 9b59bd75c3..0c584ab390 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX =3D ENV(CLANG_BIN) =0D # LLVM/CLANG doesn't support -n link option. So, it can't share the same I= A32_X64_DLINK_COMMON flag.=0D # LLVM/CLANG doesn't support common page size. So, it can't share the same= GccBase.lds script.=0D -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON =3D -nostdlib -Wl,-q,--gc-sectio= ns -z max-page-size=3D0x40=0D +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON =3D -nostdlib -Wl,-q,--gc-sectio= ns=0D DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =3D -Wl,--script=3D$(EDK_TOOLS_P= ATH)/Scripts/ClangBase.lds=0D DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLIN= K_COMMON) -Wl,--defsym=3DPECOFF_HEADER_SIZE=3D0 DEF(CLANGDWARF_DLINK2_FLAGS= _COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable=0D DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLIN= K_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map= ,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive=0D --=20 2.39.1