Difference between revisions of "Compiler development articles"

From Free Pascal wiki
Jump to navigationJump to search
m (Updated FPC date/version etc)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{Compiler development articles}}
 
{{Compiler development articles}}
 +
 +
{{Warning|''As of 2021-May-21. the current compiler version is 3.2.2, so it is possible some of the details listed below may have changed.''}}
  
 
The current FPC version under developement is 2.5.1. Compiler internals are documented at the evolving [[FPC internals]] page.
 
The current FPC version under developement is 2.5.1. Compiler internals are documented at the evolving [[FPC internals]] page.
  
= General =
+
== General ==
  
 
[[How to start]]
 
[[How to start]]
Line 15: Line 17:
 
[[Porting Free Pascal]]
 
[[Porting Free Pascal]]
  
[[Creating test units for FPC]]
+
[[Testing FPC]]
 +
 
 +
=== Enable new style smartlinking (FreeBSD, Linux) ===
  
== Enable new style smartlinking (freebsd,linux) ==
 
 
* in i_*.pas add tf_smartlink_sections to the flags field of the platform description record for your OS/CPU combo (in my case i_bsd.pas, the system_i386_freebsd_info record)
 
* in i_*.pas add tf_smartlink_sections to the flags field of the platform description record for your OS/CPU combo (in my case i_bsd.pas, the system_i386_freebsd_info record)
 
* in ogelf.pas scroll down to nearly the bottom, and add af_smartlink_sections to the flags field of as_i386_elf32_info
 
* in ogelf.pas scroll down to nearly the bottom, and add af_smartlink_sections to the flags field of as_i386_elf32_info
 
* run "(g)make all OPT='-Aas -k--gc-sections' at the toplevel to build using new smartlinking routines.
 
* run "(g)make all OPT='-Aas -k--gc-sections' at the toplevel to build using new smartlinking routines.
  
== C++ linking ==  
+
=== C++ linking ===
 
 
See http://rvelthuis.bei.t-online.de/articles/articles-cppobjs.htm
 
  
 
Note that FPC doesn't have negative VMT offsets due to GNU LD limitations.
 
Note that FPC doesn't have negative VMT offsets due to GNU LD limitations.
Line 36: Line 37:
 
is a VMT. This is also how interfaces are built"
 
is a VMT. This is also how interfaces are built"
  
= Processor dependent =
+
== Processor dependent ==
  
 
See also [[Platform list|platform list]].
 
See also [[Platform list|platform list]].
Line 42: Line 43:
 
[[Passing Pascal Types to C Routines]]
 
[[Passing Pascal Types to C Routines]]
  
== i386 ==
+
=== i386 ===
  
 
[[PIC information]]
 
[[PIC information]]
  
== PowerPC ==
+
=== PowerPC ===
  
 
[[PPC Calling conventions]]
 
[[PPC Calling conventions]]
  
== Internal Linker ==
+
=== Internal Linker ===
  
 
[[Internal Linker]]
 
[[Internal Linker]]
  
= Packages =
+
== Packages ==
  
[[packages]]
+
[[packages|Packages]]
  
 
[[Category:FPC]]
 
[[Category:FPC]]
 +
[[Category:FPC development]]

Latest revision as of 00:54, 11 June 2021

English (en) Bahasa Indonesia (id)

Warning-icon.png

Warning: As of 2021-May-21. the current compiler version is 3.2.2, so it is possible some of the details listed below may have changed.

The current FPC version under developement is 2.5.1. Compiler internals are documented at the evolving FPC internals page.

General

How to start

FPC internals

Language related articles

Coding style

Porting Free Pascal

Testing FPC

Enable new style smartlinking (FreeBSD, Linux)

  • in i_*.pas add tf_smartlink_sections to the flags field of the platform description record for your OS/CPU combo (in my case i_bsd.pas, the system_i386_freebsd_info record)
  • in ogelf.pas scroll down to nearly the bottom, and add af_smartlink_sections to the flags field of as_i386_elf32_info
  • run "(g)make all OPT='-Aas -k--gc-sections' at the toplevel to build using new smartlinking routines.

C++ linking

Note that FPC doesn't have negative VMT offsets due to GNU LD limitations.

The fundament of above C++ <-> OPas lies in COM interfaces: (quote from Rudy Velthuis)

"Well, all compilers must be able to create COM interfaces. Since in C++, these are simply pure abstract classes, and Delphi must have the same layout, for many reasons, they are all compatible. In fact, a pure abstract class pointer points to a structure of which the first entry is a VMT. This is also how interfaces are built"

Processor dependent

See also platform list.

Passing Pascal Types to C Routines

i386

PIC information

PowerPC

PPC Calling conventions

Internal Linker

Internal Linker

Packages

Packages