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

2023-03-27 Thread Rebecca Cran

I'm not able to reproduce the failure you're seeing.

The error message, "clang: error: unable to execute command: program not 
executable" looks like it would be a temporary failure. Could you try again?


Also, you said to install LLVM 11.0.0, but you apparently have 12.0.1 
installed?



--
Rebecca Cran


On 3/22/23 4:46 PM, Guo, Gua wrote:


For "where clang"

For full build log based on

About Fail full log and Pass full log

> git clone https://github.com/bcran/edk2.git --recursive

> git checkout clangdwarf

> edksetup Rebuild

> py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019 > 
BuildLogDWARF_FAIL.log <- Attachment


> git -dfx

> rm -rf Build

> edksetup Rebuild

> py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019 > 
BuildLogDWARF_PASS.log <- Attachment


Thanks,

Gua

-Original Message-
From: Rebecca Cran 
Sent: Thursday, March 23, 2023 6:24 AM
To: Guo, Gua ; devel@edk2.groups.io; Kinney, 
Michael D ; Gao, Liming 
; Liu, Zhiguang ; 
Feng, Bob C ; Chen, Christine 
; Andrew Fish ; Leif Lindholm 
; Ard Biesheuvel 
; Justen, Jordan L 
; Gerd Hoffmann 
Subject: Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF 
toolchain and remove CLANG35 and CLANG38


Also "where clang" please.

And could you provide more of the build output please? Perhaps on 
https://pastebin.com/ <https://pastebin.com/> ?


Thanks.

Rebecca Cran

On 3/22/23 4:07 PM, Guo, Gua wrote:

>

> Mine are:

>

> -Original Message-

> From: Rebecca Cran mailto:rebe...@bsdio.com>>

> Sent: Wednesday, March 22, 2023 9:11 PM

> To: Guo, Gua mailto:gua@intel.com>>; 
devel@edk2.groups.io <mailto:devel@edk2.groups.io>; Kinney,


> Michael D <mailto:michael.d.kin...@intel.com>>; Gao, Liming


> mailto:gaolim...@byosoft.com.cn>>; Liu, 
Zhiguang mailto:zhiguang@intel.com>>;


> Feng, Bob C mailto:bob.c.f...@intel.com>>; 
Chen, Christine


> mailto:yuwei.c...@intel.com>>; Andrew Fish 
mailto:af...@apple.com>>; Leif Lindholm


> mailto:quic_llind...@quicinc.com>>; Ard 
Biesheuvel


> mailto:ardb+tianoc...@kernel.org>>; 
Justen, Jordan L


> mailto:jordan.l.jus...@intel.com>>; Gerd 
Hoffmann mailto:kra...@redhat.com>>


> Subject: Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF

> toolchain and remove CLANG35 and CLANG38

>

> I'm not seeing this failure. Could you tell me what the following

> commands print, please:

>

> where clang

>

> where lld

>

> Mine are:

>

> C:\Users\bcran\Documents\src\uefi\edk2>where clang

>

> C:\Program Files\LLVM\bin\clang.exe

>

> C:\Program Files (x86)\Microsoft Visual

>

> Studio\2019\Professional\VC\Tools\Llvm\bin\clang.exe

>

> C:\Users\bcran\Documents\src\uefi\edk2>where lld

>

> C:\Program Files\LLVM\bin\lld.exe

>

> C:\Program Files (x86)\Microsoft Visual

>

> Studio\2019\Professional\VC\Tools\Llvm\bin\lld.exe

>

> Also, could you provide more of the output?

>

> On 3/21/23 10:57 PM, Guo, Gua wrote:

>

> >

>

> > Try to verify the patch on my local. Could you help to check whether

>

> > it happen on your side ?

>

> >

>

> > Please make sure windows build is not broken before code submitting.

>

> >

>

> > Before the commit:

>

> >

>

> >   * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

>

> > VS2019 PASS

>

> >   o Install

>

> >

> 
https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe 
<https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe> 



> 
<https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe 
<https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe>>


>

> >   o Install VS2019

>

> >   o edksetup.bat Rebuild

>

> >   o py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019

>

> >

>

> >   * Ubuntu 20.04: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

>

> > GCC5 PASS

>

> >   o sudo apt install clang-10 llvm-10

>

> >   o source edksetup.sh

>

> >   o make -C BaseTools

>

> >   o python3 UefiPayloadPkg/UniversalPayloadBuild.py -t GCC5

>

> >

>

> > After the commit:

>

> >

>

> >   * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

>

> > VS2019 FAIL

>

> >   o Install

>

> >

