Ok, I created a script after all - I went ahead and created a script to add 
AREA directives whenever an exported label is found.

Same question as before: do you want me to submit a patchset with the AREA 
prefixes added or do you (Ard/Leif) want to handle this?

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

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Cohen, 
Eugene
Sent: Thursday, November 19, 2015 5:53 AM
To: edk2-devel@lists.01.org
Subject: [edk2] ArmPkg: Dead code stripping

[I thought I upstreamed this long ago but it must have been a dream, so here 
goes...]

Leif and Ard,

In order to get the RVCT toolchain to dead code stripping at link time (the 
--remove option, which is the default), each function needs to be in its own 
section.  For C code we accomplish this --split_sections switch.  For assembly 
there is no switch I'm aware of so the source code must define each function in 
its own section with AREA prefixes, like this:

    AREA    s_ArmInvalidateDataCacheEntryByMVA, CODE, READONLY
ArmInvalidateDataCacheEntryByMVA
  mcr     p15, 0, r0, c7, c6, 1   ; invalidate single data cache line
  dsb
  isb
  bx      lr

    AREA    s_ ArmCleanDataCacheEntryByMVA, CODE, READONLY
ArmCleanDataCacheEntryByMVA
  mcr     p15, 0, r0, c7, c10, 1  ; clean single data cache line
  dsb
  isb
  bx      lr

for larger assembly files the code size saving can be substantial, especially 
for uncompressed/XIP code.

So I think we need to process *.asm in ArmPkg to add the AREA directives to get 
proper section splitting.  (I know this applies to RVCT for the ARM 
architecture - I'm not sure if there is an AArch64 equivalent.)

Shall I start submitting patches to add the AREA prefixes or would you like to 
investigate some alternatives?  Since our needs have only been for a few files 
I just manually added the prefixes.  Perhaps a clever script could 
automatically generate the prefixes in one sweep and we can hit all the files 
at once.

Thanks,

Eugene


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to