Recent

Author Topic: Assembler file output  (Read 5659 times)

440bx

  • Hero Member
  • *****
  • Posts: 3946
Assembler file output
« on: September 04, 2018, 05:51:51 pm »
Hello,

I would like to have FPC produce Intel syntax style assembler files and not even try to produce an executable or object file.

I've tried a number of compiler switches but, I have been unsuccessful in finding the right combination that would only produce Intel style assembler files (no matter what I give it, I always get an As/Gas style assembler file.)

The question is: what switches do I have to specify in Lazarus to have the compiler only produce Intel style assembler files without it even trying to create objs/executable files from them ?

Thank you.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Assembler file output
« Reply #1 on: September 04, 2018, 06:22:58 pm »
A shot in the dark but, have you tried specifying as output format an Intel-style assembler? For example with -Amasm or -Atasm
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Assembler file output
« Reply #2 on: September 04, 2018, 06:34:01 pm »
I would like to have FPC produce Intel syntax style assembler files and not even try to produce an executable or object file.

The options :   -al - s -Anasm 


(some of the other -A options also produce intel style)

-a is to leave generated assembler
-s is to not call linker. (save commands in ppas.bat/sh though)

Note that these options often have maintenance backlogs, as they are not really used in production

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Assembler file output
« Reply #3 on: September 04, 2018, 07:39:26 pm »
I would like to have FPC produce Intel syntax style assembler files and not even try to produce an executable or object file.

The options :   -al - s -Anasm 


(some of the other -A options also produce intel style)

-a is to leave generated assembler
-s is to not call linker. (save commands in ppas.bat/sh though)

Note that these options often have maintenance backlogs, as they are not really used in production

These are the options I've set in Lararus:
Code: Pascal  [Select][+][-]
  1. -al
  2. -sh
  3. -st
  4. -Amasm

That rewards me with :
Code: Pascal  [Select][+][-]
  1. Compile Project, Mode: Win64, OS: win64, CPU: x86_64, Target: test.exe: Exit code 1, Errors: 1
  2. _90_ntdll.pas(126,80) Error: Internal error 200704253
  3.  

and not a single assembler file produced.

If I remove the -Amasm then I do get an assembler file but, it is in ATT format even though I have specified Intel format in the Compiler Options->Parsing. (I guess that is for input, not output but... it was worth a try)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Assembler file output
« Reply #4 on: September 04, 2018, 11:07:17 pm »
Seems like Intel based assembler output is currently indeed broken. As Marco said it isn't usually used in production, so they break rather easily... Though I *do* wonder what leads to the internal error as from a first look that shouldn't happen on Windows.  :o

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Assembler file output
« Reply #5 on: September 04, 2018, 11:11:50 pm »
Though I *do* wonder what leads to the internal error as from a first look that shouldn't happen on Windows.  :o
Do you think this is something I should report as a bug ? (it would be nice to have it work)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14213
  • Probably until I exterminate Putin.
Re: Assembler file output
« Reply #6 on: September 04, 2018, 11:17:36 pm »
Any internal error is a bug. So report it. The internal error is here:agx86int.pas:638:                   internalerror(200704253);
But Sven already knew that...
Specialize a type, not a var.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Assembler file output
« Reply #7 on: September 05, 2018, 10:51:20 pm »
Yes, report it. This way it won't be forgotten... but please include a simple example program that reproduces the problem.

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Assembler file output
« Reply #8 on: September 05, 2018, 11:28:18 pm »
Yes, report it. This way it won't be forgotten... but please include a simple example program that reproduces the problem.
I reported it, the id is: 0034222.

I am not certain it always happens but, what I've experienced is that specifying the compiler switches I stated in the report often, if not always, reproduces the problem.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Assembler file output
« Reply #9 on: September 06, 2018, 04:12:17 pm »
What about the "simple example program that reproduces the problem" that I requested? I can't reproduce with a simple program and as I don't want to guess around this is a must.

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Assembler file output
« Reply #10 on: September 06, 2018, 05:31:03 pm »
What about the "simple example program that reproduces the problem" that I requested? I can't reproduce with a simple program and as I don't want to guess around this is a must.
No problem.  I didn't originally upload a simple example program because it seemed that any program compiled with the -Amasm switch caused the problem but, I uploaded a very simple example that shows it.

Thank you for looking into it.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Assembler file output
« Reply #11 on: September 06, 2018, 09:23:00 pm »
Thank you for uploading an example. :)

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Assembler file output
« Reply #12 on: September 06, 2018, 09:33:47 pm »
Thank you for uploading an example. :)
My pleasure.  Anything else that may be helpful, don't hesitate to ask.  :)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Blade

  • Full Member
  • ***
  • Posts: 177
Re: Assembler file output
« Reply #13 on: May 03, 2021, 06:57:04 am »
These are the options I've set in Lararus:
Code: Pascal  [Select][+][-]
  1. -al
  2. -sh
  3. -st
  4. -Amasm

That rewards me with :
Code: Pascal  [Select][+][-]
  1. Compile Project, Mode: Win64, OS: win64, CPU: x86_64, Target: test.exe: Exit code 1, Errors: 1
  2. _90_ntdll.pas(126,80) Error: Internal error 200704253
  3.  

and not a single assembler file produced.

If I remove the -Amasm then I do get an assembler file but, it is in ATT format even though I have specified Intel format in the Compiler Options->Parsing. (I guess that is for input, not output but... it was worth a try)

Happy to report that was playing around with getting some TASM output (Turbo Assembler), and the below settings work with the present version of FPC.

Code: Pascal  [Select][+][-]
  1. -al
  2. -sh
  3. -st
  4. -Atasm
  5.  


440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Assembler file output
« Reply #14 on: May 03, 2021, 09:55:31 am »
Happy to report that was playing around with getting some TASM output (Turbo Assembler), and the below settings work with the present version of FPC.

Code: Pascal  [Select][+][-]
  1. -al
  2. -sh
  3. -st
  4. -Atasm
  5.  
Thank you for mentioning that.  I'll play with it.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018