Hi Marek, On Sun, Mar 7, 2021 at 12:26 PM Marek Behún <marek.be...@nic.cz> wrote: > > It seems that sometimes (happening on ARM64, for example with > turris_mox_defconfig) GCC, when linking with LTO, changes the symbol > names of some functions, for example lib/string.c's memcpy() function to > memcpy.isra.0. > > This is a problem however when GCC for a code such as this: > struct some_struct *info = get_some_struct(); > struct some struct tmpinfo; > tmpinfo = *info; > emits a call to memcpy() by builtin behaviour, to copy *info to tmpinfo. > memset() can be generated sometimes as well. > > This then results in the following linking error: > .../lz4.c:93: undefined reference to `memcpy' > .../uuid.c:206: more undefined references to `memcpy' follow > > Make memcpy() and memset() visible by using the __used macro to avoid > this error.
This sounds like a GCC bug of using -fno-builtin and -flto. Could you file a bugzilla to GCC people to get some comments? > > Signed-off-by: Marek Behún <marek.be...@nic.cz> > --- > lib/string.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > Regards, Bin