This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

BZ 5012: Add FAQ entry for compiling with optimization


The following adds an entry to the FAQ to mention why optimization is
needed for compiling glibc.  Ok to commit?

Andreas

2007-10-27  Andreas Jaeger  <aj@suse.de>,
	    Carlos O'Donell <carlos@systemhalted.org>

	[BZ #5012]
	* FAQ.in: Describe why glibc needs to be compiled with
	optimization.

============================================================
Index: FAQ.in
--- FAQ.in	8 Apr 2005 20:59:50 -0000	1.137
+++ FAQ.in	27 Oct 2007 15:14:50 -0000
@@ -387,6 +387,32 @@ yourself. Please remember that for each 
 patches required to get glibc HEAD into a runnable state. The best course
 of action is to determine if you have all the required patches.
 
+??	Why do I get:
+	`#error "glibc cannot be compiled without optimization"',
+	when trying to compile GNU libc with GNU CC?
+
+{AJ,CO} There are a couple of reasons why the GNU C library will not work
+correctly if it is not complied with optimzation.
+
+In the early startup of the dynamic loader (_dl_start), before
+relocation of the PLT, you cannot make function calls. You must inline
+the functions you will use during early startup, or call compiler
+builtins (__builtin_*).
+
+Without optimizations enabled GNU CC will not inline functions. The
+early startup of the dynamic loader will make function calls via an
+unrelocated PLT and crash. 
+
+Without auditing the dynamic linker code it would be difficult to remove
+this requirement. 
+
+Another reason is that nested functions must be inlined in many cases to
+avoid executable stacks.
+
+In practice there is no reason to compile without optimizations, therefore
+we require that GNU libc be compiled with optimizations enabled.
+
+
 ? Installation and configuration issues
 
 ??	Can I replace the libc on my Linux system with GNU libc?
@@ -1685,6 +1711,7 @@ Answers were given by:
 {AO} Alexandre Oliva, <aoliva@redhat.com>
 {BH} Bruno Haible, <haible@clisp.cons.org>
 {SM} Steven Munroe, <sjmunroe@us.ibm.com>
+{CO} Carlos O'Donell, <carlos@systemhalted.org>

 Local Variables:
  mode:outline

-- 
 Andreas Jaeger, Director Platform / openSUSE, aj@suse.de
  SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
   Maxfeldstr. 5, 90409 Nürnberg, Germany
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]