Scott Duplichan [mailto:sc...@notabs.org] wrote:

]ArmPlatformPkg: fix undefined reference to memcpy
]
]Contributed-under: TianoCore Contribution Agreement 1.0
]Signed-off-by: Scott Duplichan <sc...@notabs.org>
]---
]
]When building ArmJuno, (-flto -Os build only) fails with:
]ArmPlatformPkg\Library\PL031RealTimeClockLib/PL031RealTimeClockLib.c:224: 
undefined reference to `memcpy'
]Clearly STATIC was intended for the day of month lookup table so

STATIC works, but the use of STATIC CONST is better read-only declaration
in general. That can let the read-only data live in flash memory for the case
of XIP code. A revised patch follows.

]that the compiler doesn't have to generate code to create the table
]at runtime each time the function is entered. Apparently -flto
]triggers use of memcpy for creating the table. making the table
]static removes the need for the compiler to create it at runtime.
]
]Thanks,
]Scott

--- 

Index: ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
===================================================================
--- ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c        
(revision 16323)
+++ ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c        
(working copy)
@@ -221,7 +221,7 @@
   IN  EFI_TIME  *Time
   )
 {
-  INTN  DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+  STATIC CONST INTN  DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 
31, 30, 31 };
 
   if (Time->Day < 1 ||
       Time->Day > DayOfMonth[Time->Month - 1] ||

Attachment: arm-memcpy-fix_11-11-2014.patch
Description: Binary data

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to