https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114337
Bug ID: 114337 Summary: LTO symbol table doesn't include builtin functions Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com Target Milestone: --- [hjl@gnu-cfl-3 pr31482-a]$ cat y.c #include <stdio.h> #include <stdlib.h> void * foo (size_t n) { printf ("hello\n"); return malloc (n); } [hjl@gnu-cfl-3 pr31482-a]$ gcc -flto -c y.c [hjl@gnu-cfl-3 pr31482-a]$ nm y.o 00000000 T foo [hjl@gnu-cfl-3 pr31482-a]$ lto-dump -list y.o Type Visibility Size Name function default 0 puts function default 0 malloc function default 4 foo [hjl@gnu-cfl-3 pr31482-a]$ This doesn't work with libraries which provide alternative implementations for standard functions, like jemalloc, since linker doesn't know the builtin functions are referenced. Unless GCC can inline these builtin functions, these symbols should be in LTO symbol table.