[edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF toolchain and remove CLANG35 and CLANG38

Ard Biesheuvel ardb at kernel.org
Thu Mar 23 09:04:52 UTC 2023


On Thu, 23 Mar 2023 at 02:30, Rebecca Cran <rebecca at bsdio.com> wrote:
>
> On 3/22/23 5:49 AM, Ard Biesheuvel wrote:
>
> >
> > The reason I added CLANG3x support for ARM in the past is to ensure
> > compatibility with the ARM proprietary, Clang based toolchain. At the
> > time, we went with GNU ld, but I would actually prefer if we could
> > make this work with LLD as well.
>
> Just to confirm, I'll keep lld for X64 and IA32, but I won't add
> -fuse-ld=lld for ARM or AARCH64 since none of the toolchain definitions
> currently do so.
>
>
> The problem with trying to use lld for aarch64 is the following error:
>
>
> GenFw: ERROR 3000: Invalid
>    WriteSections64():
> /home/bcran/uefi/edk2/Build/ArmVirtQemu-AARCH64/RELEASE_CLANGDWARF/AARCH64/ArmVirtPkg/MemoryInitPei/MemoryInitPeim/DEBUG/MemoryInit.dll
> due to its size (> 1 MB), this module requires 4 KB section alignment.
>

That seems to be a false positive error in GenFw.

It looks like LLD turns

ADRP
ADD

into

NOP
ADR

if the target is within -/+ 1 MiB but it doesn't update the
relocations, so GenFw goes off into the weeds. I.e..

 304:   d503201f        nop
                        304: R_AARCH64_ADR_PREL_PG_HI21 .data
 308:   100015c1        adr     x1, 5c0 <gArmMpCoreInfoPpiGuid>
                        308: R_AARCH64_ADD_ABS_LO12_NC  .data

This is just another indication that using --emit-relocs is a bad
idea, and we should really be building PIE executables and converting
those based on the dynamic relocation instead.

Adding -Wl,--no-relax to the DLINK flags should help with this,
although I notice that there are other LLD related issues, in the ID
map code I added to ArmVirtQemu a while ago, so ArmVirtQemu.dsc still
does not build.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101652): https://edk2.groups.io/g/devel/message/101652
Mute This Topic: https://groups.io/mt/97769546/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list