1 <qandaentry id="optimized-glibc-fail">
2 <question><para>My optimized build of glibc is failing
3 in spinlock.c</para></question>
4 <answer><para>It should be mentioned that glibc (and gcc and binutils)
5 are good places to not optimize.
6 The performance versus stability trade off is unusually poor
7 for these packages. But. . . .
9 <answer><para>If you've specified a CFLAGS value like "-march=i686 -mcpu=686"
10 and you're getting an error like this:
11 <screen>spinlock.c: In function `__pthread_lock':
12 spinlock.c:107: inconsistent operand constraints in an `asm'
13 make[2]: *** [/usr/src/glibc-build/linuxthreads/spinlock.o] Error 1
14 make[2]: Leaving directory `/usr/src/glibc-2.2.4/linuxthreads'
15 make[1]: *** [linuxthreads/others] Error 2
16 make[1]: Leaving directory `/usr/src/glibc-2.2.4'
17 make: *** [all] Error 2
19 It's because, unlike almost everything else, spinlock.c requires optimization.
20 You could set CFLAGS to something like "-march=i686 -mcpu=i686 -O2".
22 But it is better to set optimizations in glibc-x.x.x/Makeconfig.
23 This is the relevant section of Makeconfig:
24 <screen># Default flags to pass the C compiler.
26 ifeq ($(release),stable)
27 default_cflags := <emphasis role="strong">-g -O2</emphasis>
29 default_cflags := -g -O
33 And here is an example to adapt:
34 <screen># Default flags to pass the C compiler.
36 ifeq ($(release),stable)
37 default_cflags := <emphasis role="strong">-g0 -Os -march=i386 -mcpu=i386 -pipe</emphasis>
39 default_cflags := -g -O