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 /FAcs
I 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 provide
just 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?
Here's a snippet of an example where memcpy is being inserted:
//// H
typedef struct {
INTN Left;
INTN Top;
INTN Right;
INTN Bottom;
} RECT;
//// C
BOOLEAN PointInRect(INTN x, INTN y, RECT rcDest)
{
if(x < rcDest.Left) return FALSE;
if(x > rcDest.Right) return FALSE;
if(y < rcDest.Top) return FALSE;
if(y > rcDest.Bottom) return FALSE;
return TRUE;
}
//// COD
; 12 : if( PointInRect(rcSrc.Left, rcSrc.Top, rcDest) ) return TRUE;
0001b 41 bd 20 00 00
00 mov r13d, 32
; 00000020H
00021 48 8d 48 c8 lea rcx, QWORD PTR [rax-56]
00025 4d 8b c5 mov r8, r13
00028 48 8b fa mov rdi, rdx
0002b e8 00 00 00 00 call memcpy
00030 49 8b 2c 24 mov rbp, QWORD PTR [r12]
00034 49 8b 74 24 08 mov rsi, QWORD PTR [r12+8]
00039 48 3b 6c 24 20 cmp rbp, QWORD PTR $T22009[rsp]
0003e 7c 1c jl SHORT $LN6@RectOverla
00040 48 3b 6c 24 30 cmp rbp, QWORD PTR $T22009[rsp+16]
00045 7f 15 jg SHORT $LN6@RectOverla
00047 48 3b 74 24 28 cmp rsi, QWORD PTR $T22009[rsp+8]
0004c 7c 0e jl SHORT $LN6@RectOverla
0004e 48 3b 74 24 38 cmp rsi, QWORD PTR $T22009[rsp+24]
00053 7f 07 jg SHORT $LN6@RectOverla
$LN33@RectOverla:
00055 b0 01 mov al, 1
00057 e9 b3 00 00 00 jmp $LN7@RectOverla
$LN6@RectOverla:
UDK2014, Win8 64bit, VC2010, MdeModulePkg
------------------------------------------------------------------------------
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