From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.22143.1684762735359384398 for ; Mon, 22 May 2023 06:38:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WiFm5aSI; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684762734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=waKblRojEHT32vm/+wnZpc67F2Kz1WxJ84vKpxcrtyc=; b=WiFm5aSIcTVsMOWHyBDVd+a1KxbGY1hVZ3TYyJzmOI0YyUDzHDMcBfgZdkv2IEU0j1b0o1 bunMYz/5ep10WeUBmi12uDz4PNZIDXRWNmdtvs7JtMR0Dftx9xvUP5cK7ssH0xl1Uo8hJo viKrnjj0q8Eewb57jCfWxjMKRev9Cts= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-211-cJjmoMqoNkeaetnEwCELkQ-1; Mon, 22 May 2023 09:38:50 -0400 X-MC-Unique: cJjmoMqoNkeaetnEwCELkQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6844D803CBD; Mon, 22 May 2023 13:38:41 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.139]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4FBDEC1ED9F; Mon, 22 May 2023 13:38:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1EACC1800606; Mon, 22 May 2023 15:38:39 +0200 (CEST) Date: Mon, 22 May 2023 15:38:39 +0200 From: "Gerd Hoffmann" To: devel@edk2.groups.io, ardb@kernel.org Cc: Marvin =?utf-8?Q?H=C3=A4user?= , Pawel Polawski , Dongyan Qian , Sunil V L , Baoqi Zhang , Chao Li , Rebecca Cran , Ard Biesheuvel , Zhiguang Liu , Liming Gao , Yuwei Chen , Leif Lindholm , Michael D Kinney , Daniel Schaefer , Bob Feng , Oliver Steffen Subject: Re: [edk2-devel] [PATCH v4 01/10] BaseTools: add BASETOOLS define Message-ID: <7twvlm4w6euyc637maj4mqskob5747wfu4tridl4jtxujruegg@r4jyw7vitl3w> References: <20230414080250.1357004-2-kraxel@redhat.com> <18EC1A6E-8B81-4564-83A5-DA8EC2BA54ED@posteo.de> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, May 22, 2023 at 02:55:43PM +0200, Ard Biesheuvel wrote: > On Mon, 22 May 2023 at 14:28, Gerd Hoffmann 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