OpenSolaris

You are not signed in. Sign in or register.

gcc-related Flag Day Notices

There have been two major flag days for gcc. The first occurred in build 25 and the second, and most important, at the beginning of build 38. Both are reproduced here, edited only to reflect public URLs for policy documents.

Summary: Install build 22 or newer and the latest SUNWonbld before attempting to build any ON source newer than build 37..

Date: Thu, 30 Mar 2006 16:22:38 -0800
From: Keith M Wesolowski <keith dot wesolowski at sun dot com>
To: onnv dash gate at onnv dot eng dot sun dot com, on dash all at eng dot sun dot com
Subject: Flag Day: gcc support and shadow compilation

My putback for

	6242262 ON should be buildable with gcc

is a major flag day for the entire ON extended family.  Please read on to
understand what this change means to you.

Build Machine Maintainers
=========================

You must update your build tools immediately to pick up major changes to
the compiler wrapper.  You may install SUNWonbld (strongly preferred)
from /ws/onnv-gate/public/packages/`uname -p` or update cw directly from
/net/onnv.eng/opt/onbld/bin/`uname -p`.  Old build tools will continue
to work; however, they will not enforce the code quality requirements
described below.  New tools will generate errors when used to
build an old workspace; see the section on Build Tools below for a
workaround.

