Lazarus

Free Pascal => General => Topic started by: 440bx on May 10, 2021, 06:43:11 am

Title: How to manually build the .exe using AS and LD ?
Post by: 440bx on May 10, 2021, 06:43:11 am
Hello,

First, this is _mostly_ for self education.

After telling FPC to produce an assembly file, I'd like to use the assembler (AS) and linker (LD) to _manually_ create the executable.

Any guidance on how this can be done with both, 64bit and 32bit executables (hopefully it can be done), will be greatly appreciated.  If there is a writeup on how to do this, a link to it would be great.

Thank you for your help.
Title: Re: How to manually build the .exe using AS and LD ?
Post by: Leledumbo on May 10, 2021, 07:25:23 am
Hello,

First, this is _mostly_ for self education.

After telling FPC to produce an assembly file, I'd like to use the assembler (AS) and linker (LD) to _manually_ create the executable.

Any guidance on how this can be done with both, 64bit and 32bit executables (hopefully it can be done), will be greatly appreciated.  If there is a writeup on how to do this, a link to it would be great.

Thank you for your help.
Compile with -s, you will get ppas.sh. The required as and ld commands will be there unless internal assembler/linker is used.
Title: Re: How to manually build the .exe using AS and LD ?
Post by: 440bx on May 10, 2021, 07:54:23 am
Compile with -s, you will get ppas.sh. The required as and ld commands will be there unless internal assembler/linker is used.
Thank you Leledumbo.  That's great, I'm going to carefully study the entire process.
Title: Re: How to manually build the .exe using AS and LD ?
Post by: Jonas Maebe on May 10, 2021, 07:36:38 pm
Small addition: if you use "-s", the compiler will always switch to an external assembler. And if you add "-a", then the generated shell script for assembling/linking won't delete the assembler files once it's done.
Title: Re: How to manually build the .exe using AS and LD ?
Post by: 440bx on May 10, 2021, 07:55:25 pm
Small addition: if you use "-s", the compiler will always switch to an external assembler. And if you add "-a", then the generated shell script for assembling/linking won't delete the assembler files once it's done.
Thank you Jonas.  I did notice that.  I am using -al.  Should I be using -a instead ?
Title: Re: How to manually build the .exe using AS and LD ?
Post by: Jonas Maebe on May 10, 2021, 08:01:30 pm
-al is a superset of -a, so it's fine.
Title: Re: How to manually build the .exe using AS and LD ?
Post by: 440bx on May 10, 2021, 08:33:35 pm
-al is a superset of -a, so it's fine.
Thank you Jonas.
TinyPortal © 2005-2018