https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60160
R. Diez <rdiezmail-gcc at yahoo dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rdiezmail-gcc at yahoo dot de --- Comment #6 from R. Diez <rdiezmail-gcc at yahoo dot de> --- I am experimenting with a GCC 11.2 cross-compiler for bare-metal embedded software. There is no operating system, so no shared libraries or anything fancy. But there is a static libc (Newlib or Picolibc). I wanted to build everything with LTO, including libc, libstdc++ and libgcc. This is the makefile I am using: https://github.com/rdiez/JtagDue/blob/master/Toolchain/Makefile Search for "-ffat-lto-objects" in that makefile. As soon as I enable the LTO flags, I get linker errors. They are documented in the makefile next to the LTO options, and look similar to those reported in this bug. I tried -fno-builtin with varying degrees of success. I also tried building only the application and libc with LTO, but not libstdc++ etc., to no avail. LTO only works for the user application. As soon as libc or the other GCC libraries are compiled with LTO, it fails. Is it unfortunate, because I believe that a full LTO build for a bare-metal environment would be rather beneficial. The patch and information referenced in this bug report look dated. Is there a way to make LTO work now, at least for my configuration?