Assembly from xlc compiler?

Doug Tody NOAO/IRAF CCS tody at noao.edu
Tue Feb 12 19:20:36 AEST 1991


>From article <1991Feb12.034119.27729 at athena.mit.edu>, by jfc at athena.mit.edu (John F Carr):
> In article <12689 at ccncsu.ColoState.EDU>
> 	haines at debussy.cs.colostate.edu (Matt Haines) writes:
> 
>>I have someone interested in getting the xlc compiler to generate
>>assembly code that could then be run through the assembler to
>>produce target code.  Most compilers have the "-S" option for
>>doing this, but xlc seems to have missed that one.  Is there
>>a way I can do this?
>     [...] 
> This is a good time to ask "what do I _really_ want to do?"  If you
> want to look at the assembly, use cc -qlist.  I have seen very few
> cases on any system where there is a need to produce assembly code
> except to see what the compiler is doing (at least on systems that
> have "cc -R" or that support "const" properly).

A couple of examples of such cases are 1) if you need to work around a
compiler bug by editing and then assembling the assembler generated by
the compiler, or 2) if you need to do something at the machine level and
you want to use, e.g., the C compiler to generate most of the assembler
for you so you have a template to modify, which takes care of simple
things like argument list processing, register save/restore, etc.

The output produced by cc -qlist is prettyprinted and is fine for seeing
what assembler the compiler is producing, but is not very convenient for use
as input to AS.  The only alternative on AIX seems to be to disassemble a
linked executable with ADB, redirecting the output to a file.  The output is
not prettyprinted, but it can be converted to something AS will accept as
input by adding a few assembler directives and branch labels.

Probably others will have different opinions but I think this is a good
example of where the simplicity of the unix approach wins.  Not being able
to have the compilers produce assembler output that can be input to the
assembler is not a big deal, but it is one more little annoying feature of
AIX.  I would much rather have a -S switch than a prettyprinted assembler
listing.

This feature of AIX ignores one of the more important lessons of unix, that
the output of one program should be usable as the input of the next
program.  The prettyprinted output may seem more user friendly when you
consider only the high level compiler by itself, but it is a nusiance when
it comes to combining several tasks to do useful things.

-- 
Doug Tody, National Optical Astronomy Observatories, Tucson AZ, 602-325-9217
UUCP: {arizona,decvax,ncar}!noao!tody  or  uunet!noao.edu!tody 
Internet: tody at noao.edu             SPAN/HEPNET: NOAO::TODY (NOAO=5355)



More information about the Comp.unix.aix mailing list