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.web08.9554.1655561345082896224 for ; Sat, 18 Jun 2022 07:09:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=d5Poy5K3; 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 3A7C124010B for ; Sat, 18 Jun 2022 16:09:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1655561343; bh=wdjEgWFb0U4xGlqibDuHaXQ3TlcEveGSqc57whYTirM=; h=Subject:From:Date:Cc:To:From; b=d5Poy5K3xzWiQMvQ/vh7oWsZac0eOCueNSyqWHCNBOk/aRAPzFxt+lGRcz4aOoN1a jxjNNOrNrK0/niIc1Atoc8VUByyIr0TjbN+7fUnjwWu3l0AUpjgcJb2zOueKfPWHjQ BN/I1P1l+dKw+QLuYdPfjOskAujEviUw4djTF0MJbvC0wXZxtkI4QrG/hFM6LzDVkl Qy5IwA3JYF+ZY97mszsS0MlVrcBK3L+GEfPuD4rykG8vdcquLkDmEV4fslsd8O2cFM nW/0u3iEX+6db0CkNqQQAf1gKr0XZvfM+dx+45q9CwBSLySTMtFRUthER5RIsXXwzV 68oXY4LZQhi/Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LQHp32CF6z6tp0; Sat, 18 Jun 2022 16:08:59 +0200 (CEST) Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Re: [PATCH v1 1/1] BaseTools: Suppress read only relocs errors on XCODE5 X64 toolchain From: =?utf-8?Q?Marvin_H=C3=A4user?= In-Reply-To: <20220618132140.10037-1-theojehl76@gmail.com> Date: Sat, 18 Jun 2022 14:08:58 +0000 Cc: edk2-devel-groups-io , Bob Feng , Liming Gao , Yuwei Chen , Vitaly Cheptsov , Andrew Fish , Rebecca Cran , Pedro Falcato , Isaac W Oram Message-Id: <0BC4B9BB-0A4A-40EA-B8D8-FB0A04B38806@posteo.de> References: <20220618132140.10037-1-theojehl76@gmail.com> To: =?utf-8?Q?Th=C3=A9o_Jehl?= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable CC Andrew, Rebecca, mentors Hey all, The patch itself looks good to me. The description doesn't really = capture the issue, nor why this is an adequate solution. This should = also remove the mentioned XCODE5-specific code as part of a single = series [1] to confirm the issue has been resolved without regressions. TL;dr for the rest: Apple ld64 complains because there are relocations = to read-only segments in a PIE executable. As Mach-O allows mapping = read-only segments of PIEs to multiple virtual addresses (in different = processes), this is prohibited right at link-time for obvious reasons. = PE/COFF doesn't really have such a feature (I think Windows used to use = static addresses and now uses CoW with traditional relocs?) and UEFI has = no concept of page sharing anyway. Hence, it is safe to allow such = relocs and silence the warning. All other toolchains should already work = this way. Andrew, Rebecca, if I remember correctly, you pretty much maintain = XCODE5. I had a conversation with Andrew about related topics before, = too. Are you fine with this approach? It seems like it has previously = been applied to IA32 builds already anyway (right from import). Maybe PIE could be dropped as a whole somehow in the future? For UEFI, = it basically only adds overhead (or are there blockers to this?). Best regards, Marvin [1] = https://github.com/tianocore/edk2/tree/cc2db6ebfb6d9d85ba4c7b35fba1fa37fff= c0bc2/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/Xcode5ExceptionHandler= Asm.nasm > On 18. Jun 2022, at 15:21, Th=C3=A9o Jehl = wrote: >=20 > From: Theo Jehl >=20 > Added -read_only_relocs suppress for XCODE5 X64 toolchain > This remove the needs for XCODE5 specific source with relocation fixes >=20 > Cc: Bob Feng > Cc: Liming Gao > Cc: Yuwei Chen > Cc: Marvin H=C3=A4user > Cc: Vitaly Cheptsov >=20 > Signed-off-by: Theo Jehl > --- > BaseTools/Conf/tools_def.template | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/BaseTools/Conf/tools_def.template = b/BaseTools/Conf/tools_def.template > index 5ed19810b727..be35094cecc3 100755 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -2977,9 +2977,9 @@ RELEASE_XCODE5_IA32_CC_FLAGS =3D -arch i386 -c = -Os -Wall -Werror -inclu > ################## > # X64 definitions > ################## > - DEBUG_XCODE5_X64_DLINK_FLAGS =3D -arch x86_64 -u = _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 = -pie -all_load -dead_strip -seg1addr 0x240 -map = $(DEST_DIR_DEBUG)/$(BASE_NAME).map > - NOOPT_XCODE5_X64_DLINK_FLAGS =3D -arch x86_64 -u = _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 = -pie -all_load -dead_strip -seg1addr 0x240 -map = $(DEST_DIR_DEBUG)/$(BASE_NAME).map > -RELEASE_XCODE5_X64_DLINK_FLAGS =3D -arch x86_64 -u = _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 = -pie -all_load -dead_strip -seg1addr 0x240 -map = $(DEST_DIR_DEBUG)/$(BASE_NAME).map > + DEBUG_XCODE5_X64_DLINK_FLAGS =3D -arch x86_64 -u = _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 = -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress = -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map > + NOOPT_XCODE5_X64_DLINK_FLAGS =3D -arch x86_64 -u = _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 = -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress = -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map > +RELEASE_XCODE5_X64_DLINK_FLAGS =3D -arch x86_64 -u = _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 = -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress = -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map >=20 > *_XCODE5_X64_SLINK_FLAGS =3D -static -o > DEBUG_XCODE5_X64_ASM_FLAGS =3D -arch x86_64 -g > --=20 > 2.32.1 (Apple Git-133) >=20