Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Apr 2013 12:38:10 -0700
From:      Jeremy Chadwick <jdc@koitsu.org>
To:        Christian Baer <christian.baer@uni-dortmund.de>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: -Os breaks buildworld
Message-ID:  <20130409193810.GA10964@icarus.home.lan>
In-Reply-To: <3845278.lKnuOXNTV5@lianli4>
References:  <3845278.lKnuOXNTV5@lianli4>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 09, 2013 at 02:50:29PM +0200, Christian Baer wrote:
> Hey everyone!
> 
> This is not really an important issue, I just wanted to find out if anyone had 
> it on his or her radar.
> 
> I have a machine that isn't too powerful and hasn't got a lot of RAM either. 
> So as an experiment I wanted to compile the world with the option for 
> conserving space. Unfortunately, that didn't work out too well as it broke the 
> compile (see last lines appended after my signature).
> 
> I updated with svn to version 249301 before compiling.
> 
> The same code compiled with O2 works fine. I know you are going to ask about 
> my CFLAGS, so here they are:
> 
> CPUTYPE= athlon-xp
> CFLAGS= -O2 -fno-strict-aliasing -pipe -mtune=athlon-xp -march=athlon-xp
> 
> And yes, the CPU is really an Athlon XP. ;-)
> The only change I need to make to break the compile is -O2 to -Os.
> 
> Has anyone noticed this too?

A few things:

1. You didn't state which compiler you're using.

2. Your CFLAGS line above shows -O2, yet your output below shows -Os,
and your Subject line is talking about -Os.

3. You should use CPUTYPE?= not CPUTYPE.

4. You need to use CFLAGS+= not CFLAGS=, otherwise you're effectively
overriding flags that may be needed/set elsewhere within Makefiles.

Furthermore, are you aware of the other internals which -Os disables?

    -Os disables the following optimization flags: -falign-functions
    -falign-jumps  -falign-loops -falign-labels  -freorder-blocks
    -freorder-blocks-and-partition -fprefetch-loop-arrays
    -ftree-vect-loop-version

I would suggest not messing with the optimisation level in CFLAGS.  This
has come up/been discussed on the mailing lists repeatedly for almost
two decades.  I believe I read somewhere that adjusting that is
basically "not supported" nor will it ever be.

> famous last lines... :-)
> 
> cc -Os -fno-strict-aliasing -pipe -mtune=athlon-xp -march=athlon-xp
> -march=athlon-xp -DPTHREAD_KERNEL -I/usr/src/lib/libthr/../libc/include
> -I/usr/src/lib/libthr/thread  -I/usr/src/lib/libthr/../../include
> -I/usr/src/lib/libthr/arch/i386/include -I/usr/src/lib/libthr/sys
> -I/usr/src/lib/libthr/../../libexec/rtld-elf
> -I/usr/src/lib/libthr/../../libexec/rtld-elf/i386
> -I/usr/src/lib/libthr/../libthread_db -Winline -D_PTHREADS_INVARIANTS
> -DSYSCALL_COMPAT -std=gnu99 -Wsystem-headers -Werror -Wall
> -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes
> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign
> -c /usr/src/lib/libthr/sys/thr_error.c cc -Os -fno-strict-aliasing -pipe
> -mtune=athlon-xp -march=athlon-xp -march=athlon-xp -DPTHREAD_KERNEL
> -I/usr/src/lib/libthr/../libc/include -I/usr/src/lib/libthr/thread 
> -I/usr/src/lib/libthr/../../include
> -I/usr/src/lib/libthr/arch/i386/include -I/usr/src/lib/libthr/sys
> -I/usr/src/lib/libthr/../../libexec/rtld-elf
> -I/usr/src/lib/libthr/../../libexec/rtld-elf/i386
> -I/usr/src/lib/libthr/../libthread_db -Winline -D_PTHREADS_INVARIANTS
> -DSYSCALL_COMPAT -std=gnu99 -Wsystem-headers -Werror -Wall
> -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes
> -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign
> -c /usr/src/lib/libthr/thread/thr_affinity.c
> cc1: warnings being treated as errors
> /usr/src/lib/libthr/thread/thr_affinity.c: In function
> '_pthread_setaffinity_np': /usr/src/lib/libthr/thread/thr_umtx.h:103:
> warning: inlining failed in call to '_thr_umutex_unlock': --param
> max-inline-insns-single limit reached
> /usr/src/lib/libthr/thread/thr_affinity.c:56: warning: called from here
> /usr/src/lib/libthr/thread/thr_umtx.h:103: warning: inlining failed in
> call to '_thr_umutex_unlock': --param max-inline-insns-single limit
> reached /usr/src/lib/libthr/thread/thr_affinity.c:64: warning: called
> from here *** Error code 1
>  
> Stop in /usr/src/lib/libthr.
> *** Error code 1
> 
> Stop in /usr/src.
> *** Error code 1

-- 
| Jeremy Chadwick                                   jdc@koitsu.org |
| UNIX Systems Administrator                http://jdc.koitsu.org/ |
| Mountain View, CA, US                                            |
| Making life hard for others since 1977.             PGP 4BD6C0CB |



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130409193810.GA10964>