Sign in Join
Wiki copytemporary

Porting the Unix rtl to a new target

Porting FPC

Very global instructions to porting FPC to a *nix clone on a supported architecture:

Setting up a new target in the compiler

(typically only done when the RTL already works, and the first program runs, using a similar target)

A few things must be done for a new target: (ARCH-OS combination, assuming ARCH is supported)

If you get stuck on some linking problem, try to link a simple C program with some verbosity options turned on. (either static or linking to libc, depending on what you are trying).

A more detailed list of needed changes inside the compiler can be found at Porting Free Pascal.

Porting the RTL

Porting the Unix rtl is typically more work then the stuff above.

Typically it boils down to take the closest relative (rtl/freebsd/, and start checking and converting)

There are a few typical problem points:

startup code

The startup code mods are typically done by compiling the crt0 sources with -S to generate assembler AND compare with a objdumped small static binary. (the latter will reveal stuff like ELF identifiers), and checking with a comparable FPC existing startup code.

Typical modifications both prt0 and cprt0.as:

prt0 can strip the whole libc init/finalisation, cprt0 must preserve it.


From the Free Pascal wiki, page "Porting the Unix rtl to a new target", as it stood on 2014-04-23 after a change by BigChimp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.