Hi Ray,

 

No sure if I recall all the details.  Andrew may know them much better than me.

 

The code gen for XCODE uses PIE and RIP relative addressing, which does not require the same number/type of relocation fixups.

 

Whenever there is a need to access a data element at an absolute address and the code is copied to

a new location the RIP relative address will not work.

 

And if you try to use absolute addressing, you will get an error from XCODE linker for an unsupported fixup type.

 

Mike

 

From: Ni, Ray <ray.ni@intel.com>
Sent: Thursday, March 30, 2023 3:16 AM
To: Andrew Fish <afish@apple.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com>
Subject: Is Xcode5ExceptionHandlerAsm.nasm still needed?

 

Andrew,

In UefiCpuPkg\Library\CpuExceptionHandlerLib\X64\, there are two nasm files: ExceptionHandlerAsm.nasm and the other XCODE version.

 

The major diff between the two is the second operand in “mov rax, ASM_PFX(CommonInterruptEntry)” is patched at runtime by code, instead of relying on linker/loader to fix it.

Can I know more background why it’s needed for XCODE?

 

Given Apple is switching away from X86 CPU, is the XCODE version still needed?

 

+ Mike because I found another commit by you for bug: 565 – Fix X64 XCODE5/NASM compatibility issue in UefiCpuPkg MpInitLib (tianocore.org).

 

Thanks,

Ray