On Tue, 2024-08-20 at 08:50 +0800, Jinyang He wrote: > On 2024-08-19 23:36, Xi Ruoyao wrote: > > > On Mon, 2024-08-19 at 13:03 +0000, Jason A. Donenfeld wrote: > > > > > The compiler (GCC 14.2) calls memset() for initializing a "large" struct > > > > > in a cold path of the generic vDSO getrandom() code. There seems no way > > > > > to prevent it from calling memset(), and it's a cold path so the > > > > > performance does not matter, so just provide a naive memset() > > > > > implementation for vDSO. > > > > Why x86 doesn't need to provide a naive memset()? > > I'm not sure. Maybe it's because x86_64 has SSE2 enabled so by default > > the maximum buffer length to inline memset is larger. > > > I suspect the loongarch gcc has issue with -fno-builtin(-memset). No, -fno-builtin-memset just means don't convert memset to __builtin_memset, it does not mean "don't emit memset call," nor anything more than that. Even -ffreestanding is not guaranteed to turn off memset call generation because per the standard memset should be available even in a freestanding implementation. x86 has a -mmemset-strategy= option but it's really x86 specific. As Jason pointed out, PowerPC and ARM64 have also hit the same issue. -- Xi Ruoyao <xry111@xxxxxxxxxxx> School of Aerospace Science and Technology, Xidian University