> 
https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe 
<https://github

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

2023-03-23 Thread Ard Biesheuvel
On Thu, 23 Mar 2023 at 10:04, Ard Biesheuvel  wrote:
>
> On Thu, 23 Mar 2023 at 02:30, Rebecca Cran  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:   d503201fnop
> 304: R_AARCH64_ADR_PREL_PG_HI21 .data
>  308:   100015c1adr x1, 5c0 
> 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.

So I played around with this a bit more, also on ARM, and it seems to
me that simply disabling PIE linking is the best approach here - the
PE/COFF conversion essentially turns it into a relocatable binary
already, and so PIE linking does not actually add anything useful
here, and on ARM, the resulting ELF binary triggers an assert in GenFw

So adding

 -fuse-ld=lld -Wl,--no-relax,--no-pie

to both CLANG38_AARCH64_DLINK_FLAGS and CLANG38_ARM_DLINK_FLAGS works
for me locally, i.e., builds complete without errors and can boot
successfully.

We will also be able to drop the GccLto plugin pass through libraries,
which is rather nice as well.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101678): https://edk2.groups.io/g/devel/message/101678
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]
-=-=-=-=-=-=-=-=-=-=-=-




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

2023-03-23 Thread Ard Biesheuvel
On Thu, 23 Mar 2023 at 02:30, Rebecca Cran  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:   d503201fnop
304: R_AARCH64_ADR_PREL_PG_HI21 .data
 308:   100015c1adr x1, 5c0 
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]
-=-=-=-=-=-=-=-=-=-=-=-




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

2023-03-22 Thread Rebecca Cran

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.



--

Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101604): https://edk2.groups.io/g/devel/message/101604
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]
-=-=-=-=-=-=-=-=-=-=-=-




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

2023-03-22 Thread Rebecca Cran

Also "where clang" please.

And could you provide more of the build output please? Perhaps on 
https://pastebin.com/ ?



Thanks.

Rebecca Cran


On 3/22/23 4:07 PM, Guo, Gua wrote:


Mine are:

-Original Message-
From: Rebecca Cran 
Sent: Wednesday, March 22, 2023 9:11 PM
To: Guo, Gua ; devel@edk2.groups.io; Kinney, 
Michael D ; Gao, Liming 
; Liu, Zhiguang ; 
Feng, Bob C ; Chen, Christine 
; Andrew Fish ; Leif Lindholm 
; Ard Biesheuvel 
; Justen, Jordan L 
; Gerd Hoffmann 
Subject: Re: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF 
toolchain and remove CLANG35 and CLANG38


I'm not seeing this failure. Could you tell me what the following 
commands print, please:


where clang

where lld

Mine are:

C:\Users\bcran\Documents\src\uefi\edk2>where clang

C:\Program Files\LLVM\bin\clang.exe

C:\Program Files (x86)\Microsoft Visual

Studio\2019\Professional\VC\Tools\Llvm\bin\clang.exe

C:\Users\bcran\Documents\src\uefi\edk2>where lld

C:\Program Files\LLVM\bin\lld.exe

C:\Program Files (x86)\Microsoft Visual

Studio\2019\Professional\VC\Tools\Llvm\bin\lld.exe

Also, could you provide more of the output?

On 3/21/23 10:57 PM, Guo, Gua wrote:

>

> Try to verify the patch on my local. Could you help to check whether

> it happen on your side ?

>

> Please make sure windows build is not broken before code submitting.

>

> Before the commit:

>

>   * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

> VS2019 PASS

>   o Install

> 
https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe 
<https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe>


>   o Install VS2019

>   o edksetup.bat Rebuild

>   o py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019

>

>   * Ubuntu 20.04: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

> GCC5 PASS

>   o sudo apt install clang-10 llvm-10

>   o source edksetup.sh

>   o make -C BaseTools

>   o python3 UefiPayloadPkg/UniversalPayloadBuild.py -t GCC5

>

> After the commit:

>

>   * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

> VS2019 FAIL

>   o Install

> 
https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe 
<https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe>


>   o Install VS2019

>   o edksetup.bat Rebuild

>   o py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019

>  o

>

>   * Ubuntu 20.04: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t

> GCC5 PASS

>   o sudo apt install clang-10 llvm-10

>   o source edksetup.sh

>   o make -C BaseTools

>   o python3 UefiPayloadPkg/UniversalPayloadBuild.py -t GCC5

>

> Thanks,

>

> Gua

>

> -Original Message-

>

> From: devel@edk2.groups.io <mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> On Behalf Of Rebecca


> Cran

>

> Sent: Wednesday, March 22, 2023 9:31 AM

