public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: dann frazier <dannf@debian.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>,
	Yonghong Zhu <yonghong.zhu@intel.com>,
	Liming Gao <liming.gao@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH v2] BaseTools/GCC ARM/AARCH64: Force disable PIE
Date: Sun, 28 May 2017 12:14:06 +0000	[thread overview]
Message-ID: <CAKv+Gu8Cu-D18JaRC5nkWPAxPgtZ-UXf02u99KdfM_6nk22=jQ@mail.gmail.com> (raw)
In-Reply-To: <20170525212456.zxlmhaxvckemc3gv@xps13.dannf>

On 25 May 2017 at 21:24, dann frazier <dannf@debian.org> wrote:
> On Wed, May 24, 2017 at 03:27:07PM -0700, Ard Biesheuvel wrote:
>> On 24 May 2017 at 13:26, dann frazier <dannf@debian.org> wrote:
>> > v2:
>> > * Replace -no-pie w/ -static for compat with GCC 4.9
>> >
>>
>> For my understanding, could you elaborate on what goes wrong if you
>> omit -static / -no-pie?
>
> Well, nothing... now :) -static/-no-pie was avoiding an issue with GenFw:
>
>    -----------
> "GenFw" -e SEC -o /tmp/edk2/Build/ArmVirtQemu-AARCH64/DEBUG_GCC49/AARCH64/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore/DEBUG/ArmPlatformPrePeiCore.efi /tmp/edk2/Build/ArmVirtQemu-AARCH64/DEBUG_GCC49/AARCH64/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore/DEBUG/ArmPlatformPrePeiCore.dll
> GenFw: ERROR 3000: Invalid
>   WriteSections64():
>   /tmp/edk2/Build/ArmVirtQemu-AARCH64/DEBUG_GCC49/AARCH64/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore/DEBUG/ArmPlatformPrePeiCore.dll
>   AARCH64 small code model requires identical ELF and PE/COFF section
>   offsets modulo 4 KB.
> [...]
>    -----------
>
> Upon rebase/retest, I found that this was no longer reproducible.
> Bisection shows that the problem went away recently after this commit:
>
> commit 00b00cc57bfe0fca54c904d4dd44a263e243c88b
> Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Date:   Fri May 19 11:47:40 2017 +0100
>
>     BaseTools/Scripts: discard .gnu.hash section in GCC builds
>
> -*f*no-pie does still seem to be needed though. Without it, the ARM
> build fails with:
>
>    -----------
> "GenFw" -e DXE_DRIVER -o /tmp/edk2/Build/ArmVirtQemu-ARM/DEBUG_GCC49/ARM/MdeModulePkg/Universal/Network/DpcDxe/DpcDxe/DEBUG/DpcDxe.efi /tmp/edk2/Build/ArmVirtQemu-ARM/DEBUG_GCC49/ARM/MdeModulePkg/Universal/Network/DpcDxe/DpcDxe/DEBUG/DpcDxe.dll
> GenFw: ERROR 3000: Invalid
>   /tmp/edk2/Build/ArmVirtQemu-ARM/DEBUG_GCC49/ARM/MdeModulePkg/Universal/Network/DpcDxe/DpcDxe/DEBUG/DpcDxe.dll: Bad definition for symbol '_GLOBAL_OFFSET_TABLE_'@0x5e94 or unsupported symbol type.  For example, absolute and undefined symbols are not supported.
>    -----------
>

Meh. That is actually quite annoying. For AARCH64, we simply haven't
implemented the GOT related ELF relocations in the ELF to PE/COFF
converter, so there we cannot deal with PIC code involving GOT entries
at all. For ARM, the only roadblock appears to be that
__GLOBAL_OFFSET_TABLE__ is emitted as SHN_ABS (which makes no sense at
all given that it points into the image, which makes it relative like
any other symbol reference).

In any case, could you please drop the -static and respin? Thanks.


      reply	other threads:[~2017-05-28 12:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 20:26 [PATCH v2] BaseTools/GCC ARM/AARCH64: Force disable PIE dann frazier
2017-05-24 22:27 ` Ard Biesheuvel
2017-05-25 21:24   ` dann frazier
2017-05-28 12:14     ` 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+Gu8Cu-D18JaRC5nkWPAxPgtZ-UXf02u99KdfM_6nk22=jQ@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