Recent

Author Topic: How to manually build the .exe using AS and LD ?  (Read 1617 times)

440bx

  • Hero Member
  • *****
  • Posts: 2429
How to manually build the .exe using AS and LD ?
« 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.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8352
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: How to manually build the .exe using AS and LD ?
« Reply #1 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.

440bx

  • Hero Member
  • *****
  • Posts: 2429
Re: How to manually build the .exe using AS and LD ?
« Reply #2 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.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 881
Re: How to manually build the .exe using AS and LD ?
« Reply #3 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.

440bx

  • Hero Member
  • *****
  • Posts: 2429
Re: How to manually build the .exe using AS and LD ?
« Reply #4 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 ?
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 881
Re: How to manually build the .exe using AS and LD ?
« Reply #5 on: May 10, 2021, 08:01:30 pm »
-al is a superset of -a, so it's fine.

440bx

  • Hero Member
  • *****
  • Posts: 2429
Re: How to manually build the .exe using AS and LD ?
« Reply #6 on: May 10, 2021, 08:33:35 pm »
-al is a superset of -a, so it's fine.
Thank you Jonas.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

 

TinyPortal © 2005-2018