Recent

Author Topic: Object code listing?  (Read 627 times)

AlanTheBeast

  • Sr. Member
  • ****
  • Posts: 306
  • My software never cras....
Object code listing?
« on: July 14, 2022, 10:50:32 pm »

I can get the assembler source code using -al, but how do I get an object+assembler listing?
(Mac OS  / command line)

eg: the style listing I want is akin to:

Code: Pascal  [Select][+][-]
  1. 00401350 <_dojob>:
  2.   401350:   55                      push   %ebp
  3.   401351:   89 e5                   mov    %esp,%ebp
  4.   401353:   83 ec 28                sub    $0x28,%esp
  5.   401356:   c7 45 f4 00 00 00 00    movl   $0x0,-0xc(%ebp)
  6.   40135d:   eb 75                   jmp    4013d4 <_dojob+0x84>
  7.   40135f:   c7 45 f0 00 00 00 00    movl   $0x0,-0x10(%ebp)
  8.   401366:   eb 3c                   jmp    4013a4 <_dojob+0x54>
  9.   401368:   8b 45 f4                mov    -0xc(%ebp),%eax
  10.   40136b:   8b 04 85 00 20 40 00    mov    0x402000(,%eax,4),%eax

I tried looking at clang/gcc switches to use on the .s from fpc, but can't make tails or heads of it. (I assume the assembler used by fpc is out of gcc or clang (or is it Mac OS "as"?).
Everyone talks about the weather but nobody does anything about it.
..Samuel Clemens.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1018
Re: Object code listing?
« Reply #1 on: July 14, 2022, 10:57:37 pm »
Run objdump -d on the generated .o file.

AlanTheBeast

  • Sr. Member
  • ****
  • Posts: 306
  • My software never cras....
Re: Object code listing?
« Reply #2 on: July 15, 2022, 01:37:54 am »
Run objdump -d on the generated .o file.

Thanks.  Silly me expecting it to come out of the assembler.

Downside of that is that it's disassembled code and has some quirks to it, loses source references, not formatted ideally - a little harder to read.
Hmm, I could write a ute to substitute/merge the .s with the output of the above...
« Last Edit: July 15, 2022, 12:57:50 pm by AlanTheBeast »
Everyone talks about the weather but nobody does anything about it.
..Samuel Clemens.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8489
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Object code listing?
« Reply #3 on: July 15, 2022, 09:54:33 am »
I assume the assembler used by fpc is out of gcc or clang (or is it Mac OS "as"?).
Target platform dependent. Some targets have internal assembler so everything till becoming object files are in memory, no temporary assembly files ever generated.

AlanTheBeast

  • Sr. Member
  • ****
  • Posts: 306
  • My software never cras....
Re: Object code listing?
« Reply #4 on: July 15, 2022, 01:08:33 pm »
I assume the assembler used by fpc is out of gcc or clang (or is it Mac OS "as"?).
Target platform dependent. Some targets have internal assembler so everything till becoming object files are in memory, no temporary assembly files ever generated.

Understood, I was hoping that there was a way for fpc to pass a switch to the assembler to generate the traditional style listing.
Everyone talks about the weather but nobody does anything about it.
..Samuel Clemens.

 

TinyPortal © 2005-2018