Assembler output

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Assembler output

José Mejuto
Hello,

Can anybody enlight me in how to:

- Compile a program outputting assembler in intel format.
- Assemble the .s files in a final .exe

I can get assembler in AT&T format using "-a" but if I add "-Anasmwin32"
the program is not compiled as "nasm is not found", only main.lpr is
compiled, none of the included units (no RTL ones).

It would be great if I only need tools provided by fpc but I think that
"as.exe" can not read Intel asm format.

In the case that "as.exe" can not be used for intel format, is there any
option out there in order to get the final .exe from the .s files ?

Thank you.

--

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Assembler output

Florian Klaempfl
Am 11.09.2015 um 19:05 schrieb José Mejuto:

> Hello,
>
> Can anybody enlight me in how to:
>
> - Compile a program outputting assembler in intel format.
> - Assemble the .s files in a final .exe
>
> I can get assembler in AT&T format using "-a" but if I add "-Anasmwin32" the program is not compiled
> as "nasm is not found", only main.lpr is compiled, none of the included units (no RTL ones).
>
> It would be great if I only need tools provided by fpc but I think that "as.exe" can not read Intel
> asm format.

FPC dependents on a lot of tools like cross binutils which are not provided by FPC itself. So
install nasm separately.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Assembler output

José Mejuto
El 11/09/2015 a las 20:18, Florian Klämpfl escribió:

> FPC dependents on a lot of tools like cross binutils which are not provided by FPC itself. So
> install nasm separately.

Hello,

Thank you, so the presence of nasm should make the compiler finish the
compilation ? I was thinking that to generate .s output no assembler is
needed at all as I do not need the final .exe produced by fpc.

Anyway I'll try to install nasm (or other) and see what happends. Thank
you again.

--

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Assembler output

Sven Barth-2
In reply to this post by José Mejuto

Am 11.09.2015 19:06 schrieb "José Mejuto" <[hidden email]>:
>
> Hello,
>
> Can anybody enlight me in how to:
>
> - Compile a program outputting assembler in intel format.
> - Assemble the .s files in a final .exe
>
> I can get assembler in AT&T format using "-a" but if I add "-Anasmwin32" the program is not compiled as "nasm is not found", only main.lpr is compiled, none of the included units (no RTL ones).
>
> It would be great if I only need tools provided by fpc but I think that "as.exe" can not read Intel asm format.
>
> In the case that "as.exe" can not be used for intel format, is there any option out there in order to get the final .exe from the .s files ?

What is the reason you're trying to do this? Maybe we can help you a bit more if we know your motivation to pursue this.

Regards,
Sven


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Assembler output

José Mejuto
El 11/09/2015 a las 21:18, Sven Barth escribió:

> What is the reason you're trying to do this? Maybe we can help you a bit
> more if we know your motivation to pursue this.
>

Hello,

There are two motivations, the first one is to learn how to do it
manually, take a .pas, get the .s and assemble them (and link) to geta
final executable.

The second one is to perform some manual changes in the asm code (I know
that is very easy to trash it) in order to try to catch some possible
optimizations and apply/test them before reach a conclusion about them.

I currently had written a small SQL parser (very limited options,  just
for the simple purpose of extract some fields from a large dump) and I
think the code (tokenizer) should run faster (currently 28 Megabytes /
sec in my i7-3770). It has been written with speed in mind, so no
ansistrings, not realloc data, fixed and large read buffers, minimized
conditionals as much as possible, inline critical functions, etc...
There is still a bit of possible optimizations like replacing indirect
access (pointer[n]) by running pointers but it will degrade too much the
"easy reading" so I thought maybe I can gain some cycles here and there
and find a small set of rules (asm sequences) which can be rewritten,
something like WPO. But as noted it is more a training in the "how to"
than a need to achieve an objective.


--

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Assembler output

Karoly Balogh (Charlie/SGR)
Hi,

On Fri, 11 Sep 2015, José Mejuto wrote:

> There are two motivations, the first one is to learn how to do it manually,
> take a .pas, get the .s and assemble them (and link) to geta final executable.

IIRC it was arguments:
-a -st

This won't assemble or link the executable, but generate a script to
compile and link on the target OS. I used this often during early days of
the Amiga and MorphOS ports. :)

You can even use the resulting script as a base for your own compile/link
experiments.

Charlie
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Assembler output

José Mejuto
El 12/09/2015 a las 14:10, Karoly Balogh (Charlie/SGR) escribió:

>> There are two motivations, the first one is to learn how to do it manually,
>> take a .pas, get the .s and assemble them (and link) to geta final executable.
> IIRC it was arguments:
> -a -st
> This won't assemble or link the executable, but generate a script to
> compile and link on the target OS. I used this often during early days of
> the Amiga and MorphOS ports. :)
> You can even use the resulting script as a base for your own compile/link
> experiments.
>

Hello,

Great, sure it would be a great start/base point.


--

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal