From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mx.groups.io with SMTP id smtpd.web11.26206.1679075102528928818 for ; Fri, 17 Mar 2023 10:45:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=IMEVYD3a; spf=pass (domain: posteo.de, ip: 185.67.36.66, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 0F7362406AF for ; Fri, 17 Mar 2023 18:44:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1679075100; bh=tJUoVbYli4HeHLqIfbqK+vsNbNtnm/9TVHJ0HRYqJ/0=; h=From:Subject:Date:Cc:To:From; b=IMEVYD3abxkvBgqcbRSUev86uYXaFsTdEiWOXYxBKgf4+PcCeJAs+SFXPzDgk6RwM 4iMan+Xi6Um49HMlPub3EKLQe8YY7N9BufpPWwtZxrg8JKxAD+mg+BQAPcCMVcLryP D84t7OINp2Kb8WboLx6+6jHoyp7VbTSnOxTxLWoy7CBTqSCv/xLQFf21nFVZqdttWg HbO5WNk4ZCHEEvTnVsyYw94EXu80fHQZkNJJfifgoNjdKb0LWdPSemt0GQ+tNory5t HlOy19Z+3BwoWGr3SZlAmTagCccJg71XTccplEy9TX8+nq23n26t2LqdpOot/g50hg 0cv8Bd1KrD+cw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PdWjk32k0z9rxB; Fri, 17 Mar 2023 18:44:58 +0100 (CET) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= Mime-Version: 1.0 (1.0) Subject: Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Date: Fri, 17 Mar 2023 17:44:58 +0000 Message-Id: References: <425bcd67-f9b9-4915-d392-ddcd00ed69d4@bsdio.com> Cc: devel@edk2.groups.io, patrick.rudolph@9elements.com, guo.dong@intel.com, gua.guo@intel.com, james.lu@intel.com, ray.ni@intel.com, ardb@kernel.org In-Reply-To: <425bcd67-f9b9-4915-d392-ddcd00ed69d4@bsdio.com> To: Rebecca Cran Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Which error precisely? X64 PIE *must not* be disabled, as it=E2=80=99s used to enforce RIP-relative= addressing where possible and has been for many years. Meanwhile the issues= with IA32 is PIE was disabled by default for most toolchains, but some enab= le it nowadays (and thus it must be disabled explicitly). Best regards, Marvin > On 17. Mar 2023, at 18:30, Rebecca Cran wrote: >=20 > =EF=BB=BFI've also seen that error building X64 firmware. >=20 > Could you update those flags too, please? >=20 >=20 > --=20 >=20 > Rebecca Cran >=20 >=20 >> On 3/17/23 8:06 AM, Patrick Rudolph wrote: >> The clang toolchain might default to fPIE/fPIC, which prevents >> lld from linking the objects into a binary. >>=20 >> Specify -fno-pie -fno-pic as done on GCC to fix linking. >>=20 >> Test: >> Building the Universal Payload using the command >> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually >> works. >>=20 >> Signed-off-by: Patrick Rudolph >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4356 >> --- >> BaseTools/Conf/tools_def.template | 14 +++++++------- >> 1 file changed, 7 insertions(+), 7 deletions(-) >>=20 >> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def= .template >> index 471eb67c0c..9b59bd75c3 100755 >> --- a/BaseTools/Conf/tools_def.template >> +++ b/BaseTools/Conf/tools_def.template >> @@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS =3D -Wl,-= -defsym=3DPECOFF_HEADER_SIZE=3D0x22 >> *_CLANGDWARF_IA32_RC_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)ll= vm-rc >> *_CLANGDWARF_IA32_ASLCC_FLAGS =3D DEF(GCC_ASLCC_FLAGS) -m32 -= fno-lto DEF(CLANG38_IA32_TARGET) >> -*_CLANGDWARF_IA32_ASLDLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_ASLDL= INK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=3Dlld >> +*_CLANGDWARF_IA32_ASLDLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_ASLDL= INK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=3Dlld -no-pie >> *_CLANGDWARF_IA32_ASM_FLAGS =3D DEF(GCC5_ASM_FLAGS) -m32 -mar= ch=3Di386 DEF(CLANG38_IA32_TARGET) >> *_CLANGDWARF_IA32_RC_FLAGS =3D DEF(GCC_IA32_RC_FLAGS) >> *_CLANGDWARF_IA32_OBJCOPY_FLAGS =3D >> @@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS =3D -Wl= ,--defsym=3DPECOFF_HEADER_SIZE=3D0x22 >> *_CLANGDWARF_IA32_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) DEF(CLAN= G38_IA32_TARGET) >> *_CLANGDWARF_IA32_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) DEF(CLAN= G38_IA32_TARGET) >> -DEBUG_CLANGDWARF_IA32_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m= 32 -Oz -flto -march=3Di586 DEF(CLANG38_IA32_TARGET) -g -malign-double >> +DEBUG_CLANGDWARF_IA32_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -fn= o-pic -fno-pie -m32 -Oz -flto -march=3Di586 DEF(CLANG38_IA32_TARGET) -g -mal= ign-double >> DEBUG_CLANGDWARF_IA32_DLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLINK= _FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386 >> -DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =3D DEF(CLANGDWARF_IA32_DLINK2_FL= AGS) -O3 -fuse-ld=3Dlld >> +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =3D DEF(CLANGDWARF_IA32_DLINK2_FL= AGS) -O3 -fuse-ld=3Dlld -no-pie >> -RELEASE_CLANGDWARF_IA32_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m= 32 -Oz -flto -march=3Di586 DEF(CLANG38_IA32_TARGET) -malign-double >> +RELEASE_CLANGDWARF_IA32_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -fn= o-pic -fno-pie -m32 -Oz -flto -march=3Di586 DEF(CLANG38_IA32_TARGET) -malign= -double >> RELEASE_CLANGDWARF_IA32_DLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLINK= _FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386 >> -RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =3D DEF(CLANGDWARF_IA32_DLINK2_FL= AGS) -O3 -fuse-ld=3Dlld >> +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =3D DEF(CLANGDWARF_IA32_DLINK2_FL= AGS) -O3 -fuse-ld=3Dlld -no-pie >> -NOOPT_CLANGDWARF_IA32_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m= 32 -O0 -march=3Di586 DEF(CLANG38_IA32_TARGET) -g -malign-double >> +NOOPT_CLANGDWARF_IA32_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -fn= o-pic -fno-pie -m32 -O0 -march=3Di586 DEF(CLANG38_IA32_TARGET) -g -malign-do= uble >> NOOPT_CLANGDWARF_IA32_DLINK_FLAGS =3D DEF(CLANGDWARF_IA32_X64_DLINK= _FLAGS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat,elf32-i386 >> -NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =3D DEF(CLANGDWARF_IA32_DLINK2_FL= AGS) -O0 -fuse-ld=3Dlld >> +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =3D DEF(CLANGDWARF_IA32_DLINK2_FL= AGS) -O0 -fuse-ld=3Dlld -no-pie >> ########################## >> # CLANGDWARF X64 definitions