On Mon, May 22, 2023 at 02:55:43PM +0200, Ard Biesheuvel wrote:
> On Mon, 22 May 2023 at 14:28, Gerd Hoffmann <kra...@redhat.com> wrote:
> >
> >   Hi,
> >
> > So, after a way to long time gap, I finally found the time to look at
> > this again.  This time tried both gcc and clang.
> >
> > Just dropping the visibility hidden #pragma works fine for gcc.  It also
> > works with clang for DEBUG and RELEASE builds, but not for NOOPT builds.
> 
> So what failures are you seeing in this case?

"GenFw" -e UEFI_DRIVER -o 
/home/kraxel/projects/edk2/Build/OvmfX64/NOOPT_CLANGDWARF/X64/FatPkg/EnhancedFatDxe/Fat/OUTPUT/Fat.efi
 
/home/kraxel/projects/edk2/Build/OvmfX64/NOOPT_CLANGDWARF/X64/FatPkg/EnhancedFatDxe/Fat/DEBUG/Fat.dll
GenFw: ERROR 3000: Unsupported
  FindElfGOTSectionFromGOTEntryElfRva: GOT entries found in multiple sections.
make: *** [GNUmakefile:450: 
/home/kraxel/projects/edk2/Build/OvmfX64/NOOPT_CLANGDWARF/X64/FatPkg/EnhancedFatDxe/Fat/OUTPUT/Fat.efi]
 Error 1

> I assume this is using LLD.

Yes, there is '-fuse-ld=lld' on the clang command line.

> So the problem with LLD is that it does not update the static
> relocations it emits into the executables, so even if the linker
> relaxes any GOT based references, the relocation entry still claims
> that a GOT based reference exists.

# objdump -x 
/home/kraxel/projects/edk2/Build/OvmfX64/NOOPT_CLANGDWARF/X64/FatPkg/EnhancedFatDxe/Fat/DEBUG/Fat.dll
 | grep -i got | head
000000000000134e R_X86_64_REX_GOTPCRELX  gBS-0x0000000000000004
0000000000001ab9 R_X86_64_REX_GOTPCRELX  gBS-0x0000000000000004
0000000000001bbf R_X86_64_REX_GOTPCRELX  gBS-0x0000000000000004
00000000000021c7 R_X86_64_REX_GOTPCRELX  FatFsLock-0x0000000000000004
0000000000003eb1 R_X86_64_REX_GOTPCRELX  gFatDriverBinding-0x0000000000000004
0000000000003ebc R_X86_64_REX_GOTPCRELX  
gEfiDiskIoProtocolGuid-0x0000000000000004
0000000000004695 R_X86_64_REX_GOTPCRELX  FatFsLock-0x0000000000000004
0000000000004bfc R_X86_64_REX_GOTPCRELX  FatFsLock-0x0000000000000004
0000000000004c6e R_X86_64_REX_GOTPCRELX  FatFileInterface-0x0000000000000004
0000000000004d74 R_X86_64_REX_GOTPCRELX  FatFsLock-0x0000000000000004

> Recent clang does have a '-fdirect-access-external-data' switch which
> should suppress these references, maybe in combination with
> -fvisibility=hidden?

I'll try that.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105126): https://edk2.groups.io/g/devel/message/105126
Mute This Topic: https://groups.io/mt/98257896/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to