[Bug c++/65199] Linker failure with -flto
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65199 --- Comment #2 from Goswin von Brederlow --- That fixes it. Isn't it a gcc bug though not to detect that itself?
[Bug c++/65199] Linker failure with -flto
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65199 --- Comment #1 from Richard Biener --- Try marking your memcpy with __attribute__((used)).