That depends a bit on the compiler version and optimization level,
but (in particular in the 3.x time frame) GCC may output assembler
code on a function-by-function basis, without necessarily reading
in the whole source file first.
Ok, actually it doesn't matter if it doesn't work all the time. I'll
always be compiling with -Os anyway, so it sounds like I'm in
with a chance of the whole file being read first?
If so, where is my first opportunity, in 3.2.3, to see if there's a
"main" function in this file?
> As crt0.o can be (and usually is) completely
> written in assembler, you can arrange for everything to be in the
> sequence
> that is required. (On the linker command line, crt0.o would be placed
> first, so if the entry point is the first thing in crt0.o it will then
> also be the first thing in the executable.)
Yes, I can do that, but that means I need to have a linker command
line! The way the MVS linker works, I can link my main program,
(which obviously doesn't have crt0 in it), and, thanks to the "END"
statement, I can specify an entry point. This means no complaint
from the linker about a default (and wrong) entry point, and no
need for any linker statements. It all automatically resolves.
I don't know exactly how your port handles this on MVS, but usually
GCC itself will invoke the linker, and will itself prepare an
appropriate command linker for the linker.
GCC on MVS *only* outputs assembler. ie you always have to
use the "-S" option.
By doing so, it turns GCC into a pure text-processing application,
which will thus work in any C90 environment.
In current GCC, every insn contains "location" information pointing
back to source code line (and column) numbers. However, in GCC 3.x
I think this wasn't yet present, but you had to rely on line number
notes interspersed with the insn stream.
In any case, if you build with -g and use in addition the "debug
assembler output" flag -dA the assembler output should contain
human-readable comments containing line number information.
The GCC assembler is never invoked. After getting the assembler
output from the -S option, this is fed into IFOX00/IEV90/ASMA90.
Regardless, if line number notes are interspersed in the stream,
maybe whenever I write out an assembler instruction I will have
access to those notes and can print out a comment.
Thanks. Paul.