From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web10.9227.1681825301185172567 for ; Tue, 18 Apr 2023 06:41:41 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=Shmob/OK; spf=pass (domain: posteo.de, ip: 185.67.36.65, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 48B5424015E for ; Tue, 18 Apr 2023 15:41:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1681825299; bh=lcEAP7JF9uFWyHebjmJ8GdtGYhvjJFlMKPBXfU2nxbM=; h=Subject:From:Date:Cc:To:From; b=Shmob/OKRu3wpg4ikcethbl+rKPdrQpp/IcrKcgfYoYO8vcxXUecyApqRWC1ZNI2G NMKvXezyj4qpFHNx6VwBNeHrppJY+SdOyLAFDBEKO8fYEt83CJW9q7p+tNh2mkzyu5 Fn4bnxZbS6cF53CYiufPZ4+0D/JVnmsF83fOnpehr6o7TzXU4zchAQq35K1pJx7MDC zmFNk2LxiWJoMhWrYtQwYTTtDqPewSKzC0E2HartZ/HOrB3k+zs9qFS9pKN2wv2sXW Bm+yBxLhukHpkB+HfNYkAQJAs/PboVRtgkTOl3oo4uSuMfa/eRONISD7e7KDKMcpSX p7qRGXZ22gWeA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Q14p65pygz6tvy; Tue, 18 Apr 2023 15:41:34 +0200 (CEST) Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Subject: Re: [edk2-devel] [PATCH v4 01/10] BaseTools: add BASETOOLS define From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= In-Reply-To: Date: Tue, 18 Apr 2023 13:41:24 +0000 Cc: Ard Biesheuvel , edk2-devel-groups-io , Pawel Polawski , Dongyan Qian , Sunil V L , Baoqi Zhang , Chao Li , Rebecca Cran , Ard Biesheuvel , Zhiguang Liu , Liming Gao , Yuwei Chen , Leif Lindholm , Michael D Kinney , Daniel Schaefer , Bob Feng , Oliver Steffen Message-Id: <42EE2D39-46C4-47AD-A7B6-E7EC44669057@posteo.de> References: <20230414080250.1357004-2-kraxel@redhat.com> <18EC1A6E-8B81-4564-83A5-DA8EC2BA54ED@posteo.de> To: Gerd Hoffmann Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable > On 18. Apr 2023, at 15:20, Gerd Hoffmann wrote: >=20 > On Tue, Apr 18, 2023 at 01:59:43PM +0200, Ard Biesheuvel wrote: >> On Tue, 18 Apr 2023 at 13:52, Gerd Hoffmann = wrote: >>>=20 >>> Seems to work fine on fedora 37, even without adding --relax, maybe = this >>> is enabled by default (there is a --no-relax switch after all). = I'll go >>> try older distros / compilers / binutils too. >>>=20 >>> What would be the failure mode? Errors on ELF -> PE conversion = because >>> a GOT is present? Or will things break at runtime? >>>=20 >>=20 >> The problem here is that we rely on --emit-relocs to get at the >> relocations in the binary, in order to convert the absolute ones into >> PE/COFF relocations. >>=20 >> However, --emit-relocs did not use to cover the GOT, as those are >> added at the end by the linker and not by the compiler. So if the GOT >> is non-empty, the resulting PE executable will be corrupt. >=20 > So no build error. And at runtime probably random effects, depending = on > whenever the execution path happens to hit a bad relocation or not. = So > compile + boot testing doesn't cut it. Lovely. >=20 > So, what can I do instead? Check **/DEBUG/*.debug and see whenever a > .got section is present? >=20 >> Of course, the answer here is to dump GenFw altogether for ELF to PE >> conversion, and implement something that consumes the dynamic >> relocations generated when linking in PIE mode. >=20 > Marvin's ImageTool is exactly that I think ... Not quite, we actually didn't change anything about PIE vs non-PIE yet = (X64 is PIE, rest is non-PIE). Though that was on the "long-term TODO" = for sure. There are many other advantages though and if you're looking = for an alternative to GenFw, I'm still happy to discuss things right = now. As I develop this as part of a thesis and its deadline is in July, = any efforts past that heavily depend on the workload at whatever job I = will end up in. :) Best regards, Marvin >=20 > take care, > Gerd >=20