Forum > Unix

Object code listing?

(1/1)

AlanTheBeast:

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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---00401350 <_dojob>:  401350:   55                      push   %ebp  401351:   89 e5                   mov    %esp,%ebp  401353:   83 ec 28                sub    $0x28,%esp  401356:   c7 45 f4 00 00 00 00    movl   $0x0,-0xc(%ebp)  40135d:   eb 75                   jmp    4013d4 <_dojob+0x84>  40135f:   c7 45 f0 00 00 00 00    movl   $0x0,-0x10(%ebp)  401366:   eb 3c                   jmp    4013a4 <_dojob+0x54>  401368:   8b 45 f4                mov    -0xc(%ebp),%eax  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"?).

Jonas Maebe:
Run objdump -d on the generated .o file.

AlanTheBeast:

--- Quote from: Jonas Maebe on July 14, 2022, 10:57:37 pm ---Run objdump -d on the generated .o file.

--- End quote ---

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...

Leledumbo:

--- Quote from: AlanTheBeast on July 14, 2022, 10:50:32 pm ---I assume the assembler used by fpc is out of gcc or clang (or is it Mac OS "as"?).

--- End quote ---
Target platform dependent. Some targets have internal assembler so everything till becoming object files are in memory, no temporary assembly files ever generated.

AlanTheBeast:

--- Quote from: Leledumbo on July 15, 2022, 09:54:33 am ---
--- Quote from: AlanTheBeast on July 14, 2022, 10:50:32 pm ---I assume the assembler used by fpc is out of gcc or clang (or is it Mac OS "as"?).

--- End quote ---
Target platform dependent. Some targets have internal assembler so everything till becoming object files are in memory, no temporary assembly files ever generated.

--- End quote ---

Understood, I was hoping that there was a way for fpc to pass a switch to the assembler to generate the traditional style listing.

Navigation

[0] Message Index

Go to full version