>

> To: devel@edk2.groups.io <mailto:devel@edk2.groups.io>; Kinney, 
Michael D


> mailto:michael.d.kin...@intel.com>>; 
Gao, Liming mailto:gaolim...@byosoft.com.cn>>;


> Liu, Zhiguang <mailto:zhiguang@intel.com>>; Feng, Bob C


> mailto:bob.c.f...@intel.com>>; Chen, 
Christine mailto:yuwei.c...@intel.com>>; Andrew


> Fish mailto:af...@apple.com>>; Leif Lindholm 
mailto:quic_llind...@quicinc.com>>; Ard


> Biesheuvel <mailto:ardb+tianoc...@kernel.org>>; Justen, Jordan L


> mailto:jordan.l.jus...@intel.com>>; Gerd 
Hoffmann mailto:kra...@redhat.com>>


>

> Cc: Rebecca Cran mailto:rebe...@bsdio.com>>

>

> Subject: [edk2-devel] [PATCH 3/9] BaseTools: Update CLANGDWARF

> toolchain and remove CLANG35 and CLANG38

>

> Update the CLANGDWARF toolchain definition with the settings from

> CLANG38, and delete the CLANG35 and CLANG38 toolchains.

>

> The existing CLANGDWARF toolchain definition used ld.lld, but this

> causes the following linker errors when building OvmfPkgX64.dsc:

>

> ld.lld: error: relocation R_X86_64_64 cannot be used against local

> symbol; recompile with -fPIC

>

> >>> defined in

>

> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExce

>

> >>> ptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExcepti

>

> >>> onHandlerLib.lib(ExceptionHandlerAsm.obj)

>

> >>> referenced by

> 
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii


>

> >>> ExceptionHa

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

2023-03-22 Thread Rebecca Cran
I'm not seeing this failure. Could you tell me what the following 
commands print, please:



where clang

where lld


Mine are:


C:\Users\bcran\Documents\src\uefi\edk2>where clang
C:\Program Files\LLVM\bin\clang.exe
C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Professional\VC\Tools\Llvm\bin\clang.exe


C:\Users\bcran\Documents\src\uefi\edk2>where lld
C:\Program Files\LLVM\bin\lld.exe
C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Professional\VC\Tools\Llvm\bin\lld.exe



Also, could you provide more of the output?


On 3/21/23 10:57 PM, Guo, Gua wrote:


Try to verify the patch on my local. Could you help to check whether 
it happen on your side ?


Please make sure windows build is not broken before code submitting.

Before the commit:

  * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t
VS2019 PASS
  o Install

https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe
  o Install VS2019
  o edksetup.bat Rebuild
  o py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019

  * Ubuntu 20.04: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t
GCC5 PASS
  o sudo apt install clang-10 llvm-10
  o source edksetup.sh
  o make -C BaseTools
  o python3 UefiPayloadPkg/UniversalPayloadBuild.py -t GCC5

After the commit:

  * Windows 10: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t
VS2019 FAIL
  o Install

https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe
  o Install VS2019
  o edksetup.bat Rebuild
  o py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t VS2019
 o

  * Ubuntu 20.04: py -3 UefiPayloadPkg\UniversalPayloadBuild.py -t
GCC5 PASS
  o sudo apt install clang-10 llvm-10
  o source edksetup.sh
  o make -C BaseTools
  o python3 UefiPayloadPkg/UniversalPayloadBuild.py -t GCC5

Thanks,

Gua

-Original Message-

From: devel@edk2.groups.io  On Behalf Of Rebecca 
Cran


Sent: Wednesday, March 22, 2023 9:31 AM

To: devel@edk2.groups.io; Kinney, Michael D 
; Gao, Liming ; 
Liu, Zhiguang ; Feng, Bob C 
; Chen, Christine ; Andrew 
Fish ; Leif Lindholm ; Ard 
Biesheuvel ; Justen, Jordan L 
; Gerd Hoffmann 


Cc: Rebecca Cran 

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


Update the CLANGDWARF toolchain definition with the settings from 
CLANG38, and delete the CLANG35 and CLANG38 toolchains.


The existing CLANGDWARF toolchain definition used ld.lld, but this 
causes the following linker errors when building OvmfPkgX64.dsc:


ld.lld: error: relocation R_X86_64_64 cannot be used against local 
symbol; recompile with -fPIC


>>> defined in

>>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExce

>>> ptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExcepti

>>> onHandlerLib.lib(ExceptionHandlerAsm.obj)

>>> referenced by 
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii


