public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@linaro.org>
To: Laszlo Ersek <lersek@redhat.com>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [edk2-devel] [PATCH] ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: revert to PIE linking
Date: Fri, 6 Sep 2019 15:47:39 -0700	[thread overview]
Message-ID: <CAKv+Gu_VGT4aHrp7J9perKv8-U2X67vT8tRZWKhfA6BWs-T5wA@mail.gmail.com> (raw)
In-Reply-To: <7dff2d0c-eb94-62a8-f07a-705050a71645@redhat.com>

On Thu, 5 Sep 2019 at 12:33, Laszlo Ersek <lersek@redhat.com> wrote:
>
> On 09/05/19 01:04, Ard Biesheuvel wrote:
> > In some cases, the CLANG38 toolchain profile in LTO mode emits GOT
> > based relocations in spite of our attempts to avoid this, by using
> > hidden visibility, -Bsymbolic etc.
> >
> > On AARCH64, we managed to work around this by processing the GOT
> > based relocations in GenFw. As it turns out, the same issue exists
> > on 32-bit ARM, but unfortunately, we cannot use a similar trick to
> > get rid of the GOT entry, and the relocation metadata is insufficient
> > to locate the GOT entry in the binary.
> >
> > A bit of trial and error reveals that switching the linker options from
> > -pie to -shared in commit e07092edca8442db4a941dbeea0cd196c7bf8ec9 was
> > not the best approach, and instead, we can pass -pie to the linker
> > directly (using -Wl,xxx) rather than to the compiler directly, which
> > turns out to massage the linker in the right way, and prevents if from
> > emitting GOT based relocations. Your mileage may vary ...
> >
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> > Let's test this on a couple of different Clang versions. If it still
> > produces problems, the only other way I see is to disable the builds
> > of platforms that incorporate this module for ARM/CLANG38 [which is
> > not the end of the world]
> >
> >  ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
> > index 683397b7afd1..9e58e56fce09 100755
> > --- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
> > +++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
> > @@ -97,4 +97,4 @@
> >    gArmTokenSpaceGuid.PcdFvBaseAddress
> >
> >  [BuildOptions]
> > -  GCC:*_*_*_DLINK_FLAGS = -shared -Wl,-Bsymbolic -Wl,-T,$(MODULE_DIR)/Scripts/PrePi-PIE.lds
> > +  GCC:*_*_*_DLINK_FLAGS = -Wl,-Bsymbolic,-pie,-T,$(MODULE_DIR)/Scripts/PrePi-PIE.lds
> >
>
> Sorry for being late to this patch, I can see [*] it's upstream alrady.
> Nonetheless:
>
> Acked-by: Laszlo Ersek <lersek@redhat.com>
>

Thanks. Since the patch is already merged, I'll find another patch to
attach it to :-)

> [*] Not from my inbox though -- I've got again too much on my plate and
> am fetching email in batches. But, between my rebasing of
> "ArmVirtPkg/PlatformBootManagerLib: unload image on
> EFI_SECURITY_VIOLATION", building it, and attempting to push it, you had
> pushed this one -- and I did notice that. :)
>
> Thanks,
> Laszlo

      reply	other threads:[~2019-09-06 22:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 23:04 [PATCH] ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: revert to PIE linking Ard Biesheuvel
2019-09-05 14:19 ` Leif Lindholm
2019-09-05 14:25   ` Ard Biesheuvel
2019-09-05 15:55     ` Leif Lindholm
2019-09-05 17:06       ` Ard Biesheuvel
2019-09-05 17:16         ` Leif Lindholm
2019-09-05 17:19           ` Ard Biesheuvel
2019-09-05 14:27   ` Ard Biesheuvel
2019-09-05 19:33 ` [edk2-devel] " Laszlo Ersek
2019-09-06 22:47   ` Ard Biesheuvel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKv+Gu_VGT4aHrp7J9perKv8-U2X67vT8tRZWKhfA6BWs-T5wA@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox