-S command line option looking for the linker

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

-S command line option looking for the linker

1,402 Views
YONDA
Contributor I
I am trying to generate assembly for a cpp file, parse it, insert hooks, then assemble and link it into an elf. From the command line, -S looks like it should be the switch for outputting assembly for the input files. The only problem is that I am getting an error about not being able to find the linker.

I can fix the path so that the linker is found, but thats not the point. I am a little concerned that trying to produce the assembly, which should involve nothing but the compiler, would even look for the linker. I am hoping that -S doesnt correspond to the IDE's disassemble option, which requires a full build first and doesn't produce a file I can assemble.

I am working with the Gamecube/Wii compiler. Both platforms are PPC so I'm hoping someone has seen this before and the solution will apply

thanks in advance for any help.
Labels (1)
0 Kudos
1 Reply

250 Views
CrasyCat
Specialist III
Hello
 
First you need to understand that the Power Architecture (or PowerPC) compiler is generating directly binary code for a Power Architecture (or PowerPC) core.
It does nt generate intermediate assembly code, that needs to be assembled afterward.
 
The option -S is dis-assembling the generated code, but the generated code, but the generated file is not directly usable as input file for the assembler. You will need to  edit the generated file and create the frame for the assembly source file (section definition, optional variable definition, directives to export/import symbols and so on.
 
The option -S generates a disassembly listing but does not generate the binary object file in parallel. The disassembly listing file is stored in the output file specified with the -o option on the command line.
 
That means if you want to build a source file and generate a disassembly listing file in parallel, you have to invoke the compiler twice. Once with option -S specifying disassembly listing file name in -o option and once without -S specifying the binary file name after th e-o option.
 
I hope that helps.
 
CrasyCat
0 Kudos