>>> ExceptionHandlerAsm.obj:(.text+0x5) in archive

>>> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiC

>>> puPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OU

>>> TPUT/SecPeiCpuExceptionHandlerLib.lib

ld.lld: error: relocation R_X86_64_64 cannot be used against local 
symbol; recompile with -fPIC


>>> defined in

>>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExce

>>> ptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExcepti

>>> onHandlerLib.lib(ExceptionHandlerAsm.obj)

>>> referenced by 
edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii


>>> ExceptionHandlerAsm.obj:(.text+0x14) in archive

>>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExce

>>> ptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExcepti

>>> onHandlerLib.lib

To avoid this, use the default ld (which is normally GNU ld) instead.

Signed-off-by: Rebecca Cran 

---

BaseTools/Conf/tools_def.template | 453 

1 file changed, 171 insertions(+), 282 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template


index 471eb67c0c83..a790366063ea 100755

--- a/BaseTools/Conf/tools_def.template

+++ b/BaseTools/Conf/tools_def.template

@@ -273,32 +273,21 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc

# Required to build platforms or ACPI tables:

#   Intel(r) ACPI Compiler from

# https://acpica.org/downloads

-#

-#   CLANG35 -Linux,Windows- Requires:

-# Clang v3.5 or later, and GNU binutils 
targeting aarch64-linux-gnu or arm-linux-gnueabi


-#    Optional:

-# Required to build 

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

2023-03-22 Thread Ard Biesheuvel
On Wed, 22 Mar 2023 at 14:03, Gerd Hoffmann  wrote:
>
> On Wed, Mar 22, 2023 at 01:32:01PM +0100, Ard Biesheuvel wrote:
> > On Wed, 22 Mar 2023 at 13:28, Rebecca Cran  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.
> > > >
> > > > I can work around this issue locally by doing
> > > >
> > > > --- a/OvmfPkg/OvmfPkgX64.dsc
> > > > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > > > @@ -297,7 +297,7 @@
> > > > PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
> > > > 
> > > > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
> > > > 
> > > > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
> > > > -!if $(TOOL_CHAIN_TAG) == "XCODE5"
> > > > +!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"
> > > > 
> > > > CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
> > > >   !else
> > > >
> > > > Can you please check whether this works for you as well?
> > >
> > > Thanks, that works here too!
> > >
> > > Do we still need to keep CLANG35 and CLANG38 toolchains for
> > > compatibility with the ARM toolchain? Or have things moved on so they
> > > _can_ be removed?
> > >
> >
> > No, please go ahead and merge all of those - the 35/38 naming is so
> > out of date it is likely to confuse people, so we should rename those
> > in any case.
>
> Same goes for all the GCC4x toolchains I guess ...
>

Indeed - we should just drop those, and rename GCC5 to GCC


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101575): https://edk2.groups.io/g/devel/message/101575
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]
-=-=-=-=-=-=-=-=-=-=-=-




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

2023-03-22 Thread Gerd Hoffmann
On Wed, Mar 22, 2023 at 01:32:01PM +0100, Ard Biesheuvel wrote:
> On Wed, 22 Mar 2023 at 13:28, Rebecca Cran  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.
> > >
> > > I can work around this issue locally by doing
> > >
> > > --- a/OvmfPkg/OvmfPkgX64.dsc
> > > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > > @@ -297,7 +297,7 @@
> > > PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
> > > 
> > > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
> > > 
> > > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
> > > -!if $(TOOL_CHAIN_TAG) == "XCODE5"
> > > +!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"
> > > 
> > > CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
> > >   !else
> > >
> > > Can you please check whether this works for you as well?
> >
> > Thanks, that works here too!
> >
> > Do we still need to keep CLANG35 and CLANG38 toolchains for
> > compatibility with the ARM toolchain? Or have things moved on so they
> > _can_ be removed?
> >
> 
> No, please go ahead and merge all of those - the 35/38 naming is so
> out of date it is likely to confuse people, so we should rename those
> in any case.

Same goes for all the GCC4x toolchains I guess ...

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101574): https://edk2.groups.io/g/devel/message/101574
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]
-=-=-=-=-=-=-=-=-=-=-=-




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

2023-03-22 Thread Ard Biesheuvel
On Wed, 22 Mar 2023 at 13:28, Rebecca Cran  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.
> >
> > I can work around this issue locally by doing
> >
> > --- a/OvmfPkg/OvmfPkgX64.dsc
> > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > @@ -297,7 +297,7 @@
> > PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
> > 
> > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
> > 
> > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
> > -!if $(TOOL_CHAIN_TAG) == "XCODE5"
> > +!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"
> > 
> > CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
> >   !else
> >
> > Can you please check whether this works for you as well?
>
> Thanks, that works here too!
>
> Do we still need to keep CLANG35 and CLANG38 toolchains for
> compatibility with the ARM toolchain? Or have things moved on so they
> _can_ be removed?
>

