NO

Author Topic: Is there a counterpart to -S option  (Read 982 times)

Offline optimizer

  • Member
  • *
  • Posts: 2
Is there a counterpart to -S option
« 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?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1917
Re: Is there a counterpart to -S option
« Reply #1 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.

Offline optimizer

  • Member
  • *
  • Posts: 2
Re: Is there a counterpart to -S option
« Reply #2 on: February 25, 2022, 03:24:44 pm »

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

Thank you  frankie.

Offline Akko

  • Member
  • *
  • Posts: 24
Re: Is there a counterpart to -S option
« Reply #3 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.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1917
Re: Is there a counterpart to -S option
« Reply #4 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.

Offline Vortex

  • Member
  • *
  • Posts: 564
    • http://www.vortex.masmcode.com
Re: Is there a counterpart to -S option
« Reply #5 on: April 06, 2022, 11:04:30 pm »
Hi Akko,

A very good disassembler :

https://github.com/gitGNU/objconv
Code it... That's all...

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2181
    • http://www.smorgasbordet.com
Re: Is there a counterpart to -S option
« Reply #6 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).
/Pelle

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1974
Re: Is there a counterpart to -S option
« Reply #7 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
« Last Edit: April 08, 2022, 08:23:38 am by TimoVJL »
May the source be with you