https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61001
Emmanuel Blot <eblot.ml at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution|--- |INVALID --- Comment #4 from Emmanuel Blot <eblot.ml at gmail dot com> --- (In reply to Hans-Peter Nilsson from comment #3) > (In reply to Marc Glisse from comment #2) > > -fno-builtin-memcmp is not a hack, it is necessary, even without -flto. > > Without it, linking is not the only thing that may fail. gcc may look at > > your implementation, recognize that it is doing the same thing as memcmp, > > and replace it with a call to memcmp... > > True in part. Each code implementing the standard NAME function should > themselves be compiled with the corresponding -fno-builtin-NAME. But other > than that, there should be no restrictions or required options. There are > likely bugs hiding (like, -flto combined with compiling the implementation > of such a function) so PLEASE: > > Provide a test-case or you'll at most receive cryptic comments like this one. Sorry about the delay, I've been out of the office for 2 weeks. I spent some time reproducing the issue with a small code base (2 source files + 1 linker file), then I realised I was misusing the -fno-builtin-NAME option switch. With -fno-builtin-memcpy -fno-builtin-memset properly set, both the sample test case and the original code work as expected. Thanks for the support, and very sorry for the noise, I did not know about the -fno-builtin-NAME flag.