Liming,

Here is the updated patch for the MdePkg, one patch per lib.

~/work/src/edk2(ASM_FUNCTION_REMOVE_IF_UNREFERENCED)>find MdePkg  -iname '*.S' -exec grep -L ASM_FUNCTION_REMOVE_IF_UNREFERENCED  {} \; | grep Ia32
~/work/src/edk2(ASM_FUNCTION_REMOVE_IF_UNREFERENCED)>find MdePkg  -iname '*.S' -exec grep -L ASM_FUNCTION_REMOVE_IF_UNREFERENCED  {} \; | grep X64
~/work/src/edk2(ASM_FUNCTION_REMOVE_IF_UNREFERENCED)>

Thanks,

Andrew Fish

Attachment: ASM_FUNCTION_REMOVE_IF_UNREFERENCED.patch
Description: Binary data



On Nov 7, 2014, at 2:30 AM, Andrew Fish <af...@apple.com> wrote:


On Nov 6, 2014, at 9:23 PM, Gao, Liming <liming....@intel.com> wrote:

Andrew:
  Is this a full list? I find some missing .S files in MdePkg, such as BaseCpuLib/X64/CpuSleep.S, BaseMemoryLibSse2/X64/ScanMem8.S.
 

Liming,

I might have missed some, as initially I was looking at the build output map files to target the fixes. I write a script to scan the .S files, and update the patchs. 

Thanks,

Andrew Fish

Thanks
Liming
From: Andrew Fish [mailto:af...@apple.com] 
Sent: Friday, November 07, 2014 3:15 AM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] MdePkg patches to fix Xcode dead stripping issues.
 
For an assembly function to be stripped by the Xcode linker the .S file must contain the .subsections_via_symbols directive. The edk2 abstracts this away via ASM_FUNCTION_REMOVE_IF_UNREFERENCED.
 
If the .S does not contain a ASM_FUNCTION_REMOVE_IF_UNREFERENCED, then when this library is included those assemble functions always end up in the final image even if they are not called. If there are unreferenced intermediate symbols that do not start with L, that are not accessed then the the code from that label to the next label will be removed. Thus multiple assembly functions can be in a single file and each one gets dead stripped independent. 
 
The patch should be low risk as ASM_FUNCTION_REMOVE_IF_UNREFERENCED is mapped to nothing on assemblers other than Xcode. 
 
Thanks,
 
Andrew Fish
 
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to