Pelles C forum

Assembly language => Assembly discussions => Topic started by: optimizer on February 25, 2022, 02:14:11 pm

Title: Is there a counterpart to -S option
Post by: optimizer on February 25, 2022, 02:14:11 pm
In other C compilters such as gcc, there is a -S option to translate to assembly file rather than binary.
For instance, "gcc -S prog.c" creates a prog.s file in their assembly syntax, "gcc -S -masm=intel prog.c" creates a prog.s file in the intel assembly syntax.  Is there such a feature here?
Title: Re: Is there a counterpart to -S option
Post by: frankie on February 25, 2022, 02:38:19 pm
You can use the /T option:
/Tx86-coff      Creates a COFF (Common Object File Format) object file for a X86 processor.
/Tx86-asm     Creates an assembly text file for a X86 processor.
/Tx64-coff      Creates a COFF (Common Object File Format) object file for a X64 processor. As of version 9.00, the default.
/Tx64-asm     Creates an assembly text file for a X64 processor.
/Tamd64-coff Alias for /Tx64-coff.
/Tamd64-asm Alias for /Tx64-asm.

The assembler is available only with INTEL syntax.
See help file, command line tools POCC.
Title: Re: Is there a counterpart to -S option
Post by: optimizer on February 25, 2022, 03:24:44 pm

/Tx64-asm was what I was looking for. Tried it and it works.

Thank you  frankie.
Title: Re: Is there a counterpart to -S option
Post by: Akko on April 06, 2022, 08:39:09 pm
Is there a way to disassemble just ONE single function?

My code has about 2000 functions and complete disassembly
does not make any sense at all.
Title: Re: Is there a counterpart to -S option
Post by: frankie on April 06, 2022, 10:25:52 pm
Is there a way to disassemble just ONE single function?

My code has about 2000 functions and complete disassembly
does not make any sense at all.
You can't because this is not a disassembling, but a different output of the compiler.
Using the switch /T the compiler is instructed to emit assembler code for the source 'C' code in a text file instead of the corresponding machine op-codes in an object file.
You can use the PE/COFF viewer, distributed with PellesC V11, to disassemble the object file, but it will be a mess to locate the function you want in the object code.
Probably the simplest way to achieve what you want is to copy the source code of the function you want in a new source file and compile just this file with the /T option.
Title: Re: Is there a counterpart to -S option
Post by: Vortex on April 06, 2022, 11:04:30 pm
Hi Akko,

A very good disassembler :

https://github.com/gitGNU/objconv
Title: Re: Is there a counterpart to -S option
Post by: Pelle on April 07, 2022, 11:14:05 am
You can also just create a normal object file from the compiler and then use
Code: [Select]
PODUMP -disasm <somename>.objto look at the result.

If you include the compiler option /Zd (line numbers) source lines will be mixed with assembly code in the output.
Most optimizations will still be enabled with the /Zd option (unlike the /Zi option).
Title: Re: Is there a counterpart to -S option
Post by: TimoVJL on April 08, 2022, 08:18:57 am
There is an poide Add-In for podump too:
https://forum.pellesc.de/index.php?topic=6985.msg26516#msg26516
PrjObjPODmp_WS is for podump.exe