As you know, EDK2 depends on the linker stripping dead code to manage code 
size, especially from libraries.  This is particularly important when running 
from a pre-DDR environment (memory-mapped flash or SRAM).

The ARM RVCT linker can only do dead code stripping by placing different 
functions into different section.  With ARM RVCT C compiler we currently handle 
this with the "--split_sections" switch which forces every function into its 
own section.

With the ARM RVCT assembler no such smart option is available.  Currently the 
ARM support libraries (ArmLib and the like) combine all the code in an assembly 
file into one section.  So when a module calls one function in the file, the 
linker includes all of the functions as well even though they're not called.

The solution to this is to place an AREA directive before each function in RVCT 
assembly files to force them into their own sections and get the  dead code 
stripping we want.

I implemented this on our older edk2 codebase (based on rev 13353) and have 
attached the patch.  My apologies for the patch being based on so old a 
revision - this means there are probably more functions that will need this 
treatment in the latest revision.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen  eug...@hp.com<mailto:eug...@hp.com>

Eugene

Attachment: armlib_functions_in_sections.patch
Description: armlib_functions_in_sections.patch

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to