An explanation of why optimization is required to build Glibc appears
in the official FAQ.

Frequently Asked Questions about the GNU C Library
https://sourceware.org/glibc/wiki/FAQ

  Question 1-12

  Why do I get: #error "glibc cannot be compiled without optimization",
  when trying to compile GNU libc with GNU CC?

---

The Glibc developers say that inlining must be enforced in certain
circumstances to cope with situations that are peculiar to Glibc.

I believe that it is not quite accurate to describe this as an
optimization issue.  The goal of optimization is better performance.
A very smart compiler may figure out that inlining a certain function
does not lead to a performance gain and make it an independent,
standard function, overriding the intent of the programmer stated by
"inline".  My guess is that GCC does not do this, but there is no
guarantee.

If inlining must be enforced, the right way to do it is by setting a
compiler option that does just that where it is necessary.  Using "-O2"
for that effect is not sound.

I frequently override the default CFLAGS and provide my own, but not
when building Glibc.


-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to