When using the edk2 (UEFI), functions like memcpy and memset are not available, but they have functions CopyMem and SetMem. Normally that is not too much of a problem, but sometimes the compiler does optimizations that replace my code with memcpy/memset and I get linker errors saying that I have a unresolved reference to them. As far as I can tell, they are used essentially the same (same args and whatnot).
I was wondering what would be possible to fix this rather than individually dealing with the instances as they happen. I tried googling compiler macros, but I couldn't find a good example to see if it would be a good way to do it.
If the compiler inserts memcpy() and memset() as a part of the optimization process, then there's nothing you can achieve using macros. Your chances are:
I. Reduce the optimization level gradually in each individual case until the linker error goes away.
II. Switch to a conforming standard library
III. Implement memcpy() and memset() manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With