All good now, thanks for clarifying.I have converted the code to pointers and 
it is now compiling again.
Seems like an odd limitation though, could we actually just provide memcpy to 
the compiler?(I'm no expert, just wandering)
From: [email protected]
Date: Mon, 29 Sep 2014 06:34:47 -0700
To: [email protected]
Subject: Re: [edk2] Compiler inserting memcpy. Unresolved external      symbol  
memcpy


On Sep 29, 2014, at 5:39 AM, Scott Duplichan <[email protected]> wrote:J. E. 
[mailto:[email protected]]  wrote:
Sent: Monday, September 29, 2014 03:24 AM
To: [email protected]
Subject: [edk2] Compiler inserting memcpy. Unresolved external symbol memcpy 
I'm getting this error when compiling my project in X64. (But no error in NT32 
for some reason, probably a 32bit vs 64bit thing). error LNK2001: unresolved 
external symbol memcpy I don't use memcpy at all, I only use CopyMem. So it 
must be the compiler optimizing code and inserting memcpy here and there. I 
added compile option /FAcsI found 20+ instances of memcpy. Is there a trick 
around this so I don't have to modify lots of code? This is a real problem with 
no easy solution that I know of. My rant: Why doesn't EDK2 providejust memcpy, 
etc?For your code, passing &rcDest instead of rcDest should eliminate the 
memcpy calls you show. Thanks,Scott If there is no way around it, should I not 
be parsing STRUCTS through functions and use pointers instead?
Yes. 
UEFI 2.4 2.3.4.2 Detailed Calling ConventionsThe caller passes the first four 
integer arguments in registers. The integer values are passed from left to 
right in Rcx, Rdx, R8, and R9 registers. The caller passes arguments five and 
above onto the stack. All arguments must be right-justified in the register in 
which they are passed. This ensures the callee can process only the bits in the 
register that are required.The caller passes arrays and strings via a pointer 
to memory allocated by the caller. The caller passes structures and unions of 
size 8, 16, 32, or 64 bits as if they were integers of the same size. The 
caller is not allowed to pass structures and unions of other than these sizes 
and must pass these unions and structures via a pointer.…
Thus the memcpy is the compiler enforcing the calling conventions. 
RECT A, B;
A = B;
Will also cause memcpy to be emitted. 
Thanks,
Andrew Fish 
------------------------------------------------------------------------------
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel                         
                  
------------------------------------------------------------------------------
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to