Recent

Author Topic: Assembler file output  (Read 1499 times)

440bx

  • Sr. Member
  • ****
  • Posts: 391
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.

lucamar

  • Hero Member
  • *****
  • Posts: 504
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 1.8.4/FPC 3.0.4 on:
(K)Ubuntu 11..16, Windows XP SP3 (Home/Prof.) and various DOS incarnations.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6627
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

  • Sr. Member
  • ****
  • Posts: 391
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)

PascalDragon

  • Full Member
  • ***
  • Posts: 206
  • 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

  • Sr. Member
  • ****
  • Posts: 391
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)

Thaddy

  • Hero Member
  • *****
  • Posts: 7195
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...
inline variables like in D10.3 are a bit like Brexit: if you are given the wrong information it sounds like a good idea. Every kid loves candy, but it makes you fat and your teeth will disappear.

PascalDragon

  • Full Member
  • ***
  • Posts: 206
  • 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

  • Sr. Member
  • ****
  • Posts: 391
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.

PascalDragon

  • Full Member
  • ***
  • Posts: 206
  • 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

  • Sr. Member
  • ****
  • Posts: 391
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.

PascalDragon

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

440bx

  • Sr. Member
  • ****
  • Posts: 391
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.  :)