This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: Final intermodule patch


Geoff,
I think the command line option handling for the (excellent) intermodule
mode is wrong.

	gcc -c file1.c file2.c
gets me separate file1.o and file2.o objects.
	gcc -c file1.c file2.c -o foo.o
gets me intermodule work. Yet I've not changed any *optimization*
option.

I'd guess users (we should canvas some) would think of intermodule stuff
as an optimization, and be surprised that it is not triggered by a -O
level (say -O4?) or a -fintermodule flag. Here's a pop quiz
	You want to turn inter-file analysis on, do you
	a) Turn the optimization level way up
	b) Specify the name of the intermediate output file?

I notice that the manual just says,
	If you specify @option{-o} when compiling more than one input file,
	or you are producing an executable file as output, all the source
	files on the command line will be compiled at once.'
what does this tell me? Is
	gcc file1.c file2.c -o a.out -O2
the same as
	gcc file1.c file2.c -o a.o -O2 -c
	gcc a.o
-no. The latter does intermodule stuff but the former does not. 'at
once' is being used with two different meanings in the one sentance![1]
You'll notice we've now made the options non-compoundable. Unless I
misgrepped I could find nothing in the invoke.texi file about the
advantages or disadvantages of 'compiling at once'

The use of this patch also affects the downstream tools used to process
the object file(s). Now their invokations need to be modified to take a
single input file, rather than a collection of object files.

IMHO, intermodule mode should be an optimization level, and produce
separate output files per input file. Thus the user merely needs to add
or remove the appropriate optimization flag from the compile line - rather
than tweaking all subsequent commands too.

We could fudge multi-file output for now by putting all the code in one
output file, and emitting empty stubs for the remaining ones. Then users
will not have to change when we do do separate output files.

nathan

[1] A pedant points out that the compiler will compile your source 'at once'
even if you do not specify the name of an output file -- it doesn't sit
there humming to itself for a few minutes before starting the work!

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



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