Compiler development articles

From Lazarus-ccr

Jump to: navigation, search

English (en) Bahasa Indonesia (id)

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

Contents

[edit] General

How to start

FPC internals

Language related articles

Coding style

Porting Free Pascal

[edit] 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.

[edit] 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.

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"

[edit] Processor dependent

See also platform list.

Passing Pascal Types to C Routines

[edit] i386

PIC information

[edit] PowerPC

PPC Calling conventions

[edit] Internal Linker

Internal Linker

[edit] Packages

packages