No, please go ahead and merge all of those - the 35/38 naming is so
out of date it is likely to confuse people, so we should rename those
in any case.

I haven't tried building EDK2 for ARM with LLD myself - let me know if
you run into any issues there.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101573): https://edk2.groups.io/g/devel/message/101573
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]
-=-=-=-=-=-=-=-=-=-=-=-




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

2023-03-22 Thread Rebecca Cran

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.

I can work around this issue locally by doing

--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -297,7 +297,7 @@
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf

PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf

MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
-!if $(TOOL_CHAIN_TAG) == "XCODE5"
+!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"

CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
  !else

Can you please check whether this works for you as well?


Thanks, that works here too!

Do we still need to keep CLANG35 and CLANG38 toolchains for 
compatibility with the ARM toolchain? Or have things moved on so they 
_can_ be removed?



--
Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101571): https://edk2.groups.io/g/devel/message/101571
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]
-=-=-=-=-=-=-=-=-=-=-=-




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

2023-03-22 Thread Ard Biesheuvel
On Wed, 22 Mar 2023 at 02:30, Rebecca Cran  wrote:
>
> Update the CLANGDWARF toolchain definition with the settings from
> CLANG38, and delete the CLANG35 and CLANG38 toolchains.
>
> The existing CLANGDWARF toolchain definition used ld.lld, but this
> causes the following linker errors when building OvmfPkgX64.dsc:
>
> ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol;
> recompile with -fPIC
> >>> defined in 
> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
> >>> referenced by 
> >>> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
> >>>   ExceptionHandlerAsm.obj:(.text+0x5) in archive 
> >>> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
>
> ld.lld: error: relocation R_X86_64_64 cannot be used against local symbol; 
> recompile with -fPIC
> >>> defined in 
> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
> >>> referenced by 
> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
> >>>   ExceptionHandlerAsm.obj:(.text+0x14) in archive 
> >>> edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
>
> To avoid this, use the default ld (which is normally GNU ld) instead.
>

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.

I can work around this issue locally by doing

--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -297,7 +297,7 @@
   PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
   
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
   
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
-!if $(TOOL_CHAIN_TAG) == "XCODE5"
+!if $(TOOL_CHAIN_TAG) == "XCODE5" || $(TOOL_CHAIN_TAG) == "CLANGDWARF"
   
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerLib.inf
 !else

Can you please check whether this works for you as well?





> Signed-off-by: Rebecca Cran 
> ---
>  BaseTools/Conf/tools_def.template | 453 
>  1 file changed, 171 insertions(+), 282 deletions(-)
>
> diff --git a/BaseTools/Conf/tools_def.template 
> b/BaseTools/Conf/tools_def.template
> index 471eb67c0c83..a790366063ea 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -273,32 +273,21 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
>  # Required to build platforms or ACPI tables:
>  #   Intel(r) ACPI Compiler from
>  #   https://acpica.org/downloads
> -#
> -#   CLANG35 -Linux,Windows-  Requires:
> -# Clang v3.5 or later, and GNU binutils 
> targeting aarch64-linux-gnu or arm-linux-gnueabi
> -#Optional:
> -# Required to build platforms or ACPI tables:
> -#   Intel(r) ACPI Compiler from
> -#   https://acpica.org/downloads
> -#   CLANG38  -Linux-  Requires:
> -# Clang v3.8, LLVMgold plugin and GNU binutils 
> 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi
> -# Clang v3.9 or later, LLVMgold plugin and GNU 
> binutils 2.28 targeting x86_64-linux-gnu, aarch64-linux-gnu or 
> arm-linux-gnueabi
> +#   CLANGDWARF  -Linux-  Requires:
> +# Clang 9 or above, and GNU binutils targeting 
> x86_64-linux-gnu, aaarch64-linux-gnu or arm-linux-gnuaebi
>  #Optional:
>  # Required to build platforms or ACPI tables:
>  #   Intel(r) ACPI Compiler from
>  #   https://acpica.org/downloads
> +# Required to compile nasm source:
> +#   nasm compiler from
> +#   NASM -- https://nasm.us
>  #   CLANGPDB -Linux, Windows, Mac-  Requires:
>  # Clang 9 or above from http://releases.llvm.org/
>  #Optional:
>  # Required to