On Thu, 23 Mar 2023 at 02:30, Rebecca Cran <rebe...@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/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-