Note also that if you have not already followed the instructions from
September 2005 for updating gcc
(see below), or do not have
gcc installed at all (a decent possibility for recent build machines, or on
SPARC, which has not yet required it) then you will get errors from the gcc
back-end, including:

    cc1: error: invalid option `save-args'
    cc1: error: unrecognized command line option "-fno-constant-pools"
    cc1: error: unrecognized command line option "-fno-dwarf2-indirect-strings"
    cc1: error: unrecognized command line option "-fno-jump-tables"
    cc1: note: -fwritable-strings is deprecated; see documentation for details

Please make sure that gcc is installed and up-to-date.  gcc --version should
contain the line:

    gcc (GCC) 3.4.3 (csl-sol210-3_4-20050802)

or otherwise indicate a newer version.  In particular, the version used to
build ON10 -- csl-sol210-3_4-branch -- is too old.


All Engineers
=============

Shadow Compilation
------------------
This putback introduces the concept of primary and shadow compilers.
Both will be executed by the compiler wrapper when compiling most files
in ON.  This is done automatically and requires no special steps on your
part.  In your nightly log, you will see something like:

/builds2/wesolows/gcc/usr/src/tools/proto/opt/onbld//bin/i386/cw -_cc
[flags]
+ /usr/sfw/bin/gcc [flags] -o /tmp/.cwhvG.tt.o
+ /ws/onnv-tools/SUNWspro/SOS10/bin/cc -O [flags]

Note that both compilers are executed instead of only the primary,
designated by the "-_cc" argument to cw.  The shadow compiler is used
only to compile, never to link.  At this time, Studio 10 remains the
primary compiler, and gcc is the shadow compiler, on both x86 and SPARC.

Warnings and Errors
-------------------
The effect of shadow compilation is to expand the set of warnings and
errors emitted by the compiler to include those issued by gcc.
Therefore, you may see warnings or errors in your code that you did not
see previously.  As before, these must be fixed before putback.  The
ONNV C-team will enforce this policy[0].  For information on the
rationale and background for this policy, see
the background and rationale document.
A detailed description of Shadow Compilation is also provided.

Because many of these warnings may be unfamiliar, we have prepared a
document describing some of the common ones, as well as how to avoid
them.  See
the bug fixing notes.

Incremental Builds
------------------
You should perform a clobber build after the first bringover containing
these changes.  Incrementals will work but will not cause the shadow
compiler to be run on active files you have not changed since your last
build.  This could cause you to miss errors or warnings that would be
issued by the shadow compiler.  Afterward, incrementals will work
normally.

Compiler Bugs
-------------
If you believe a warning or error you are seeing is the result of a bug
in gcc, please file the bug against solaris/utility/gnu_compiler.  If
the bug is in fact in the compiler, there is no workaround, and it is
blocking you from putting back, the C-team may issue you a waiver.

Build Tools
-----------
If your build machine has not yet been updated, you must either build
a copy of the tools containing my changes (such as with nightly's 't'
option) or use the tools in /ws/onnv-tools/onbld.  You can find out
whether your build tools are current by doing:

	$ strings /path/to/cw | grep SHADOW

You should see:

	CW_SHADOW_SERIAL
	CW_NO_SHADOW

If not, your tools are too old and do not support shadow compilation.

Building a workspace that does not contain my changes with the new tools
will cause build failures due to gcc errors and warnings.  You can avoid
these until you resync by setting:

	CW_NO_SHADOW=1

in your environment (either in your shell or in your nightly env file).

The compiler wrapper now has a man page.  See cw(1).

Build Times
-----------
Both compilers are executed in parallel by default.  Therefore the
increase in build time caused by shadow compilation will vary from
machine to machine.  In general, expect a 20-30% increase in build
times.  This is somewhat less than the time taken by lint.

Building with GCC as the Primary Compiler
-----------------------------------------
You can build with gcc as the primary compiler (Studio will be the
shadow compiler) by setting the __GNUC environment variable to the empty
value.  Note that you are not yet required to do this, nor are you
required to test any gcc-built objects.

References
==========

[0] ON gcc policy

-- 
Keith M Wesolowski		"Sir, we're surrounded!" 
Solaris Kernel Team		"Excellent; we can attack in any direction!" 

The previous flag day notice describes other changes required for build machines. If you have not already made these changes, you will need to do so at this time.

Date: Tue, 20 Sep 2005 15:07:16 -0700
From: Keith M Wesolowski <keith dot wesolowski at sun dot com>
To: on dash all at sun dot com, onnv dash gate at onnv dot eng dot sun dot com
Subject: Flag day - build machine upgrades, gcc changes

If you don't maintain a build machine or build ON with gcc, you can
ignore the rest of this message.

My putback for

6237094 perl build should honor $(CC)
6272179 relocation processing should be bypassed when building libgenunix et al
6307198 Need to pass in -save_args option when the new gcc is available
6310534 new gcc options should be used to build ON

represents a flag day for all build machine maintainers and a heads-up
for engineers debugging amd64 bits built with gcc.

Function arguments on amd64
---------------------------

The save_args feature previously available for Vulcan builds is now
enabled when building with gcc as well.  As described at
http://onnv.sfbay/links/flagdays/pages/2005071403.html, this feature
allows inspection of function arguments when using mdb.  You will need
to use gcc from build 22 or newer; see "Build machines" below for more
information on compiler requirements.

Build machines
--------------

There are three separate upgrades required for all build machines:

	- Linker
	- gcc compilers and related packages
	- SUNWlibm, for 

The easiest and fastest way to get all of these required changes is to
install or upgrade to Nevada build 22 or later.  Build 22 is available
on the netinstall servers for both x86 and SPARC and has been released
to the public as Solaris Express Community Edition.  Other upgrade
options are described in more detail below.

This putback introduces use of the -znoreloc linker flag for building
kernel shared libraries such as libgenunix.so.  These objects are not
delivered and are used only for symbol resolution during the build,
but your build will fail with messages like:

	ld: fatal: option -z has illegal argument `noreloc'
	ld: fatal: Flags processing errors

if your linker is too old.  Support for this flag was introduced in
build 14; you can BFU to any recent build to obtain the needed fix.

This putback also introduces the use of new compiler flags during gcc
builds.  Support for these flags was incorporated into SUNWgcc and
SUNWgccruntime in sfw build 22.  If you attempt to build with an old
gcc, your build will fail.  If you cannot netinstall build 22 or later,
you can upgrade to the latest gcc by doing:

	# /ws/onnv-gate/public/bin/update_gcc

Finally, to support gcc builds of perl, a SUNWlibm containing the fix
for

	6285517 gcc 3.4.x/4.x c99 math intrinsics support needed

is required.  This fix integrated into build 18.  If you cannot upgrade
to build 22 or newer, you can obtain this fix by doing:

	# /ws/onnv-gate/public/bin/update_devpro

Please don't hesitate to contact me if you have further questions.

-- 
Keith M Wesolowski		"Sir, we're surrounded!" 
Solaris Kernel Team		"Excellent; we can attack in any direction!"