On Jan 15, 2013, at 9:20 PM, "Tian, Feng" <feng.t...@intel.com> wrote:

> Hi, Andrew
>  
> Which case will have to do this change? If the file format needs a relocation 
> entry, what it will impact?
>  

It breaks Xcode for X64. 

"as" -arch x86_64 -g -o 
/Users/fish/work/edk2TOT/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.obj
 -I/Users/fish/work/edk2TOT/OvmfPkg/Library/LoadLinuxLib/X64 
-I/Users/fish/work/edk2TOT/OvmfPkg/Library/LoadLinuxLib 
-I/Users/fish/work/edk2TOT/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/DEBUG
 -I/Users/fish/work/edk2TOT/MdePkg -I/Users/fish/work/edk2TOT/MdePkg/Include 
-I/Users/fish/work/edk2TOT/MdePkg/Include/X64 
-I/Users/fish/work/edk2TOT/OvmfPkg -I/Users/fish/work/edk2TOT/OvmfPkg/Include 
/Users/fish/work/edk2TOT/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii
/Users/fish/work/edk2TOT/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:34:32-bit
 absolute addressing is not supported for x86-64
/Users/fish/work/edk2TOT/Build/OvmfX64/DEBUG_XCLANG/X64/OvmfPkg/Library/LoadLinuxLib/LoadLinuxLib/OUTPUT/X64/JumpToKernel.iii:34:cannot
 do signed 4 byte relocation

The Xcode assembler is more focused on supporting the complier than humans 
writing assembler, so not all the features are support. 
If you think about it a 64-bit address is quite large. A %RIP relative address 
can be encoded in a much smaller space lea 20(%rip), %eax can be encoded in a 
much smaller instruction and it does not take up a relocation in the PE/COFF 
image. So I  think clang does %RIP relative addressing for X64 vs. encoding 
64-bit absolute addressees. 

Thanks,

Andrew Fish

> Thanks
> Feng
>  
> From: Andrew Fish [mailto:af...@apple.com] 
> Sent: Wednesday, January 16, 2013 05:58
> To: edk2-devel@lists.sourceforge.net
> Subject: [edk2] [Patch] MdeModulePkg: Fix Xcode assembly issue
>  
> Dear MdeModulePkg maintainer,
>  
> Please review this patch that is required to make this file assemble and link 
> with Xcode. It replaces absolute addressing that requires a relocation entry 
> with PC relative addressing that does not require a relocation entry.
>  
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: af...@apple.com
>  
> svn diff --diff-cmd diff Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S
> Index: Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S
> ===================================================================
> --- Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S    (revision 14050)
> +++ Universal/Acpi/BootScriptExecutorDxe/X64/S3Asm.S (working copy)
> @@ -18,14 +18,14 @@
>  ASM_PFX(AsmTransferControl):
>      # rcx S3WakingVector    :DWORD
>      # rdx AcpiLowMemoryBase :DWORD
> -    lea   _AsmTransferControl_al_0000, %eax 
> +    lea   _AsmTransferControl_al_0000(%rip), %eax   
>      movq  $0x2800000000, %r8 
>      orq   %r8, %rax
>      pushq %rax
>      shrd  $20, %ecx, %ebx
>      andl  $0x0f, %ecx 
>      movw  %cx, %bx
> -    movl  %ebx, jmp_addr 
> +    movl  %ebx, jmp_addr(%rip) 
>      lret
>  _AsmTransferControl_al_0000:
>      .byte    0x0b8, 0x30, 0      # mov ax, 30h as selector
> @@ -124,7 +124,7 @@
>      popq     %rcx
>      popq     %rax                         # restore all volatile registers
>      jnz      L1
> -    jmpq     *ASM_PFX(mOriginalHandler)
> +    jmpq     *ASM_PFX(mOriginalHandler)(%rip)
>  L1:
>      addq     $0x08, %rsp                  # skip error code for PF
>      iretq
>  
>  
> Andrew Fish
>  
>  
> 
> 
>  
> ------------------------------------------------------------------------------
> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
> and much more. Keep your Java skills current with LearnJavaNow -
> 200+ hours of step-by-step video tutorials by Java experts.
> SALE $49.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122612 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to