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

Attachment: ASM_FUNCTION_REMOVE_IF_UNREFERENCED.patch
Description: Binary data

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

Reply via email to