On Mon, Aug 17, 2020 at 11:36:49AM -0700, Nick Desaulniers wrote: > > > Though I don't understand the original issue, with -ffreestanding, > > > sprintf shouldn't have been turned into strcpy in the first place. > > Huh? The original issue for this thread is because `-ffreestanding` > *isn't* being used for most targets (oh boy, actually mixed usage by > ARCH. Looks like MIPS, m68k, superH, xtensa, and 32b x86 use it?); and > I'm not suggesting it be used. > Sorry, I meant the issue mentioned in the commit that removed -ffreestanding, not the stpcpy one you're solving now. It says that sprintf got converted into strcpy, which caused failures because back then, strcpy was #define'd to __builtin_strcpy, and the default implementation was actually of a function called __builtin_strcpy o_O, not strcpy. Anyway, that's water under the bridge now. 6edfba1b33c7 ("x86_64: Don't define string functions to builtin") gcc should handle this anyways, and it causes problems when sprintf is turned into strcpy by gcc behind our backs and the C fallback version of strcpy is actually defining __builtin_strcpy